diff --git a/package.json b/package.json index e541bc3..183de94 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,14 @@ "homepage": ".", "private": true, "scripts": { - "start": "vite", - "build": "vite build", + "start": "vite --base=/client/ --host", + "build": "vite build --base=/client/", + "preview": "vite preview --base=/client/ --host", "build:prod": "npx browserslist@latest --update-db && yarn build", "eslint": "eslint src --ext .ts,.tsx" }, "dependencies": { - "@nitrots/nitro-renderer": "^1.6.6", + "@nitrots/nitro-renderer": "file:submodules/renderer", "@tanstack/react-virtual": "^3.0.0-alpha.0", "emoji-toolkit": "^7.0.1", "react": "^18.2.0", @@ -38,4 +39,4 @@ "sass": "^1.56.2", "vite": "^4.0.1" } -} +} \ No newline at end of file diff --git a/submodules/renderer/.browserslistrc b/submodules/renderer/.browserslistrc new file mode 100644 index 0000000..c529e38 --- /dev/null +++ b/submodules/renderer/.browserslistrc @@ -0,0 +1,12 @@ +# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. +# For additional information regarding the format and rule options, please see: +# https://github.com/browserslist/browserslist#queries + +# You can see what browsers were selected by your queries by running: +# npx browserslist + +last 1 Chrome version +last 1 Firefox version +last 2 Edge major versions +last 2 Safari major versions +last 2 iOS major versions diff --git a/submodules/renderer/.editorconfig b/submodules/renderer/.editorconfig new file mode 100644 index 0000000..0792692 --- /dev/null +++ b/submodules/renderer/.editorconfig @@ -0,0 +1,16 @@ +# Editor configuration, see https://editorconfig.org +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.ts] +quote_type = single + +[*.md] +max_line_length = off +trim_trailing_whitespace = false diff --git a/submodules/renderer/.eslintrc.json b/submodules/renderer/.eslintrc.json new file mode 100644 index 0000000..23546cf --- /dev/null +++ b/submodules/renderer/.eslintrc.json @@ -0,0 +1,135 @@ +{ + "env": { + "browser": true, + "es2021": true, + "node": true + }, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 12, + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint" + ], + "rules": { + "indent": [ + "error", + 4, + { + "SwitchCase": 1 + } + ], + "no-multi-spaces": [ + "error" + ], + "no-trailing-spaces": [ + "error", + { + "skipBlankLines": false, + "ignoreComments": true + } + ], + "linebreak-style": [ + "off" + ], + "quotes": [ + "error", + "single" + ], + "semi": [ + "error", + "always" + ], + "brace-style": [ + "error", + "allman" + ], + "object-curly-spacing": [ + "error", + "always" + ], + "keyword-spacing": [ + "error", + { + "overrides": + { + "if": + { + "after": false + }, + "for": + { + "after": false + }, + "while": + { + "after": false + }, + "switch": + { + "after": false + } + } + } + ], + "@typescript-eslint/no-explicit-any": [ + "off" + ], + "@typescript-eslint/explicit-module-boundary-types": [ + "off", + { + "allowedNames": [ + "getMessageArray" + ] + } + ], + "@typescript-eslint/ban-ts-comment": [ + "off" + ], + "@typescript-eslint/no-empty-function": [ + "error", + { + "allow": [ + "functions", + "arrowFunctions", + "generatorFunctions", + "methods", + "generatorMethods", + "constructors" + ] + } + ], + "@typescript-eslint/no-unused-vars": [ + "off" + ], + "@typescript-eslint/no-inferrable-types": [ + "error", + { + "ignoreParameters": true, + "ignoreProperties": true + } + ], + "@typescript-eslint/ban-types": [ + "error", + { + "types": + { + "String": true, + "Boolean": true, + "Number": true, + "Symbol": true, + "{}": false, + "Object": false, + "object": false, + "Function": false + }, + "extendDefaults": true + } + ] + } +} diff --git a/submodules/renderer/.gitignore b/submodules/renderer/.gitignore new file mode 100644 index 0000000..1413af9 --- /dev/null +++ b/submodules/renderer/.gitignore @@ -0,0 +1,51 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. + +# compiled output +/dist +/tmp +/out-tsc +# Only exists if Bazel was run +/bazel-out + +# dependencies +/node_modules + +# profiling files +chrome-profiler-events*.json +speed-measure-plugin*.json + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +.history/* + +# misc +/.sass-cache +/connect.lock +/coverage +/libpeerconnection.log +npm-debug.log +yarn-error.log +testem.log +/typings +.git + +# System Files +.DS_Store +Thumbs.db + +*.zip +*.as +*.bin diff --git a/submodules/renderer/.gitlab-ci.yml b/submodules/renderer/.gitlab-ci.yml new file mode 100644 index 0000000..5952b51 --- /dev/null +++ b/submodules/renderer/.gitlab-ci.yml @@ -0,0 +1,25 @@ +image: node:16.3 + +stages: + - test + - compile + +ESLinter: + stage: test + script: + - npm i + - node ./node_modules/eslint/bin/eslint.js src/ + cache: + key: ${CI_COMMIT_BRANCH} + paths: + - node_modules + +Compile: + stage: compile + script: + - yarn install + - yarn compile + cache: + key: ${CI_COMMIT_BRANCH} + paths: + - node_modules diff --git a/submodules/renderer/.vscode/settings.json b/submodules/renderer/.vscode/settings.json new file mode 100644 index 0000000..3fdf856 --- /dev/null +++ b/submodules/renderer/.vscode/settings.json @@ -0,0 +1,32 @@ +{ + "typescript.tsdk": "node_modules\\typescript\\lib", + "typescript.preferences.importModuleSpecifier": "relative", + "typescript.preferences.quoteStyle": "single", + "typescript.format.placeOpenBraceOnNewLineForControlBlocks": true, + "typescript.format.placeOpenBraceOnNewLineForFunctions": true, + "editor.wordWrap": "on", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true, + "source.fixAll.sortJSON": false, + "source.organizeImports": true + }, + "editor.formatOnSave": false, + "git.ignoreLimitWarning": true, + "files.eol": "\n", + "files.insertFinalNewline": true, + "files.trimFinalNewlines": true, + "emmet.showExpandedAbbreviation": "never", + "eslint.format.enable": true, + "eslint.validate": [ + "javascript", + "typescript" + ], + "eslint.workingDirectories": [ + { + "pattern": "./src" + } + ], + "javascript.format.enable": false, + "thunder-client.saveToWorkspace": false, + "thunder-client.workspaceRelativePath": "." +} diff --git a/submodules/renderer/LICENSE b/submodules/renderer/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/submodules/renderer/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; 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, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/submodules/renderer/README.md b/submodules/renderer/README.md new file mode 100644 index 0000000..33c4b6b --- /dev/null +++ b/submodules/renderer/README.md @@ -0,0 +1,17 @@ +# Nitro Renderer + +nitro-renderer is a Javascript library for rendering Nitro in the browser using PixiJS + +## Installation + +npm + +``` +npm install @nitrots/nitro-renderer +``` + +yarn + +``` +yarn add @nitrots/nitro-renderer +``` diff --git a/submodules/renderer/index.ts b/submodules/renderer/index.ts new file mode 100644 index 0000000..8420b10 --- /dev/null +++ b/submodules/renderer/index.ts @@ -0,0 +1 @@ +export * from './src'; diff --git a/submodules/renderer/package.json b/submodules/renderer/package.json new file mode 100644 index 0000000..bf95445 --- /dev/null +++ b/submodules/renderer/package.json @@ -0,0 +1,73 @@ +{ + "name": "@nitrots/nitro-renderer", + "description": "Javascript library for rendering Nitro in the browser using PixiJS", + "version": "1.6.6", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://git.krews.org/nitro/nitro-renderer.git" + }, + "license": "GPL-3.0", + "bugs": { + "url": "https://git.krews.org/nitro/nitro-renderer/issues" + }, + "homepage": "https://git.krews.org/nitro/nitro-renderer", + "type": "module", + "scripts": { + "build": "vite build", + "compile": "tsc --project ./tsconfig.json --noEmit false", + "eslint": "eslint ./src --fix" + }, + "main": "./index", + "dependencies": { + "@pixi/app": "~6.5.0", + "@pixi/basis": "~6.5.0", + "@pixi/canvas-display": "~6.5.0", + "@pixi/canvas-extract": "~6.5.0", + "@pixi/canvas-renderer": "~6.5.0", + "@pixi/constants": "~6.5.0", + "@pixi/core": "~6.5.0", + "@pixi/display": "~6.5.0", + "@pixi/events": "~6.5.0", + "@pixi/extensions": "~6.5.0", + "@pixi/extract": "~6.5.0", + "@pixi/filter-alpha": "~6.5.0", + "@pixi/filter-color-matrix": "~6.5.0", + "@pixi/graphics": "~6.5.0", + "@pixi/graphics-extras": "~6.5.0", + "@pixi/interaction": "~6.5.0", + "@pixi/loaders": "~6.5.0", + "@pixi/math": "~6.5.0", + "@pixi/math-extras": "~6.5.0", + "@pixi/mixin-cache-as-bitmap": "~6.5.0", + "@pixi/mixin-get-child-by-name": "~6.5.0", + "@pixi/mixin-get-global-position": "~6.5.0", + "@pixi/polyfill": "~6.5.0", + "@pixi/runner": "~6.5.0", + "@pixi/settings": "~6.5.0", + "@pixi/sprite": "~6.5.0", + "@pixi/sprite-tiling": "~6.5.0", + "@pixi/spritesheet": "~6.5.0", + "@pixi/text": "~6.5.0", + "@pixi/ticker": "~6.5.0", + "@pixi/tilemap": "^3.2.2", + "@pixi/utils": "~6.5.0", + "gifuct-js": "^2.1.2", + "howler": "^2.2.3", + "pako": "^2.0.4" + }, + "devDependencies": { + "@rollup/plugin-typescript": "^10.0.1", + "@types/howler": "^2.2.7", + "@types/pako": "^1.0.3", + "@typescript-eslint/eslint-plugin": "^5.30.7", + "@typescript-eslint/parser": "^5.30.7", + "eslint": "^8.20.0", + "tslib": "^2.3.1", + "typescript": "~4.4.4", + "vite": "^4.0.2", + "vite-plugin-minify": "^1.5.2" + } +} diff --git a/submodules/renderer/src/api/INitroCore.ts b/submodules/renderer/src/api/INitroCore.ts new file mode 100644 index 0000000..a63afc4 --- /dev/null +++ b/submodules/renderer/src/api/INitroCore.ts @@ -0,0 +1,9 @@ +import { IDisposable } from './common'; +import { ICommunicationManager } from './communication'; +import { IConfigurationManager } from './configuration'; + +export interface INitroCore extends IDisposable +{ + configuration: IConfigurationManager; + communication: ICommunicationManager; +} diff --git a/submodules/renderer/src/api/asset/AssetManager.ts b/submodules/renderer/src/api/asset/AssetManager.ts new file mode 100644 index 0000000..fa23735 --- /dev/null +++ b/submodules/renderer/src/api/asset/AssetManager.ts @@ -0,0 +1,205 @@ +import { BaseTexture, Resource, Texture } from '@pixi/core'; +import { Spritesheet } from '@pixi/spritesheet'; +import { NitroLogger } from '../common'; +import { ArrayBufferToBase64, NitroBundle } from '../utils'; +import { GraphicAssetCollection } from './GraphicAssetCollection'; +import { IAssetData } from './IAssetData'; +import { IAssetManager } from './IAssetManager'; +import { IGraphicAsset } from './IGraphicAsset'; +import { IGraphicAssetCollection } from './IGraphicAssetCollection'; + +export class AssetManager implements IAssetManager +{ + public static _INSTANCE: IAssetManager = new AssetManager(); + + private _textures: Map> = new Map(); + private _collections: Map = new Map(); + + public getTexture(name: string): Texture + { + if(!name) return null; + + const existing = this._textures.get(name); + + if(!existing) return null; + + return existing; + } + + public setTexture(name: string, texture: Texture): void + { + if(!name || !texture) return; + + this._textures.set(name, texture); + } + + public getAsset(name: string): IGraphicAsset + { + if(!name) return null; + + for(const collection of this._collections.values()) + { + if(!collection) continue; + + const existing = collection.getAsset(name); + + if(!existing) continue; + + return existing; + } + + return null; + } + + public getCollection(name: string): IGraphicAssetCollection + { + if(!name) return null; + + const existing = this._collections.get(name); + + if(!existing) return null; + + return existing; + } + + public createCollection(data: IAssetData, spritesheet: Spritesheet): IGraphicAssetCollection + { + if(!data) return null; + + const collection = new GraphicAssetCollection(data, spritesheet); + + if(collection) + { + for(const [name, texture] of collection.textures.entries()) this.setTexture(name, texture); + + this._collections.set(collection.name, collection); + } + + return collection; + } + + public async downloadAsset(url: string): Promise + { + return await this.downloadAssets([url]); + } + + public async downloadAssets(urls: string[]): Promise + { + if(!urls || !urls.length) return Promise.resolve(true); + + try + { + for(const url of urls) + { + const response = await fetch(url); + + if(response.status !== 200) continue; + + let contentType = 'application/octet-stream'; + + if(response.headers.has('Content-Type')) + { + contentType = response.headers.get('Content-Type'); + } + + switch(contentType) + { + case 'application/octet-stream': { + const buffer = await response.arrayBuffer(); + const nitroBundle = new NitroBundle(buffer); + + await this.processAsset( + nitroBundle.baseTexture, + nitroBundle.jsonFile as IAssetData + ); + break; + } + case 'image/png': + case 'image/jpeg': + case 'image/gif': { + const buffer = await response.arrayBuffer(); + const base64 = ArrayBufferToBase64(buffer); + const baseTexture = BaseTexture.from( + `data:${ contentType };base64,${ base64 }` + ); + + const createAsset = async () => + { + const texture = new Texture(baseTexture); + this.setTexture(url, texture); + }; + + if(baseTexture.valid) + { + await createAsset(); + } + else + { + await new Promise((resolve, reject) => + { + baseTexture.once('update', async () => + { + await createAsset(); + + return resolve(); + }); + }); + } + break; + } + } + } + + return Promise.resolve(true); + } + catch (err) + { + NitroLogger.error(err); + + return Promise.resolve(false); + } + } + + private async processAsset(baseTexture: BaseTexture, data: IAssetData): Promise + { + const spritesheetData = data.spritesheet; + + if(!baseTexture || !spritesheetData || !Object.keys(spritesheetData).length) + { + this.createCollection(data, null); + + return; + } + + const createAsset = async () => + { + const spritesheet = new Spritesheet(baseTexture, spritesheetData); + + await spritesheet.parse(); + + this.createCollection(data, spritesheet); + }; + + if(baseTexture.valid) + { + await createAsset(); + } + else + { + await new Promise((resolve, reject) => + { + baseTexture.once('update', async () => + { + await createAsset(); + + return resolve(); + }); + }); + } + } + + public get collections(): Map + { + return this._collections; + } +} diff --git a/submodules/renderer/src/api/asset/GetAssetManager.ts b/submodules/renderer/src/api/asset/GetAssetManager.ts new file mode 100644 index 0000000..e17c720 --- /dev/null +++ b/submodules/renderer/src/api/asset/GetAssetManager.ts @@ -0,0 +1,3 @@ +import { AssetManager } from './AssetManager'; + +export const GetAssetManager = () => AssetManager._INSTANCE; diff --git a/submodules/renderer/src/api/asset/GraphicAsset.ts b/submodules/renderer/src/api/asset/GraphicAsset.ts new file mode 100644 index 0000000..b99bb71 --- /dev/null +++ b/submodules/renderer/src/api/asset/GraphicAsset.ts @@ -0,0 +1,148 @@ +import { Resource, Texture } from '@pixi/core'; +import { Rectangle } from '@pixi/math'; +import { Sprite } from '@pixi/sprite'; +import { TextureUtils } from '../../pixi-proxy'; +import { IGraphicAsset } from './IGraphicAsset'; + +export class GraphicAsset implements IGraphicAsset +{ + private static GRAPHIC_POOL: GraphicAsset[] = []; + + private _name: string; + private _source: string; + private _texture: Texture; + private _usesPalette: boolean; + private _x: number; + private _y: number; + private _width: number; + private _height: number; + private _flipH: boolean; + private _flipV: boolean; + private _rectangle: Rectangle; + private _initialized: boolean; + + public static createAsset(name: string, source: string, texture: Texture, x: number, y: number, flipH: boolean = false, flipV: boolean = false, usesPalette: boolean = false): GraphicAsset + { + const graphicAsset = (GraphicAsset.GRAPHIC_POOL.length ? GraphicAsset.GRAPHIC_POOL.pop() : new GraphicAsset()); + + graphicAsset._name = name; + graphicAsset._source = source || null; + + if(texture) + { + graphicAsset._texture = texture; + graphicAsset._initialized = false; + } + else + { + graphicAsset._texture = null; + graphicAsset._initialized = true; + } + + graphicAsset._usesPalette = usesPalette; + graphicAsset._x = x; + graphicAsset._y = y; + graphicAsset._flipH = flipH; + graphicAsset._flipV = flipV; + graphicAsset._rectangle = null; + + return graphicAsset; + } + + public recycle(): void + { + this._texture = null; + + GraphicAsset.GRAPHIC_POOL.push(this); + } + + private initialize(): void + { + if(this._initialized || !this._texture) return; + + this._width = this._texture.width; + this._height = this._texture.height; + + this._initialized = true; + } + + public getImageUrl(): string + { + return TextureUtils.generateImageUrl(new Sprite(this._texture)); + } + + public get name(): string + { + return this._name; + } + + public get source(): string + { + return this._source; + } + + public get texture(): Texture + { + return this._texture; + } + + public get usesPalette(): boolean + { + return this._usesPalette; + } + + public get x(): number + { + return this._x; + } + + public get y(): number + { + return this._y; + } + + public get width(): number + { + this.initialize(); + + return this._width; + } + + public get height(): number + { + this.initialize(); + + return this._height; + } + + public get offsetX(): number + { + if(!this._flipH) return this._x; + + return (-(this._x)); + } + + public get offsetY(): number + { + if(!this._flipV) return this._y; + + return (-(this._y)); + } + + public get flipH(): boolean + { + return this._flipH; + } + + public get flipV(): boolean + { + return this._flipV; + } + + public get rectangle(): Rectangle + { + if(!this._rectangle) this._rectangle = new Rectangle(0, 0, this.width, this.height); + + return this._rectangle; + } +} diff --git a/submodules/renderer/src/api/asset/GraphicAssetCollection.ts b/submodules/renderer/src/api/asset/GraphicAssetCollection.ts new file mode 100644 index 0000000..990b78c --- /dev/null +++ b/submodules/renderer/src/api/asset/GraphicAssetCollection.ts @@ -0,0 +1,392 @@ +import { BaseTexture, Resource, Texture } from '@pixi/core'; +import { Spritesheet } from '@pixi/spritesheet'; +import { Dict } from '@pixi/utils'; +import { GetTickerTime } from '../../pixi-proxy'; +import { GraphicAsset } from './GraphicAsset'; +import { GraphicAssetPalette } from './GraphicAssetPalette'; +import { IAsset } from './IAsset'; +import { IAssetData } from './IAssetData'; +import { IAssetPalette } from './IAssetPalette'; +import { IGraphicAsset } from './IGraphicAsset'; +import { IGraphicAssetCollection } from './IGraphicAssetCollection'; + +export class GraphicAssetCollection implements IGraphicAssetCollection +{ + private static PALETTE_ASSET_DISPOSE_THRESHOLD: number = 10; + + private _referenceCount: number; + private _referenceTimestamp: number; + + private _name: string; + private _baseTexture: BaseTexture; + private _data: IAssetData; + private _textures: Map>; + private _assets: Map; + private _palettes: Map; + private _paletteAssetNames: string[]; + + constructor(data: IAssetData, spritesheet: Spritesheet) + { + if(!data) throw new Error('invalid_collection'); + + this._name = data.name; + this._baseTexture = ((spritesheet && spritesheet.baseTexture) || null); + this._data = data; + this._textures = new Map(); + this._assets = new Map(); + this._palettes = new Map(); + this._paletteAssetNames = []; + + if(spritesheet) this.addLibraryAsset(spritesheet.textures); + + this.define(data); + } + + public static removeFileExtension(name: string): string + { + return (name.substring(0, name.lastIndexOf('.')) || name); + } + + public dispose(): void + { + if(this._palettes) + { + for(const palette of this._palettes.values()) palette.dispose(); + + this._palettes.clear(); + } + + if(this._paletteAssetNames) + { + this.disposePaletteAssets(); + + this._paletteAssetNames = null; + } + + if(this._assets) + { + for(const asset of this._assets.values()) asset.recycle(); + + this._assets.clear(); + } + } + + public addReference(): void + { + this._referenceCount++; + this._referenceTimestamp = GetTickerTime(); + } + + public removeReference(): void + { + this._referenceCount--; + + if(this._referenceCount <= 0) + { + this._referenceCount = 0; + this._referenceTimestamp = GetTickerTime(); + + this.disposePaletteAssets(false); + } + } + + public define(data: IAssetData): void + { + const assets = data.assets; + const palettes = data.palettes; + + if(assets) this.defineAssets(assets); + + if(palettes) this.definePalettes(palettes); + } + + private defineAssets(assets: { [index: string]: IAsset }): void + { + if(!assets) return; + + for(const name in assets) + { + const asset = assets[name]; + + if(!asset) continue; + + const x = (-(asset.x) || 0); + const y = (-(asset.y) || 0); + let flipH = false; + const flipV = false; + const usesPalette = (asset.usesPalette || false); + let source = (asset.source || ''); + + if(asset.flipH && source.length) flipH = true; + + // if(asset.flipV && source.length) flipV = true; + + if(!source.length) source = name; + + const texture = this.getLibraryAsset(source); + + if(!texture) continue; + + let didAddAsset = this.createAsset(name, source, texture, flipH, flipV, x, y, usesPalette); + + if(!didAddAsset) + { + const existingAsset = this.getAsset(name); + + if(existingAsset && (existingAsset.name !== existingAsset.source)) + { + didAddAsset = this.replaceAsset(name, source, texture, flipH, flipV, x, y, usesPalette); + } + } + } + } + + private definePalettes(palettes: { [index: string]: IAssetPalette }): void + { + if(!palettes) return; + + for(const name in palettes) + { + const palette = palettes[name]; + + if(!palette) continue; + + const id = palette.id.toString(); + + if(this._palettes.get(id)) continue; + + let colorOne = 0xFFFFFF; + let colorTwo = 0xFFFFFF; + + let color = palette.color1; + + if(color && color.length > 0) colorOne = parseInt(color, 16); + + color = palette.color2; + + if(color && color.length > 0) colorTwo = parseInt(color, 16); + + this._palettes.set(id, new GraphicAssetPalette(palette.rgb, colorOne, colorTwo)); + } + } + + private createAsset(name: string, source: string, texture: Texture, flipH: boolean, flipV: boolean, x: number, y: number, usesPalette: boolean): boolean + { + if(this._assets.get(name)) return false; + + const graphicAsset = GraphicAsset.createAsset(name, source, texture, x, y, flipH, flipV, usesPalette); + + this._assets.set(name, graphicAsset); + + return true; + } + + private replaceAsset(name: string, source: string, texture: Texture, flipH: boolean, flipV: boolean, x: number, y: number, usesPalette: boolean): boolean + { + const existing = this._assets.get(name); + + if(existing) + { + this._assets.delete(name); + + existing.recycle(); + } + + return this.createAsset(name, source, texture, flipH, flipV, x, y, usesPalette); + } + + public getAsset(name: string): IGraphicAsset + { + if(!name) return null; + + const existing = this._assets.get(name); + + if(!existing) return null; + + return existing; + } + + public getAssetWithPalette(name: string, paletteName: string): IGraphicAsset + { + const saveName = (name + '@' + paletteName); + + let asset = this.getAsset(saveName); + + if(!asset) + { + asset = this.getAsset(name); + + if(!asset || !asset.usesPalette) return asset; + + const palette = this.getPalette(paletteName); + + if(palette) + { + const texture = palette.applyPalette(asset.texture); + + if(texture) + { + this._paletteAssetNames.push(saveName); + + this.createAsset(saveName, (asset.source + '@' + paletteName), texture, asset.flipH, asset.flipV, asset.x, asset.y, false); + + asset = this.getAsset(saveName); + } + } + } + + return asset; + } + + public getTexture(name: string): Texture + { + return this._textures.get(name); + } + + public getPaletteNames(): string[] + { + return Array.from(this._palettes.keys()); + } + + public getPaletteColors(paletteName: string): number[] + { + const palette = this.getPalette(paletteName); + + if(palette) return [palette.primaryColor, palette.secondaryColor]; + + return null; + } + + public getPalette(name: string): GraphicAssetPalette + { + if(!name) return null; + + const existing = this._palettes.get(name); + + if(!existing) return null; + + return existing; + } + + public addAsset(name: string, texture: Texture, override: boolean, x: number = 0, y: number = 0, flipH: boolean = false, flipV: boolean = false): boolean + { + if(!name || !texture) return false; + + const existingTexture = this.getLibraryAsset(name); + + if(!existingTexture) + { + this._textures.set(name, texture); + + return this.createAsset(name, name, texture, flipH, flipV, x, y, false); + } + + if(override) + { + existingTexture.baseTexture = texture.baseTexture; + existingTexture.frame = texture.frame; + existingTexture.trim = texture.trim; + + existingTexture.updateUvs(); + + return true; + } + + return false; + } + + public disposeAsset(name: string): void + { + const existing = this._assets.get(name); + + if(!existing) return; + + this._assets.delete(name); + + const texture = this.getLibraryAsset(existing.source); + + if(texture) + { + this._textures.delete(existing.source); + + texture.destroy(true); + } + + existing.recycle(); + } + + public getLibraryAsset(name: string): Texture + { + if(!name) return null; + + name = this._name + '_' + name; + + const texture = this._textures.get(name); + + if(!texture) return null; + + return texture; + } + + private addLibraryAsset(textures: Dict>): void + { + if(!textures) return; + + for(const name in textures) + { + const texture = textures[name]; + + if(!texture) continue; + + this._textures.set(GraphicAssetCollection.removeFileExtension(name), texture); + } + } + + private disposePaletteAssets(disposeAll: boolean = true): void + { + if(this._paletteAssetNames) + { + if(disposeAll || (this._paletteAssetNames.length > GraphicAssetCollection.PALETTE_ASSET_DISPOSE_THRESHOLD)) + { + for(const name of this._paletteAssetNames) this.disposeAsset(name); + + this._paletteAssetNames = []; + } + } + } + + public get referenceCount(): number + { + return this._referenceCount; + } + + public get referenceTimestamp(): number + { + return this._referenceTimestamp; + } + + public get name(): string + { + return this._name; + } + + public get baseTexture(): BaseTexture + { + return this._baseTexture; + } + + public get data(): IAssetData + { + return this._data; + } + + public get textures(): Map + { + return this._textures; + } + + public get assets(): Map + { + return this._assets; + } +} diff --git a/submodules/renderer/src/api/asset/GraphicAssetGifCollection.ts b/submodules/renderer/src/api/asset/GraphicAssetGifCollection.ts new file mode 100644 index 0000000..a09adbc --- /dev/null +++ b/submodules/renderer/src/api/asset/GraphicAssetGifCollection.ts @@ -0,0 +1,11 @@ +import { Resource, Texture } from '@pixi/core'; + +export class GraphicAssetGifCollection +{ + constructor( + public name: string, + public textures: Texture[], + public durations: number[] + ) + {} +} diff --git a/submodules/renderer/src/api/asset/GraphicAssetPalette.ts b/submodules/renderer/src/api/asset/GraphicAssetPalette.ts new file mode 100644 index 0000000..0a1ecc7 --- /dev/null +++ b/submodules/renderer/src/api/asset/GraphicAssetPalette.ts @@ -0,0 +1,61 @@ +import { Renderer, Resource, Texture } from '@pixi/core'; +import { Sprite } from '@pixi/sprite'; +import { PixiApplicationProxy, TextureUtils } from '../../pixi-proxy'; + +export class GraphicAssetPalette +{ + private _palette: [number, number, number][]; + private _primaryColor: number; + private _secondaryColor: number; + + constructor(palette: [number, number, number][], primaryColor: number, secondaryColor: number) + { + this._palette = palette; + + while(this._palette.length < 256) this._palette.push([0, 0, 0]); + + this._primaryColor = primaryColor; + this._secondaryColor = secondaryColor; + } + + public dispose(): void + { + + } + + public applyPalette(texture: Texture): Texture + { + const renderTexture = TextureUtils.createAndWriteRenderTexture(texture.width, texture.height, new Sprite(texture)); + const pixels = TextureUtils.getPixels(renderTexture); + + for(let i = 0; i < pixels.length; i += 4) + { + let paletteColor = this._palette[pixels[i + 1]]; + + if(paletteColor === undefined) paletteColor = [0, 0, 0]; + + pixels[i] = paletteColor[0]; + pixels[i + 1] = paletteColor[1]; + pixels[i + 2] = paletteColor[2]; + } + + const canvaGLTexture = renderTexture.baseTexture._glTextures['1']?.texture; + const gl = (PixiApplicationProxy.instance.renderer as Renderer)?.gl; + + gl.bindTexture(gl.TEXTURE_2D, canvaGLTexture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, renderTexture.width, renderTexture.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, pixels); + gl.bindTexture(gl.TEXTURE_2D, null); + + return renderTexture; + } + + public get primaryColor(): number + { + return this._primaryColor; + } + + public get secondaryColor(): number + { + return this._secondaryColor; + } +} diff --git a/submodules/renderer/src/api/asset/IAsset.ts b/submodules/renderer/src/api/asset/IAsset.ts new file mode 100644 index 0000000..f4e4fb4 --- /dev/null +++ b/submodules/renderer/src/api/asset/IAsset.ts @@ -0,0 +1,9 @@ +export interface IAsset +{ + source?: string; + x?: number; + y?: number; + flipH?: boolean; + flipV?: boolean; + usesPalette?: boolean; +} diff --git a/submodules/renderer/src/api/asset/IAssetAlias.ts b/submodules/renderer/src/api/asset/IAssetAlias.ts new file mode 100644 index 0000000..5c14027 --- /dev/null +++ b/submodules/renderer/src/api/asset/IAssetAlias.ts @@ -0,0 +1,6 @@ +export interface IAssetAlias +{ + link?: string; + flipH?: boolean; + flipV?: boolean; +} diff --git a/submodules/renderer/src/api/asset/IAssetData.ts b/submodules/renderer/src/api/asset/IAssetData.ts new file mode 100644 index 0000000..f12820f --- /dev/null +++ b/submodules/renderer/src/api/asset/IAssetData.ts @@ -0,0 +1,23 @@ +import { IAssetAnimation } from './animation'; +import { IAsset } from './IAsset'; +import { IAssetAlias } from './IAssetAlias'; +import { IAssetPalette } from './IAssetPalette'; +import { IAssetLogicData } from './logic'; +import { IAssetRoomVisualizationData } from './room-visualization'; +import { ISpritesheetData } from './spritesheet'; +import { IAssetVisualizationData } from './visualization'; + +export interface IAssetData { + type?: string; + name?: string; + visualizationType?: string; + logicType?: string; + spritesheet?: ISpritesheetData; + logic?: IAssetLogicData; + assets?: { [index: string]: IAsset }; + aliases?: { [index: string]: IAssetAlias }; + animations?: { [index: string]: IAssetAnimation }; + palettes?: { [index: string]: IAssetPalette }; + visualizations?: IAssetVisualizationData[]; + roomVisualization?: IAssetRoomVisualizationData; +} diff --git a/submodules/renderer/src/api/asset/IAssetManager.ts b/submodules/renderer/src/api/asset/IAssetManager.ts new file mode 100644 index 0000000..d2be282 --- /dev/null +++ b/submodules/renderer/src/api/asset/IAssetManager.ts @@ -0,0 +1,18 @@ + +import { Resource, Texture } from '@pixi/core'; +import { Spritesheet } from '@pixi/spritesheet'; +import { IAssetData } from './IAssetData'; +import { IGraphicAsset } from './IGraphicAsset'; +import { IGraphicAssetCollection } from './IGraphicAssetCollection'; + +export interface IAssetManager +{ + getTexture(name: string): Texture; + setTexture(name: string, texture: Texture): void; + getAsset(name: string): IGraphicAsset; + getCollection(name: string): IGraphicAssetCollection; + createCollection(data: IAssetData, spritesheet: Spritesheet): IGraphicAssetCollection; + downloadAssets(urls: string[]): Promise; + downloadAsset(url: string): Promise; + collections: Map; +} diff --git a/submodules/renderer/src/api/asset/IAssetPalette.ts b/submodules/renderer/src/api/asset/IAssetPalette.ts new file mode 100644 index 0000000..9b0384b --- /dev/null +++ b/submodules/renderer/src/api/asset/IAssetPalette.ts @@ -0,0 +1,12 @@ +export interface IAssetPalette +{ + id?: number; + source?: string; + master?: boolean; + tags?: string[]; + breed?: number; + colorTag?: number; + color1?: string; + color2?: string; + rgb?: [ number, number, number ][]; +} diff --git a/submodules/renderer/src/api/asset/IGraphicAsset.ts b/submodules/renderer/src/api/asset/IGraphicAsset.ts new file mode 100644 index 0000000..ea4c633 --- /dev/null +++ b/submodules/renderer/src/api/asset/IGraphicAsset.ts @@ -0,0 +1,19 @@ +import { Resource, Texture } from '@pixi/core'; +import { Rectangle } from '@pixi/math'; + +export interface IGraphicAsset +{ + name: string; + source: string; + texture: Texture; + usesPalette: boolean; + x: number; + y: number; + width: number; + height: number; + offsetX: number; + offsetY: number; + flipH: boolean; + flipV: boolean; + rectangle: Rectangle; +} diff --git a/submodules/renderer/src/api/asset/IGraphicAssetCollection.ts b/submodules/renderer/src/api/asset/IGraphicAssetCollection.ts new file mode 100644 index 0000000..50b797a --- /dev/null +++ b/submodules/renderer/src/api/asset/IGraphicAssetCollection.ts @@ -0,0 +1,25 @@ +import { BaseTexture, Resource, Texture } from '@pixi/core'; +import { IAssetData } from './IAssetData'; +import { IGraphicAsset } from './IGraphicAsset'; +import { IGraphicAssetPalette } from './IGraphicAssetPalette'; + +export interface IGraphicAssetCollection +{ + dispose(): void; + addReference(): void; + removeReference(): void; + define(data: IAssetData): void; + getAsset(name: string): IGraphicAsset; + getAssetWithPalette(name: string, paletteName: string): IGraphicAsset; + getTexture(name: string): Texture; + getPaletteNames(): string[]; + getPaletteColors(paletteName: string): number[]; + getPalette(name: string): IGraphicAssetPalette; + addAsset(name: string, texture: Texture, override: boolean, x?: number, y?: number, flipH?: boolean, flipV?: boolean): boolean; + disposeAsset(name: string): void; + referenceCount: number; + referenceTimestamp: number; + name: string; + baseTexture: BaseTexture; + data: IAssetData; +} diff --git a/submodules/renderer/src/api/asset/IGraphicAssetGifCollection.ts b/submodules/renderer/src/api/asset/IGraphicAssetGifCollection.ts new file mode 100644 index 0000000..c17b368 --- /dev/null +++ b/submodules/renderer/src/api/asset/IGraphicAssetGifCollection.ts @@ -0,0 +1,8 @@ +import { Resource, Texture } from '@pixi/core'; + +export interface IGraphicAssetGifCollection +{ + name: string; + textures: Texture[]; + durations: number[]; +} diff --git a/submodules/renderer/src/api/asset/IGraphicAssetPalette.ts b/submodules/renderer/src/api/asset/IGraphicAssetPalette.ts new file mode 100644 index 0000000..60e8223 --- /dev/null +++ b/submodules/renderer/src/api/asset/IGraphicAssetPalette.ts @@ -0,0 +1,9 @@ +import { Resource, Texture } from '@pixi/core'; + +export interface IGraphicAssetPalette +{ + dispose: () => void; + applyPalette(texture: Texture): Texture; + primaryColor: number; + secondaryColor: number; +} diff --git a/submodules/renderer/src/api/asset/animation/IAssetAnimation.ts b/submodules/renderer/src/api/asset/animation/IAssetAnimation.ts new file mode 100644 index 0000000..b35e0eb --- /dev/null +++ b/submodules/renderer/src/api/asset/animation/IAssetAnimation.ts @@ -0,0 +1,23 @@ +import { IAssetAnimationAdd } from './IAssetAnimationAdd'; +import { IAssetAnimationAvatar } from './IAssetAnimationAvatar'; +import { IAssetAnimationDirection } from './IAssetAnimationDirection'; +import { IAssetAnimationFrame } from './IAssetAnimationFrame'; +import { IAssetAnimationOverride } from './IAssetAnimationOverride'; +import { IAssetAnimationRemove } from './IAssetAnimationRemove'; +import { IAssetAnimationShadow } from './IAssetAnimationShadow'; +import { IAssetAnimationSprite } from './IAssetAnimationSprite'; + +export interface IAssetAnimation +{ + name?: string; + desc?: string; + resetOnToggle?: boolean; + directions?: IAssetAnimationDirection[]; + shadows?: IAssetAnimationShadow[]; + adds?: IAssetAnimationAdd[]; + removes?: IAssetAnimationRemove[]; + sprites?: IAssetAnimationSprite[]; + frames?: IAssetAnimationFrame[]; + avatars?: IAssetAnimationAvatar[]; + overrides?: IAssetAnimationOverride[]; +} diff --git a/submodules/renderer/src/api/asset/animation/IAssetAnimationAdd.ts b/submodules/renderer/src/api/asset/animation/IAssetAnimationAdd.ts new file mode 100644 index 0000000..3da37c6 --- /dev/null +++ b/submodules/renderer/src/api/asset/animation/IAssetAnimationAdd.ts @@ -0,0 +1,8 @@ +export interface IAssetAnimationAdd +{ + id?: string; + align?: string; + blend?: string; + ink?: number; + base?: string; +} diff --git a/submodules/renderer/src/api/asset/animation/IAssetAnimationAvatar.ts b/submodules/renderer/src/api/asset/animation/IAssetAnimationAvatar.ts new file mode 100644 index 0000000..dcd030e --- /dev/null +++ b/submodules/renderer/src/api/asset/animation/IAssetAnimationAvatar.ts @@ -0,0 +1,6 @@ +export interface IAssetAnimationAvatar +{ + ink?: number; + foreground?: string; + background?: string; +} diff --git a/submodules/renderer/src/api/asset/animation/IAssetAnimationDirection.ts b/submodules/renderer/src/api/asset/animation/IAssetAnimationDirection.ts new file mode 100644 index 0000000..0c18eae --- /dev/null +++ b/submodules/renderer/src/api/asset/animation/IAssetAnimationDirection.ts @@ -0,0 +1,4 @@ +export interface IAssetAnimationDirection +{ + offset?: number; +} diff --git a/submodules/renderer/src/api/asset/animation/IAssetAnimationFrame.ts b/submodules/renderer/src/api/asset/animation/IAssetAnimationFrame.ts new file mode 100644 index 0000000..b8b88a0 --- /dev/null +++ b/submodules/renderer/src/api/asset/animation/IAssetAnimationFrame.ts @@ -0,0 +1,8 @@ +import { IAssetAnimationFramePart } from './IAssetAnimationFramePart'; + +export interface IAssetAnimationFrame +{ + repeats?: number; + fxs?: IAssetAnimationFramePart[]; + bodyparts?: IAssetAnimationFramePart[]; +} diff --git a/submodules/renderer/src/api/asset/animation/IAssetAnimationFramePart.ts b/submodules/renderer/src/api/asset/animation/IAssetAnimationFramePart.ts new file mode 100644 index 0000000..ac8c093 --- /dev/null +++ b/submodules/renderer/src/api/asset/animation/IAssetAnimationFramePart.ts @@ -0,0 +1,14 @@ +import { IAssetAnimationFramePartItem } from './IAssetAnimationFramePartItem'; + +export interface IAssetAnimationFramePart +{ + id?: string; + frame?: number; + base?: string; + action?: string; + dx?: number; + dy?: number; + dz?: number; + dd?: number; + items?: IAssetAnimationFramePartItem[]; +} diff --git a/submodules/renderer/src/api/asset/animation/IAssetAnimationFramePartItem.ts b/submodules/renderer/src/api/asset/animation/IAssetAnimationFramePartItem.ts new file mode 100644 index 0000000..45a7642 --- /dev/null +++ b/submodules/renderer/src/api/asset/animation/IAssetAnimationFramePartItem.ts @@ -0,0 +1,5 @@ +export interface IAssetAnimationFramePartItem +{ + id?: string; + base?: string; +} diff --git a/submodules/renderer/src/api/asset/animation/IAssetAnimationOverride.ts b/submodules/renderer/src/api/asset/animation/IAssetAnimationOverride.ts new file mode 100644 index 0000000..3d56833 --- /dev/null +++ b/submodules/renderer/src/api/asset/animation/IAssetAnimationOverride.ts @@ -0,0 +1,8 @@ +import { IAssetAnimationFrame } from './IAssetAnimationFrame'; + +export interface IAssetAnimationOverride +{ + name?: string; + override?: string; + frames?: IAssetAnimationFrame[]; +} diff --git a/submodules/renderer/src/api/asset/animation/IAssetAnimationRemove.ts b/submodules/renderer/src/api/asset/animation/IAssetAnimationRemove.ts new file mode 100644 index 0000000..ac65fb5 --- /dev/null +++ b/submodules/renderer/src/api/asset/animation/IAssetAnimationRemove.ts @@ -0,0 +1,4 @@ +export interface IAssetAnimationRemove +{ + id?: string; +} diff --git a/submodules/renderer/src/api/asset/animation/IAssetAnimationShadow.ts b/submodules/renderer/src/api/asset/animation/IAssetAnimationShadow.ts new file mode 100644 index 0000000..dfe22a8 --- /dev/null +++ b/submodules/renderer/src/api/asset/animation/IAssetAnimationShadow.ts @@ -0,0 +1,4 @@ +export interface IAssetAnimationShadow +{ + id?: string; +} diff --git a/submodules/renderer/src/api/asset/animation/IAssetAnimationSprite.ts b/submodules/renderer/src/api/asset/animation/IAssetAnimationSprite.ts new file mode 100644 index 0000000..afc7b05 --- /dev/null +++ b/submodules/renderer/src/api/asset/animation/IAssetAnimationSprite.ts @@ -0,0 +1,11 @@ +import { IAssetAnimationSpriteDirection } from './IAssetAnimationSpriteDirection'; + +export interface IAssetAnimationSprite +{ + id?: string; + member?: string; + directions?: number; + staticY?: number; + ink?: number; + directionList?: IAssetAnimationSpriteDirection[]; +} diff --git a/submodules/renderer/src/api/asset/animation/IAssetAnimationSpriteDirection.ts b/submodules/renderer/src/api/asset/animation/IAssetAnimationSpriteDirection.ts new file mode 100644 index 0000000..746719d --- /dev/null +++ b/submodules/renderer/src/api/asset/animation/IAssetAnimationSpriteDirection.ts @@ -0,0 +1,7 @@ +export interface IAssetAnimationSpriteDirection +{ + id?: number; + dx?: number; + dy?: number; + dz?: number; +} diff --git a/submodules/renderer/src/api/asset/animation/index.ts b/submodules/renderer/src/api/asset/animation/index.ts new file mode 100644 index 0000000..56543d0 --- /dev/null +++ b/submodules/renderer/src/api/asset/animation/index.ts @@ -0,0 +1,12 @@ +export * from './IAssetAnimation'; +export * from './IAssetAnimationAdd'; +export * from './IAssetAnimationAvatar'; +export * from './IAssetAnimationDirection'; +export * from './IAssetAnimationFrame'; +export * from './IAssetAnimationFramePart'; +export * from './IAssetAnimationFramePartItem'; +export * from './IAssetAnimationOverride'; +export * from './IAssetAnimationRemove'; +export * from './IAssetAnimationShadow'; +export * from './IAssetAnimationSprite'; +export * from './IAssetAnimationSpriteDirection'; diff --git a/submodules/renderer/src/api/asset/index.ts b/submodules/renderer/src/api/asset/index.ts new file mode 100644 index 0000000..3ba873f --- /dev/null +++ b/submodules/renderer/src/api/asset/index.ts @@ -0,0 +1,26 @@ +export * from './animation'; +export * from './AssetManager'; +export * from './GetAssetManager'; +export * from './GraphicAsset'; +export * from './GraphicAssetCollection'; +export * from './GraphicAssetGifCollection'; +export * from './GraphicAssetPalette'; +export * from './IAsset'; +export * from './IAssetAlias'; +export * from './IAssetData'; +export * from './IAssetManager'; +export * from './IAssetPalette'; +export * from './IGraphicAsset'; +export * from './IGraphicAssetCollection'; +export * from './IGraphicAssetGifCollection'; +export * from './IGraphicAssetPalette'; +export * from './logic'; +export * from './logic/model'; +export * from './logic/particlesystem'; +export * from './room-visualization'; +export * from './spritesheet'; +export * from './visualization'; +export * from './visualization/animation'; +export * from './visualization/color'; +export * from './visualization/gestures'; +export * from './visualization/postures'; diff --git a/submodules/renderer/src/api/asset/logic/IAssetLogicCustomVars.ts b/submodules/renderer/src/api/asset/logic/IAssetLogicCustomVars.ts new file mode 100644 index 0000000..1ebd4a8 --- /dev/null +++ b/submodules/renderer/src/api/asset/logic/IAssetLogicCustomVars.ts @@ -0,0 +1,4 @@ +export interface ICustomVars +{ + variables?: string[]; +} diff --git a/submodules/renderer/src/api/asset/logic/IAssetLogicData.ts b/submodules/renderer/src/api/asset/logic/IAssetLogicData.ts new file mode 100644 index 0000000..acf484c --- /dev/null +++ b/submodules/renderer/src/api/asset/logic/IAssetLogicData.ts @@ -0,0 +1,17 @@ +import { ICustomVars } from './IAssetLogicCustomVars'; +import { IAssetLogicPlanetSystem } from './IAssetLogicPlanetSystem'; +import { ISoundSample } from './ISoundSample'; +import { IAssetLogicModel } from './model/IAssetLogicModel'; +import { IParticleSystem } from './particlesystem'; + +export interface IAssetLogicData +{ + model?: IAssetLogicModel; + maskType?: string; + credits?: string; + soundSample?: ISoundSample; + action?: { link?: string, startState?: number }; + planetSystems?: IAssetLogicPlanetSystem[]; + particleSystems?: IParticleSystem[]; + customVars?: ICustomVars; +} diff --git a/submodules/renderer/src/api/asset/logic/IAssetLogicPlanetSystem.ts b/submodules/renderer/src/api/asset/logic/IAssetLogicPlanetSystem.ts new file mode 100644 index 0000000..47521bc --- /dev/null +++ b/submodules/renderer/src/api/asset/logic/IAssetLogicPlanetSystem.ts @@ -0,0 +1,11 @@ +export interface IAssetLogicPlanetSystem +{ + id?: number; + name?: string; + parent?: string; + radius?: number; + arcSpeed?: number; + arcOffset?: number; + blend?: number; + height?: number; +} diff --git a/submodules/renderer/src/api/asset/logic/ISoundSample.ts b/submodules/renderer/src/api/asset/logic/ISoundSample.ts new file mode 100644 index 0000000..003f9f6 --- /dev/null +++ b/submodules/renderer/src/api/asset/logic/ISoundSample.ts @@ -0,0 +1,5 @@ +export interface ISoundSample +{ + id?: number; + noPitch?: boolean; +} diff --git a/submodules/renderer/src/api/asset/logic/index.ts b/submodules/renderer/src/api/asset/logic/index.ts new file mode 100644 index 0000000..569907b --- /dev/null +++ b/submodules/renderer/src/api/asset/logic/index.ts @@ -0,0 +1,6 @@ +export * from './IAssetLogicCustomVars'; +export * from './IAssetLogicData'; +export * from './IAssetLogicPlanetSystem'; +export * from './ISoundSample'; +export * from './model'; +export * from './particlesystem'; diff --git a/submodules/renderer/src/api/asset/logic/model/IAssetDimension.ts b/submodules/renderer/src/api/asset/logic/model/IAssetDimension.ts new file mode 100644 index 0000000..4a4629f --- /dev/null +++ b/submodules/renderer/src/api/asset/logic/model/IAssetDimension.ts @@ -0,0 +1,6 @@ +export interface IAssetDimension +{ + x: number; + y: number; + z?: number; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/asset/logic/model/IAssetLogicModel.ts b/submodules/renderer/src/api/asset/logic/model/IAssetLogicModel.ts new file mode 100644 index 0000000..eef3245 --- /dev/null +++ b/submodules/renderer/src/api/asset/logic/model/IAssetLogicModel.ts @@ -0,0 +1,7 @@ +import { IAssetDimension } from './IAssetDimension'; + +export interface IAssetLogicModel +{ + dimensions?: IAssetDimension; + directions?: number[]; +} diff --git a/submodules/renderer/src/api/asset/logic/model/index.ts b/submodules/renderer/src/api/asset/logic/model/index.ts new file mode 100644 index 0000000..4d08a72 --- /dev/null +++ b/submodules/renderer/src/api/asset/logic/model/index.ts @@ -0,0 +1,2 @@ +export * from './IAssetDimension'; +export * from './IAssetLogicModel'; diff --git a/submodules/renderer/src/api/asset/logic/particlesystem/IParticleSystem.ts b/submodules/renderer/src/api/asset/logic/particlesystem/IParticleSystem.ts new file mode 100644 index 0000000..871f5f3 --- /dev/null +++ b/submodules/renderer/src/api/asset/logic/particlesystem/IParticleSystem.ts @@ -0,0 +1,11 @@ +import { IParticleSystemEmitter } from './IParticleSystemEmitter'; + +export interface IParticleSystem +{ + size?: number; + canvasId?: number; + offsetY?: number; + blend?: number; + bgColor?: string; + emitters?: IParticleSystemEmitter[]; +} diff --git a/submodules/renderer/src/api/asset/logic/particlesystem/IParticleSystemEmitter.ts b/submodules/renderer/src/api/asset/logic/particlesystem/IParticleSystemEmitter.ts new file mode 100644 index 0000000..fa175e2 --- /dev/null +++ b/submodules/renderer/src/api/asset/logic/particlesystem/IParticleSystemEmitter.ts @@ -0,0 +1,15 @@ +import { IParticleSystemParticle } from './IParticleSystemParticle'; +import { IParticleSystemSimulation } from './IParticleSystemSimulation'; + +export interface IParticleSystemEmitter +{ + id?: number; + name?: string; + spriteId?: number; + maxNumParticles?: number; + particlesPerFrame?: number; + burstPulse?: number; + fuseTime?: number; + simulation?: IParticleSystemSimulation; + particles?: IParticleSystemParticle[]; +} diff --git a/submodules/renderer/src/api/asset/logic/particlesystem/IParticleSystemParticle.ts b/submodules/renderer/src/api/asset/logic/particlesystem/IParticleSystemParticle.ts new file mode 100644 index 0000000..99281fa --- /dev/null +++ b/submodules/renderer/src/api/asset/logic/particlesystem/IParticleSystemParticle.ts @@ -0,0 +1,7 @@ +export interface IParticleSystemParticle +{ + isEmitter?: boolean; + lifeTime?: number; + fade?: boolean; + frames?: string[]; +} diff --git a/submodules/renderer/src/api/asset/logic/particlesystem/IParticleSystemSimulation.ts b/submodules/renderer/src/api/asset/logic/particlesystem/IParticleSystemSimulation.ts new file mode 100644 index 0000000..fef400c --- /dev/null +++ b/submodules/renderer/src/api/asset/logic/particlesystem/IParticleSystemSimulation.ts @@ -0,0 +1,9 @@ +export interface IParticleSystemSimulation +{ + force?: number; + direction?: number; + gravity?: number; + airFriction?: number; + shape?: string; + energy?: number; +} diff --git a/submodules/renderer/src/api/asset/logic/particlesystem/index.ts b/submodules/renderer/src/api/asset/logic/particlesystem/index.ts new file mode 100644 index 0000000..428f6fc --- /dev/null +++ b/submodules/renderer/src/api/asset/logic/particlesystem/index.ts @@ -0,0 +1,4 @@ +export * from './IParticleSystem'; +export * from './IParticleSystemEmitter'; +export * from './IParticleSystemParticle'; +export * from './IParticleSystemSimulation'; diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlane.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlane.ts new file mode 100644 index 0000000..6007641 --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlane.ts @@ -0,0 +1,8 @@ +import { IAssetPlaneVisualization } from './IAssetPlaneVisualization'; + +export interface IAssetPlane +{ + id?: string; + visualizations?: IAssetPlaneVisualization[]; + animatedVisualization?: IAssetPlaneVisualization[]; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMask.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMask.ts new file mode 100644 index 0000000..0fd8465 --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMask.ts @@ -0,0 +1,7 @@ +import { IAssetPlaneMaskVisualization } from './IAssetPlaneMaskVisualization'; + +export interface IAssetPlaneMask +{ + id?: string; + visualizations?: IAssetPlaneMaskVisualization[]; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaskData.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaskData.ts new file mode 100644 index 0000000..2767b59 --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaskData.ts @@ -0,0 +1,6 @@ +import { IAssetPlaneMask } from './IAssetPlaneMask'; + +export interface IAssetPlaneMaskData +{ + masks?: IAssetPlaneMask[]; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaskVisualization.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaskVisualization.ts new file mode 100644 index 0000000..66c5ae8 --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaskVisualization.ts @@ -0,0 +1,7 @@ +import { IAssetPlaneTextureBitmap } from './IAssetPlaneTextureBitmap'; + +export interface IAssetPlaneMaskVisualization +{ + size?: number; + bitmaps?: IAssetPlaneTextureBitmap[]; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaterial.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaterial.ts new file mode 100644 index 0000000..59ae007 --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaterial.ts @@ -0,0 +1,7 @@ +import { IAssetPlaneMaterialCellMatrix } from './IAssetPlaneMaterialCellMatrix'; + +export interface IAssetPlaneMaterial +{ + id?: string; + matrices?: IAssetPlaneMaterialCellMatrix[]; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaterialCell.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaterialCell.ts new file mode 100644 index 0000000..fafae27 --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaterialCell.ts @@ -0,0 +1,7 @@ +import { IAssetPlaneMaterialCellExtraItemData } from './IAssetPlaneMaterialCellExtraItemData'; + +export interface IAssetPlaneMaterialCell +{ + textureId?: string; + extraData?: IAssetPlaneMaterialCellExtraItemData; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaterialCellColumn.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaterialCellColumn.ts new file mode 100644 index 0000000..d2b36d3 --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaterialCellColumn.ts @@ -0,0 +1,8 @@ +import { IAssetPlaneMaterialCell } from './IAssetPlaneMaterialCell'; + +export interface IAssetPlaneMaterialCellColumn +{ + repeatMode?: string; + width?: number; + cells?: IAssetPlaneMaterialCell[]; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaterialCellExtraItemData.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaterialCellExtraItemData.ts new file mode 100644 index 0000000..a49833f --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaterialCellExtraItemData.ts @@ -0,0 +1,6 @@ +export interface IAssetPlaneMaterialCellExtraItemData +{ + limitMax?: number; + extraItemTypes?: string[]; + offsets?: [number, number][]; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaterialCellMatrix.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaterialCellMatrix.ts new file mode 100644 index 0000000..526cde2 --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneMaterialCellMatrix.ts @@ -0,0 +1,12 @@ +import { IAssetPlaneMaterialCellColumn } from './IAssetPlaneMaterialCellColumn'; + +export interface IAssetPlaneMaterialCellMatrix +{ + repeatMode?: string; + align?: string; + normalMinX?: number; + normalMaxX?: number; + normalMinY?: number; + normalMaxY?: number; + columns?: IAssetPlaneMaterialCellColumn[]; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneTexture.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneTexture.ts new file mode 100644 index 0000000..fff62fa --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneTexture.ts @@ -0,0 +1,7 @@ +import { IAssetPlaneTextureBitmap } from './IAssetPlaneTextureBitmap'; + +export interface IAssetPlaneTexture +{ + id?: string; + bitmaps?: IAssetPlaneTextureBitmap[]; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneTextureBitmap.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneTextureBitmap.ts new file mode 100644 index 0000000..e1af985 --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneTextureBitmap.ts @@ -0,0 +1,8 @@ +export interface IAssetPlaneTextureBitmap +{ + assetName?: string; + normalMinX?: number; + normalMaxX?: number; + normalMinY?: number; + normalMaxY?: number; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneVisualization.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneVisualization.ts new file mode 100644 index 0000000..db3b4de --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneVisualization.ts @@ -0,0 +1,10 @@ +import { IAssetPlaneVisualizationAnimatedLayer } from './IAssetPlaneVisualizationAnimatedLayer'; +import { IAssetPlaneVisualizationLayer } from './IAssetPlaneVisualizationLayer'; + +export interface IAssetPlaneVisualization +{ + size?: number; + horizontalAngle?: number; + verticalAngle?: number; + allLayers?: (IAssetPlaneVisualizationLayer | IAssetPlaneVisualizationAnimatedLayer)[]; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneVisualizationAnimatedLayer.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneVisualizationAnimatedLayer.ts new file mode 100644 index 0000000..4cd50c2 --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneVisualizationAnimatedLayer.ts @@ -0,0 +1,6 @@ +import { IAssetPlaneVisualizationAnimatedLayerItem } from './IAssetPlaneVisualizationAnimatedLayerItem'; + +export interface IAssetPlaneVisualizationAnimatedLayer +{ + items?: IAssetPlaneVisualizationAnimatedLayerItem[]; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneVisualizationAnimatedLayerItem.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneVisualizationAnimatedLayerItem.ts new file mode 100644 index 0000000..9ee426e --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneVisualizationAnimatedLayerItem.ts @@ -0,0 +1,11 @@ +export interface IAssetPlaneVisualizationAnimatedLayerItem +{ + id?: number; + assetId?: string; + x?: string; + y?: string; + randomX?: string; + randomY?: string; + speedX?: number; + speedY?: number; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneVisualizationData.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneVisualizationData.ts new file mode 100644 index 0000000..4e48d53 --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneVisualizationData.ts @@ -0,0 +1,10 @@ +import { IAssetPlane } from './IAssetPlane'; +import { IAssetPlaneMaterial } from './IAssetPlaneMaterial'; +import { IAssetPlaneTexture } from './IAssetPlaneTexture'; + +export interface IAssetPlaneVisualizationData +{ + planes?: IAssetPlane[]; + materials?: IAssetPlaneMaterial[]; + textures?: IAssetPlaneTexture[]; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneVisualizationLayer.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneVisualizationLayer.ts new file mode 100644 index 0000000..e009893 --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetPlaneVisualizationLayer.ts @@ -0,0 +1,7 @@ +export interface IAssetPlaneVisualizationLayer +{ + materialId?: string; + color?: number; + offset?: number; + align?: string; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/IAssetRoomVisualizationData.ts b/submodules/renderer/src/api/asset/room-visualization/IAssetRoomVisualizationData.ts new file mode 100644 index 0000000..e82ea8f --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/IAssetRoomVisualizationData.ts @@ -0,0 +1,10 @@ +import { IAssetPlaneMaskData } from './IAssetPlaneMaskData'; +import { IAssetPlaneVisualizationData } from './IAssetPlaneVisualizationData'; + +export interface IAssetRoomVisualizationData +{ + floorData?: IAssetPlaneVisualizationData; + wallData?: IAssetPlaneVisualizationData; + landscapeData?: IAssetPlaneVisualizationData; + maskData?: IAssetPlaneMaskData; +} diff --git a/submodules/renderer/src/api/asset/room-visualization/index.ts b/submodules/renderer/src/api/asset/room-visualization/index.ts new file mode 100644 index 0000000..4d6face --- /dev/null +++ b/submodules/renderer/src/api/asset/room-visualization/index.ts @@ -0,0 +1,17 @@ +export * from './IAssetPlane'; +export * from './IAssetPlaneMask'; +export * from './IAssetPlaneMaskData'; +export * from './IAssetPlaneMaskVisualization'; +export * from './IAssetPlaneMaterial'; +export * from './IAssetPlaneMaterialCell'; +export * from './IAssetPlaneMaterialCellColumn'; +export * from './IAssetPlaneMaterialCellExtraItemData'; +export * from './IAssetPlaneMaterialCellMatrix'; +export * from './IAssetPlaneTexture'; +export * from './IAssetPlaneTextureBitmap'; +export * from './IAssetPlaneVisualization'; +export * from './IAssetPlaneVisualizationAnimatedLayer'; +export * from './IAssetPlaneVisualizationAnimatedLayerItem'; +export * from './IAssetPlaneVisualizationData'; +export * from './IAssetPlaneVisualizationLayer'; +export * from './IAssetRoomVisualizationData'; diff --git a/submodules/renderer/src/api/asset/spritesheet/ISpritesheetData.ts b/submodules/renderer/src/api/asset/spritesheet/ISpritesheetData.ts new file mode 100644 index 0000000..2858958 --- /dev/null +++ b/submodules/renderer/src/api/asset/spritesheet/ISpritesheetData.ts @@ -0,0 +1,7 @@ +import { ISpritesheetData as PixiSpritesheet } from '@pixi/spritesheet'; +import { ISpritesheetMeta } from './ISpritesheetMeta'; + +export interface ISpritesheetData extends PixiSpritesheet +{ + meta: ISpritesheetMeta; +} diff --git a/submodules/renderer/src/api/asset/spritesheet/ISpritesheetFrame.ts b/submodules/renderer/src/api/asset/spritesheet/ISpritesheetFrame.ts new file mode 100644 index 0000000..0833b50 --- /dev/null +++ b/submodules/renderer/src/api/asset/spritesheet/ISpritesheetFrame.ts @@ -0,0 +1,25 @@ +export interface ISpritesheetFrame +{ + frame: { + x: number; + y: number; + w: number; + h: number; + }; + rotated: boolean; + trimmed: boolean; + spriteSourceSize: { + x: number; + y: number; + w: number; + h: number; + }; + sourceSize: { + w: number; + h: number; + }; + pivot: { + x: number; + y: number; + }; +} diff --git a/submodules/renderer/src/api/asset/spritesheet/ISpritesheetMeta.ts b/submodules/renderer/src/api/asset/spritesheet/ISpritesheetMeta.ts new file mode 100644 index 0000000..3a74f7b --- /dev/null +++ b/submodules/renderer/src/api/asset/spritesheet/ISpritesheetMeta.ts @@ -0,0 +1,12 @@ +export interface ISpritesheetMeta +{ + app: string; + version: string; + image: string; + format: string; + size: { + w: number; + h: number; + }; + scale: string; +} diff --git a/submodules/renderer/src/api/asset/spritesheet/index.ts b/submodules/renderer/src/api/asset/spritesheet/index.ts new file mode 100644 index 0000000..9c94e8b --- /dev/null +++ b/submodules/renderer/src/api/asset/spritesheet/index.ts @@ -0,0 +1,3 @@ +export * from './ISpritesheetData'; +export * from './ISpritesheetFrame'; +export * from './ISpritesheetMeta'; diff --git a/submodules/renderer/src/api/asset/visualization/IAssetVisualizationData.ts b/submodules/renderer/src/api/asset/visualization/IAssetVisualizationData.ts new file mode 100644 index 0000000..e17ecdc --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/IAssetVisualizationData.ts @@ -0,0 +1,20 @@ +import { IAssetVisualAnimation } from './animation/IAssetVisualAnimation'; +import { IAssetColor } from './color/IAssetColor'; +import { IAssetGesture } from './gestures/IAssetGesture'; +import { IAssetVisualizationDirection } from './IAssetVisualizationDirection'; +import { IAssetVisualizationLayer } from './IAssetVisualizationLayer'; +import { IAssetPosture } from './postures/IAssetPosture'; + +export interface IAssetVisualizationData +{ + size?: number; + layerCount?: number; + angle?: number; + layers?: { [index: string]: IAssetVisualizationLayer }; + colors?: { [index: string]: IAssetColor }; + directions?: { [index: string]: IAssetVisualizationDirection }; + animations?: { [index: string]: IAssetVisualAnimation }; + defaultPosture?: string; + postures?: { defaultPosture?: string, postures?: IAssetPosture[] }; + gestures?: IAssetGesture[]; +} diff --git a/submodules/renderer/src/api/asset/visualization/IAssetVisualizationDirection.ts b/submodules/renderer/src/api/asset/visualization/IAssetVisualizationDirection.ts new file mode 100644 index 0000000..cc628f1 --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/IAssetVisualizationDirection.ts @@ -0,0 +1,6 @@ +import { IAssetVisualizationLayer } from './IAssetVisualizationLayer'; + +export interface IAssetVisualizationDirection +{ + layers?: { [index: string]: IAssetVisualizationLayer }; +} diff --git a/submodules/renderer/src/api/asset/visualization/IAssetVisualizationLayer.ts b/submodules/renderer/src/api/asset/visualization/IAssetVisualizationLayer.ts new file mode 100644 index 0000000..61fcf56 --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/IAssetVisualizationLayer.ts @@ -0,0 +1,10 @@ +export interface IAssetVisualizationLayer +{ + x?: number; + y?: number; + z?: number; + alpha?: number; + ink?: string; + tag?: string; + ignoreMouse?: boolean; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/asset/visualization/animation/IAssetVisualAnimation.ts b/submodules/renderer/src/api/asset/visualization/animation/IAssetVisualAnimation.ts new file mode 100644 index 0000000..4e71438 --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/animation/IAssetVisualAnimation.ts @@ -0,0 +1,10 @@ +import { IAssetVisualAnimationLayer } from './IAssetVisualAnimationLayer'; + +export interface IAssetVisualAnimation +{ + transitionTo?: number; + transitionFrom?: number; + immediateChangeFrom?: string; + randomStart?: boolean; + layers?: { [index: string]: IAssetVisualAnimationLayer }; +} diff --git a/submodules/renderer/src/api/asset/visualization/animation/IAssetVisualAnimationLayer.ts b/submodules/renderer/src/api/asset/visualization/animation/IAssetVisualAnimationLayer.ts new file mode 100644 index 0000000..2a274ea --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/animation/IAssetVisualAnimationLayer.ts @@ -0,0 +1,9 @@ +import { IAssetVisualAnimationSequence } from './IAssetVisualAnimationSequence'; + +export interface IAssetVisualAnimationLayer +{ + loopCount?: number; + frameRepeat?: number; + random?: number; + frameSequences?: { [index: string]: IAssetVisualAnimationSequence }; +} diff --git a/submodules/renderer/src/api/asset/visualization/animation/IAssetVisualAnimationSequence.ts b/submodules/renderer/src/api/asset/visualization/animation/IAssetVisualAnimationSequence.ts new file mode 100644 index 0000000..bb25104 --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/animation/IAssetVisualAnimationSequence.ts @@ -0,0 +1,8 @@ +import { IAssetVisualAnimationSequenceFrame } from './IAssetVisualAnimationSequenceFrame'; + +export interface IAssetVisualAnimationSequence +{ + loopCount?: number; + random?: number; + frames?: { [index: string]: IAssetVisualAnimationSequenceFrame }; +} diff --git a/submodules/renderer/src/api/asset/visualization/animation/IAssetVisualAnimationSequenceFrame.ts b/submodules/renderer/src/api/asset/visualization/animation/IAssetVisualAnimationSequenceFrame.ts new file mode 100644 index 0000000..196631e --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/animation/IAssetVisualAnimationSequenceFrame.ts @@ -0,0 +1,11 @@ +import { IAssetVisualAnimationSequenceFrameOffset } from './IAssetVisualAnimationSequenceFrameOffset'; + +export interface IAssetVisualAnimationSequenceFrame +{ + id?: number; + x?: number; + y?: number; + randomX?: number; + randomY?: number; + offsets?: { [index: string]: IAssetVisualAnimationSequenceFrameOffset }; +} diff --git a/submodules/renderer/src/api/asset/visualization/animation/IAssetVisualAnimationSequenceFrameOffset.ts b/submodules/renderer/src/api/asset/visualization/animation/IAssetVisualAnimationSequenceFrameOffset.ts new file mode 100644 index 0000000..bc85461 --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/animation/IAssetVisualAnimationSequenceFrameOffset.ts @@ -0,0 +1,6 @@ +export interface IAssetVisualAnimationSequenceFrameOffset +{ + direction?: number; + x?: number; + y?: number; +} diff --git a/submodules/renderer/src/api/asset/visualization/animation/index.ts b/submodules/renderer/src/api/asset/visualization/animation/index.ts new file mode 100644 index 0000000..19b332c --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/animation/index.ts @@ -0,0 +1,5 @@ +export * from './IAssetVisualAnimation'; +export * from './IAssetVisualAnimationLayer'; +export * from './IAssetVisualAnimationSequence'; +export * from './IAssetVisualAnimationSequenceFrame'; +export * from './IAssetVisualAnimationSequenceFrameOffset'; diff --git a/submodules/renderer/src/api/asset/visualization/color/IAssetColor.ts b/submodules/renderer/src/api/asset/visualization/color/IAssetColor.ts new file mode 100644 index 0000000..29ebc75 --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/color/IAssetColor.ts @@ -0,0 +1,6 @@ +import { IAssetColorLayer } from './IAssetColorLayer'; + +export interface IAssetColor +{ + layers?: { [index: string]: IAssetColorLayer }; +} diff --git a/submodules/renderer/src/api/asset/visualization/color/IAssetColorLayer.ts b/submodules/renderer/src/api/asset/visualization/color/IAssetColorLayer.ts new file mode 100644 index 0000000..7a1372e --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/color/IAssetColorLayer.ts @@ -0,0 +1,4 @@ +export interface IAssetColorLayer +{ + color?: number; +} diff --git a/submodules/renderer/src/api/asset/visualization/color/index.ts b/submodules/renderer/src/api/asset/visualization/color/index.ts new file mode 100644 index 0000000..00aff50 --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/color/index.ts @@ -0,0 +1,2 @@ +export * from './IAssetColor'; +export * from './IAssetColorLayer'; diff --git a/submodules/renderer/src/api/asset/visualization/gestures/IAssetGesture.ts b/submodules/renderer/src/api/asset/visualization/gestures/IAssetGesture.ts new file mode 100644 index 0000000..ddf3752 --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/gestures/IAssetGesture.ts @@ -0,0 +1,5 @@ +export interface IAssetGesture +{ + id?: string; + animationId?: number; +} diff --git a/submodules/renderer/src/api/asset/visualization/gestures/index.ts b/submodules/renderer/src/api/asset/visualization/gestures/index.ts new file mode 100644 index 0000000..2c6e978 --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/gestures/index.ts @@ -0,0 +1 @@ +export * from './IAssetGesture'; diff --git a/submodules/renderer/src/api/asset/visualization/index.ts b/submodules/renderer/src/api/asset/visualization/index.ts new file mode 100644 index 0000000..334bddc --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/index.ts @@ -0,0 +1,7 @@ +export * from './animation'; +export * from './color'; +export * from './gestures'; +export * from './IAssetVisualizationData'; +export * from './IAssetVisualizationDirection'; +export * from './IAssetVisualizationLayer'; +export * from './postures'; diff --git a/submodules/renderer/src/api/asset/visualization/postures/IAssetPosture.ts b/submodules/renderer/src/api/asset/visualization/postures/IAssetPosture.ts new file mode 100644 index 0000000..3313851 --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/postures/IAssetPosture.ts @@ -0,0 +1,5 @@ +export interface IAssetPosture +{ + id?: string; + animationId?: number; +} diff --git a/submodules/renderer/src/api/asset/visualization/postures/index.ts b/submodules/renderer/src/api/asset/visualization/postures/index.ts new file mode 100644 index 0000000..c24c1b9 --- /dev/null +++ b/submodules/renderer/src/api/asset/visualization/postures/index.ts @@ -0,0 +1 @@ +export * from './IAssetPosture'; diff --git a/submodules/renderer/src/api/common/IDisposable.ts b/submodules/renderer/src/api/common/IDisposable.ts new file mode 100644 index 0000000..b9f6040 --- /dev/null +++ b/submodules/renderer/src/api/common/IDisposable.ts @@ -0,0 +1,5 @@ +export interface IDisposable +{ + dispose(): void; + disposed: boolean; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/common/IEventDispatcher.ts b/submodules/renderer/src/api/common/IEventDispatcher.ts new file mode 100644 index 0000000..3d4f178 --- /dev/null +++ b/submodules/renderer/src/api/common/IEventDispatcher.ts @@ -0,0 +1,10 @@ +import { IDisposable } from './IDisposable'; +import { INitroEvent } from './INitroEvent'; + +export interface IEventDispatcher extends IDisposable +{ + addEventListener(type: string, callback: Function): void + removeEventListener(type: string, callback: Function): void; + removeAllListeners(): void; + dispatchEvent(event: INitroEvent): boolean; +} diff --git a/submodules/renderer/src/api/common/ILinkEventTracker.ts b/submodules/renderer/src/api/common/ILinkEventTracker.ts new file mode 100644 index 0000000..311567d --- /dev/null +++ b/submodules/renderer/src/api/common/ILinkEventTracker.ts @@ -0,0 +1,5 @@ +export interface ILinkEventTracker +{ + linkReceived(link: string): void; + eventUrlPrefix: string; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/common/INitroEvent.ts b/submodules/renderer/src/api/common/INitroEvent.ts new file mode 100644 index 0000000..e063ad8 --- /dev/null +++ b/submodules/renderer/src/api/common/INitroEvent.ts @@ -0,0 +1,4 @@ +export interface INitroEvent +{ + type: string; +} diff --git a/submodules/renderer/src/api/common/INitroManager.ts b/submodules/renderer/src/api/common/INitroManager.ts new file mode 100644 index 0000000..22ac5f8 --- /dev/null +++ b/submodules/renderer/src/api/common/INitroManager.ts @@ -0,0 +1,10 @@ +import { IDisposable } from './IDisposable'; +import { IEventDispatcher } from './IEventDispatcher'; + +export interface INitroManager extends IDisposable +{ + init(): void; + events: IEventDispatcher; + isLoaded: boolean; + isLoading: boolean; +} diff --git a/submodules/renderer/src/api/common/IUpdateReceiver.ts b/submodules/renderer/src/api/common/IUpdateReceiver.ts new file mode 100644 index 0000000..76c3891 --- /dev/null +++ b/submodules/renderer/src/api/common/IUpdateReceiver.ts @@ -0,0 +1,6 @@ +import { IDisposable } from './IDisposable'; + +export interface IUpdateReceiver extends IDisposable +{ + update(time: number): void; +} diff --git a/submodules/renderer/src/api/common/NitroLogger.ts b/submodules/renderer/src/api/common/NitroLogger.ts new file mode 100644 index 0000000..d286d2b --- /dev/null +++ b/submodules/renderer/src/api/common/NitroLogger.ts @@ -0,0 +1,48 @@ +export class NitroLogger +{ + public static LOG_DEBUG: boolean = false; + public static LOG_WARN: boolean = false; + public static LOG_ERROR: boolean = false; + public static LOG_EVENTS: boolean = false; + public static LOG_PACKETS: boolean = false; + + public static log(...messages: any[]): void + { + if(!this.LOG_DEBUG) return; + + console.log(this.logPrefix(), ...messages); + } + + public static warn(...messages: any[]): void + { + if(!this.LOG_WARN) return; + + console.warn(this.logPrefix(), ...messages); + } + + public static error(...messages: any[]): void + { + if(!this.LOG_ERROR) return; + + console.error(this.logPrefix(), ...messages); + } + + public static events(...messages: any[]): void + { + if(!this.LOG_EVENTS) return; + + console.log(this.logPrefix(), ...messages); + } + + public static packets(...messages: any[]): void + { + if(!this.LOG_PACKETS) return; + + console.log(this.logPrefix(), ...messages); + } + + private static logPrefix(): string + { + return '[Nitro]'; + } +} diff --git a/submodules/renderer/src/api/common/index.ts b/submodules/renderer/src/api/common/index.ts new file mode 100644 index 0000000..5142ae0 --- /dev/null +++ b/submodules/renderer/src/api/common/index.ts @@ -0,0 +1,7 @@ +export * from './IDisposable'; +export * from './IEventDispatcher'; +export * from './ILinkEventTracker'; +export * from './INitroEvent'; +export * from './INitroManager'; +export * from './IUpdateReceiver'; +export * from './NitroLogger'; diff --git a/submodules/renderer/src/api/communication/ICodec.ts b/submodules/renderer/src/api/communication/ICodec.ts new file mode 100644 index 0000000..39c4b29 --- /dev/null +++ b/submodules/renderer/src/api/communication/ICodec.ts @@ -0,0 +1,9 @@ +import { IBinaryWriter } from '../utils'; +import { IConnection } from './IConnection'; +import { IMessageDataWrapper } from './IMessageDataWrapper'; + +export interface ICodec +{ + encode(header: number, messages: any[]): IBinaryWriter; + decode(connection: IConnection): IMessageDataWrapper[]; +} diff --git a/submodules/renderer/src/api/communication/ICommunicationManager.ts b/submodules/renderer/src/api/communication/ICommunicationManager.ts new file mode 100644 index 0000000..fc79a49 --- /dev/null +++ b/submodules/renderer/src/api/communication/ICommunicationManager.ts @@ -0,0 +1,8 @@ +import { IDisposable } from '../common'; +import { IConnection } from './IConnection'; +import { IConnectionStateListener } from './IConnectionStateListener'; + +export interface ICommunicationManager extends IDisposable +{ + createConnection(stateListener?: IConnectionStateListener): IConnection; +} diff --git a/submodules/renderer/src/api/communication/IConnection.ts b/submodules/renderer/src/api/communication/IConnection.ts new file mode 100644 index 0000000..3aa30ab --- /dev/null +++ b/submodules/renderer/src/api/communication/IConnection.ts @@ -0,0 +1,19 @@ +import { IEventDispatcher } from '../common'; +import { IMessageComposer } from './IMessageComposer'; +import { IMessageConfiguration } from './IMessageConfiguration'; +import { IMessageEvent } from './IMessageEvent'; + +export interface IConnection extends IEventDispatcher +{ + init(socketUrl: string): void; + dispose(): void; + onReady(): void; + authenticated(): void; + send(...composers: IMessageComposer[]): void; + processReceivedData(): void; + registerMessages(configuration: IMessageConfiguration): void; + addMessageEvent(event: IMessageEvent): void; + removeMessageEvent(event: IMessageEvent): void; + isAuthenticated: boolean; + dataBuffer: ArrayBuffer; +} diff --git a/submodules/renderer/src/api/communication/IConnectionStateListener.ts b/submodules/renderer/src/api/communication/IConnectionStateListener.ts new file mode 100644 index 0000000..d140fd0 --- /dev/null +++ b/submodules/renderer/src/api/communication/IConnectionStateListener.ts @@ -0,0 +1,4 @@ +export interface IConnectionStateListener +{ + connectionInit(socketUrl: string): void; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/communication/IMessageComposer.ts b/submodules/renderer/src/api/communication/IMessageComposer.ts new file mode 100644 index 0000000..eb09bc8 --- /dev/null +++ b/submodules/renderer/src/api/communication/IMessageComposer.ts @@ -0,0 +1,5 @@ +export interface IMessageComposer +{ + dispose(): void; + getMessageArray(): T; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/communication/IMessageConfiguration.ts b/submodules/renderer/src/api/communication/IMessageConfiguration.ts new file mode 100644 index 0000000..03efd30 --- /dev/null +++ b/submodules/renderer/src/api/communication/IMessageConfiguration.ts @@ -0,0 +1,5 @@ +export interface IMessageConfiguration +{ + events: Map; + composers: Map; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/communication/IMessageDataWrapper.ts b/submodules/renderer/src/api/communication/IMessageDataWrapper.ts new file mode 100644 index 0000000..0f1c39f --- /dev/null +++ b/submodules/renderer/src/api/communication/IMessageDataWrapper.ts @@ -0,0 +1,15 @@ +import { IBinaryReader } from '../utils'; + +export interface IMessageDataWrapper +{ + readByte(): number; + readBytes(length: number): IBinaryReader; + readBoolean(): boolean; + readShort(): number; + readInt(): number; + readFloat(): number; + readDouble(): number; + readString(): string; + header: number; + bytesAvailable: boolean; +} diff --git a/submodules/renderer/src/api/communication/IMessageEvent.ts b/submodules/renderer/src/api/communication/IMessageEvent.ts new file mode 100644 index 0000000..5949015 --- /dev/null +++ b/submodules/renderer/src/api/communication/IMessageEvent.ts @@ -0,0 +1,11 @@ +import { IConnection } from './IConnection'; +import { IMessageParser } from './IMessageParser'; + +export interface IMessageEvent +{ + dispose(): void; + callBack: Function; + parserClass: Function; + parser: IMessageParser; + connection: IConnection; +} diff --git a/submodules/renderer/src/api/communication/IMessageParser.ts b/submodules/renderer/src/api/communication/IMessageParser.ts new file mode 100644 index 0000000..f10a50d --- /dev/null +++ b/submodules/renderer/src/api/communication/IMessageParser.ts @@ -0,0 +1,7 @@ +import { IMessageDataWrapper } from './IMessageDataWrapper'; + +export interface IMessageParser +{ + flush(): boolean; + parse(wrapper: IMessageDataWrapper): boolean; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/communication/enums/ClientDeviceCategoryEnum.ts b/submodules/renderer/src/api/communication/enums/ClientDeviceCategoryEnum.ts new file mode 100644 index 0000000..abd127f --- /dev/null +++ b/submodules/renderer/src/api/communication/enums/ClientDeviceCategoryEnum.ts @@ -0,0 +1,5 @@ +export class ClientDeviceCategoryEnum +{ + public static UNKNOWN: number = 0; + public static BROWSER: number = 1; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/communication/enums/ClientPlatformEnum.ts b/submodules/renderer/src/api/communication/enums/ClientPlatformEnum.ts new file mode 100644 index 0000000..417b811 --- /dev/null +++ b/submodules/renderer/src/api/communication/enums/ClientPlatformEnum.ts @@ -0,0 +1,7 @@ +export class ClientPlatformEnum +{ + public static UNKNOWN: number = 0; + public static FLASH: number = 1; + public static HTML5: number = 2; + +} \ No newline at end of file diff --git a/submodules/renderer/src/api/communication/enums/WebSocketEventEnum.ts b/submodules/renderer/src/api/communication/enums/WebSocketEventEnum.ts new file mode 100644 index 0000000..303b79c --- /dev/null +++ b/submodules/renderer/src/api/communication/enums/WebSocketEventEnum.ts @@ -0,0 +1,7 @@ +export class WebSocketEventEnum +{ + public static CONNECTION_OPENED = 'open'; + public static CONNECTION_CLOSED = 'close'; + public static CONNECTION_ERROR = 'error'; + public static CONNECTION_MESSAGE = 'message'; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/communication/enums/index.ts b/submodules/renderer/src/api/communication/enums/index.ts new file mode 100644 index 0000000..42a2270 --- /dev/null +++ b/submodules/renderer/src/api/communication/enums/index.ts @@ -0,0 +1,3 @@ +export * from './ClientDeviceCategoryEnum'; +export * from './ClientPlatformEnum'; +export * from './WebSocketEventEnum'; diff --git a/submodules/renderer/src/api/communication/index.ts b/submodules/renderer/src/api/communication/index.ts new file mode 100644 index 0000000..779143d --- /dev/null +++ b/submodules/renderer/src/api/communication/index.ts @@ -0,0 +1,10 @@ +export * from './enums'; +export * from './ICodec'; +export * from './ICommunicationManager'; +export * from './IConnection'; +export * from './IConnectionStateListener'; +export * from './IMessageComposer'; +export * from './IMessageConfiguration'; +export * from './IMessageDataWrapper'; +export * from './IMessageEvent'; +export * from './IMessageParser'; diff --git a/submodules/renderer/src/api/configuration/IConfigurationManager.ts b/submodules/renderer/src/api/configuration/IConfigurationManager.ts new file mode 100644 index 0000000..6aee784 --- /dev/null +++ b/submodules/renderer/src/api/configuration/IConfigurationManager.ts @@ -0,0 +1,3 @@ +import { INitroManager } from '../common'; + +export type IConfigurationManager = INitroManager diff --git a/submodules/renderer/src/api/configuration/NitroConfiguration.ts b/submodules/renderer/src/api/configuration/NitroConfiguration.ts new file mode 100644 index 0000000..d3e0158 --- /dev/null +++ b/submodules/renderer/src/api/configuration/NitroConfiguration.ts @@ -0,0 +1,114 @@ +import { NitroLogger } from '../common'; + +export class NitroConfiguration +{ + private static _definitions: Map = new Map(); + private static _config: any = {}; + private static _missingKeys: string[] = []; + + public static parseConfiguration(data: { [index: string]: any }, overrides: boolean = false): boolean + { + if(!data) return false; + + try + { + const regex = new RegExp(/\${(.*?)}/g); + + for(const key in data) + { + let value = data[key]; + + if(typeof value === 'string') value = this.interpolate((value as string), regex); + + if(this._definitions.has(key)) + { + if(overrides) this.setValue(key, value); + } + else + { + this.setValue(key, value); + } + } + + return true; + } + + catch (e) + { + NitroLogger.error(e.stack); + + return false; + } + } + + public static interpolate(value: string, regex: RegExp = null): string + { + if(!regex) regex = new RegExp(/\${(.*?)}/g); + + const pieces = value.match(regex); + + if(pieces && pieces.length) + { + for(const piece of pieces) + { + const existing = (this._definitions.get(this.removeInterpolateKey(piece)) as string); + + if(existing) (value = value.replace(piece, existing)); + } + } + + return value; + } + + private static removeInterpolateKey(value: string): string + { + return value.replace('${', '').replace('}', ''); + } + + public static getValue(key: string, value: T = null): T + { + let existing = this._definitions.get(key); + + if(existing === undefined) + { + if(this._missingKeys.indexOf(key) >= 0) return value; + + this._missingKeys.push(key); + NitroLogger.warn(`Missing configuration key: ${key}`); + + existing = value; + } + + return (existing as T); + } + + public static setValue(key: string, value: T): void + { + const parts = key.split('.'); + + let last = this._config; + + for(let i = 0; i < parts.length; i++) + { + const part = parts[i].toString(); + + if(i !== (parts.length - 1)) + { + if(!last[part]) last[part] = {}; + + last = last[part]; + + continue; + } + + last[part] = value; + } + + this._definitions.set(key, value); + } + + public static get definitions(): Map + { + return this._definitions; + } +} diff --git a/submodules/renderer/src/api/configuration/index.ts b/submodules/renderer/src/api/configuration/index.ts new file mode 100644 index 0000000..93d8832 --- /dev/null +++ b/submodules/renderer/src/api/configuration/index.ts @@ -0,0 +1,2 @@ +export * from './IConfigurationManager'; +export * from './NitroConfiguration'; diff --git a/submodules/renderer/src/api/index.ts b/submodules/renderer/src/api/index.ts new file mode 100644 index 0000000..808803e --- /dev/null +++ b/submodules/renderer/src/api/index.ts @@ -0,0 +1,48 @@ +export * from './asset'; +export * from './asset/animation'; +export * from './asset/logic'; +export * from './asset/logic/model'; +export * from './asset/logic/particlesystem'; +export * from './asset/spritesheet'; +export * from './asset/visualization'; +export * from './asset/visualization/animation'; +export * from './asset/visualization/color'; +export * from './asset/visualization/gestures'; +export * from './asset/visualization/postures'; +export * from './common'; +export * from './communication'; +export * from './communication/enums'; +export * from './configuration'; +export * from './INitroCore'; +export * from './nitro'; +export * from './nitro/avatar'; +export * from './nitro/avatar/actions'; +export * from './nitro/avatar/animation'; +export * from './nitro/avatar/enum'; +export * from './nitro/avatar/figuredata'; +export * from './nitro/avatar/pet'; +export * from './nitro/avatar/structure'; +export * from './nitro/camera'; +export * from './nitro/communication'; +export * from './nitro/enums'; +export * from './nitro/localization'; +export * from './nitro/room'; +export * from './nitro/room/enums'; +export * from './nitro/room/object'; +export * from './nitro/room/object/data'; +export * from './nitro/room/object/data/type'; +export * from './nitro/room/utils'; +export * from './nitro/session'; +export * from './nitro/session/enum'; +export * from './nitro/sound'; +export * from './nitro/sound/common'; +export * from './room'; +export * from './room/object'; +export * from './room/object/enum'; +export * from './room/object/logic'; +export * from './room/object/visualization'; +export * from './room/renderer'; +export * from './ui'; +export * from './ui/widget'; +export * from './ui/widget/enums'; +export * from './utils'; diff --git a/submodules/renderer/src/api/nitro/avatar/IAvatarAssetDownloadLibrary.ts b/submodules/renderer/src/api/nitro/avatar/IAvatarAssetDownloadLibrary.ts new file mode 100644 index 0000000..4ed78f8 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/IAvatarAssetDownloadLibrary.ts @@ -0,0 +1,8 @@ +import { IEventDispatcher } from '../../common'; + +export interface IAvatarAssetDownloadLibrary extends IEventDispatcher +{ + downloadAsset(): void; + readonly libraryName: string; + readonly isLoaded: boolean; +} diff --git a/submodules/renderer/src/api/nitro/avatar/IAvatarEffectListener.ts b/submodules/renderer/src/api/nitro/avatar/IAvatarEffectListener.ts new file mode 100644 index 0000000..adb37f0 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/IAvatarEffectListener.ts @@ -0,0 +1,6 @@ +import { IDisposable } from '../../common'; + +export interface IAvatarEffectListener extends IDisposable +{ + resetEffect(effect: number): void; +} diff --git a/submodules/renderer/src/api/nitro/avatar/IAvatarFigureContainer.ts b/submodules/renderer/src/api/nitro/avatar/IAvatarFigureContainer.ts new file mode 100644 index 0000000..6e11806 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/IAvatarFigureContainer.ts @@ -0,0 +1,10 @@ +export interface IAvatarFigureContainer +{ + getPartTypeIds(): IterableIterator; + hasPartType(_arg_1: string): boolean; + getPartSetId(_arg_1: string): number; + getPartColorIds(_arg_1: string): number[]; + updatePart(_arg_1: string, _arg_2: number, _arg_3: number[]): void; + removePart(_arg_1: string): void; + getFigureString(): string; +} diff --git a/submodules/renderer/src/api/nitro/avatar/IAvatarImage.ts b/submodules/renderer/src/api/nitro/avatar/IAvatarImage.ts new file mode 100644 index 0000000..559a7d3 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/IAvatarImage.ts @@ -0,0 +1,36 @@ +import { RenderTexture } from '@pixi/core'; +import { Sprite } from '@pixi/sprite'; +import { IGraphicAsset } from '../../asset'; +import { IDisposable } from '../../common'; +import { IAnimationLayerData, IAvatarDataContainer, ISpriteDataContainer } from './animation'; +import { IAvatarFigureContainer } from './IAvatarFigureContainer'; +import { IPartColor } from './structure'; + +export interface IAvatarImage extends IDisposable +{ + getServerRenderData(): any; + setDirection(_arg_1: string, _arg_2: number): void; + setDirectionAngle(_arg_1: string, _arg_2: number): void; + updateAnimationByFrames(_arg_1?: number): void; + getScale(): string; + getSprites(): ISpriteDataContainer[]; + getLayerData(_arg_1: ISpriteDataContainer): IAnimationLayerData; + getImage(setType: string, hightlight: boolean, scale?: number, cache?: boolean): RenderTexture; + getImageAsSprite(setType: string, scale?: number): Sprite; + getCroppedImage(setType: string, scale?: number): HTMLImageElement; + getAsset(_arg_1: string): IGraphicAsset; + getDirection(): number; + getFigure(): IAvatarFigureContainer; + getPartColor(_arg_1: string): IPartColor; + isAnimating(): boolean; + getCanvasOffsets(): number[]; + initActionAppends(): void; + endActionAppends(): void; + appendAction(_arg_1: string, ..._args: any[]): boolean; + avatarSpriteData: IAvatarDataContainer; + isPlaceholder(): boolean; + forceActionUpdate(): void; + animationHasResetOnToggle: boolean; + resetAnimationFrameCounter(): void; + mainAction: string; +} diff --git a/submodules/renderer/src/api/nitro/avatar/IAvatarImageListener.ts b/submodules/renderer/src/api/nitro/avatar/IAvatarImageListener.ts new file mode 100644 index 0000000..cc68c92 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/IAvatarImageListener.ts @@ -0,0 +1,6 @@ +import { IDisposable } from '../../common'; + +export interface IAvatarImageListener extends IDisposable +{ + resetFigure(figure: string): void; +} diff --git a/submodules/renderer/src/api/nitro/avatar/IAvatarRenderManager.ts b/submodules/renderer/src/api/nitro/avatar/IAvatarRenderManager.ts new file mode 100644 index 0000000..0c983e3 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/IAvatarRenderManager.ts @@ -0,0 +1,26 @@ +import { AvatarAssetDownloadManager, AvatarStructure } from '../../../nitro'; +import { IAssetManager, IGraphicAsset } from '../../asset'; +import { INitroManager } from '../../common'; +import { IAvatarEffectListener } from './IAvatarEffectListener'; +import { IAvatarFigureContainer } from './IAvatarFigureContainer'; +import { IAvatarImage } from './IAvatarImage'; +import { IAvatarImageListener } from './IAvatarImageListener'; +import { IStructureData } from './structure'; + +export interface IAvatarRenderManager extends INitroManager +{ + createFigureContainer(figure: string): IAvatarFigureContainer; + isFigureContainerReady(container: IAvatarFigureContainer): boolean; + createAvatarImage(figure: string, size: string, gender: string, listener?: IAvatarImageListener, effectListener?: IAvatarEffectListener): IAvatarImage; + downloadAvatarFigure(container: IAvatarFigureContainer, listener: IAvatarImageListener): void; + getFigureClubLevel(container: IAvatarFigureContainer, gender: string, searchParts?: string[]): number; + isValidFigureSetForGender(setId: number, gender: string): boolean; + getFigureStringWithFigureIds(k: string, _arg_2: string, _arg_3: number[]): string; + getMandatoryAvatarPartSetIds(k: string, _arg_2: number): string[]; + getAssetByName(name: string): IGraphicAsset; + assets: IAssetManager; + isReady: boolean; + structure: AvatarStructure; + structureData: IStructureData; + downloadManager: AvatarAssetDownloadManager; +} diff --git a/submodules/renderer/src/api/nitro/avatar/IEffectAssetDownloadLibrary.ts b/submodules/renderer/src/api/nitro/avatar/IEffectAssetDownloadLibrary.ts new file mode 100644 index 0000000..d08cd31 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/IEffectAssetDownloadLibrary.ts @@ -0,0 +1,10 @@ +import { IAssetAnimation } from '../../asset'; +import { IEventDispatcher } from '../../common'; + +export interface IEffectAssetDownloadLibrary extends IEventDispatcher +{ + downloadAsset(): void; + readonly libraryName: string; + readonly animation: { [index: string]: IAssetAnimation }; + readonly isLoaded: boolean; +} diff --git a/submodules/renderer/src/api/nitro/avatar/IOutfit.ts b/submodules/renderer/src/api/nitro/avatar/IOutfit.ts new file mode 100644 index 0000000..e797d6f --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/IOutfit.ts @@ -0,0 +1,5 @@ +export interface IOutfit +{ + figure: string; + gender: string; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/avatar/actions/IActionDefinition.ts b/submodules/renderer/src/api/nitro/avatar/actions/IActionDefinition.ts new file mode 100644 index 0000000..9c0e5f1 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/actions/IActionDefinition.ts @@ -0,0 +1,19 @@ +export interface IActionDefinition +{ + id: string; + state: string; + precedence: number; + activePartSet: string; + isMain: boolean; + isDefault: boolean; + assetPartDefinition: string; + lay: string; + geometryType: string; + isAnimation: boolean; + startFromFrameZero: boolean; + isAnimated(_arg_1: string): boolean; + getPrevents(_arg_1: string): string[]; + getPreventHeadTurn(_arg_1: string): boolean; + setOffsets(_arg_1: string, _arg_2: number, _arg_3: []): void; + getOffsets(_arg_1: string, _arg_2: number): number[]; +} diff --git a/submodules/renderer/src/api/nitro/avatar/actions/IActiveActionData.ts b/submodules/renderer/src/api/nitro/avatar/actions/IActiveActionData.ts new file mode 100644 index 0000000..214c64f --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/actions/IActiveActionData.ts @@ -0,0 +1,11 @@ +import { IActionDefinition } from './IActionDefinition'; + +export interface IActiveActionData +{ + id: string; + actionType: string; + actionParameter: string; + startFrame: number; + definition: IActionDefinition; + overridingAction: string; +} diff --git a/submodules/renderer/src/api/nitro/avatar/actions/index.ts b/submodules/renderer/src/api/nitro/avatar/actions/index.ts new file mode 100644 index 0000000..9e191b0 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/actions/index.ts @@ -0,0 +1,2 @@ +export * from './IActionDefinition'; +export * from './IActiveActionData'; diff --git a/submodules/renderer/src/api/nitro/avatar/animation/IAnimation.ts b/submodules/renderer/src/api/nitro/avatar/animation/IAnimation.ts new file mode 100644 index 0000000..2f53b72 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/animation/IAnimation.ts @@ -0,0 +1,11 @@ +export interface IAnimation +{ + hasAvatarData(): boolean; + hasDirectionData(): boolean; + hasAddData(): boolean; + id: string; + spriteData: any; + removeData: any; + addData: any; + resetOnToggle: boolean; +} diff --git a/submodules/renderer/src/api/nitro/avatar/animation/IAnimationLayerData.ts b/submodules/renderer/src/api/nitro/avatar/animation/IAnimationLayerData.ts new file mode 100644 index 0000000..8bf9e86 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/animation/IAnimationLayerData.ts @@ -0,0 +1,12 @@ +import { IActiveActionData } from '../actions'; + +export interface IAnimationLayerData +{ + id: string; + action: IActiveActionData; + animationFrame: number; + dx: number; + dy: number; + dz: number; + dd: number; +} diff --git a/submodules/renderer/src/api/nitro/avatar/animation/IAnimationManager.ts b/submodules/renderer/src/api/nitro/avatar/animation/IAnimationManager.ts new file mode 100644 index 0000000..2fff676 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/animation/IAnimationManager.ts @@ -0,0 +1,9 @@ +import { IAnimation } from './IAnimation'; +import { IAnimationLayerData } from './IAnimationLayerData'; + +export interface IAnimationManager +{ + animations: Map; + getAnimation(_arg_1: string): IAnimation; + getLayerData(_arg_1: string, _arg_2: number, _arg_3: string): IAnimationLayerData; +} diff --git a/submodules/renderer/src/api/nitro/avatar/animation/IAvatarDataContainer.ts b/submodules/renderer/src/api/nitro/avatar/animation/IAvatarDataContainer.ts new file mode 100644 index 0000000..e35443a --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/animation/IAvatarDataContainer.ts @@ -0,0 +1,12 @@ +import { AdjustmentFilter } from '../../../../pixi-proxy'; + +export interface IAvatarDataContainer +{ + ink: number; + colorTransform: AdjustmentFilter; + paletteIsGrayscale: boolean; + reds: number[]; + greens: number[]; + blues: number[]; + alphas: number[]; +} diff --git a/submodules/renderer/src/api/nitro/avatar/animation/ISpriteDataContainer.ts b/submodules/renderer/src/api/nitro/avatar/animation/ISpriteDataContainer.ts new file mode 100644 index 0000000..97df715 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/animation/ISpriteDataContainer.ts @@ -0,0 +1,14 @@ +import { IAnimation } from './IAnimation'; + +export interface ISpriteDataContainer +{ + animation: IAnimation; + id: string; + ink: number; + member: string; + hasDirections: boolean; + hasStaticY: boolean; + getDirectionOffsetX(_arg_1: number): number; + getDirectionOffsetY(_arg_1: number): number; + getDirectionOffsetZ(_arg_1: number): number; +} diff --git a/submodules/renderer/src/api/nitro/avatar/animation/index.ts b/submodules/renderer/src/api/nitro/avatar/animation/index.ts new file mode 100644 index 0000000..c6ce58c --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/animation/index.ts @@ -0,0 +1,5 @@ +export * from './IAnimation'; +export * from './IAnimationLayerData'; +export * from './IAnimationManager'; +export * from './IAvatarDataContainer'; +export * from './ISpriteDataContainer'; diff --git a/submodules/renderer/src/api/nitro/avatar/enum/AvatarAction.ts b/submodules/renderer/src/api/nitro/avatar/enum/AvatarAction.ts new file mode 100644 index 0000000..2d7ac10 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/enum/AvatarAction.ts @@ -0,0 +1,127 @@ +export class AvatarAction +{ + public static CARRY_OBJECT = 'cri'; + public static DANCE = 'dance'; + public static EFFECT = 'fx'; + public static EXPRESSION = 'expression'; + public static EXPRESSION_BLOW_A_KISS = 'blow'; + public static EXPRESSION_CRY = 'cry'; + public static EXPRESSION_IDLE = 'idle'; + public static EXPRESSION_LAUGH = 'laugh'; + public static EXPRESSION_RESPECT = 'respect'; + public static EXPRESSION_RIDE_JUMP = 'ridejump'; + public static EXPRESSION_SNOWBOARD_OLLIE = 'sbollie'; + public static EXPRESSION_SNOWBORD_360 = 'sb360'; + public static EXPRESSION_WAVE = 'wave'; + public static GESTURE = 'gest'; + public static GESTURE_AGGRAVATED = 'agr'; + public static GESTURE_SAD = 'sad'; + public static GESTURE_SMILE = 'sml'; + public static GESTURE_SURPRISED = 'srp'; + public static GUIDE_STATUS = 'guide'; + public static MUTED = 'muted'; + public static PET_GESTURE_BLINK = 'eyb'; + public static PET_GESTURE_CRAZY = 'crz'; + public static PET_GESTURE_JOY = 'joy'; + public static PET_GESTURE_MISERABLE = 'mis'; + public static PET_GESTURE_PUZZLED = 'puz'; + public static PET_GESTURE_TONGUE = 'tng'; + public static PLAYING_GAME = 'playing_game'; + public static POSTURE = 'posture'; + public static POSTURE_FLOAT = 'float'; + public static POSTURE_LAY = 'lay'; + public static POSTURE_SIT = 'sit'; + public static POSTURE_STAND = 'std'; + public static POSTURE_SWIM = 'swim'; + public static POSTURE_WALK = 'mv'; + public static SIGN = 'sign'; + public static SLEEP = 'sleep'; + public static SNOWWAR_DIE_BACK = 'swdieback'; + public static SNOWWAR_DIE_FRONT = 'swdiefront'; + public static SNOWWAR_PICK = 'swpick'; + public static SNOWWAR_RUN = 'swrun'; + public static SNOWWAR_THROW = 'swthrow'; + public static TALK = 'talk'; + public static BLINK = 'blink'; + public static TYPING = 'typing'; + public static USE_OBJECT = 'usei'; + public static VOTE = 'vote'; + + public static GESTURE_MAP = [ '', AvatarAction.GESTURE_SMILE, AvatarAction.GESTURE_AGGRAVATED, AvatarAction.GESTURE_SURPRISED, AvatarAction.GESTURE_SAD, AvatarAction.PET_GESTURE_JOY, AvatarAction.PET_GESTURE_CRAZY, AvatarAction.PET_GESTURE_TONGUE, AvatarAction.PET_GESTURE_BLINK, AvatarAction.PET_GESTURE_MISERABLE, AvatarAction.PET_GESTURE_PUZZLED ]; + + public static EXPRESSION_MAP = [ '', AvatarAction.EXPRESSION_WAVE, AvatarAction.EXPRESSION_BLOW_A_KISS, AvatarAction.EXPRESSION_LAUGH, AvatarAction.EXPRESSION_CRY, AvatarAction.EXPRESSION_IDLE, AvatarAction.DANCE, AvatarAction.EXPRESSION_RESPECT, AvatarAction.EXPRESSION_SNOWBOARD_OLLIE, AvatarAction.EXPRESSION_SNOWBORD_360, AvatarAction.EXPRESSION_RIDE_JUMP ]; + + public static getExpressionTimeout(expressionId: number): number + { + expressionId = parseInt(expressionId as any); + + switch(expressionId) + { + case 1: + return 5000; + case 2: + return 1400; + case 3: + return 2000; + case 4: + return 2000; + case 5: + return 0; + case 6: + return 700; + case 7: + return 2000; + case 8: + return 1500; + case 9: + return 1500; + case 10: + return 1500; + default: + return 0; + } + } + + public static getExpressionId(expression: string): number + { + return AvatarAction.EXPRESSION_MAP.indexOf(expression); + } + + public static getExpression(expressionId: number): string + { + if(expressionId > AvatarAction.EXPRESSION_MAP.length) return null; + + return AvatarAction.EXPRESSION_MAP[expressionId]; + } + + public static getGestureId(gesture: string): number + { + return AvatarAction.GESTURE_MAP.indexOf(gesture); + } + + public static getGesture(gestureId: number): string + { + if(gestureId > AvatarAction.GESTURE_MAP.length) return null; + + return AvatarAction.GESTURE_MAP[gestureId]; + } + + public static idToAvatarActionState(id: string): string + { + if(id === 'Lay') return 'lay'; + if(id === 'Float') return 'float'; + if(id === 'Swim') return 'swim'; + if(id === 'Sit') return 'sit'; + if(id === 'Respect') return 'respect'; + if(id === 'Wave') return 'wave'; + if(id === 'Idle') return 'idle'; + if(id === 'Dance') return 'dance'; + if(id === 'UseItem') return 'usei'; + if(id === 'CarryItem') return 'cri'; + if(id === 'Talk') return 'talk'; + if(id === 'Sleep') return 'Sleep'; + if(id === 'Move') return 'mv'; + + return 'std'; + } +} diff --git a/submodules/renderer/src/api/nitro/avatar/enum/AvatarDirectionAngle.ts b/submodules/renderer/src/api/nitro/avatar/enum/AvatarDirectionAngle.ts new file mode 100644 index 0000000..f204774 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/enum/AvatarDirectionAngle.ts @@ -0,0 +1,7 @@ +export class AvatarDirectionAngle +{ + public static DIRECTION_TO_ANGLE: number[] = [45, 90, 135, 180, 225, 270, 315, 0]; //_Str_2204 + public static DIRECTION_IS_FLIPPED: boolean[] = [false, false, false, false, true, true, true, false]; //_Str_1859 + public static MIN_DIRECTION: number = 0; //_Str_1562 + public static MAX_DIRECTION: number = 7; //_Str_1257 +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/avatar/enum/AvatarEditorFigureCategory.ts b/submodules/renderer/src/api/nitro/avatar/enum/AvatarEditorFigureCategory.ts new file mode 100644 index 0000000..02e1801 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/enum/AvatarEditorFigureCategory.ts @@ -0,0 +1,10 @@ +export class AvatarEditorFigureCategory +{ + public static GENERIC: string = 'hd'; + public static HEAD: string = 'head'; + public static TORSO: string = 'torso'; + public static LEGS: string = 'legs'; + public static HOTLOOKS: string = 'hotlooks'; + public static WARDROBE: string = 'wardrobe'; + public static EFFECTS: string = 'effects'; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/avatar/enum/AvatarEditorInstanceId.ts b/submodules/renderer/src/api/nitro/avatar/enum/AvatarEditorInstanceId.ts new file mode 100644 index 0000000..82cfaae --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/enum/AvatarEditorInstanceId.ts @@ -0,0 +1,7 @@ +export class AvatarEditorInstanceId +{ + public static OWN_AVATAR_EDITOR: number = 0; + public static FURNITURE_AVATAR_EDITOR: number = 1; + public static BOT_EDITOR: number = 2; + public static DEV_TOOL_EDITOR: number = 3; +} diff --git a/submodules/renderer/src/api/nitro/avatar/enum/AvatarEditorSideCategory.ts b/submodules/renderer/src/api/nitro/avatar/enum/AvatarEditorSideCategory.ts new file mode 100644 index 0000000..8dfd979 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/enum/AvatarEditorSideCategory.ts @@ -0,0 +1,5 @@ +export class AvatarEditorSideCategory +{ + public static NOTHING: string = 'nothing'; + public static WARDROBE: string = 'wardrobe'; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/avatar/enum/AvatarFigurePartType.ts b/submodules/renderer/src/api/nitro/avatar/enum/AvatarFigurePartType.ts new file mode 100644 index 0000000..30bc564 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/enum/AvatarFigurePartType.ts @@ -0,0 +1,29 @@ +export class AvatarFigurePartType +{ + public static BODY: string = 'bd'; + public static SHOES: string = 'sh'; + public static LEGS: string = 'lg'; + public static CHEST: string = 'ch'; + public static WAIST_ACCESSORY: string = 'wa'; + public static CHEST_ACCESSORY: string = 'ca'; + public static HEAD: string = 'hd'; + public static HAIR: string = 'hr'; + public static FACE_ACCESSORY: string = 'fa'; + public static EYE_ACCESSORY: string = 'ea'; + public static HEAD_ACCESSORY: string = 'ha'; + public static HEAD_ACCESSORY_EXTRA: string = 'he'; + public static COAT_CHEST: string = 'cc'; + public static CHEST_PRINT: string = 'cp'; + public static LEFT_HAND_ITEM: string = 'li'; + public static LEFT_HAND: string = 'lh'; + public static LEFT_SLEEVE: string = 'ls'; + public static RIGHT_HAND: string = 'rh'; + public static RIGHT_SLEEVE: string = 'rs'; + public static FACE: string = 'fc'; + public static EYES: string = 'ey'; + public static HAIR_BIG: string = 'hrb'; + public static RIGHT_HAND_ITEM: string = 'ri'; + public static LEFT_COAT_SLEEVE: string = 'lc'; + public static RIGHT_COAT_SLEEVE: string = 'rc'; + public static FIGURE_SETS: string[] = [ AvatarFigurePartType.SHOES, AvatarFigurePartType.LEGS, AvatarFigurePartType.CHEST, AvatarFigurePartType.WAIST_ACCESSORY, AvatarFigurePartType.CHEST_ACCESSORY, AvatarFigurePartType.HEAD, AvatarFigurePartType.HAIR, AvatarFigurePartType.FACE_ACCESSORY, AvatarFigurePartType.EYE_ACCESSORY, AvatarFigurePartType.HEAD_ACCESSORY, AvatarFigurePartType.HEAD_ACCESSORY_EXTRA, AvatarFigurePartType.COAT_CHEST, AvatarFigurePartType.CHEST_PRINT ]; +} diff --git a/submodules/renderer/src/api/nitro/avatar/enum/AvatarGuideStatus.ts b/submodules/renderer/src/api/nitro/avatar/enum/AvatarGuideStatus.ts new file mode 100644 index 0000000..48a5b3c --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/enum/AvatarGuideStatus.ts @@ -0,0 +1,6 @@ +export class AvatarGuideStatus +{ + public static NONE: number = 0; + public static GUIDE: number = 1; + public static REQUESTER: number = 2; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/avatar/enum/AvatarScaleType.ts b/submodules/renderer/src/api/nitro/avatar/enum/AvatarScaleType.ts new file mode 100644 index 0000000..5933495 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/enum/AvatarScaleType.ts @@ -0,0 +1,5 @@ +export class AvatarScaleType +{ + public static LARGE: string = 'h'; + public static SMALL: string = 'sh'; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/avatar/enum/AvatarSetType.ts b/submodules/renderer/src/api/nitro/avatar/enum/AvatarSetType.ts new file mode 100644 index 0000000..38df0af --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/enum/AvatarSetType.ts @@ -0,0 +1,6 @@ +export class AvatarSetType +{ + public static FULL: string = 'full'; + public static HEAD: string = 'head'; + public static BODY: string = 'body'; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/avatar/enum/GeometryType.ts b/submodules/renderer/src/api/nitro/avatar/enum/GeometryType.ts new file mode 100644 index 0000000..402c05f --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/enum/GeometryType.ts @@ -0,0 +1,8 @@ +export class GeometryType +{ + public static VERTICAL: string = 'vertical'; + public static SITTING: string = 'sitting'; + public static HORIZONTAL: string = 'horizontal'; + public static SWIM: string = 'swim'; + public static SNOWWARS_HORIZONTAL: string = 'swhorizontal'; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/avatar/enum/RenderMode.ts b/submodules/renderer/src/api/nitro/avatar/enum/RenderMode.ts new file mode 100644 index 0000000..ff9f877 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/enum/RenderMode.ts @@ -0,0 +1,7 @@ +export class RenderMode +{ + public static TOOL: string = 'tool'; + public static COMPONENT: string = 'component'; + public static ONLINE_TOOL: string = 'online_tool'; + public static LOCAL_ONLY: string = 'local_only'; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/avatar/enum/index.ts b/submodules/renderer/src/api/nitro/avatar/enum/index.ts new file mode 100644 index 0000000..8ea559f --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/enum/index.ts @@ -0,0 +1,11 @@ +export * from './AvatarAction'; +export * from './AvatarDirectionAngle'; +export * from './AvatarEditorFigureCategory'; +export * from './AvatarEditorInstanceId'; +export * from './AvatarEditorSideCategory'; +export * from './AvatarFigurePartType'; +export * from './AvatarGuideStatus'; +export * from './AvatarScaleType'; +export * from './AvatarSetType'; +export * from './GeometryType'; +export * from './RenderMode'; diff --git a/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureData.ts b/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureData.ts new file mode 100644 index 0000000..86e7901 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureData.ts @@ -0,0 +1,8 @@ +import { IFigureDataPalette } from './IFigureDataPalette'; +import { IFigureDataSetType } from './IFigureDataSetType'; + +export interface IFigureData +{ + palettes?: IFigureDataPalette[]; + setTypes?: IFigureDataSetType[]; +} diff --git a/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataColor.ts b/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataColor.ts new file mode 100644 index 0000000..535dead --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataColor.ts @@ -0,0 +1,8 @@ +export interface IFigureDataColor +{ + id?: number; + index?: number; + club?: number; + selectable?: boolean; + hexCode?: string; +} diff --git a/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataHiddenLayer.ts b/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataHiddenLayer.ts new file mode 100644 index 0000000..80f42e6 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataHiddenLayer.ts @@ -0,0 +1,4 @@ +export interface IFigureDataHiddenLayer +{ + partType?: string; +} diff --git a/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataPalette.ts b/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataPalette.ts new file mode 100644 index 0000000..f83fa06 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataPalette.ts @@ -0,0 +1,7 @@ +import { IFigureDataColor } from './IFigureDataColor'; + +export interface IFigureDataPalette +{ + id?: number; + colors?: IFigureDataColor[]; +} diff --git a/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataPart.ts b/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataPart.ts new file mode 100644 index 0000000..e57ef47 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataPart.ts @@ -0,0 +1,8 @@ +export interface IFigureDataPart +{ + id?: number; + type?: string; + colorable?: boolean; + index?: number; + colorindex?: number; +} diff --git a/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataSet.ts b/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataSet.ts new file mode 100644 index 0000000..f3c89d9 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataSet.ts @@ -0,0 +1,15 @@ +import { IFigureDataHiddenLayer } from './IFigureDataHiddenLayer'; +import { IFigureDataPart } from './IFigureDataPart'; + +export interface IFigureDataSet +{ + id?: number; + gender?: string; + club?: number; + colorable?: boolean; + selectable?: boolean; + preselectable?: boolean; + sellable?: boolean; + parts?: IFigureDataPart[]; + hiddenLayers?: IFigureDataHiddenLayer[]; +} diff --git a/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataSetType.ts b/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataSetType.ts new file mode 100644 index 0000000..d9a2d97 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/figuredata/IFigureDataSetType.ts @@ -0,0 +1,12 @@ +import { IFigureDataSet } from './IFigureDataSet'; + +export interface IFigureDataSetType +{ + type?: string; + paletteId?: number; + mandatory_m_0?: boolean; + mandatory_f_0?: boolean; + mandatory_m_1?: boolean; + mandatory_f_1?: boolean; + sets?: IFigureDataSet[]; +} diff --git a/submodules/renderer/src/api/nitro/avatar/figuredata/index.ts b/submodules/renderer/src/api/nitro/avatar/figuredata/index.ts new file mode 100644 index 0000000..579987b --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/figuredata/index.ts @@ -0,0 +1,7 @@ +export * from './IFigureData'; +export * from './IFigureDataColor'; +export * from './IFigureDataHiddenLayer'; +export * from './IFigureDataPalette'; +export * from './IFigureDataPart'; +export * from './IFigureDataSet'; +export * from './IFigureDataSetType'; diff --git a/submodules/renderer/src/api/nitro/avatar/index.ts b/submodules/renderer/src/api/nitro/avatar/index.ts new file mode 100644 index 0000000..7ad21f6 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/index.ts @@ -0,0 +1,14 @@ +export * from './actions'; +export * from './animation'; +export * from './enum'; +export * from './figuredata'; +export * from './IAvatarAssetDownloadLibrary'; +export * from './IAvatarEffectListener'; +export * from './IAvatarFigureContainer'; +export * from './IAvatarImage'; +export * from './IAvatarImageListener'; +export * from './IAvatarRenderManager'; +export * from './IEffectAssetDownloadLibrary'; +export * from './IOutfit'; +export * from './pet'; +export * from './structure'; diff --git a/submodules/renderer/src/api/nitro/avatar/pet/IPetCustomPart.ts b/submodules/renderer/src/api/nitro/avatar/pet/IPetCustomPart.ts new file mode 100644 index 0000000..8d4f968 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/pet/IPetCustomPart.ts @@ -0,0 +1,6 @@ +export interface IPetCustomPart +{ + layerId: number; + partId: number; + paletteId: number; +} diff --git a/submodules/renderer/src/api/nitro/avatar/pet/PetType.ts b/submodules/renderer/src/api/nitro/avatar/pet/PetType.ts new file mode 100644 index 0000000..9058b7b --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/pet/PetType.ts @@ -0,0 +1,38 @@ +export class PetType +{ + public static DOG: number = 0; + public static CAT: number = 1; + public static CROCODILE: number = 2; + public static TERRIER: number = 3; + public static BEAR: number = 4; + public static PIG: number = 5; + public static LION: number = 6; + public static RHINO: number = 7; + public static SPIDER: number = 8; + public static TURTLE: number = 9; + public static CHICKEN: number = 10; + public static FROG: number = 11; + public static DRAGON: number = 12; + public static MONSTER: number = 13; + public static MONKEY: number = 14; + public static HORSE: number = 15; + public static MONSTERPLANT: number = 16; + public static BUNNY: number = 17; + public static BUNNYEVIL: number = 18; + public static BUNNYDEPRESSED: number = 19; + public static BUNNYLOVE: number = 20; + public static PIGEONGOOD: number = 21; + public static PIGEONEVIL: number = 22; + public static DEMONMONKEY: number = 23; + public static BABYBEAR: number = 24; + public static BABYTERRIER: number = 25; + public static GNOME: number = 26; + public static LEPRECHAUN: number = 27; + public static KITTENBABY: number = 28; + public static PUPPYBABY: number = 29; + public static PIGLETNBABY: number = 30; + public static HALOOMPA: number = 31; + public static FOOLS: number = 32; + public static PTEROSAUR: number = 33; + public static VELOCIRAPTOR: number = 34; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/avatar/pet/index.ts b/submodules/renderer/src/api/nitro/avatar/pet/index.ts new file mode 100644 index 0000000..a30c541 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/pet/index.ts @@ -0,0 +1,2 @@ +export * from './IPetCustomPart'; +export * from './PetType'; diff --git a/submodules/renderer/src/api/nitro/avatar/structure/IFigurePart.ts b/submodules/renderer/src/api/nitro/avatar/structure/IFigurePart.ts new file mode 100644 index 0000000..578725b --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/structure/IFigurePart.ts @@ -0,0 +1,9 @@ +export interface IFigurePart +{ + id: number; + type: string; + breed: number; + index: number; + colorLayerIndex: number; + paletteMap: number; +} diff --git a/submodules/renderer/src/api/nitro/avatar/structure/IFigurePartSet.ts b/submodules/renderer/src/api/nitro/avatar/structure/IFigurePartSet.ts new file mode 100644 index 0000000..7e1653e --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/structure/IFigurePartSet.ts @@ -0,0 +1,16 @@ +import { IFigurePart } from './IFigurePart'; + +export interface IFigurePartSet +{ + getPart(_arg_1: string, _arg_2: number): IFigurePart; + id: number; + type: string; + gender: string; + clubLevel: number; + isColorable: boolean; + isSelectable: boolean; + parts: IFigurePart[]; + hiddenLayers: string[]; + isPreSelectable: boolean; + isSellable: boolean; +} diff --git a/submodules/renderer/src/api/nitro/avatar/structure/IFigureSetData.ts b/submodules/renderer/src/api/nitro/avatar/structure/IFigureSetData.ts new file mode 100644 index 0000000..5ea24a6 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/structure/IFigureSetData.ts @@ -0,0 +1,7 @@ +import { IFigureData } from '../figuredata'; + +export interface IFigureSetData +{ + parse(data: any): boolean; + appendJSON(data: IFigureData): boolean; +} diff --git a/submodules/renderer/src/api/nitro/avatar/structure/IPalette.ts b/submodules/renderer/src/api/nitro/avatar/structure/IPalette.ts new file mode 100644 index 0000000..8c5c0e2 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/structure/IPalette.ts @@ -0,0 +1,9 @@ +import { IAdvancedMap } from '../../../utils'; +import { IPartColor } from './IPartColor'; + +export interface IPalette +{ + getColor(id: number): IPartColor; + id: number; + colors: IAdvancedMap; +} diff --git a/submodules/renderer/src/api/nitro/avatar/structure/IPartColor.ts b/submodules/renderer/src/api/nitro/avatar/structure/IPartColor.ts new file mode 100644 index 0000000..6978528 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/structure/IPartColor.ts @@ -0,0 +1,8 @@ +export interface IPartColor +{ + id: number; + index: number; + clubLevel: number; + isSelectable: boolean; + rgb: number; +} diff --git a/submodules/renderer/src/api/nitro/avatar/structure/ISetType.ts b/submodules/renderer/src/api/nitro/avatar/structure/ISetType.ts new file mode 100644 index 0000000..9277a47 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/structure/ISetType.ts @@ -0,0 +1,12 @@ +import { IAdvancedMap } from '../../../utils'; +import { IFigurePartSet } from './IFigurePartSet'; + +export interface ISetType +{ + getPartSet(_arg_1: number): IFigurePartSet; + isMandatory(_arg_1: string, _arg_2: number): boolean; + optionalFromClubLevel(_arg_1: string): number; + type: string; + paletteID: number; + partSets: IAdvancedMap; +} diff --git a/submodules/renderer/src/api/nitro/avatar/structure/IStructureData.ts b/submodules/renderer/src/api/nitro/avatar/structure/IStructureData.ts new file mode 100644 index 0000000..392e885 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/structure/IStructureData.ts @@ -0,0 +1,12 @@ +import { IFigurePartSet } from './IFigurePartSet'; +import { IPalette } from './IPalette'; +import { ISetType } from './ISetType'; + +export interface IStructureData +{ + parse(data: any): boolean; + appendJSON(k: any): boolean; + getSetType(_arg_1: string): ISetType; + getPalette(_arg_1: number): IPalette; + getFigurePartSet(_arg_1: number): IFigurePartSet; +} diff --git a/submodules/renderer/src/api/nitro/avatar/structure/index.ts b/submodules/renderer/src/api/nitro/avatar/structure/index.ts new file mode 100644 index 0000000..4c63b05 --- /dev/null +++ b/submodules/renderer/src/api/nitro/avatar/structure/index.ts @@ -0,0 +1,7 @@ +export * from './IFigurePart'; +export * from './IFigurePartSet'; +export * from './IFigureSetData'; +export * from './IPalette'; +export * from './IPartColor'; +export * from './ISetType'; +export * from './IStructureData'; diff --git a/submodules/renderer/src/api/nitro/camera/IRoomCameraWidgetEffect.ts b/submodules/renderer/src/api/nitro/camera/IRoomCameraWidgetEffect.ts new file mode 100644 index 0000000..321a26b --- /dev/null +++ b/submodules/renderer/src/api/nitro/camera/IRoomCameraWidgetEffect.ts @@ -0,0 +1,11 @@ +import { Resource, Texture } from '@pixi/core'; +import { ColorMatrix } from '@pixi/filter-color-matrix'; + +export interface IRoomCameraWidgetEffect +{ + name: string; + minLevel: number; + texture: Texture; + colorMatrix: ColorMatrix; + blendMode: number; +} diff --git a/submodules/renderer/src/api/nitro/camera/IRoomCameraWidgetManager.ts b/submodules/renderer/src/api/nitro/camera/IRoomCameraWidgetManager.ts new file mode 100644 index 0000000..d8847e9 --- /dev/null +++ b/submodules/renderer/src/api/nitro/camera/IRoomCameraWidgetManager.ts @@ -0,0 +1,13 @@ +import { Resource, Texture } from '@pixi/core'; +import { IEventDispatcher } from '../../common'; +import { IRoomCameraWidgetEffect } from './IRoomCameraWidgetEffect'; +import { IRoomCameraWidgetSelectedEffect } from './IRoomCameraWidgetSelectedEffect'; + +export interface IRoomCameraWidgetManager +{ + init(): void; + applyEffects(texture: Texture, selectedEffects: IRoomCameraWidgetSelectedEffect[], isZoomed: boolean): HTMLImageElement; + events: IEventDispatcher; + effects: Map; + isLoaded: boolean; +} diff --git a/submodules/renderer/src/api/nitro/camera/IRoomCameraWidgetSelectedEffect.ts b/submodules/renderer/src/api/nitro/camera/IRoomCameraWidgetSelectedEffect.ts new file mode 100644 index 0000000..3bb3b2c --- /dev/null +++ b/submodules/renderer/src/api/nitro/camera/IRoomCameraWidgetSelectedEffect.ts @@ -0,0 +1,7 @@ +import { IRoomCameraWidgetEffect } from './IRoomCameraWidgetEffect'; + +export interface IRoomCameraWidgetSelectedEffect +{ + effect: IRoomCameraWidgetEffect; + alpha: number; +} diff --git a/submodules/renderer/src/api/nitro/camera/index.ts b/submodules/renderer/src/api/nitro/camera/index.ts new file mode 100644 index 0000000..7c7db03 --- /dev/null +++ b/submodules/renderer/src/api/nitro/camera/index.ts @@ -0,0 +1,3 @@ +export * from './IRoomCameraWidgetEffect'; +export * from './IRoomCameraWidgetManager'; +export * from './IRoomCameraWidgetSelectedEffect'; diff --git a/submodules/renderer/src/api/nitro/communication/INitroCommunicationDemo.ts b/submodules/renderer/src/api/nitro/communication/INitroCommunicationDemo.ts new file mode 100644 index 0000000..cab1521 --- /dev/null +++ b/submodules/renderer/src/api/nitro/communication/INitroCommunicationDemo.ts @@ -0,0 +1,3 @@ +import { INitroManager } from '../../common'; + +export type INitroCommunicationDemo = INitroManager diff --git a/submodules/renderer/src/api/nitro/communication/INitroCommunicationManager.ts b/submodules/renderer/src/api/nitro/communication/INitroCommunicationManager.ts new file mode 100644 index 0000000..e00d1ca --- /dev/null +++ b/submodules/renderer/src/api/nitro/communication/INitroCommunicationManager.ts @@ -0,0 +1,11 @@ +import { INitroManager } from '../../common'; +import { IConnection, IMessageEvent } from '../../communication'; +import { INitroCommunicationDemo } from './INitroCommunicationDemo'; + +export interface INitroCommunicationManager extends INitroManager +{ + registerMessageEvent(event: IMessageEvent): IMessageEvent; + removeMessageEvent(event: IMessageEvent): void; + demo: INitroCommunicationDemo; + connection: IConnection; +} diff --git a/submodules/renderer/src/api/nitro/communication/index.ts b/submodules/renderer/src/api/nitro/communication/index.ts new file mode 100644 index 0000000..9e6ef3d --- /dev/null +++ b/submodules/renderer/src/api/nitro/communication/index.ts @@ -0,0 +1,2 @@ +export * from './INitroCommunicationDemo'; +export * from './INitroCommunicationManager'; diff --git a/submodules/renderer/src/api/nitro/enums/RelationshipStatusEnum.ts b/submodules/renderer/src/api/nitro/enums/RelationshipStatusEnum.ts new file mode 100644 index 0000000..b64873c --- /dev/null +++ b/submodules/renderer/src/api/nitro/enums/RelationshipStatusEnum.ts @@ -0,0 +1,10 @@ +export class RelationshipStatusEnum +{ + public static NONE: number = 0; + public static HEART: number = 1; + public static SMILE: number = 2; + public static BOBBA: number = 3; + + public static RELATIONSHIP_TYPES = [ 0, 1, 2, 3 ]; + public static RELATIONSHIP_NAMES: string[] = ['None', 'Heart', 'Smile', 'Bobba']; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/enums/ToolbarIconEnum.ts b/submodules/renderer/src/api/nitro/enums/ToolbarIconEnum.ts new file mode 100644 index 0000000..d389a95 --- /dev/null +++ b/submodules/renderer/src/api/nitro/enums/ToolbarIconEnum.ts @@ -0,0 +1,10 @@ +export class ToolbarIconEnum +{ + public static HOTEL_VIEW: string = 'hotel_view'; + public static HOME_ROOM: string = 'home_room'; + public static NAVIGATOR: string = 'navigator'; + public static CATALOG: string = 'catalog'; + public static INVENTORY: string = 'inventory'; + public static ME_MENU: string = 'me_menu'; + public static FRIEND_LIST: string = 'friendlist'; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/enums/index.ts b/submodules/renderer/src/api/nitro/enums/index.ts new file mode 100644 index 0000000..98a436c --- /dev/null +++ b/submodules/renderer/src/api/nitro/enums/index.ts @@ -0,0 +1,2 @@ +export * from './RelationshipStatusEnum'; +export * from './ToolbarIconEnum'; diff --git a/submodules/renderer/src/api/nitro/index.ts b/submodules/renderer/src/api/nitro/index.ts new file mode 100644 index 0000000..fea0a3b --- /dev/null +++ b/submodules/renderer/src/api/nitro/index.ts @@ -0,0 +1,20 @@ +export * from './avatar'; +export * from './avatar/actions'; +export * from './avatar/animation'; +export * from './avatar/enum'; +export * from './avatar/figuredata'; +export * from './avatar/pet'; +export * from './avatar/structure'; +export * from './camera'; +export * from './communication'; +export * from './enums'; +export * from './localization'; +export * from './room'; +export * from './room/enums'; +export * from './room/object'; +export * from './room/object/data'; +export * from './room/object/data/type'; +export * from './room/utils'; +export * from './session'; +export * from './session/enum'; +export * from './sound'; diff --git a/submodules/renderer/src/api/nitro/localization/INitroLocalizationManager.ts b/submodules/renderer/src/api/nitro/localization/INitroLocalizationManager.ts new file mode 100644 index 0000000..7cc681a --- /dev/null +++ b/submodules/renderer/src/api/nitro/localization/INitroLocalizationManager.ts @@ -0,0 +1,17 @@ +import { INitroManager } from '../../common'; + +export interface INitroLocalizationManager extends INitroManager +{ + getRomanNumeral(number: number): string; + getPreviousLevelBadgeId(badgeName: string): string; + hasValue(key: string): boolean; + getValue(key: string, doParams?: boolean): string; + getValueWithParameter(key: string, parameter: string, replacement: string): string; + getValueWithParameters(key: string, parameters: string[], replacements: string[]): string; + setValue(key: string, value: string): void; + registerParameter(key: string, parameter: string, value: string): void; + getBadgeName(key: string): string; + getBadgeDesc(key: string): string; + getBadgePointLimit(badge: string): number; + setBadgePointLimit(badge: string, point: number): void; +} diff --git a/submodules/renderer/src/api/nitro/localization/index.ts b/submodules/renderer/src/api/nitro/localization/index.ts new file mode 100644 index 0000000..f02abe8 --- /dev/null +++ b/submodules/renderer/src/api/nitro/localization/index.ts @@ -0,0 +1 @@ +export * from './INitroLocalizationManager'; diff --git a/submodules/renderer/src/api/nitro/room/IGetImageListener.ts b/submodules/renderer/src/api/nitro/room/IGetImageListener.ts new file mode 100644 index 0000000..6e400e9 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/IGetImageListener.ts @@ -0,0 +1,7 @@ +import { NitroRenderTexture } from '../../../pixi-proxy'; + +export interface IGetImageListener +{ + imageReady(id: number, texture: NitroRenderTexture, image?: HTMLImageElement): void; + imageFailed(id: number): void; +} diff --git a/submodules/renderer/src/api/nitro/room/IImageResult.ts b/submodules/renderer/src/api/nitro/room/IImageResult.ts new file mode 100644 index 0000000..ee286f5 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/IImageResult.ts @@ -0,0 +1,9 @@ +import { RenderTexture } from '@pixi/core'; + +export interface IImageResult +{ + id: number; + data: RenderTexture; + image: HTMLImageElement; + getImage(): HTMLImageElement; +} diff --git a/submodules/renderer/src/api/nitro/room/IPetColorResult.ts b/submodules/renderer/src/api/nitro/room/IPetColorResult.ts new file mode 100644 index 0000000..f66417d --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/IPetColorResult.ts @@ -0,0 +1,10 @@ +export interface IPetColorResult +{ + readonly primaryColor: number; + readonly secondaryColor: number; + readonly breed: number; + readonly tag: string; + readonly id: string; + readonly isMaster: boolean; + readonly layerTags: string[]; +} diff --git a/submodules/renderer/src/api/nitro/room/IRoomContentListener.ts b/submodules/renderer/src/api/nitro/room/IRoomContentListener.ts new file mode 100644 index 0000000..375b146 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/IRoomContentListener.ts @@ -0,0 +1,4 @@ +export interface IRoomContentListener +{ + onRoomContentLoaded(id: number, assetName: string, sucess: boolean): void; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/room/IRoomContentLoader.ts b/submodules/renderer/src/api/nitro/room/IRoomContentLoader.ts new file mode 100644 index 0000000..4fe3b0b --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/IRoomContentLoader.ts @@ -0,0 +1,34 @@ +import { Resource, Texture } from '@pixi/core'; +import { IPetColorResult, IRoomContentListener } from '.'; +import { IGraphicAssetCollection, IGraphicAssetGifCollection } from '../../asset'; +import { IEventDispatcher } from '../../common'; +import { IRoomObject } from '../../room'; +import { ISessionDataManager } from '../session'; + +export interface IRoomContentLoader +{ + dispose: () => void; + initialize(events: IEventDispatcher): void; + setSessionDataManager(sessionData: ISessionDataManager): void; + downloadAsset(type: string, events: IEventDispatcher): void; + isLoaderType(type: string): boolean; + getCollection(name: string): IGraphicAssetCollection; + getPlaceholderName(type: string): string; + getCategoryForType(type: string): number; + setRoomObjectRoomId(object: IRoomObject, roomId: string): void; + getFurnitureFloorNameForTypeId(typeId: number): string; + getFurnitureWallNameForTypeId(typeId: number, extra?: string): string; + getFurnitureFloorColorIndex(typeId: number): number; + getFurnitureWallColorIndex(typeId: number): number; + getImage(name: string): HTMLImageElement; + getAssetIconUrl(type: string, colorIndex: string): string; + addAssetToCollection(collectionName: string, assetName: string, texture: Texture, override?: boolean): boolean; + getPetNameForType(type: number): string; + downloadImage(id: number, type: string, param: string, events?: IEventDispatcher): boolean; + getRoomObjectAdUrl(type: string): string; + getPetColorResult(petIndex: number, paletteIndex: number): IPetColorResult; + getPetColorResultsForTag(petIndex: number, tagName: string): IPetColorResult[]; + setIconListener(listener: IRoomContentListener): void; + createGifCollection(collectionName: string, textures: Texture[], durations: number[]): IGraphicAssetGifCollection; + getGifCollection(name: string): IGraphicAssetGifCollection; +} diff --git a/submodules/renderer/src/api/nitro/room/IRoomCreator.ts b/submodules/renderer/src/api/nitro/room/IRoomCreator.ts new file mode 100644 index 0000000..040bba1 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/IRoomCreator.ts @@ -0,0 +1,53 @@ +import { IRoomInstance, IRoomObjectController, IVector3D } from '../../room'; +import { IRoomSessionManager, ISessionDataManager } from '../session'; +import { IObjectData, IRoomMapData } from './object'; +import { IFurnitureStackingHeightMap, ILegacyWallGeometry } from './utils'; + +export interface IRoomCreator +{ + destroyRoom(id: number): void; + getRoomInstance(roomId: number): IRoomInstance; + updateRoomInstancePlaneVisibility(roomId: number, wallVisible: boolean, floorVisible?: boolean): boolean; + updateRoomInstancePlaneThickness(roomId: number, wallThickness: number, floorThickness: number): boolean; + updateRoomInstancePlaneType(roomId: number, floorType?: string, wallType?: string, landscapeType?: string, _arg_5?: boolean): boolean; + removeRoomInstance(roomId: number): void; + createRoomInstance(roomId: number, roomMap: IRoomMapData): void; + setRoomSessionOwnUser(roomId: number, objectId: number): void; + setRoomInstanceModelName(roomId: number, name: string): void; + getFurnitureStackingHeightMap(roomId: number): IFurnitureStackingHeightMap; + setFurnitureStackingHeightMap(roomId: number, heightMap: IFurnitureStackingHeightMap): void; + getLegacyWallGeometry(roomId: number): ILegacyWallGeometry; + getRoomObject(roomId: number, objectId: number, category: number): IRoomObjectController; + getRoomObjectByIndex(roomId: number, index: number, category: number): IRoomObjectController; + getRoomObjectCursor(roomId: number): IRoomObjectController; + getRoomObjectUser(roomId: number, objectId: number): IRoomObjectController; + removeRoomObjectUser(roomId: number, objectId: number): void; + getRoomObjectFloor(roomId: number, objectId: number): IRoomObjectController; + addFurnitureFloor(roomId: number, id: number, typeId: number, location: IVector3D, direction: IVector3D, state: number, objectData: IObjectData, extra?: number, expires?: number, usagePolicy?: number, ownerId?: number, ownerName?: string, synchronized?: boolean, realRoomObject?: boolean, sizeZ?: number): boolean; + addFurnitureFloorByTypeName(roomId: number, id: number, typeName: string, location: IVector3D, direction: IVector3D, state: number, objectData: IObjectData, extra?: number, expires?: number, usagePolicy?: number, ownerId?: number, ownerName?: string, synchronized?: boolean, realRoomObject?: boolean, sizeZ?: number): boolean; + addFurnitureWall(roomId: number, id: number, typeId: number, location: IVector3D, direction: IVector3D, state: number, extra: string, expires?: number, usagePolicy?: number, ownerId?: number, ownerName?: string, realRoomObject?: boolean): boolean; + removeRoomObjectFloor(roomId: number, objectId: number, userId?: number, _arg_4?: boolean): void; + removeRoomObjectWall(roomId: number, objectId: number, userId?: number): void; + updateRoomObjectFloor(roomId: number, objectId: number, location: IVector3D, direction: IVector3D, state: number, data: IObjectData, extra?: number): boolean; + updateRoomObjectWall(roomId: number, objectId: number, location: IVector3D, direction: IVector3D, state: number, extra?: string): boolean; + updateRoomObjectWallItemData(roomId: number, objectId: number, data: string): boolean; + updateRoomObjectFloorHeight(roomId: number, objectId: number, height: number): boolean; + updateRoomObjectFloorExpiration(roomId: number, objectId: number, expires: number): boolean; + updateRoomObjectWallExpiration(roomId: number, objectId: number, expires: number): boolean; + rollRoomObjectFloor(roomId: number, objectId: number, location: IVector3D, targetLocation: IVector3D): void; + addRoomObjectUser(roomId: number, objectId: number, location: IVector3D, direction: IVector3D, headDirection: number, type: number, figure: string): boolean; + updateRoomObjectUserLocation(roomId: number, objectId: number, location: IVector3D, targetLocation: IVector3D, canStandUp?: boolean, baseY?: number, direction?: IVector3D, headDirection?: number): boolean; + updateRoomObjectUserAction(roomId: number, objectId: number, action: string, value: number, parameter?: string): boolean; + updateRoomObjectUserFigure(roomId: number, objectId: number, figure: string, gender?: string, subType?: string, isRiding?: boolean): boolean; + updateRoomObjectUserFlatControl(roomId: number, objectId: number, level: string): boolean; + updateRoomObjectUserEffect(roomId: number, objectId: number, effectId: number, delay?: number): boolean; + updateRoomObjectUserGesture(roomId: number, objectId: number, gestureId: number): boolean; + updateRoomObjectUserPetGesture(roomId: number, objectId: number, gesture: string): boolean; + updateRoomObjectUserPosture(roomId: number, objectId: number, type: string, parameter?: string): boolean; + updateRoomObjectUserOwn(roomId: number, objectId: number): void; + getPetTypeId(figure: string): number; + refreshTileObjectMap(k: number, _arg_2: string): void; + setRoomEngineGameMode(roomId: number, isPlaying: boolean): void; + sessionDataManager: ISessionDataManager; + roomSessionManager: IRoomSessionManager; +} diff --git a/submodules/renderer/src/api/nitro/room/IRoomEngine.ts b/submodules/renderer/src/api/nitro/room/IRoomEngine.ts new file mode 100644 index 0000000..b1f4294 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/IRoomEngine.ts @@ -0,0 +1,103 @@ +import { RenderTexture } from '@pixi/core'; +import { DisplayObject } from '@pixi/display'; +import { Point, Rectangle } from '@pixi/math'; +import { INitroManager } from '../../common'; +import { IRoomGeometry, IRoomManager, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectVisualizationFactory, IRoomRendererFactory, IRoomRenderingCanvas, IVector3D } from '../../room'; +import { IPetCustomPart } from '../avatar'; +import { IRoomSessionManager, ISessionDataManager } from '../session'; +import { IGetImageListener } from './IGetImageListener'; +import { IImageResult } from './IImageResult'; +import { IPetColorResult } from './IPetColorResult'; +import { IRoomContentLoader } from './IRoomContentLoader'; +import { IRoomObjectEventManager } from './IRoomObjectEventManager'; +import { IObjectData, IRoomMapData } from './object'; + +export interface IRoomEngine extends INitroManager +{ + setActiveRoomId(roomId: number): void; + onRoomEngineInitalized(flag: boolean): void; + disableUpdate(flag: boolean): void; + runUpdate(): void; + createRoomInstance(roomId: number, roomMap: IRoomMapData): void; + getRoomInstanceDisplay(roomId: number, id: number, width: number, height: number, scale: number): DisplayObject; + setRoomInstanceRenderingCanvasScale(roomId: number, canvasId: number, scale: number, point?: Point, offsetPoint?: Point, override?: boolean, asDelta?: boolean): void; + setRoomInstanceRenderingCanvasMask(roomId: number, canvasId: number, flag: boolean): void; + getRoomInstanceRenderingCanvas(roomId: number, canvasId?: number): IRoomRenderingCanvas; + getRoomInstanceRenderingCanvasOffset(roomId: number, canvasId?: number): Point; + setRoomInstanceRenderingCanvasOffset(roomId: number, canvasId: number, point: Point): boolean; + getRoomInstanceRenderingCanvasScale(roomId?: number, canvasId?: number): number; + initializeRoomInstanceRenderingCanvas(roomId: number, canvasId: number, width: number, height: number): void; + updateRoomInstancePlaneVisibility(roomId: number, wallVisible: boolean, floorVisible?: boolean): boolean; + updateRoomInstancePlaneThickness(roomId: number, wallThickness: number, floorThickness: number): boolean; + updateRoomInstancePlaneType(roomId: number, floorType?: string, wallType?: string, landscapeType?: string, _arg_5?: boolean): boolean; + updateObjectRoomColor(k: number, _arg_2: number, _arg_3: number, _arg_4: boolean): boolean; + getRoomInstanceGeometry(roomId: number, canvasId?: number): IRoomGeometry; + getRoomInstanceVariable(roomId: number, key: string): T; + getTotalObjectsForManager(roomId: number, category: number): number; + getRoomObject(roomId: number, objectId: number, category: number): IRoomObjectController; + getRoomObjectByIndex(roomId: number, index: number, category: number): IRoomObjectController; + removeRoomObjectFloor(roomId: number, objectId: number, userId?: number, _arg_4?: boolean): void; + removeRoomObjectWall(roomId: number, objectId: number, userId?: number): void; + removeRoomObjectUser(roomId: number, objectId: number): void; + getRoomObjects(roomId: number, category: number): IRoomObject[]; + getRoomObjectCount(roomId: number, categoryId: number): number; + getRoomObjectBoundingRectangle(roomId: number, objectId: number, category: number, canvasId: number): Rectangle; + getRoomObjectScreenLocation(roomId: number, objectId: number, objectType: number, canvasId?: number): Point; + getGenericRoomObjectImage(type: string, value: string, direction: IVector3D, scale: number, listener: IGetImageListener, bgColor?: number, extras?: string, objectData?: IObjectData, state?: number, frameCount?: number, posture?: string, originalId?: number): IImageResult; + getFurnitureFloorIconUrl(typeId: number): string; + getFurnitureFloorIcon(typeId: number, listener: IGetImageListener, extras?: string, objectData?: IObjectData): IImageResult; + getFurnitureWallIconUrl(typeId: number, extra?: string): string; + getFurnitureWallIcon(typeId: number, listener: IGetImageListener, extras?: string): IImageResult; + updateRoomObjectWallLocation(roomId: number, objectId: number, location: IVector3D): boolean; + addRoomObjectUser(roomId: number, objectId: number, location: IVector3D, direction: IVector3D, headDirection: number, type: number, figure: string): boolean; + updateRoomObjectUserLocation(roomId: number, objectId: number, location: IVector3D, targetLocation: IVector3D, canStandUp?: boolean, baseY?: number, direction?: IVector3D, headDirection?: number): boolean; + addFurnitureFloor(roomId: number, id: number, typeId: number, location: IVector3D, direction: IVector3D, state: number, objectData: IObjectData, extra?: number, expires?: number, usagePolicy?: number, ownerId?: number, ownerName?: string, synchronized?: boolean, realRoomObject?: boolean, sizeZ?: number): boolean; + addFurnitureFloorByTypeName(roomId: number, id: number, typeName: string, location: IVector3D, direction: IVector3D, state: number, objectData: IObjectData, extra?: number, expires?: number, usagePolicy?: number, ownerId?: number, ownerName?: string, synchronized?: boolean, realRoomObject?: boolean, sizeZ?: number): boolean; + addFurnitureWall(roomId: number, id: number, typeId: number, location: IVector3D, direction: IVector3D, state: number, extra: string, expires?: number, usagePolicy?: number, ownerId?: number, ownerName?: string, realRoomObject?: boolean): boolean; + initalizeTemporaryObjectsByType(type: string, _arg_2: boolean): void; + updateRoomObjectFloor(roomId: number, objectId: number, location: IVector3D, direction: IVector3D, state: number, data: IObjectData, extra?: number): boolean; + updateRoomObjectWall(roomId: number, objectId: number, location: IVector3D, direction: IVector3D, state: number, extra?: string): boolean; + updateRoomObjectUserAction(roomId: number, objectId: number, action: string, value: number, parameter?: string): boolean; + updateRoomObjectUserFigure(roomId: number, objectId: number, figure: string, gender?: string, subType?: string, isRiding?: boolean): boolean; + updateRoomObjectUserEffect(roomId: number, objectId: number, effectId: number, delay?: number): boolean; + updateRoomObjectUserGesture(roomId: number, objectId: number, gestureId: number): boolean; + updateRoomObjectUserPosture(roomId: number, objectId: number, type: string, parameter?: string): boolean; + getFurnitureFloorImage(typeId: number, direction: IVector3D, scale: number, listener: IGetImageListener, bgColor?: number, extras?: string, state?: number, frameCount?: number, objectData?: IObjectData): IImageResult; + getFurnitureWallImage(typeId: number, direction: IVector3D, scale: number, listener: IGetImageListener, bgColor?: number, extras?: string, state?: number, frameCount?: number): IImageResult; + getRoomObjectImage(roomId: number, objectId: number, category: number, direction: IVector3D, scale: number, listener: IGetImageListener, bgColor?: number): IImageResult; + getRoomObjectPetImage(typeId: number, paletteId: number, color: number, direction: IVector3D, scale: number, listener: IGetImageListener, headOnly?: boolean, bgColor?: number, customParts?: IPetCustomPart[], posture?: string): IImageResult; + getFurnitureFloorName(typeId: number): string; + getFurnitureWallName(typeId: number, extra?: string): string; + selectRoomObject(roomId: number, objectId: number, objectCategory: number): void; + setSelectedAvatar(roomId: number, objectId: number): void; + cancelRoomObjectInsert(): void; + getPetColorResult(petIndex: number, paletteIndex: number): IPetColorResult; + getPetColorResultsForTag(petIndex: number, tagName: string): IPetColorResult[]; + cancelRoomObjectPlacement(): void; + useRoomObject(objectId: number, category: number): boolean; + objectInitialized(roomId: string, objectId: number, category: number): void; + changeObjectModelData(roomId: number, objectId: number, category: number, numberKey: string, numberValue: number): boolean; + changeObjectState(roomId: number, objectId: number, category: number): void; + processRoomObjectOperation(objectId: number, category: number, operation: string): boolean; + modifyRoomObjectDataWithMap(objectId: number, category: number, operation: string, data: Map): boolean + modifyRoomObjectData(objectId: number, category: number, colorHex: string, data: string): boolean + processRoomObjectPlacement(placementSource: string, id: number, category: number, typeId: number, legacyString?: string, stuffData?: IObjectData, state?: number, frameNumber?: number, posture?: string): boolean; + dispatchMouseEvent(canvasId: number, x: number, y: number, type: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean, buttonDown: boolean): void; + createTextureFromRoom(roomId: number, canvasId?: number, bounds?: Rectangle): RenderTexture; + saveTextureAsScreenshot(texture: RenderTexture, saveAsThumbnail?: boolean): void; + saveBase64AsScreenshot(base64: string, saveAsThumbnail?: boolean): void; + deleteRoomObject(objectId: number, objectCategory: number): boolean; + sessionDataManager: ISessionDataManager; + roomSessionManager: IRoomSessionManager; + roomManager: IRoomManager; + objectEventHandler: IRoomObjectEventManager; + roomRendererFactory: IRoomRendererFactory; + visualizationFactory: IRoomObjectVisualizationFactory; + logicFactory: IRoomObjectLogicFactory; + roomContentLoader: IRoomContentLoader; + activeRoomId: number; + ready: boolean; + disposed: boolean; + selectedAvatarId: number; + isDecorating: boolean; +} diff --git a/submodules/renderer/src/api/nitro/room/IRoomEngineServices.ts b/submodules/renderer/src/api/nitro/room/IRoomEngineServices.ts new file mode 100644 index 0000000..af1444b --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/IRoomEngineServices.ts @@ -0,0 +1,47 @@ +import { IEventDispatcher } from '../../common'; +import { IConnection } from '../../communication'; +import { IRoomInstance, IRoomObjectController, IRoomRenderingCanvas, IVector3D } from '../../room'; +import { IRoomSessionManager, ISessionDataManager } from '../session'; +import { ISelectedRoomObjectData } from './ISelectedRoomObjectData'; +import { IObjectData } from './object'; +import { IFurnitureStackingHeightMap, ILegacyWallGeometry, ITileObjectMap } from './utils'; + +export interface IRoomEngineServices +{ + getRoomInstance(roomId: number): IRoomInstance; + getActiveRoomInstanceRenderingCanvas(): IRoomRenderingCanvas; + addRoomInstanceFloorHole(roomId: number, objectId: number): void; + removeRoomInstanceFloorHole(roomId: number, objectId: number): void; + getSelectedRoomObjectData(roomId: number): ISelectedRoomObjectData; + setSelectedRoomObjectData(roomId: number, data: ISelectedRoomObjectData): void; + getPlacedRoomObjectData(roomId: number): ISelectedRoomObjectData; + setPlacedRoomObjectData(roomId: number, data: ISelectedRoomObjectData): void; + getLegacyWallGeometry(roomId: number): ILegacyWallGeometry; + getFurnitureStackingHeightMap(roomId: number): IFurnitureStackingHeightMap; + getRoomObject(roomId: number, objectId: number, category: number): IRoomObjectController; + getRoomObjectByIndex(roomId: number, index: number, category: number): IRoomObjectController; + getRoomObjectCategoryForType(type: string): number; + getRoomObjectCursor(roomId: number): IRoomObjectController; + getRoomObjectSelectionArrow(roomId: number): IRoomObjectController; + addRoomObjectUser(roomId: number, objectId: number, location: IVector3D, direction: IVector3D, headDirection: number, type: number, figure: string): boolean; + addFurnitureFloor(roomId: number, id: number, typeId: number, location: IVector3D, direction: IVector3D, state: number, objectData: IObjectData, extra?: number, expires?: number, usagePolicy?: number, ownerId?: number, ownerName?: string, synchronized?: boolean, realRoomObject?: boolean, sizeZ?: number): boolean; + addFurnitureFloorByTypeName(roomId: number, id: number, typeName: string, location: IVector3D, direction: IVector3D, state: number, objectData: IObjectData, extra?: number, expires?: number, usagePolicy?: number, ownerId?: number, ownerName?: string, synchronized?: boolean, realRoomObject?: boolean, sizeZ?: number): boolean; + addFurnitureWall(roomId: number, id: number, typeId: number, location: IVector3D, direction: IVector3D, state: number, extra: string, expires?: number, usagePolicy?: number, ownerId?: number, ownerName?: string, realRoomObject?: boolean): boolean; + removeRoomObjectFloor(roomId: number, objectId: number, userId?: number, _arg_4?: boolean): void; + removeRoomObjectWall(roomId: number, objectId: number, userId?: number): void; + removeRoomObjectUser(roomId: number, objectId: number): void; + loadRoomObjectBadgeImage(roomId: number, objectId: number, objectCategory: number, badgeId: string, groupBadge?: boolean): void; + updateRoomObjectMask(roomId: number, objectId: number, _arg_?: boolean): void; + setObjectMoverIconSprite(objectId: number, category: number, _arg_3: boolean, instanceData?: string, stuffData?: IObjectData, state?: number, frameNumber?: number, posture?: string): void; + setObjectMoverIconSpriteVisible(k: boolean): void; + updateMousePointer(type: string, objectId: number, objectType: string): void; + removeObjectMoverIconSprite(): void; + getRoomTileObjectMap(k: number): ITileObjectMap; + isPlayingGame(): boolean; + connection: IConnection; + sessionDataManager: ISessionDataManager; + roomSessionManager: IRoomSessionManager; + activeRoomId: number; + events: IEventDispatcher; + isDecorating: boolean; +} diff --git a/submodules/renderer/src/api/nitro/room/IRoomObjectEventManager.ts b/submodules/renderer/src/api/nitro/room/IRoomObjectEventManager.ts new file mode 100644 index 0000000..4f0cec3 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/IRoomObjectEventManager.ts @@ -0,0 +1,6 @@ +import { IRoomObjectController } from '../../room'; + +export interface IRoomObjectEventManager +{ + getValidRoomObjectDirection(k: IRoomObjectController, _arg_2: boolean): number; +} diff --git a/submodules/renderer/src/api/nitro/room/ISelectedRoomObjectData.ts b/submodules/renderer/src/api/nitro/room/ISelectedRoomObjectData.ts new file mode 100644 index 0000000..e189a6b --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/ISelectedRoomObjectData.ts @@ -0,0 +1,18 @@ +import { IVector3D } from '../../room'; +import { IObjectData } from './object'; + +export interface ISelectedRoomObjectData +{ + id: number; + category: number; + operation: string; + loc: IVector3D; + dir: IVector3D; + typeId: number; + instanceData: string; + stuffData: IObjectData; + state: number; + animFrame: number; + posture: string; + dispose: () => void; +} diff --git a/submodules/renderer/src/api/nitro/room/enums/FriendFurniEngravingWidgetType.ts b/submodules/renderer/src/api/nitro/room/enums/FriendFurniEngravingWidgetType.ts new file mode 100644 index 0000000..47a95f9 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/enums/FriendFurniEngravingWidgetType.ts @@ -0,0 +1,8 @@ +export class FriendFurniEngravingWidgetType +{ + public static readonly LOVE_LOCK: number = 0; + public static readonly CARVE_A_TREE: number = 1; + public static readonly FRIENDS_PORTRAIT: number = 2; + public static readonly WILD_WEST_WANTED: number = 3; + public static readonly HABBOWEEN: number = 4; +} diff --git a/submodules/renderer/src/api/nitro/room/enums/RoomObjectPlacementSource.ts b/submodules/renderer/src/api/nitro/room/enums/RoomObjectPlacementSource.ts new file mode 100644 index 0000000..629bec4 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/enums/RoomObjectPlacementSource.ts @@ -0,0 +1,5 @@ +export class RoomObjectPlacementSource +{ + public static CATALOG: string = 'catalog'; + public static INVENTORY: string = 'inventory'; +} diff --git a/submodules/renderer/src/api/nitro/room/enums/index.ts b/submodules/renderer/src/api/nitro/room/enums/index.ts new file mode 100644 index 0000000..0ea238d --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/enums/index.ts @@ -0,0 +1,2 @@ +export * from './FriendFurniEngravingWidgetType'; +export * from './RoomObjectPlacementSource'; diff --git a/submodules/renderer/src/api/nitro/room/index.ts b/submodules/renderer/src/api/nitro/room/index.ts new file mode 100644 index 0000000..e10262d --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/index.ts @@ -0,0 +1,15 @@ +export * from './enums'; +export * from './IGetImageListener'; +export * from './IImageResult'; +export * from './IPetColorResult'; +export * from './IRoomContentListener'; +export * from './IRoomContentLoader'; +export * from './IRoomCreator'; +export * from './IRoomEngine'; +export * from './IRoomEngineServices'; +export * from './IRoomObjectEventManager'; +export * from './ISelectedRoomObjectData'; +export * from './object'; +export * from './object/data'; +export * from './object/data/type'; +export * from './utils'; diff --git a/submodules/renderer/src/api/nitro/room/object/IPetFigureData.ts b/submodules/renderer/src/api/nitro/room/object/IPetFigureData.ts new file mode 100644 index 0000000..4a40d1c --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/IPetFigureData.ts @@ -0,0 +1,10 @@ +export interface IPetFigureData +{ + readonly typeId: number; + readonly paletteId: number; + readonly color: string; + readonly breedId: number; + readonly figuredata: string; + readonly customParts: number[]; + readonly custompartCount: number; +} diff --git a/submodules/renderer/src/api/nitro/room/object/IRoomMapData.ts b/submodules/renderer/src/api/nitro/room/object/IRoomMapData.ts new file mode 100644 index 0000000..a54a7c3 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/IRoomMapData.ts @@ -0,0 +1,14 @@ +export interface IRoomMapData +{ + width: number; + height: number; + wallHeight: number; + fixedWallsHeight: number; + tileMap: { height: number }[][]; + holeMap: { id: number, x: number, y: number, width: number, height: number }[]; + doors: { x: number, y: number, z: number, dir: number }[]; + dimensions: { minX: number, maxX: number, minY: number, maxY: number }; + restrictsDragging: boolean; + restrictsScaling: boolean; + restrictedScale: number; +} diff --git a/submodules/renderer/src/api/nitro/room/object/RoomObjectCategory.ts b/submodules/renderer/src/api/nitro/room/object/RoomObjectCategory.ts new file mode 100644 index 0000000..6e93273 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/RoomObjectCategory.ts @@ -0,0 +1,9 @@ +export class RoomObjectCategory +{ + public static MINIMUM: number = -2; + public static ROOM: number = 0; + public static FLOOR: number = 10; + public static WALL: number = 20; + public static UNIT: number = 100; + public static CURSOR: number = 200; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/room/object/RoomObjectLogicType.ts b/submodules/renderer/src/api/nitro/room/object/RoomObjectLogicType.ts new file mode 100644 index 0000000..bb16bef --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/RoomObjectLogicType.ts @@ -0,0 +1,74 @@ +export class RoomObjectLogicType +{ + public static FURNITURE_BASIC = 'furniture_basic'; + public static FURNITURE_MULTISTATE = 'furniture_multistate'; + public static FURNITURE_MULTIHEIGHT = 'furniture_multiheight'; + public static FURNITURE_RANDOMSTATE = 'furniture_randomstate'; + public static FURNITURE_PLACEHOLDER = 'furniture_placeholder'; + public static FURNITURE_CREDIT = 'furniture_credit'; + public static FURNITURE_STICKIE = 'furniture_stickie'; + public static FURNITURE_PRESENT = 'furniture_present'; + public static FURNITURE_TROPHY = 'furniture_trophy'; + public static FURNITURE_ECOTRON_BOX = 'furniture_ecotron_box'; + public static FURNITURE_DICE = 'furniture_dice'; + public static FURNITURE_HOCKEY_SCORE = 'furniture_hockey_score'; + public static FURNITURE_HABBOWHEEL = 'furniture_habbowheel'; + public static FURNITURE_ONE_WAY_DOOR = 'furniture_one_way_door'; + public static FURNITURE_PLANET_SYSTEM = 'furniture_planet_system'; + public static FURNITURE_WINDOW = 'furniture_window'; + public static FURNITURE_EXTERNAL_IMAGE_WALLITEM = 'furniture_external_image_wallitem'; + public static FURNITURE_ROOMDIMMER = 'furniture_roomdimmer'; + public static FURNITURE_SOUND_MACHINE = 'furniture_sound_machine'; + public static FURNITURE_JUKEBOX = 'furniture_jukebox'; + public static FURNITURE_CRACKABLE = 'furniture_crackable'; + public static FURNITURE_PUSHABLE = 'furniture_pushable'; + public static FURNITURE_CLOTHING_CHANGE = 'furniture_clothing_change'; + public static FURNITURE_COUNTER_CLOCK = 'furniture_counter_clock'; + public static FURNITURE_SCORE = 'furniture_score'; + public static FURNITURE_ES = 'furniture_es'; + public static FURNITURE_FIREWORKS = 'furniture_fireworks'; + public static FURNITURE_SONG_DISK = 'furniture_song_disk'; + public static FURNITURE_BB = 'furniture_bb'; + public static FURNITURE_BG = 'furniture_bg'; + public static FURNITURE_WELCOME_GIFT = 'furniture_welcome_gift'; + public static FURNITURE_FLOOR_HOLE = 'furniture_floor_hole'; + public static FURNITURE_MANNEQUIN = 'furniture_mannequin'; + public static FURNITURE_GUILD_CUSTOMIZED = 'furniture_guild_customized'; + public static FURNITURE_GROUP_FORUM_TERMINAL = 'furniture_group_forum_terminal'; + public static FURNITURE_PET_CUSTOMIZATION = 'furniture_pet_customization'; + public static FURNITURE_CUCKOO_CLOCK = 'furniture_cuckoo_clock'; + public static FURNITURE_VOTE_COUNTER = 'furniture_vote_counter'; + public static FURNITURE_VOTE_MAJORITY = 'furniture_vote_majority'; + public static FURNITURE_SOUNDBLOCK = 'furniture_soundblock'; + public static FURNITURE_RANDOM_TELEPORT = 'furniture_random_teleport'; + public static FURNITURE_MONSTERPLANT_SEED = 'furniture_monsterplant_seed'; + public static FURNITURE_PURCHASABLE_CLOTHING = 'furniture_purchasable_clothing'; + public static FURNITURE_BACKGROUND_COLOR = 'furniture_background_color'; + public static FURNITURE_MYSTERYBOX = 'furniture_mysterybox'; + public static FURNITURE_EFFECTBOX = 'furniture_effectbox'; + public static FURNITURE_MYSTERYTROPHY = 'furniture_mysterytrophy'; + public static FURNITURE_ACHIEVEMENT_RESOLUTION = 'furniture_achievement_resolution'; + public static FURNITURE_LOVELOCK = 'furniture_lovelock'; + public static FURNITURE_WILDWEST_WANTED = 'furniture_wildwest_wanted'; + public static FURNITURE_HWEEN_LOVELOCK = 'furniture_hween_lovelock'; + public static FURNITURE_BADGE_DISPLAY = 'furniture_badge_display'; + public static FURNITURE_HIGH_SCORE = 'furniture_high_score'; + public static FURNITURE_INTERNAL_LINK = 'furniture_internal_link'; + public static FURNITURE_CUSTOM_STACK_HEIGHT = 'furniture_custom_stack_height'; + public static FURNITURE_YOUTUBE = 'furniture_youtube'; + public static FURNITURE_RENTABLE_SPACE = 'furniture_rentable_space'; + public static FURNITURE_CHANGE_STATE_WHEN_STEP_ON = 'furniture_change_state_when_step_on'; + public static FURNITURE_VIMEO = 'furniture_vimeo'; + public static FURNITURE_EDITABLE_INTERNAL_LINK = 'furniture_editable_internal_link'; + public static FURNITURE_EDITABLE_ROOM_LINK = 'furniture_editable_room_link'; + public static FURNITURE_CRAFTING_GIZMO = 'furniture_crafting_gizmo'; + public static ROOM = 'room'; + public static USER = 'user'; + public static BOT = 'bot'; + public static RENTABLE_BOT = 'rentable_bot'; + public static PET = 'pet'; + public static TILE_CURSOR = 'tile_cursor'; + public static SELECTION_ARROW = 'selection_arrow'; + public static GAME_SNOWBALL = 'game_snowball'; + public static GAME_SNOWSPLASH = 'game_snowsplash'; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/room/object/RoomObjectOperationType.ts b/submodules/renderer/src/api/nitro/room/object/RoomObjectOperationType.ts new file mode 100644 index 0000000..61b8b83 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/RoomObjectOperationType.ts @@ -0,0 +1,15 @@ +export class RoomObjectOperationType +{ + public static OBJECT_UNDEFINED: string = 'OBJECT_UNDEFINED'; + public static OBJECT_MOVE: string = 'OBJECT_MOVE'; + public static OBJECT_PLACE: string = 'OBJECT_PLACE'; + public static OBJECT_ROTATE_POSITIVE: string = 'OBJECT_ROTATE_POSITIVE'; + public static OBJECT_ROTATE_NEGATIVE: string = 'OBJECT_ROTATE_NEGATIVE'; + public static OBJECT_MOVE_TO: string = 'OBJECT_MOVE_TO'; + public static OBJECT_PLACE_TO: string = 'OBJECT_PLACE_TO'; + public static OBJECT_PICKUP: string = 'OBJECT_PICKUP'; + public static OBJECT_PICKUP_BOT: string = 'OBJECT_PICKUP_BOT'; + public static OBJECT_PICKUP_PET: string = 'OBJECT_PICKUP_PET'; + public static OBJECT_EJECT: string = 'OBJECT_EJECT'; + public static OBJECT_SAVE_STUFF_DATA: string = 'OBJECT_SAVE_STUFF_DATA'; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/room/object/RoomObjectType.ts b/submodules/renderer/src/api/nitro/room/object/RoomObjectType.ts new file mode 100644 index 0000000..dbfc3c7 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/RoomObjectType.ts @@ -0,0 +1,7 @@ +export class RoomObjectType +{ + public static USER: number = 1; + public static PET: number = 2; + public static BOT: number = 3; + public static RENTABLE_BOT: number = 4; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/room/object/RoomObjectUserType.ts b/submodules/renderer/src/api/nitro/room/object/RoomObjectUserType.ts new file mode 100644 index 0000000..e476a24 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/RoomObjectUserType.ts @@ -0,0 +1,40 @@ +export class RoomObjectUserType +{ + public static USER: string = 'user'; + public static PET: string = 'pet'; + public static BOT: string = 'bot'; + public static RENTABLE_BOT: string = 'rentable_bot'; + public static MONSTER_PLANT: string = 'monsterplant'; + public static AVATAR_TYPES: { [key: string]: number } = { 'user': 1, 'pet': 2, 'bot': 3, 'rentable_bot': 4 }; + + public static getTypeNumber(type: string): number + { + return RoomObjectUserType.AVATAR_TYPES[type]; + } + + public static getTypeString(type: number): string + { + for(const key in RoomObjectUserType.AVATAR_TYPES) + { + if(!key) continue; + + if(RoomObjectUserType.AVATAR_TYPES[key] !== type) continue; + + return key; + } + + return null; + } + + public static getRealType(type: string): string + { + switch(type) + { + case RoomObjectUserType.BOT: + case RoomObjectUserType.RENTABLE_BOT: + return RoomObjectUserType.USER; + default: + return type; + } + } +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/room/object/RoomObjectVariable.ts b/submodules/renderer/src/api/nitro/room/object/RoomObjectVariable.ts new file mode 100644 index 0000000..9ecb4f8 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/RoomObjectVariable.ts @@ -0,0 +1,145 @@ +export class RoomObjectVariable +{ + public static OBJECT_ROOM_ID: string = 'object_room_id'; + public static OBJECT_ACCURATE_Z_VALUE: string = 'object_accurate_z_value'; + public static TILE_CURSOR_HEIGHT: string = 'tile_cursor_height'; + public static FIGURE: string = 'figure'; + public static GENDER: string = 'gender'; + public static OWN_USER: string = 'own_user'; + public static FIGURE_CAN_STAND_UP: string = 'figure_can_stand_up'; + public static FIGURE_VERTICAL_OFFSET: string = 'figure_vertical_offset'; + public static FIGURE_TALK: string = 'figure_talk'; + public static FIGURE_DANCE: string = 'figure_dance'; + public static FIGURE_SLEEP: string = 'figure_sleep'; + public static FIGURE_BLINK: string = 'figure_blink'; + public static FIGURE_EFFECT: string = 'figure_effect'; + public static FIGURE_CARRY_OBJECT: string = 'figure_carry_object'; + public static FIGURE_USE_OBJECT: string = 'figure_use_object'; + public static FIGURE_GESTURE: string = 'figure_gesture'; + public static FIGURE_POSTURE: string = 'figure_posture'; + public static FIGURE_POSTURE_PARAMETER: string = 'figure_posture_parameter'; + public static FIGURE_HIGHLIGHT_ENABLE: string = 'figure_highlight_enable'; + public static FIGURE_HIGHLIGHT: string = 'figure_highlight'; + public static FURNITURE_PURCHASER_NAME: string = 'furniture_purchaser_name'; + public static FURNITURE_PURCHASER_FIGURE: string = 'furniture_purchaser_figure'; + public static STD: string = 'std'; + public static FIGURE_SIGN: string = 'figure_sign'; + public static FIGURE_FLAT_CONTROL: string = 'figure_flat_control'; + public static FIGURE_IS_TYPING: string = 'figure_is_typing'; + public static FIGURE_IS_MUTED: string = 'figure_is_muted'; + public static FIGURE_GAINED_EXPERIENCE: string = 'figure_gained_experience'; + public static FIGURE_EXPERIENCE_TIMESTAMP: string = 'figure_experience_timestamp'; + public static FIGURE_NUMBER_VALUE: string = 'figure_number_value'; + public static FIGURE_IS_PLAYING_GAME: string = 'figure_is_playing_game'; + public static FIGURE_GUIDE_STATUS: string = 'figure_guide_status'; + public static FIGURE_EXPRESSION: string = 'figure_expression'; + public static HEAD_DIRECTION: string = 'head_direction'; + public static FURNITURE_CUSTOM_VARIABLES: string = 'furniture_custom_variables'; + public static FURNITURE_AUTOMATIC_STATE_INDEX: string = 'furniture_automatic_state_index'; + public static FURNITURE_ALWAYS_STACKABLE: string = 'furniture_always_stackable'; + public static FURNITURE_DISABLE_PICKING_ANIMATION: string = 'furniture_disable_picking_animation'; + public static FURNITURE_DATA_FORMAT: string = 'furniture_data_format'; + public static FURNITURE_UNIQUE_SERIAL_NUMBER: string = 'furniture_unique_serial_number'; + public static FURNITURE_UNIQUE_EDITION_SIZE: string = 'furniture_unique_edition_size'; + public static FURNITURE_CRACKABLE_STATE: string = 'furniture_crackable_state'; + public static FURNITURE_CRACKABLE_HITS: string = 'furniture_crackable_hits'; + public static FURNITURE_CRACKABLE_TARGET: string = 'furniture_crackable_target'; + public static FURNITURE_CREDIT_VALUE: string = 'furniture_credit_value'; + public static FURNITURE_DATA: string = 'furniture_data'; + public static FURNITURE_ITEMDATA: string = 'furniture_itemdata'; + public static FURNITURE_COLOR: string = 'furniture_color'; + public static FURNITURE_LIFT_AMOUNT: string = 'furniure_lift_amount'; + public static FURNITURE_GUILD_CUSTOMIZED_GUILD_ID: string = 'furniture_guild_customized_guild_id'; + public static FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME: string = 'furniture_guild_customized_asset_name'; + public static FURNITURE_GUILD_CUSTOMIZED_COLOR_1: string = 'furniture_guild_customized_color_1'; + public static FURNITURE_GUILD_CUSTOMIZED_COLOR_2: string = 'furniture_guild_customized_color_2'; + public static FURNITURE_STATE_UPDATE_TIME: string = 'furniture_state_update_time'; + public static FURNITURE_SELECTION_DISABLED: string = 'furniture_selection_disabled'; + public static FURNITURE_SIZE_X: string = 'furniture_size_x'; + public static FURNITURE_SIZE_Y: string = 'furniture_size_y'; + public static FURNITURE_SIZE_Z: string = 'furniture_size_z'; + public static FURNITURE_CENTER_X: string = 'furniture_center_x'; + public static FURNITURE_CENTER_Y: string = 'furniture_center_y'; + public static FURNITURE_CENTER_Z: string = 'furniture_center_z'; + public static FURNITURE_ALLOWED_DIRECTIONS: string = 'furniture_allowed_directions'; + public static FURNITURE_AD_URL: string = 'furniture_ad_url'; + public static FURNITURE_TYPE_ID: string = 'furniture_type_id'; + public static FURNITURE_EXTRAS: string = 'furniture_extras'; + public static FURNITURE_EXPIRY_TIME: string = 'furniture_expiry_time'; + public static FURNITURE_EXPIRTY_TIMESTAMP: string = 'furniture_expiry_timestamp'; + public static FURNITURE_REAL_ROOM_OBJECT: string = 'furniture_real_room_object'; + public static FURNITURE_IS_STICKIE: string = 'furniture_is_stickie'; + public static FURNITURE_BRANDING_IMAGE_STATUS: string = 'furniture_branding_image_status'; + public static FURNITURE_BRANDING_IMAGE_URL: string = 'furniture_branding_image_url'; + public static FURNITURE_BRANDING_URL: string = 'furniture_branding_url'; + public static FURNITURE_BRANDING_OFFSET_X: string = 'furniture_branding_offset_x'; + public static FURNITURE_BRANDING_OFFSET_Y: string = 'furniture_branding_offset_y'; + public static FURNITURE_BRANDING_OFFSET_Z: string = 'furniture_branding_offset_z'; + public static FURNITURE_BRANDING_IS_ANIMATED: string = 'furniture_branding_is_animated'; + public static FURNITURE_BADGE_IMAGE_STATUS: string = 'furniture_badge_image_status'; + public static FURNITURE_BADGE_ASSET_NAME: string = 'furniture_badge_asset_name'; + public static FURNITURE_BADGE_VISIBLE_IN_STATE: string = 'furniture_badge_visible_in_state'; + public static FURNITURE_ALPHA_MULTIPLIER: string = 'furniture_alpha_multiplier'; + public static FURNITURE_USAGE_POLICY: string = 'furniture_usage_policy'; + public static FURNITURE_OWNER_ID: string = 'furniture_owner_id'; + public static FURNITURE_OWNER_NAME: string = 'furniture_owner_name'; + public static FURNITURE_ROOM_BACKGROUND_COLOR_HUE: string = 'furniture_room_background_color_hue'; + public static FURNITURE_ROOM_BACKGROUND_COLOR_SATURATION: string = 'furniture_room_background_color_saturation'; + public static FURNITURE_ROOM_BACKGROUND_COLOR_LIGHTNESS: string = 'furniture_room_background_color_lightness'; + public static FURNITURE_USES_PLANE_MASK: string = 'furniture_uses_plane_mask'; + public static FURNITURE_PLANE_MASK_TYPE: string = 'furniture_plane_mask_type'; + public static FURNITURE_IS_VARIABLE_HEIGHT: string = 'furniture_is_variable_height'; + public static FURNITURE_VOTE_MAJORITY_RESULT: string = 'furniture_vote_majority_result'; + public static FURNITURE_VOTE_COUNTER_COUNT: string = 'furniture_vote_counter_count'; + public static FURNITURE_SOUNDBLOCK_RELATIVE_ANIMATION_SPEED: string = 'furniture_soundblock_relative_animation_speed'; + public static FURNITURE_MANNEQUIN_NAME: string = 'furniture_mannequin_name'; + public static FURNITURE_MANNEQUIN_GENDER: string = 'furniture_mannequin_gender'; + public static FURNITURE_MANNEQUIN_FIGURE: string = 'furniture_mannequin_figure'; + public static FURNITURE_HIGHSCORE_SCORE_TYPE: string = 'furniture_highscore_score_type'; + public static FURNITURE_HIGHSCORE_CLEAR_TYPE: string = 'furniture_highscore_clear_type'; + public static FURNITURE_HIGHSCORE_DATA_ENTRY_COUNT: string = 'furniture_highscore_data_entry_count'; + public static FURNITURE_HIGHSCORE_DATA_ENTRY_BASE_USERS_: string = 'furniture_highscore_data_entry_base_users_'; + public static FURNITURE_HIGHSCORE_DATA_ENTRY_BASE_SCORE_: string = 'furniture_highscore_data_entry_base_score_'; + public static FURNITURE_INTERNAL_LINK: string = 'furniture_internal_link'; + public static FURNITURE_CLOTHING_BOY: string = 'furniture_clothing_boy'; + public static FURNITURE_CLOTHING_GIRL: string = 'furniture_clothing_girl'; + public static FURNITURE_PLANETSYSTEM_DATA: string = 'furniture_planetsystem_data'; + public static FURNITURE_FIREWORKS_DATA: string = 'furniture_fireworks_data'; + public static PET_PALETTE_INDEX: string = 'pet_palette_index'; + public static PET_COLOR: string = 'pet_color'; + public static PET_HEAD_ONLY: string = 'pet_head_only'; + public static PET_CUSTOM_LAYER_IDS: string = 'pet_custom_layer_ids'; + public static PET_CUSTOM_PARTS_IDS: string = 'pet_custom_part_ids'; + public static PET_CUSTOM_PALETTE_IDS: string = 'pet_custom_palette_ids'; + public static PET_IS_RIDING: string = 'pet_is_riding'; + public static PET_TYPE: string = 'pet_type'; + public static PET_ALLOWED_DIRECTIONS: string = 'pet_allowed_directions'; + public static RACE: string = 'race'; + public static ROOM_MAP_DATA: string = 'room_map_data'; + public static ROOM_PLANE_MASK_XML: string = 'room_plane_mask_xml'; + public static ROOM_FLOOR_TYPE: string = 'room_floor_type'; + public static ROOM_WALL_TYPE: string = 'room_wall_type'; + public static ROOM_LANDSCAPE_TYPE: string = 'room_landscape_type'; + public static ROOM_WALL_THICKNESS: string = 'room_wall_thickness'; + public static ROOM_FLOOR_THICKNESS: string = 'room_floor_thickness'; + public static ROOM_FLOOR_HOLE_UPDATE_TIME: string = 'room_floor_hole_update_time'; + public static ROOM_FLOOR_VISIBILITY: string = 'room_floor_visibility'; + public static ROOM_WALL_VISIBILITY: string = 'room_wall_visibility'; + public static ROOM_LANDSCAPE_VISIBILITY: string = 'room_landscape_visibility'; + public static ROOM_DOOR_X: string = 'room_door_x'; + public static ROOM_DOOR_Y: string = 'room_door_y'; + public static ROOM_DOOR_Z: string = 'room_door_z'; + public static ROOM_DOOR_DIR: string = 'room_door_dir'; + public static ROOM_BACKGROUND_COLOR: string = 'room_background_color'; + public static ROOM_COLORIZE_BG_ONLY: string = 'room_colorize_bg_only'; + public static ROOM_RANDOM_SEED: string = 'room_random_seed'; + public static ROOM_WORLD_TYPE: string = 'room_world_type'; + public static ROOM_SELECTED_X: string = 'room_selected_x'; + public static ROOM_SELECTED_Y: string = 'room_selected_y'; + public static ROOM_SELECTED_Z: string = 'room_selected_z'; + public static ROOM_SELECTED_PLANE: string = 'room_selected_plane'; + public static IMAGE_QUERY_SCALE: string = 'image_query_scale'; + public static FURNITURE_FRIENDFURNI_ENGRAVING: string = 'furniture_friendfurni_engraving_type'; + public static SESSION_URL_PREFIX: string = 'session_url_prefix'; + public static SESSION_CURRENT_USER_ID: string = 'session_current_user_id'; +} diff --git a/submodules/renderer/src/api/nitro/room/object/RoomObjectVisualizationType.ts b/submodules/renderer/src/api/nitro/room/object/RoomObjectVisualizationType.ts new file mode 100644 index 0000000..0af0485 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/RoomObjectVisualizationType.ts @@ -0,0 +1,40 @@ +export class RoomObjectVisualizationType +{ + public static FURNITURE_STATIC = 'furniture_static'; + public static FURNITURE_ANIMATED = 'furniture_animated'; + public static FURNITURE_RESETTING_ANIMATED = 'furniture_resetting_animated'; + public static FURNITURE_POSTER = 'furniture_poster'; + public static FURNITURE_EXTERNAL_IMAGE = 'furniture_external_image'; + public static FURNITURE_HABBOWHEEL = 'furniture_habbowheel'; + public static FURNITURE_VAL_RANDOMIZER = 'furniture_val_randomizer'; + public static FURNITURE_BOTTLE = 'furniture_bottle'; + public static FURNITURE_PLANET_SYSTEM = 'furniture_planet_system'; + public static FURNITURE_QUEUE_TILE = 'furniture_queue_tile'; + public static FURNITURE_PARTY_BEAMER = 'furniture_party_beamer'; + public static FURNITURE_CUBOID = 'furniture_cuboid'; + public static FURNITURE_GIFT_WRAPPED = 'furniture_gift_wrapped'; + public static FURNITURE_GIFT_WRAPPED_FIREWORKS = 'furniture_gift_wrapped_fireworks'; + public static FURNITURE_COUNTER_CLOCK = 'furniture_counter_clock'; + public static FURNITURE_WATER_AREA = 'furniture_water_area'; + public static FURNITURE_SCORE_BOARD = 'furniture_score_board'; + public static FURNITURE_FIREWORKS = 'furniture_fireworks'; + public static FURNITURE_BB = 'furniture_bb'; + public static FURNITURE_ISOMETRIC_BB = 'furniture_isometric_bb'; + public static FURNITURE_BG = 'furniture_bg'; + public static FURNITURE_STICKIE = 'furniture_stickie'; + public static FURNITURE_MANNEQUIN = 'furniture_mannequin'; + public static FURNITURE_GUILD_CUSTOMIZED = 'furniture_guild_customized'; + public static FURNITURE_GUILD_ISOMETRIC_BADGE = 'furniture_guild_isometric_badge'; + public static FURNITURE_VOTE_COUNTER = 'furniture_vote_counter'; + public static FURNITURE_VOTE_MAJORITY = 'furniture_vote_majority'; + public static FURNITURE_SOUNDBLOCK = 'furniture_soundblock'; + public static FURNITURE_BADGE_DISPLAY = 'furniture_badge_display'; + public static FURNITURE_YOUTUBE = 'furniture_youtube'; + public static FURNITURE_BUILDER_PLACEHOLDER = 'furniture_builder_placeholder'; + public static ROOM = 'room'; + public static USER = 'user'; + public static PET_ANIMATED = 'pet_animated'; + public static BOT = 'bot'; + public static RENTABLE_BOT = 'rentable_bot'; + public static TILE_CURSOR = 'tile_cursor'; +} diff --git a/submodules/renderer/src/api/nitro/room/object/data/IObjectData.ts b/submodules/renderer/src/api/nitro/room/object/data/IObjectData.ts new file mode 100644 index 0000000..be56f1c --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/IObjectData.ts @@ -0,0 +1,17 @@ +import { IMessageDataWrapper } from '../../../../communication'; +import { IRoomObjectModel } from '../../../../room'; + +export interface IObjectData +{ + state: number; + isUnique: boolean; + uniqueNumber: number; + uniqueSeries: number; + rarityLevel: number; + flags: number; + parseWrapper(wrapper: IMessageDataWrapper): void; + initializeFromRoomObjectModel(model: IRoomObjectModel): void; + writeRoomObjectModel(model: IRoomObjectModel): void; + getLegacyString(): string; + compare(data: IObjectData): boolean; +} diff --git a/submodules/renderer/src/api/nitro/room/object/data/ObjectDataBase.ts b/submodules/renderer/src/api/nitro/room/object/data/ObjectDataBase.ts new file mode 100644 index 0000000..25ddfcc --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/ObjectDataBase.ts @@ -0,0 +1,99 @@ +import { IMessageDataWrapper } from '../../../../communication'; +import { IRoomObjectModel } from '../../../../room'; +import { RoomObjectVariable } from '../RoomObjectVariable'; +import { IObjectData } from './IObjectData'; +import { ObjectDataFlags } from './ObjectDataFlags'; + +export class ObjectDataBase implements IObjectData +{ + private _flags: number; + private _uniqueNumber: number; + private _uniqueSeries: number; + + constructor() + { + this._flags = 0; + this._uniqueNumber = 0; + this._uniqueSeries = 0; + } + + public parseWrapper(wrapper: IMessageDataWrapper): void + { + if((this._flags & ObjectDataFlags.UNIQUE_SET) > 0) + { + this._uniqueNumber = wrapper.readInt(); + this._uniqueSeries = wrapper.readInt(); + } + } + + public initializeFromRoomObjectModel(model: IRoomObjectModel): void + { + this._uniqueNumber = model.getValue(RoomObjectVariable.FURNITURE_UNIQUE_SERIAL_NUMBER); + this._uniqueSeries = model.getValue(RoomObjectVariable.FURNITURE_UNIQUE_EDITION_SIZE); + } + + public writeRoomObjectModel(model: IRoomObjectModel): void + { + if(!model) return; + + model.setValue(RoomObjectVariable.FURNITURE_UNIQUE_SERIAL_NUMBER, this._uniqueNumber); + model.setValue(RoomObjectVariable.FURNITURE_UNIQUE_EDITION_SIZE, this._uniqueSeries); + } + + public getLegacyString(): string + { + return ''; + } + + public compare(data: IObjectData): boolean + { + return false; + } + + public get state(): number + { + const state = parseInt(this.getLegacyString()); + + return isNaN(state) ? 0 : state; + } + + public get isUnique(): boolean + { + return this._uniqueSeries > 0; + } + + public get uniqueNumber(): number + { + return this._uniqueNumber; + } + + public set uniqueNumber(number: number) + { + this._uniqueNumber = number; + } + + public get uniqueSeries(): number + { + return this._uniqueSeries; + } + + public set uniqueSeries(series: number) + { + this._uniqueSeries = series; + } + + public get rarityLevel(): number + { + return -1; + } + + public get flags(): number + { + return this._flags; + } + + public set flags(flags: number) + { + this._flags = flags; + } +} diff --git a/submodules/renderer/src/api/nitro/room/object/data/ObjectDataFactory.ts b/submodules/renderer/src/api/nitro/room/object/data/ObjectDataFactory.ts new file mode 100644 index 0000000..b6f3e5d --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/ObjectDataFactory.ts @@ -0,0 +1,44 @@ +import { IObjectData } from './IObjectData'; +import { CrackableDataType, EmptyDataType, HighScoreDataType, LegacyDataType, MapDataType, NumberDataType, StringDataType, VoteDataType } from './type'; + +export class ObjectDataFactory +{ + public static getData(flags: number): IObjectData + { + let objectData: IObjectData = null; + + switch(flags & 0xFF) + { + case CrackableDataType.FORMAT_KEY: + objectData = new CrackableDataType(); + break; + case EmptyDataType.FORMAT_KEY: + objectData = new EmptyDataType(); + break; + case HighScoreDataType.FORMAT_KEY: + objectData = new HighScoreDataType(); + break; + case LegacyDataType.FORMAT_KEY: + objectData = new LegacyDataType(); + break; + case MapDataType.FORMAT_KEY: + objectData = new MapDataType(); + break; + case NumberDataType.FORMAT_KEY: + objectData = new NumberDataType(); + break; + case StringDataType.FORMAT_KEY: + objectData = new StringDataType(); + break; + case VoteDataType.FORMAT_KEY: + objectData = new VoteDataType(); + break; + } + + if(!objectData) return null; + + objectData.flags = (flags & 0xFF00); + + return objectData; + } +} diff --git a/submodules/renderer/src/api/nitro/room/object/data/ObjectDataFlags.ts b/submodules/renderer/src/api/nitro/room/object/data/ObjectDataFlags.ts new file mode 100644 index 0000000..5d5a119 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/ObjectDataFlags.ts @@ -0,0 +1,4 @@ +export class ObjectDataFlags +{ + public static UNIQUE_SET = 256; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/room/object/data/ObjectDataKey.ts b/submodules/renderer/src/api/nitro/room/object/data/ObjectDataKey.ts new file mode 100644 index 0000000..eff1160 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/ObjectDataKey.ts @@ -0,0 +1,11 @@ +export class ObjectDataKey +{ + public static LEGACY_KEY: number = 0; + public static MAP_KEY: number = 1; + public static STRING_KEY: number = 2; + public static VOTE_KEY: number = 3; + public static EMPTY_KEY: number = 4; + public static NUMBER_KEY: number = 5; + public static HIGHSCORE_KEY: number = 6; + public static CRACKABLE_KEY: number = 7; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/room/object/data/index.ts b/submodules/renderer/src/api/nitro/room/object/data/index.ts new file mode 100644 index 0000000..64993e4 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/index.ts @@ -0,0 +1,6 @@ +export * from './IObjectData'; +export * from './ObjectDataBase'; +export * from './ObjectDataFactory'; +export * from './ObjectDataFlags'; +export * from './ObjectDataKey'; +export * from './type'; diff --git a/submodules/renderer/src/api/nitro/room/object/data/type/CrackableDataType.ts b/submodules/renderer/src/api/nitro/room/object/data/type/CrackableDataType.ts new file mode 100644 index 0000000..8fd96fd --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/type/CrackableDataType.ts @@ -0,0 +1,74 @@ +import { IMessageDataWrapper } from '../../../../../communication'; +import { IRoomObjectModel } from '../../../../../room'; +import { RoomObjectVariable } from '../../RoomObjectVariable'; +import { IObjectData } from '../IObjectData'; +import { ObjectDataBase } from '../ObjectDataBase'; +import { ObjectDataKey } from '../ObjectDataKey'; + +export class CrackableDataType extends ObjectDataBase implements IObjectData +{ + public static FORMAT_KEY = ObjectDataKey.CRACKABLE_KEY; + + private _state: string; + private _hits: number; + private _target: number; + + constructor() + { + super(); + + this._state = ''; + this._hits = 0; + this._target = 0; + } + + public parseWrapper(wrapper: IMessageDataWrapper): void + { + if(!wrapper) return; + + this._state = wrapper.readString(); + this._hits = wrapper.readInt(); + this._target = wrapper.readInt(); + + super.parseWrapper(wrapper); + } + + public initializeFromRoomObjectModel(model: IRoomObjectModel): void + { + super.initializeFromRoomObjectModel(model); + + this._state = model.getValue(RoomObjectVariable.FURNITURE_CRACKABLE_STATE); + this._hits = model.getValue(RoomObjectVariable.FURNITURE_CRACKABLE_HITS); + this._target = model.getValue(RoomObjectVariable.FURNITURE_CRACKABLE_TARGET); + } + + public writeRoomObjectModel(model: IRoomObjectModel): void + { + super.writeRoomObjectModel(model); + + model.setValue(RoomObjectVariable.FURNITURE_DATA_FORMAT, CrackableDataType.FORMAT_KEY); + model.setValue(RoomObjectVariable.FURNITURE_CRACKABLE_STATE, this._state); + model.setValue(RoomObjectVariable.FURNITURE_CRACKABLE_HITS, this._hits); + model.setValue(RoomObjectVariable.FURNITURE_CRACKABLE_TARGET, this._target); + } + + public getLegacyString(): string + { + return this._state; + } + + public compare(data: IObjectData): boolean + { + return true; + } + + public get hits(): number + { + return this._hits; + } + + public get target(): number + { + return this._target; + } +} diff --git a/submodules/renderer/src/api/nitro/room/object/data/type/EmptyDataType.ts b/submodules/renderer/src/api/nitro/room/object/data/type/EmptyDataType.ts new file mode 100644 index 0000000..62d9d03 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/type/EmptyDataType.ts @@ -0,0 +1,39 @@ +import { IMessageDataWrapper } from '../../../../../communication'; +import { IRoomObjectModel } from '../../../../../room'; +import { RoomObjectVariable } from '../../RoomObjectVariable'; +import { IObjectData } from '../IObjectData'; +import { ObjectDataBase } from '../ObjectDataBase'; +import { ObjectDataKey } from '../ObjectDataKey'; + +export class EmptyDataType extends ObjectDataBase implements IObjectData +{ + public static FORMAT_KEY = ObjectDataKey.EMPTY_KEY; + + private _state: string; + + public parseWrapper(wrapper: IMessageDataWrapper): void + { + if(!wrapper) return; + + this._state = ''; + + super.parseWrapper(wrapper); + } + + public writeRoomObjectModel(model: IRoomObjectModel): void + { + super.writeRoomObjectModel(model); + + model.setValue(RoomObjectVariable.FURNITURE_DATA_FORMAT, EmptyDataType.FORMAT_KEY); + } + + public getLegacyString(): string + { + return this._state; + } + + public compare(data: IObjectData): boolean + { + return super.compare(data); + } +} diff --git a/submodules/renderer/src/api/nitro/room/object/data/type/HighScoreData.ts b/submodules/renderer/src/api/nitro/room/object/data/type/HighScoreData.ts new file mode 100644 index 0000000..cb18b33 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/type/HighScoreData.ts @@ -0,0 +1,36 @@ +export class HighScoreData +{ + private _score: number; + private _users: string[]; + + constructor() + { + this._score = -1; + this._users = []; + } + + public get score(): number + { + return this._score; + } + + public set score(k: number) + { + this._score = k; + } + + public get users(): string[] + { + return this._users; + } + + public set users(k: string[]) + { + this._users = k; + } + + public addUsername(k: string): void + { + this._users.push(k); + } +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/room/object/data/type/HighScoreDataType.ts b/submodules/renderer/src/api/nitro/room/object/data/type/HighScoreDataType.ts new file mode 100644 index 0000000..205c2e8 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/type/HighScoreDataType.ts @@ -0,0 +1,131 @@ +import { IMessageDataWrapper } from '../../../../../communication'; +import { IRoomObjectModel } from '../../../../../room'; +import { RoomObjectVariable } from '../../RoomObjectVariable'; +import { IObjectData } from '../IObjectData'; +import { ObjectDataBase } from '../ObjectDataBase'; +import { ObjectDataKey } from '../ObjectDataKey'; +import { HighScoreData } from './HighScoreData'; + +export class HighScoreDataType extends ObjectDataBase implements IObjectData +{ + public static FORMAT_KEY = ObjectDataKey.HIGHSCORE_KEY; + + private _state: string; + private _scoreType: number; + private _clearType: number; + private _entries: HighScoreData[]; + + constructor() + { + super(); + + this._state = ''; + this._scoreType = -1; + this._clearType = -1; + this._entries = []; + } + + public parseWrapper(wrapper: IMessageDataWrapper): void + { + if(!wrapper) return; + + this._state = wrapper.readString(); + this._scoreType = wrapper.readInt(); + this._clearType = wrapper.readInt(); + + let totalScores = wrapper.readInt(); + + while(totalScores > 0) + { + const data = new HighScoreData(); + + data.score = wrapper.readInt(); + + let totalUsers = wrapper.readInt(); + + while(totalUsers > 0) + { + data.addUsername(wrapper.readString()); + + totalUsers--; + } + + this._entries.push(data); + + totalScores--; + } + + super.parseWrapper(wrapper); + } + + public initializeFromRoomObjectModel(model: IRoomObjectModel): void + { + this._scoreType = model.getValue(RoomObjectVariable.FURNITURE_HIGHSCORE_SCORE_TYPE); + this._clearType = model.getValue(RoomObjectVariable.FURNITURE_HIGHSCORE_CLEAR_TYPE); + this._entries = []; + + const totalEntries = model.getValue(RoomObjectVariable.FURNITURE_HIGHSCORE_DATA_ENTRY_COUNT); + + let i = 0; + + while(i < totalEntries) + { + const data = new HighScoreData(); + + data.score = model.getValue(RoomObjectVariable.FURNITURE_HIGHSCORE_DATA_ENTRY_BASE_SCORE_ + i); + data.users = model.getValue(RoomObjectVariable.FURNITURE_HIGHSCORE_DATA_ENTRY_BASE_USERS_ + i); + + this._entries.push(data); + + i++; + } + + super.initializeFromRoomObjectModel(model); + } + + public writeRoomObjectModel(model: IRoomObjectModel): void + { + super.writeRoomObjectModel(model); + + model.setValue(RoomObjectVariable.FURNITURE_DATA_FORMAT, HighScoreDataType.FORMAT_KEY); + model.setValue(RoomObjectVariable.FURNITURE_HIGHSCORE_SCORE_TYPE, this._scoreType); + model.setValue(RoomObjectVariable.FURNITURE_HIGHSCORE_CLEAR_TYPE, this._clearType); + + if(this._entries) + { + model.setValue(RoomObjectVariable.FURNITURE_HIGHSCORE_DATA_ENTRY_COUNT, this._entries.length); + + let i = 0; + + while(i < this._entries.length) + { + const entry = this._entries[i]; + + model.setValue((RoomObjectVariable.FURNITURE_HIGHSCORE_DATA_ENTRY_BASE_SCORE_ + i), entry.score); + model.setValue((RoomObjectVariable.FURNITURE_HIGHSCORE_DATA_ENTRY_BASE_USERS_ + i), entry.users); + + i++; + } + } + } + + public getLegacyString(): string + { + return this._state; + } + + public get entries(): HighScoreData[] + { + return this._entries; + } + + public get clearType(): number + { + return this._clearType; + } + + public get scoreType(): number + { + return this._scoreType; + } +} diff --git a/submodules/renderer/src/api/nitro/room/object/data/type/LegacyDataType.ts b/submodules/renderer/src/api/nitro/room/object/data/type/LegacyDataType.ts new file mode 100644 index 0000000..29eb592 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/type/LegacyDataType.ts @@ -0,0 +1,59 @@ +import { IMessageDataWrapper } from '../../../../../communication'; +import { IRoomObjectModel } from '../../../../../room'; +import { RoomObjectVariable } from '../../RoomObjectVariable'; +import { IObjectData } from '../IObjectData'; +import { ObjectDataBase } from '../ObjectDataBase'; +import { ObjectDataKey } from '../ObjectDataKey'; + +export class LegacyDataType extends ObjectDataBase implements IObjectData +{ + public static FORMAT_KEY = ObjectDataKey.LEGACY_KEY; + + private _data: string; + + constructor() + { + super(); + + this._data = ''; + } + + public parseWrapper(wrapper: IMessageDataWrapper): void + { + if(!wrapper) return; + + this._data = wrapper.readString(); + + super.parseWrapper(wrapper); + } + + public initializeFromRoomObjectModel(model: IRoomObjectModel): void + { + super.initializeFromRoomObjectModel(model); + + this._data = model.getValue(RoomObjectVariable.FURNITURE_DATA); + } + + public writeRoomObjectModel(model: IRoomObjectModel): void + { + super.writeRoomObjectModel(model); + + model.setValue(RoomObjectVariable.FURNITURE_DATA_FORMAT, LegacyDataType.FORMAT_KEY); + model.setValue(RoomObjectVariable.FURNITURE_DATA, this._data); + } + + public getLegacyString(): string + { + return this._data; + } + + public compare(data: IObjectData): boolean + { + return (this._data === data.getLegacyString()); + } + + public setString(data: string): void + { + this._data = data; + } +} diff --git a/submodules/renderer/src/api/nitro/room/object/data/type/MapDataType.ts b/submodules/renderer/src/api/nitro/room/object/data/type/MapDataType.ts new file mode 100644 index 0000000..4d45794 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/type/MapDataType.ts @@ -0,0 +1,90 @@ +import { IMessageDataWrapper } from '../../../../../communication'; +import { IRoomObjectModel } from '../../../../../room'; +import { RoomObjectVariable } from '../../RoomObjectVariable'; +import { IObjectData } from '../IObjectData'; +import { ObjectDataBase } from '../ObjectDataBase'; +import { ObjectDataKey } from '../ObjectDataKey'; + +export class MapDataType extends ObjectDataBase +{ + public static FORMAT_KEY = ObjectDataKey.MAP_KEY; + + private static STATE: string = 'state'; + private static RARITY: string = 'rarity'; + + private _data: { [index: string]: string }; + + constructor() + { + super(); + + this._data = {}; + } + + public parseWrapper(wrapper: IMessageDataWrapper): void + { + if(!wrapper) return; + + this._data = {}; + + const totalSets = wrapper.readInt(); + + if(totalSets) for(let i = 0; i < totalSets; i++) this._data[wrapper.readString()] = wrapper.readString(); + + super.parseWrapper(wrapper); + } + + public initializeFromRoomObjectModel(model: IRoomObjectModel): void + { + super.initializeFromRoomObjectModel(model); + + this._data = model.getValue<{ [index: string]: string }>(RoomObjectVariable.FURNITURE_DATA) || {}; + } + + public writeRoomObjectModel(model: IRoomObjectModel): void + { + super.writeRoomObjectModel(model); + + model.setValue(RoomObjectVariable.FURNITURE_DATA_FORMAT, MapDataType.FORMAT_KEY); + model.setValue(RoomObjectVariable.FURNITURE_DATA, this._data); + } + + public getLegacyString(): string + { + if(!this._data) return ''; + + const state = this._data[MapDataType.STATE]; + + if(state === undefined || state === null) return ''; + + return state; + } + + public compare(data: IObjectData): boolean + { + return false; + } + + public getValue(key: string): string + { + return this._data[key]; + } + + public get rarityLevel(): number + { + if(!this._data) return -1; + + const state = this._data[MapDataType.RARITY]; + + if(state === undefined || state === null) return -1; + + return parseInt(state); + } + + // TODO: How to get the keys? + public get data() + { + return this._data; + } + +} diff --git a/submodules/renderer/src/api/nitro/room/object/data/type/NumberDataType.ts b/submodules/renderer/src/api/nitro/room/object/data/type/NumberDataType.ts new file mode 100644 index 0000000..2790189 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/type/NumberDataType.ts @@ -0,0 +1,91 @@ +import { IMessageDataWrapper } from '../../../../../communication'; +import { IRoomObjectModel } from '../../../../../room'; +import { RoomObjectVariable } from '../../RoomObjectVariable'; +import { IObjectData } from '../IObjectData'; +import { ObjectDataBase } from '../ObjectDataBase'; +import { ObjectDataKey } from '../ObjectDataKey'; + +export class NumberDataType extends ObjectDataBase +{ + public static FORMAT_KEY = ObjectDataKey.NUMBER_KEY; + + private static STATE: number = 0; + + private _data: number[]; + + constructor() + { + super(); + + this._data = []; + } + + public parseWrapper(wrapper: IMessageDataWrapper): void + { + if(!wrapper) return; + + this._data = []; + + const totalNumbers = wrapper.readInt(); + + if(totalNumbers) for(let i = 0; i < totalNumbers; i++) this._data.push(wrapper.readInt()); + + super.parseWrapper(wrapper); + } + + public initializeFromRoomObjectModel(model: IRoomObjectModel): void + { + super.initializeFromRoomObjectModel(model); + + this._data = model.getValue(RoomObjectVariable.FURNITURE_DATA); + } + + public writeRoomObjectModel(model: IRoomObjectModel): void + { + super.writeRoomObjectModel(model); + + model.setValue(RoomObjectVariable.FURNITURE_DATA_FORMAT, NumberDataType.FORMAT_KEY); + model.setValue(RoomObjectVariable.FURNITURE_DATA, this._data); + } + + public getLegacyString(): string + { + if(!this._data || !this._data.length) return ''; + + return this._data[NumberDataType.STATE].toString(); + } + + public compare(data: IObjectData): boolean + { + if(!(data instanceof NumberDataType)) return false; + + let i = 0; + + while(i < this._data.length) + { + if(i === 0) + { + // + } + else + { + if(this._data[i] !== data.getValue(i)) return false; + } + + i++; + } + + return true; + } + + public getValue(index: number): number + { + if(!this._data || !this._data.length) return -1; + + const value = this._data[index]; + + if(value === undefined || value === null) return -1; + + return value; + } +} diff --git a/submodules/renderer/src/api/nitro/room/object/data/type/StringDataType.ts b/submodules/renderer/src/api/nitro/room/object/data/type/StringDataType.ts new file mode 100644 index 0000000..7101854 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/type/StringDataType.ts @@ -0,0 +1,90 @@ +import { IMessageDataWrapper } from '../../../../../communication'; +import { IRoomObjectModel } from '../../../../../room'; +import { RoomObjectVariable } from '../../RoomObjectVariable'; +import { IObjectData } from '../IObjectData'; +import { ObjectDataBase } from '../ObjectDataBase'; +import { ObjectDataKey } from '../ObjectDataKey'; + +export class StringDataType extends ObjectDataBase +{ + public static FORMAT_KEY = ObjectDataKey.STRING_KEY; + + private static STATE: number = 0; + + private _data: string[]; + + constructor() + { + super(); + + this._data = []; + } + + public parseWrapper(wrapper: IMessageDataWrapper): void + { + if(!wrapper) return; + + this._data = []; + + const totalStrings = wrapper.readInt(); + + if(totalStrings) for(let i = 0; i < totalStrings; i++) this._data.push(wrapper.readString()); + + super.parseWrapper(wrapper); + } + + public initializeFromRoomObjectModel(model: IRoomObjectModel): void + { + super.initializeFromRoomObjectModel(model); + + this._data = model.getValue(RoomObjectVariable.FURNITURE_DATA); + } + + public writeRoomObjectModel(model: IRoomObjectModel): void + { + super.writeRoomObjectModel(model); + + model.setValue(RoomObjectVariable.FURNITURE_DATA_FORMAT, StringDataType.FORMAT_KEY); + model.setValue(RoomObjectVariable.FURNITURE_DATA, this._data); + } + + public getLegacyString(): string + { + if(!this._data || !this._data.length) return ''; + + return this._data[StringDataType.STATE]; + } + + public compare(data: IObjectData): boolean + { + if(!(data instanceof StringDataType)) return false; + + let i = 0; + + while(i < this._data.length) + { + if(i === 0) + { + // + } + else + { + if(this._data[i] !== data.getValue(i)) return false; + } + + i++; + } + + return true; + } + + public getValue(index: number): string + { + return this._data[index] || ''; + } + + public setValue(data: string[]): void + { + this._data = data; + } +} diff --git a/submodules/renderer/src/api/nitro/room/object/data/type/VoteDataType.ts b/submodules/renderer/src/api/nitro/room/object/data/type/VoteDataType.ts new file mode 100644 index 0000000..5650361 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/type/VoteDataType.ts @@ -0,0 +1,66 @@ +import { IMessageDataWrapper } from '../../../../../communication'; +import { IRoomObjectModel } from '../../../../../room'; +import { RoomObjectVariable } from '../../RoomObjectVariable'; +import { IObjectData } from '../IObjectData'; +import { ObjectDataBase } from '../ObjectDataBase'; +import { ObjectDataKey } from '../ObjectDataKey'; + +export class VoteDataType extends ObjectDataBase +{ + public static FORMAT_KEY = ObjectDataKey.VOTE_KEY; + + private _state: string; + private _result: number; + + constructor() + { + super(); + + this._state = ''; + this._result = 0; + } + + public parseWrapper(wrapper: IMessageDataWrapper): void + { + if(!wrapper) return; + + this._state = wrapper.readString(); + this._result = wrapper.readInt(); + + super.parseWrapper(wrapper); + } + + public writeRoomObjectModel(model: IRoomObjectModel): void + { + super.writeRoomObjectModel(model); + + model.setValue(RoomObjectVariable.FURNITURE_DATA_FORMAT, VoteDataType.FORMAT_KEY); + + const data: { [index: string]: string } = {}; + + data['S'] = this._state; + data['R'] = this._result.toString(); + + model.setValue(RoomObjectVariable.FURNITURE_DATA, data); + } + + public getLegacyString(): string + { + return this._state; + } + + public compare(data: IObjectData): boolean + { + return true; + } + + public setString(state: string): void + { + this._state = state; + } + + public get result(): number + { + return this._result; + } +} diff --git a/submodules/renderer/src/api/nitro/room/object/data/type/index.ts b/submodules/renderer/src/api/nitro/room/object/data/type/index.ts new file mode 100644 index 0000000..6f81bc5 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/data/type/index.ts @@ -0,0 +1,9 @@ +export * from './CrackableDataType'; +export * from './EmptyDataType'; +export * from './HighScoreData'; +export * from './HighScoreDataType'; +export * from './LegacyDataType'; +export * from './MapDataType'; +export * from './NumberDataType'; +export * from './StringDataType'; +export * from './VoteDataType'; diff --git a/submodules/renderer/src/api/nitro/room/object/index.ts b/submodules/renderer/src/api/nitro/room/object/index.ts new file mode 100644 index 0000000..b2bff00 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/object/index.ts @@ -0,0 +1,11 @@ +export * from './data'; +export * from './data/type'; +export * from './IPetFigureData'; +export * from './IRoomMapData'; +export * from './RoomObjectCategory'; +export * from './RoomObjectLogicType'; +export * from './RoomObjectOperationType'; +export * from './RoomObjectType'; +export * from './RoomObjectUserType'; +export * from './RoomObjectVariable'; +export * from './RoomObjectVisualizationType'; diff --git a/submodules/renderer/src/api/nitro/room/utils/IFurnitureStackingHeightMap.ts b/submodules/renderer/src/api/nitro/room/utils/IFurnitureStackingHeightMap.ts new file mode 100644 index 0000000..5427932 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/utils/IFurnitureStackingHeightMap.ts @@ -0,0 +1,11 @@ +export interface IFurnitureStackingHeightMap +{ + dispose: () => void; + getTileHeight(x: number, y: number): number; + setTileHeight(x: number, y: number, height: number): void; + setStackingBlocked(x: number, y: number, isNotStackable: boolean): void; + setIsRoomTile(x: number, y: number, isRoomTile: boolean): void; + validateLocation(k: number, _arg_2: number, _arg_3: number, _arg_4: number, _arg_5: number, _arg_6: number, _arg_7: number, _arg_8: number, _arg_9: boolean, _arg_10?: number): boolean; + readonly width: number; + readonly height: number; +} diff --git a/submodules/renderer/src/api/nitro/room/utils/ILegacyWallGeometry.ts b/submodules/renderer/src/api/nitro/room/utils/ILegacyWallGeometry.ts new file mode 100644 index 0000000..1ce25a9 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/utils/ILegacyWallGeometry.ts @@ -0,0 +1,18 @@ +import { IVector3D } from '../../../room'; + +export interface ILegacyWallGeometry +{ + dispose: () => void; + readonly disposed: boolean; + scale: number; + initialize(width: number, height: number, floorHeight: number): void; + setHeight(x: number, y: number, height: number): boolean; + getHeight(x: number, y: number): number; + getLocation(k: number, _arg_2: number, _arg_3: number, _arg_4: number, _arg_5: string): IVector3D; + getLocationOldFormat(k: number, _arg_2: number, _arg_3: string): IVector3D; + getOldLocation(k: IVector3D, _arg_2: number): [number, number, number, number, string]; + getOldLocationString(k: IVector3D, _arg_2: number): string; + getDirection(k: string): number; + getFloorAltitude(k: number, _arg_2: number): number; + isRoomTile(k: number, _arg_2: number): boolean; +} diff --git a/submodules/renderer/src/api/nitro/room/utils/ITileObjectMap.ts b/submodules/renderer/src/api/nitro/room/utils/ITileObjectMap.ts new file mode 100644 index 0000000..b7fda05 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/utils/ITileObjectMap.ts @@ -0,0 +1,11 @@ +import { IRoomObject } from '../../../room'; + +export interface ITileObjectMap +{ + clear(): void; + populate(k: IRoomObject[]): void; + dispose(): void; + getObjectIntTile(k: number, _arg_2: number): IRoomObject; + setObjectInTile(k: number, _arg_2: number, _arg_3: IRoomObject): void; + addRoomObject(k: IRoomObject): void; +} diff --git a/submodules/renderer/src/api/nitro/room/utils/ObjectRolling.ts b/submodules/renderer/src/api/nitro/room/utils/ObjectRolling.ts new file mode 100644 index 0000000..15cbc4f --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/utils/ObjectRolling.ts @@ -0,0 +1,40 @@ +import { IVector3D } from '../../../room'; + +export class ObjectRolling +{ + public static MOVE: string = 'mv'; + public static SLIDE: string = 'sld'; + + private _id: number; + private _location: IVector3D; + private _targetLocation: IVector3D; + private _movementType: string; + + constructor(id: number, location: IVector3D, targetLocation: IVector3D, movementType: string = null) + { + this._id = id; + this._location = location; + this._targetLocation = targetLocation; + this._movementType = movementType; + } + + public get id(): number + { + return this._id; + } + + public get location(): IVector3D + { + return this._location; + } + + public get targetLocation(): IVector3D + { + return this._targetLocation; + } + + public get movementType(): string + { + return this._movementType; + } +} diff --git a/submodules/renderer/src/api/nitro/room/utils/index.ts b/submodules/renderer/src/api/nitro/room/utils/index.ts new file mode 100644 index 0000000..e8d1668 --- /dev/null +++ b/submodules/renderer/src/api/nitro/room/utils/index.ts @@ -0,0 +1,4 @@ +export * from './IFurnitureStackingHeightMap'; +export * from './ILegacyWallGeometry'; +export * from './ITileObjectMap'; +export * from './ObjectRolling'; diff --git a/submodules/renderer/src/api/nitro/session/FurnitureType.ts b/submodules/renderer/src/api/nitro/session/FurnitureType.ts new file mode 100644 index 0000000..7f8aff0 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/FurnitureType.ts @@ -0,0 +1,10 @@ +export enum FurnitureType +{ + FLOOR = 'S', + WALL = 'I', + EFFECT = 'E', + BADGE = 'B', + ROBOT = 'R', + HABBO_CLUB = 'H', + PET = 'P' +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/session/IFurnitureData.ts b/submodules/renderer/src/api/nitro/session/IFurnitureData.ts new file mode 100644 index 0000000..0ebc9c7 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IFurnitureData.ts @@ -0,0 +1,33 @@ +export interface IFurnitureData +{ + type: string; + id: number; + className: string; + fullName: string; + category: string; + hasIndexedColor: boolean; + colorIndex: number; + revision: number; + tileSizeX: number; + tileSizeY: number; + tileSizeZ: number; + colors: number[]; + name: string; + description: string; + adUrl: string; + purchaseOfferId: number; + rentOfferId: number; + customParams: string; + specialType: number; + purchaseCouldBeUsedForBuyout: boolean; + rentCouldBeUsedForBuyout: boolean; + availableForBuildersClub: boolean; + canStandOn: boolean; + canSitOn: boolean; + canLayOn: boolean; + isExternalImage: boolean; + excludeDynamic: boolean; + furniLine: string; + environment: string; + rare: boolean; +} diff --git a/submodules/renderer/src/api/nitro/session/IFurnitureDataListener.ts b/submodules/renderer/src/api/nitro/session/IFurnitureDataListener.ts new file mode 100644 index 0000000..e94ec16 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IFurnitureDataListener.ts @@ -0,0 +1,4 @@ +export interface IFurnitureDataListener +{ + loadFurnitureData(): void; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/session/IGroupInformationManager.ts b/submodules/renderer/src/api/nitro/session/IGroupInformationManager.ts new file mode 100644 index 0000000..999b084 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IGroupInformationManager.ts @@ -0,0 +1,7 @@ +import { IDisposable } from '../../common'; + +export interface IGroupInformationManager extends IDisposable +{ + init(): void; + getGroupBadge(groupId: number): string; +} diff --git a/submodules/renderer/src/api/nitro/session/IIgnoredUsersManager.ts b/submodules/renderer/src/api/nitro/session/IIgnoredUsersManager.ts new file mode 100644 index 0000000..85ee7e5 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IIgnoredUsersManager.ts @@ -0,0 +1,9 @@ +export interface IIgnoredUsersManager +{ + init(): void; + requestIgnoredUsers(): void; + ignoreUserId(id: number): void; + ignoreUser(name: string): void; + unignoreUser(name: string): void; + isIgnored(name: string): boolean; +} diff --git a/submodules/renderer/src/api/nitro/session/IPollChoice.ts b/submodules/renderer/src/api/nitro/session/IPollChoice.ts new file mode 100644 index 0000000..e645676 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IPollChoice.ts @@ -0,0 +1,6 @@ +export interface IPollChoice +{ + value: string; + choiceText: string; + choiceType: number; +} diff --git a/submodules/renderer/src/api/nitro/session/IPollQuestion.ts b/submodules/renderer/src/api/nitro/session/IPollQuestion.ts new file mode 100644 index 0000000..d85fd9f --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IPollQuestion.ts @@ -0,0 +1,14 @@ +import { IPollChoice } from './IPollChoice'; + +export interface IPollQuestion +{ + questionId: number; + questionType: number; + sortOrder: number; + questionText: string; + questionCategory: number; + questionAnswerType: number; + questionAnswerCount: number; + children: IPollQuestion[]; + questionChoices: IPollChoice[]; +} diff --git a/submodules/renderer/src/api/nitro/session/IProductData.ts b/submodules/renderer/src/api/nitro/session/IProductData.ts new file mode 100644 index 0000000..95cf4d1 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IProductData.ts @@ -0,0 +1,6 @@ +export interface IProductData +{ + type: string; + name: string; + description: string; +} diff --git a/submodules/renderer/src/api/nitro/session/IProductDataListener.ts b/submodules/renderer/src/api/nitro/session/IProductDataListener.ts new file mode 100644 index 0000000..463b1e5 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IProductDataListener.ts @@ -0,0 +1,6 @@ +import { IDisposable } from '../../../api'; + +export interface IProductDataListener extends IDisposable +{ + loadProductData(): void; +} diff --git a/submodules/renderer/src/api/nitro/session/IQuestion.ts b/submodules/renderer/src/api/nitro/session/IQuestion.ts new file mode 100644 index 0000000..fdd1b3f --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IQuestion.ts @@ -0,0 +1,12 @@ +export interface IQuestion +{ + id: number; + number: number; + type: number; + content: string; + selection_min?: number; + selections?: string[]; + selection_values?: string[]; + selection_count?: number; + selection_max?: number; +} diff --git a/submodules/renderer/src/api/nitro/session/IRoomHandlerListener.ts b/submodules/renderer/src/api/nitro/session/IRoomHandlerListener.ts new file mode 100644 index 0000000..cf364cb --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IRoomHandlerListener.ts @@ -0,0 +1,10 @@ +import { IEventDispatcher } from '../../common'; +import { IRoomSession } from './IRoomSession'; + +export interface IRoomHandlerListener +{ + getSession(id: number): IRoomSession; + sessionUpdate(id: number, type: string): void; + sessionReinitialize(fromRoomId: number, toRoomId: number): void; + events: IEventDispatcher; +} diff --git a/submodules/renderer/src/api/nitro/session/IRoomModerationSettings.ts b/submodules/renderer/src/api/nitro/session/IRoomModerationSettings.ts new file mode 100644 index 0000000..bf9428c --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IRoomModerationSettings.ts @@ -0,0 +1,6 @@ +export interface IRoomModerationSettings +{ + readonly allowMute: number; + readonly allowKick: number; + readonly allowBan: number; +} diff --git a/submodules/renderer/src/api/nitro/session/IRoomPetData.ts b/submodules/renderer/src/api/nitro/session/IRoomPetData.ts new file mode 100644 index 0000000..70dfbbc --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IRoomPetData.ts @@ -0,0 +1,30 @@ +export interface IRoomPetData +{ + id: number; + level: number; + maximumLevel: number; + experience: number; + levelExperienceGoal: number; + energy: number; + maximumEnergy: number; + happyness: number; + maximumHappyness: number; + ownerId: number; + ownerName: string; + respect: number; + age: number; + unknownRarity: number; + saddle: boolean; + rider: boolean; + skillTresholds: number[]; + publiclyRideable: number; + breedable: boolean; + fullyGrown: boolean; + dead: boolean; + rarityLevel: number; + maximumTimeToLive: number; + remainingTimeToLive: number; + remainingGrowTime: number; + publiclyBreedable: boolean; + readonly adultLevel: number; +} diff --git a/submodules/renderer/src/api/nitro/session/IRoomSession.ts b/submodules/renderer/src/api/nitro/session/IRoomSession.ts new file mode 100644 index 0000000..3c9b084 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IRoomSession.ts @@ -0,0 +1,68 @@ +import { IDisposable } from '../../common'; +import { IConnection } from '../../communication'; +import { IRoomModerationSettings } from './IRoomModerationSettings'; +import { IUserDataManager } from './IUserDataManager'; + +export interface IRoomSession extends IDisposable +{ + openGift(objectId: number): void; + setConnection(connection: IConnection): void; + setControllerLevel(level: number): void; + setOwnRoomIndex(roomIndex: number): void; + setRoomOwner(): void; + start(): boolean; + reset(roomId: number): void; + sendChatMessage(text: string, styleId: number): void; + sendShoutMessage(text: string, styleId: number): void; + sendWhisperMessage(recipientName: string, text: string, styleId: number): void; + sendChatTypingMessage(isTyping: boolean): void; + sendMottoMessage(motto: string): void; + sendDanceMessage(danceId: number): void; + sendExpressionMessage(expression: number): void; + sendSignMessage(sign: number): void; + sendPostureMessage(posture: number): void; + sendDoorbellApprovalMessage(userName: string, flag: boolean): void; + sendAmbassadorAlertMessage(userId: number): void; + sendKickMessage(userId: number): void; + sendMuteMessage(userId: number, minutes: number): void; + sendBanMessage(userId: number, type: string): void; + sendGiveRightsMessage(userId: number): void; + sendTakeRightsMessage(userId: number): void; + sendPollStartMessage(pollId: number): void; + sendPollRejectMessage(pollId: number): void; + sendPollAnswerMessage(pollId: number, questionId: number, answers: string[]): void; + votePoll(counter: number): void; + sendPeerUsersClassificationMessage(userClassType: string): void; + sendRoomUsersClassificationMessage(userClassType: string): void; + updateMoodlightData(id: number, effectId: number, color: number, brightness: number, apply: boolean): void; + toggleMoodlightState(): void; + pickupPet(id: number): void; + pickupBot(id: number): void; + requestMoodlightSettings(): void; + mountPet(id: number): void; + dismountPet(id: number): void; + usePetProduct(itemId: number, petId: number): void; + removePetSaddle(id: number): void; + togglePetBreeding(id: number): void; + togglePetRiding(id: number): void; + useMultistateItem(id: number): void; + harvestPet(id: number): void; + compostPlant(id: number): void; + requestPetCommands(id: number): void; + sendScriptProceed(): void; + connection: IConnection; + userDataManager: IUserDataManager; + roomId: number; + state: string; + tradeMode: number; + isPrivateRoom: boolean; + doorMode: number; + allowPets: boolean; + controllerLevel: number; + ownRoomIndex: number; + isGuildRoom: boolean; + isRoomOwner: boolean; + isDecorating: boolean; + isSpectator: boolean; + moderationSettings: IRoomModerationSettings; +} diff --git a/submodules/renderer/src/api/nitro/session/IRoomSessionManager.ts b/submodules/renderer/src/api/nitro/session/IRoomSessionManager.ts new file mode 100644 index 0000000..28f2118 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IRoomSessionManager.ts @@ -0,0 +1,13 @@ +import { INitroManager } from '../../common'; +import { INitroCommunicationManager } from '../communication'; +import { IRoomSession } from './IRoomSession'; + +export interface IRoomSessionManager extends INitroManager +{ + getSession(id: number): IRoomSession; + createSession(roomId: number, password?: string): boolean; + startSession(session: IRoomSession): boolean; + removeSession(id: number, openLandingView?: boolean): void; + communication: INitroCommunicationManager; + viewerSession: IRoomSession; +} diff --git a/submodules/renderer/src/api/nitro/session/IRoomUserData.ts b/submodules/renderer/src/api/nitro/session/IRoomUserData.ts new file mode 100644 index 0000000..09eaa57 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IRoomUserData.ts @@ -0,0 +1,26 @@ +export interface IRoomUserData +{ + readonly roomIndex: number; + activityPoints: number; + name: string; + type: number; + sex: string; + figure: string; + custom: string; + webID: number; + groupId: number; + groupName: string; + groupStatus: number; + ownerId: number; + ownerName: string; + rarityLevel: number; + hasSaddle: boolean; + isRiding: boolean; + canBreed: boolean; + canHarvest: boolean; + canRevive: boolean; + hasBreedingPermission: boolean; + petLevel: number; + botSkills: number[]; + isModerator: boolean; +} diff --git a/submodules/renderer/src/api/nitro/session/ISessionDataManager.ts b/submodules/renderer/src/api/nitro/session/ISessionDataManager.ts new file mode 100644 index 0000000..8d26861 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/ISessionDataManager.ts @@ -0,0 +1,58 @@ +import { Resource, Texture } from '@pixi/core'; +import { INitroManager } from '../../common'; +import { INitroCommunicationManager } from '../communication'; +import { IFurnitureData } from './IFurnitureData'; +import { IFurnitureDataListener } from './IFurnitureDataListener'; +import { IGroupInformationManager } from './IGroupInformationManager'; +import { IIgnoredUsersManager } from './IIgnoredUsersManager'; +import { IProductData } from './IProductData'; + +export interface ISessionDataManager extends INitroManager +{ + getAllFurnitureData(listener: IFurnitureDataListener): IFurnitureData[]; + removePendingFurniDataListener(listener: IFurnitureDataListener): void; + getFloorItemData(id: number): IFurnitureData; + getFloorItemDataByName(name: string): IFurnitureData; + getWallItemData(id: number): IFurnitureData; + getWallItemDataByName(name: string): IFurnitureData; + getProductData(type: string): IProductData; + getBadgeUrl(name: string): string; + getGroupBadgeUrl(name: string): string; + getBadgeImage(name: string): Texture; + getUserTags(roomUnitId: number): string[]; + loadBadgeImage(name: string): string; + getGroupBadgeImage(name: string): Texture; + loadGroupBadgeImage(name: string): string; + hasSecurity(level: number): boolean; + giveRespect(userId: number): void; + givePetRespect(petId: number): void; + sendSpecialCommandMessage(text: string, styleId?: number): void; + ignoreUser(name: string): void; + unignoreUser(name: string): void; + isUserIgnored(name: string): boolean; + getGroupBadge(groupId: number): string; + communication: INitroCommunicationManager; + userId: number; + userName: string; + figure: string; + gender: string; + realName: string; + ignoredUsersManager: IIgnoredUsersManager; + groupInformationManager: IGroupInformationManager; + respectsReceived: number; + respectsLeft: number; + respectsPetLeft: number; + canChangeName: boolean; + clubLevel: number; + securityLevel: number; + isAmbassador: boolean; + isNoob: boolean; + isRealNoob: boolean; + isSystemOpen: boolean; + isSystemShutdown: boolean; + isAuthenticHabbo: boolean; + isModerator: boolean; + isCameraFollowDisabled: boolean; + uiFlags: number; + tags: string[]; +} diff --git a/submodules/renderer/src/api/nitro/session/IUserDataManager.ts b/submodules/renderer/src/api/nitro/session/IUserDataManager.ts new file mode 100644 index 0000000..3a10791 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/IUserDataManager.ts @@ -0,0 +1,26 @@ +import { IConnection } from '../../communication'; +import { IRoomUserData } from './IRoomUserData'; + +export interface IUserDataManager +{ + setConnection(connection: IConnection): void; + getUserData(webID: number): IRoomUserData; + getPetData(webID: number): IRoomUserData; + getBotData(webID: number): IRoomUserData; + getRentableBotData(webID: number): IRoomUserData; + getDataByType(webID: number, type: number): IRoomUserData; + getUserDataByIndex(roomIndex: number): IRoomUserData; + getUserDataByName(name: string): IRoomUserData; + updateUserData(data: IRoomUserData): void; + removeUserData(roomIndex: number): void; + getUserBadges(userId: number): string[]; + setUserBadges(userId: number, badges: string[]): void; + updateFigure(roomIndex: number, figure: string, sex: string, hasSaddle: boolean, isRiding: boolean): void; + updateName(roomIndex: number, name: string): void; + updateMotto(roomIndex: number, custom: string): void; + updateAchievementScore(roomIndex: number, score: number): void; + updatePetLevel(roomIndex: number, level: number): void; + updatePetBreedingStatus(roomIndex: number, canBreed: boolean, canHarvest: boolean, canRevive: boolean, hasBreedingPermission: boolean): void; + requestPetInfo(id: number): void; + connection: IConnection; +} diff --git a/submodules/renderer/src/api/nitro/session/enum/GenericErrorEnum.ts b/submodules/renderer/src/api/nitro/session/enum/GenericErrorEnum.ts new file mode 100644 index 0000000..611139b --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/enum/GenericErrorEnum.ts @@ -0,0 +1,5 @@ +export class GenericErrorEnum +{ + public static KICKED_OUT_OF_ROOM: number = 4008; + public static STRIP_LOCKED_FOR_TRADING: number = -13001; +} diff --git a/submodules/renderer/src/api/nitro/session/enum/NoobnessLevelEnum.ts b/submodules/renderer/src/api/nitro/session/enum/NoobnessLevelEnum.ts new file mode 100644 index 0000000..c9aecaf --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/enum/NoobnessLevelEnum.ts @@ -0,0 +1,6 @@ +export class NoobnessLevelEnum +{ + public static OLD_IDENTITY: number = 0; + public static NEW_IDENTITY: number = 1; + public static REAL_NOOB: number = 2; +} diff --git a/submodules/renderer/src/api/nitro/session/enum/RoomControllerLevel.ts b/submodules/renderer/src/api/nitro/session/enum/RoomControllerLevel.ts new file mode 100644 index 0000000..ecd6309 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/enum/RoomControllerLevel.ts @@ -0,0 +1,9 @@ +export class RoomControllerLevel +{ + public static NONE: number = 0; + public static GUEST: number = 1; + public static GUILD_MEMBER: number = 2; + public static GUILD_ADMIN: number = 3; + public static ROOM_OWNER: number = 4; + public static MODERATOR: number = 5; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/session/enum/RoomTradingLevelEnum.ts b/submodules/renderer/src/api/nitro/session/enum/RoomTradingLevelEnum.ts new file mode 100644 index 0000000..be0b1e4 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/enum/RoomTradingLevelEnum.ts @@ -0,0 +1,22 @@ +export class RoomTradingLevelEnum +{ + public static NO_TRADING: number = 0; + public static ROOM_CONTROLLER_REQUIRED: number = 1; + public static FREE_TRADING: number = 2; + + + public static getLocalizationKey(k: number): string + { + switch(k) + { + case RoomTradingLevelEnum.FREE_TRADING: + return '${trading.mode.free}'; + case RoomTradingLevelEnum.ROOM_CONTROLLER_REQUIRED: + return '${trading.mode.controller}'; + case RoomTradingLevelEnum.NO_TRADING: + return '${trading.mode.not.allowed}'; + } + + return ''; + } +} diff --git a/submodules/renderer/src/api/nitro/session/enum/SecurityLevel.ts b/submodules/renderer/src/api/nitro/session/enum/SecurityLevel.ts new file mode 100644 index 0000000..9b3011e --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/enum/SecurityLevel.ts @@ -0,0 +1,13 @@ +export class SecurityLevel +{ + public static SUPER_USER: number = 9; + public static ADMINISTRATOR: number = 8; + public static COMMUNITY: number = 7; + public static PLAYER_SUPPORT: number = 6; + public static MODERATOR: number = 5; + public static EMPLOYEE: number = 4; + public static BUS_PARTNER: number = 3; + public static PARTNER: number = 2; + public static CELEBRITY: number = 1; + public static NONE: number = 0; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/nitro/session/enum/index.ts b/submodules/renderer/src/api/nitro/session/enum/index.ts new file mode 100644 index 0000000..1e96fd3 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/enum/index.ts @@ -0,0 +1,5 @@ +export * from './GenericErrorEnum'; +export * from './NoobnessLevelEnum'; +export * from './RoomControllerLevel'; +export * from './RoomTradingLevelEnum'; +export * from './SecurityLevel'; diff --git a/submodules/renderer/src/api/nitro/session/index.ts b/submodules/renderer/src/api/nitro/session/index.ts new file mode 100644 index 0000000..0607986 --- /dev/null +++ b/submodules/renderer/src/api/nitro/session/index.ts @@ -0,0 +1,19 @@ +export * from './enum'; +export * from './FurnitureType'; +export * from './IFurnitureData'; +export * from './IFurnitureDataListener'; +export * from './IGroupInformationManager'; +export * from './IIgnoredUsersManager'; +export * from './IPollChoice'; +export * from './IPollQuestion'; +export * from './IProductData'; +export * from './IProductDataListener'; +export * from './IQuestion'; +export * from './IRoomHandlerListener'; +export * from './IRoomModerationSettings'; +export * from './IRoomPetData'; +export * from './IRoomSession'; +export * from './IRoomSessionManager'; +export * from './IRoomUserData'; +export * from './ISessionDataManager'; +export * from './IUserDataManager'; diff --git a/submodules/renderer/src/api/nitro/sound/IMusicController.ts b/submodules/renderer/src/api/nitro/sound/IMusicController.ts new file mode 100644 index 0000000..ec3c109 --- /dev/null +++ b/submodules/renderer/src/api/nitro/sound/IMusicController.ts @@ -0,0 +1,25 @@ +import { IAdvancedMap } from '../../utils'; +import { ISongInfo } from './common'; +import { IPlaylistController } from './IPlaylistController'; + +export interface IMusicController +{ + getRoomItemPlaylist(_arg_1?: number): IPlaylistController; + getSongDiskInventorySize(): number; + getSongDiskInventoryDiskId(_arg_1: number): number; + getSongDiskInventorySongId(_arg_1: number): number; + getSongInfo(_arg_1: number): ISongInfo; + getSongIdPlayingAtPriority(_arg_1: number): number; + playSong(songId: number, priority: number, startPos?: number, playLength?: number, fadeInSeconds?: number, fadeOutSeconds?: number): boolean; + stop(priority: number): void; + addSongInfoRequest(_arg_1: number): void; + requestSongInfoWithoutSamples(_arg_1: number): void; + requestUserSongDisks(): void; + onSongLoaded(_arg_1: number): void; + updateVolume(_arg_1: number): void; + samplesUnloaded(_arg_1: number[]): void; + get samplesIdsInUse(): number[]; + get songDiskInventory(): IAdvancedMap + init(): void; + dispose(): void; +} diff --git a/submodules/renderer/src/api/nitro/sound/IPlaylistController.ts b/submodules/renderer/src/api/nitro/sound/IPlaylistController.ts new file mode 100644 index 0000000..a8feea3 --- /dev/null +++ b/submodules/renderer/src/api/nitro/sound/IPlaylistController.ts @@ -0,0 +1,15 @@ +import { ISongInfo } from './common/ISongInfo'; + +export interface IPlaylistController +{ + get priority():number; + get length():number; + get playPosition():number; + get nowPlayingSongId():number; + get isPlaying():boolean; + get entries(): ISongInfo[]; + getEntry(_arg_1: number):ISongInfo; + requestPlayList():void; + init(): void; + dispose():void; +} diff --git a/submodules/renderer/src/api/nitro/sound/ISoundManager.ts b/submodules/renderer/src/api/nitro/sound/ISoundManager.ts new file mode 100644 index 0000000..e0bbb0f --- /dev/null +++ b/submodules/renderer/src/api/nitro/sound/ISoundManager.ts @@ -0,0 +1,8 @@ +import { INitroManager } from '../../common'; +import { IMusicController } from './IMusicController'; + +export interface ISoundManager extends INitroManager +{ + get musicController(): IMusicController; + get traxVolume(): number; +} diff --git a/submodules/renderer/src/api/nitro/sound/common/ISongInfo.ts b/submodules/renderer/src/api/nitro/sound/common/ISongInfo.ts new file mode 100644 index 0000000..475b75d --- /dev/null +++ b/submodules/renderer/src/api/nitro/sound/common/ISongInfo.ts @@ -0,0 +1,12 @@ +export interface ISongInfo +{ + //get loaded():boolean; + get id():number; + get diskId():number; + set diskId(id: number); + get length():number; + get name():string; + get creator():string; + get songData():string; + //get soundObject():IHabboSound; +} diff --git a/submodules/renderer/src/api/nitro/sound/common/index.ts b/submodules/renderer/src/api/nitro/sound/common/index.ts new file mode 100644 index 0000000..c6c8783 --- /dev/null +++ b/submodules/renderer/src/api/nitro/sound/common/index.ts @@ -0,0 +1 @@ +export * from './ISongInfo'; diff --git a/submodules/renderer/src/api/nitro/sound/index.ts b/submodules/renderer/src/api/nitro/sound/index.ts new file mode 100644 index 0000000..37eb921 --- /dev/null +++ b/submodules/renderer/src/api/nitro/sound/index.ts @@ -0,0 +1,4 @@ +export * from './common'; +export * from './IMusicController'; +export * from './IPlaylistController'; +export * from './ISoundManager'; diff --git a/submodules/renderer/src/api/room/IPetBreedingResultData.ts b/submodules/renderer/src/api/room/IPetBreedingResultData.ts new file mode 100644 index 0000000..b3f8985 --- /dev/null +++ b/submodules/renderer/src/api/room/IPetBreedingResultData.ts @@ -0,0 +1,10 @@ +export interface IPetBreedingResultData +{ + readonly stuffId: number; + readonly classId: number; + readonly productCode: string; + readonly userId: number; + readonly userName: string; + readonly rarityLevel: number; + readonly hasMutation: boolean; +} diff --git a/submodules/renderer/src/api/room/IRoomGeometry.ts b/submodules/renderer/src/api/room/IRoomGeometry.ts new file mode 100644 index 0000000..1ee0bc3 --- /dev/null +++ b/submodules/renderer/src/api/room/IRoomGeometry.ts @@ -0,0 +1,21 @@ +import { Point } from '@pixi/math'; +import { IVector3D } from './IVector3D'; + +export interface IRoomGeometry +{ + getCoordinatePosition(_arg_1: IVector3D): IVector3D; + getScreenPoint(_arg_1: IVector3D): Point; + getScreenPosition(_arg_1: IVector3D): IVector3D; + getPlanePosition(_arg_1: Point, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D): Point; + setDisplacement(_arg_1: IVector3D, _arg_2: IVector3D): void; + adjustLocation(_arg_1: IVector3D, _arg_2: number): void; + performZoom(): void; + performZoomOut(): void; + performZoomIn(): void; + isZoomedIn(): boolean; + updateId: number; + z_scale: number; + scale: number; + directionAxis: IVector3D; + direction: IVector3D; +} diff --git a/submodules/renderer/src/api/room/IRoomInstance.ts b/submodules/renderer/src/api/room/IRoomInstance.ts new file mode 100644 index 0000000..838096b --- /dev/null +++ b/submodules/renderer/src/api/room/IRoomInstance.ts @@ -0,0 +1,27 @@ +import { IDisposable } from '../../api'; +import { IRoomInstanceContainer } from './IRoomInstanceContainer'; +import { IRoomObjectManager } from './IRoomObjectManager'; +import { IRoomObject, IRoomObjectModel } from './object'; +import { IRoomRendererBase } from './renderer'; + +export interface IRoomInstance extends IDisposable +{ + setRenderer(renderer: IRoomRendererBase): void; + getManager(category: number): IRoomObjectManager; + getTotalObjectsForManager(category: number): number; + getRoomObject(id: number, category: number): IRoomObject; + getRoomObjectsForCategory(category: number): IRoomObject[]; + getRoomObjectByIndex(index: number, category: number): IRoomObject; + createRoomObject(id: number, stateCount: number, type: string, category: number): IRoomObject; + createRoomObjectAndInitalize(objectId: number, type: string, category: number): IRoomObject; + removeRoomObject(id: number, category: number): void; + removeAllManagers(): void; + addUpdateCategory(category: number): void; + removeUpdateCategory(category: number): void; + update(time: number, update?: boolean): void; + id: string; + container: IRoomInstanceContainer; + renderer: IRoomRendererBase; + managers: Map; + model: IRoomObjectModel; +} diff --git a/submodules/renderer/src/api/room/IRoomInstanceContainer.ts b/submodules/renderer/src/api/room/IRoomInstanceContainer.ts new file mode 100644 index 0000000..efe5184 --- /dev/null +++ b/submodules/renderer/src/api/room/IRoomInstanceContainer.ts @@ -0,0 +1,8 @@ +import { IRoomObjectManager } from './IRoomObjectManager'; +import { IRoomObject } from './object'; + +export interface IRoomInstanceContainer +{ + createRoomObjectAndInitalize(roomId: string, objectId: number, type: string, category: number): IRoomObject; + createRoomObjectManager(category: number): IRoomObjectManager; +} diff --git a/submodules/renderer/src/api/room/IRoomManager.ts b/submodules/renderer/src/api/room/IRoomManager.ts new file mode 100644 index 0000000..44c6b4a --- /dev/null +++ b/submodules/renderer/src/api/room/IRoomManager.ts @@ -0,0 +1,18 @@ +import { IEventDispatcher, INitroManager } from '../common'; +import { IRoomContentLoader } from '../nitro'; +import { IRoomInstance } from './IRoomInstance'; +import { IRoomObject } from './object'; + +export interface IRoomManager extends INitroManager +{ + getRoomInstance(roomId: string): IRoomInstance; + createRoomInstance(roomId: string): IRoomInstance; + removeRoomInstance(roomId: string): boolean; + addUpdateCategory(category: number): void; + removeUpdateCategory(category: number): void; + createRoomObjectAndInitalize(roomId: string, objectId: number, type: string, category: number): IRoomObject; + setContentLoader(loader: IRoomContentLoader): void; + update(time: number, update?: boolean): void; + rooms: Map; + events: IEventDispatcher; +} diff --git a/submodules/renderer/src/api/room/IRoomManagerListener.ts b/submodules/renderer/src/api/room/IRoomManagerListener.ts new file mode 100644 index 0000000..3bf9681 --- /dev/null +++ b/submodules/renderer/src/api/room/IRoomManagerListener.ts @@ -0,0 +1,6 @@ +export interface IRoomManagerListener +{ + onRoomEngineInitalized(flag: boolean): void; + objectInitialized(roomId: string, objectId: number, category: number): void; + initalizeTemporaryObjectsByType(type: string, _arg_2: boolean): void; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/room/IRoomObjectManager.ts b/submodules/renderer/src/api/room/IRoomObjectManager.ts new file mode 100644 index 0000000..9e0ea3b --- /dev/null +++ b/submodules/renderer/src/api/room/IRoomObjectManager.ts @@ -0,0 +1,14 @@ +import { IAdvancedMap } from '../utils'; +import { IRoomObjectController } from './object'; + +export interface IRoomObjectManager +{ + dispose(): void; + getObject(id: number): IRoomObjectController; + getObjectByIndex(index: number): IRoomObjectController; + createObject(id: number, stateCount: number, type: string): IRoomObjectController; + removeObject(id: number): void; + removeAllObjects(): void; + objects: IAdvancedMap; + totalObjects: number; +} diff --git a/submodules/renderer/src/api/room/IRoomObjectUpdateMessage.ts b/submodules/renderer/src/api/room/IRoomObjectUpdateMessage.ts new file mode 100644 index 0000000..5b04a52 --- /dev/null +++ b/submodules/renderer/src/api/room/IRoomObjectUpdateMessage.ts @@ -0,0 +1,7 @@ +import { IVector3D } from './IVector3D'; + +export interface IRoomObjectUpdateMessage +{ + readonly location: IVector3D; + readonly direction: IVector3D; +} diff --git a/submodules/renderer/src/api/room/IRoomSpriteMouseEvent.ts b/submodules/renderer/src/api/room/IRoomSpriteMouseEvent.ts new file mode 100644 index 0000000..c942d6c --- /dev/null +++ b/submodules/renderer/src/api/room/IRoomSpriteMouseEvent.ts @@ -0,0 +1,17 @@ +export interface IRoomSpriteMouseEvent +{ + readonly type: string; + readonly eventId: string; + readonly canvasId: string; + readonly spriteTag: string; + readonly screenX: number; + readonly screenY: number; + readonly localX: number; + readonly localY: number; + readonly ctrlKey: boolean; + readonly altKey: boolean; + readonly shiftKey: boolean; + readonly buttonDown: boolean; + spriteOffsetX: number; + spriteOffsetY: number; +} diff --git a/submodules/renderer/src/api/room/IVector3D.ts b/submodules/renderer/src/api/room/IVector3D.ts new file mode 100644 index 0000000..9214be4 --- /dev/null +++ b/submodules/renderer/src/api/room/IVector3D.ts @@ -0,0 +1,10 @@ +export interface IVector3D +{ + assign(vector: IVector3D): void; + add(vector: IVector3D): void; + subtract(vector: IVector3D): void; + x: number; + y: number; + z: number; + length: number; +} diff --git a/submodules/renderer/src/api/room/RoomObjectSpriteData.ts b/submodules/renderer/src/api/room/RoomObjectSpriteData.ts new file mode 100644 index 0000000..768cae2 --- /dev/null +++ b/submodules/renderer/src/api/room/RoomObjectSpriteData.ts @@ -0,0 +1,18 @@ +export class RoomObjectSpriteData +{ + public objectId: number; + public x: number; + public y: number; + public z: number; + public name: string; + public blendMode: string; + public flipH: boolean; + public skew: number; + public frame: boolean; + public color: string; + public alpha: number; + public width: number; + public height: number; + public type: string; + public posture: string; +} diff --git a/submodules/renderer/src/api/room/Vector3d.ts b/submodules/renderer/src/api/room/Vector3d.ts new file mode 100644 index 0000000..0ee362a --- /dev/null +++ b/submodules/renderer/src/api/room/Vector3d.ts @@ -0,0 +1,189 @@ +import { IVector3D } from './IVector3D'; + +export class Vector3d implements IVector3D +{ + private _x: number; + private _y: number; + private _z: number; + private _length: number; + + constructor(x: number = 0, y: number = 0, z: number = 0) + { + this._x = x; + this._y = y; + this._z = z; + this._length = NaN; + } + + public static sum(vector1: IVector3D, vector2: IVector3D): Vector3d + { + if(!vector1 || !vector2) return null; + + return new Vector3d((vector1.x + vector2.x), (vector1.y + vector2.y), (vector1.z + vector2.z)); + } + + public static dif(vector1: IVector3D, vector2: IVector3D): Vector3d + { + if(!vector1 || !vector2) return null; + + return new Vector3d((vector1.x - vector2.x), (vector1.y - vector2.y), (vector1.z - vector2.z)); + } + + public static product(vector: IVector3D, value: number): Vector3d + { + if(!vector) return null; + + return new Vector3d((vector.x * value), (vector.y * value), (vector.z * value)); + } + + public static dotProduct(vector1: IVector3D, vector2: IVector3D): number + { + if(!vector1 || !vector2) return 0; + + return (vector1.x * vector2.x) + (vector1.y * vector2.y) + (vector1.z * vector2.z); + } + + public static crossProduct(vector1: IVector3D, vector2: IVector3D): Vector3d + { + if(!vector1 || !vector2) return null; + + return new Vector3d(((vector1.y * vector2.z) - (vector1.z * vector2.y)), ((vector1.z * vector2.x) - (vector1.x * vector2.z)), ((vector1.x * vector2.y) - (vector1.y * vector2.x))); + } + + public static scalarProjection(vector1: IVector3D, vector2: IVector3D): number + { + if(!vector1 || !vector2) return -1; + + const length = vector2.length; + + if(length > 0) + { + return ((vector1.x * vector2.x) + (vector1.y * vector2.y) + (vector1.z * vector2.z)) / length; + } + + return -1; + } + + public static cosAngle(vector1: IVector3D, vector2: IVector3D): number + { + if(!vector1 || !vector2) return 0; + + const totalLength = (vector1.length * vector2.length); + + if(!totalLength) return 0; + + return (Vector3d.dotProduct(vector1, vector2) / totalLength); + } + + public static isEqual(vector1: IVector3D, vector2: IVector3D): boolean + { + if(!vector1 || !vector2) return false; + + if((vector1.x !== vector2.x) || (vector1.y !== vector2.y) || (vector1.z !== vector2.z)) return false; + + return true; + } + + public negate(): void + { + this._x = -(this._x); + this._y = -(this._y); + this._z = -(this._z); + } + + public add(vector: IVector3D): void + { + if(!vector) return; + + this._x += vector.x; + this._y += vector.y; + this._z += vector.z; + this._length = NaN; + } + + public subtract(vector: IVector3D): void + { + if(!vector) return; + + this._x -= vector.x; + this._y -= vector.y; + this._z -= vector.z; + this._length = NaN; + } + + public multiply(amount: number): void + { + this._x *= amount; + this._y *= amount; + this._z *= amount; + this._length = NaN; + } + + public divide(amount: number): void + { + if(!amount) return; + + this._x /= amount; + this._y /= amount; + this._z /= amount; + this._length = NaN; + } + + public assign(vector: IVector3D): void + { + if(!vector) return; + + this._x = vector.x; + this._y = vector.y; + this._z = vector.z; + this._length = NaN; + } + + public get x(): number + { + return this._x; + } + + public set x(k: number) + { + this._x = k; + this._length = NaN; + } + + public get y(): number + { + return this._y; + } + + public set y(k: number) + { + this._y = k; + this._length = NaN; + } + + public get z(): number + { + return this._z; + } + + public set z(k: number) + { + this._z = k; + this._length = NaN; + } + + public get length(): number + { + if(isNaN(this._length)) + { + this._length = Math.sqrt(((this._x * this._x) + (this._y * this._y)) + (this._z * this._z)); + } + + return this._length; + } + + public toString(): string + { + return `[Vector3d: ${this._x}, ${this._y}, ${this._z}]`; + } +} diff --git a/submodules/renderer/src/api/room/index.ts b/submodules/renderer/src/api/room/index.ts new file mode 100644 index 0000000..2f37439 --- /dev/null +++ b/submodules/renderer/src/api/room/index.ts @@ -0,0 +1,17 @@ +export * from './IPetBreedingResultData'; +export * from './IRoomGeometry'; +export * from './IRoomInstance'; +export * from './IRoomInstanceContainer'; +export * from './IRoomManager'; +export * from './IRoomManagerListener'; +export * from './IRoomObjectManager'; +export * from './IRoomObjectUpdateMessage'; +export * from './IRoomSpriteMouseEvent'; +export * from './IVector3D'; +export * from './object'; +export * from './object/enum'; +export * from './object/logic'; +export * from './object/visualization'; +export * from './renderer'; +export * from './RoomObjectSpriteData'; +export * from './Vector3d'; diff --git a/submodules/renderer/src/api/room/object/IRoomObject.ts b/submodules/renderer/src/api/room/object/IRoomObject.ts new file mode 100644 index 0000000..0dca252 --- /dev/null +++ b/submodules/renderer/src/api/room/object/IRoomObject.ts @@ -0,0 +1,22 @@ +import { IDisposable } from '../../common'; +import { IVector3D } from '../IVector3D'; +import { IRoomObjectModel } from './IRoomObjectModel'; +import { IRoomObjectMouseHandler } from './logic'; +import { IRoomObjectVisualization } from './visualization'; + +export interface IRoomObject extends IDisposable +{ + getLocation(): IVector3D; + getDirection(): IVector3D; + getState(index?: number): number; + id: number; + instanceId: number; + type: string; + model: IRoomObjectModel; + visualization: IRoomObjectVisualization; + mouseHandler: IRoomObjectMouseHandler; + location: IVector3D; + direction: IVector3D; + updateCounter: number; + isReady: boolean; +} diff --git a/submodules/renderer/src/api/room/object/IRoomObjectController.ts b/submodules/renderer/src/api/room/object/IRoomObjectController.ts new file mode 100644 index 0000000..9a66d4f --- /dev/null +++ b/submodules/renderer/src/api/room/object/IRoomObjectController.ts @@ -0,0 +1,18 @@ +import { IRoomObjectUpdateMessage } from '../IRoomObjectUpdateMessage'; +import { IVector3D } from '../IVector3D'; +import { IRoomObject } from './IRoomObject'; +import { IRoomObjectEventHandler } from './logic'; +import { IRoomObjectGraphicVisualization } from './visualization'; + +export interface IRoomObjectController extends IRoomObject +{ + setLocation(vector: IVector3D): void; + setDirection(vector: IVector3D): void; + setState(state: number, index?: number): boolean; + setVisualization(visualization: IRoomObjectGraphicVisualization): void; + setLogic(logic: IRoomObjectEventHandler): void; + processUpdateMessage(message: IRoomObjectUpdateMessage): void; + tearDown(): void; + isReady: boolean; + logic: IRoomObjectEventHandler; +} diff --git a/submodules/renderer/src/api/room/object/IRoomObjectModel.ts b/submodules/renderer/src/api/room/object/IRoomObjectModel.ts new file mode 100644 index 0000000..64291ed --- /dev/null +++ b/submodules/renderer/src/api/room/object/IRoomObjectModel.ts @@ -0,0 +1,8 @@ +export interface IRoomObjectModel +{ + dispose(): void; + getValue(key: string): T; + setValue(key: string, value: T): void; + removeKey(key: string): void; + updateCounter: number; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/room/object/IRoomObjectModelController.ts b/submodules/renderer/src/api/room/object/IRoomObjectModelController.ts new file mode 100644 index 0000000..2dc6fbc --- /dev/null +++ b/submodules/renderer/src/api/room/object/IRoomObjectModelController.ts @@ -0,0 +1,11 @@ +import { IAdvancedMap } from '../../utils'; +import { IRoomObjectModel } from './IRoomObjectModel'; + +export interface IRoomObjectModelController extends IRoomObjectModel +{ + setNumber(_arg_1: string, _arg_2: number, _arg_3: boolean): void; + setString(_arg_1: string, _arg_2: string, _arg_3: boolean): void; + setNumberArray(_arg_1: string, _arg_2: [], _arg_3: boolean): void; + setStringArray(_arg_1: string, _arg_2: [], _arg_3: boolean): void; + setStringToStringMap(_arg_1: string, _arg_2: IAdvancedMap, _arg_3: boolean): void; +} diff --git a/submodules/renderer/src/api/room/object/enum/AlphaTolerance.ts b/submodules/renderer/src/api/room/object/enum/AlphaTolerance.ts new file mode 100644 index 0000000..94b695e --- /dev/null +++ b/submodules/renderer/src/api/room/object/enum/AlphaTolerance.ts @@ -0,0 +1,6 @@ +export class AlphaTolerance +{ + public static MATCH_ALL_PIXELS: number = -1; + public static MATCH_OPAQUE_PIXELS: number = 128; + public static MATCH_NOTHING: number = 256; +} diff --git a/submodules/renderer/src/api/room/object/enum/RoomObjectSpriteType.ts b/submodules/renderer/src/api/room/object/enum/RoomObjectSpriteType.ts new file mode 100644 index 0000000..ec4f953 --- /dev/null +++ b/submodules/renderer/src/api/room/object/enum/RoomObjectSpriteType.ts @@ -0,0 +1,7 @@ +export class RoomObjectSpriteType +{ + public static DEFAULT: number = 1; + public static ROOM_PLANE: number = 2; + public static AVATAR: number = 3; + public static AVATAR_OWN: number = 4; +} diff --git a/submodules/renderer/src/api/room/object/enum/index.ts b/submodules/renderer/src/api/room/object/enum/index.ts new file mode 100644 index 0000000..b648257 --- /dev/null +++ b/submodules/renderer/src/api/room/object/enum/index.ts @@ -0,0 +1,2 @@ +export * from './AlphaTolerance'; +export * from './RoomObjectSpriteType'; diff --git a/submodules/renderer/src/api/room/object/index.ts b/submodules/renderer/src/api/room/object/index.ts new file mode 100644 index 0000000..7d028eb --- /dev/null +++ b/submodules/renderer/src/api/room/object/index.ts @@ -0,0 +1,7 @@ +export * from './enum'; +export * from './IRoomObject'; +export * from './IRoomObjectController'; +export * from './IRoomObjectModel'; +export * from './IRoomObjectModelController'; +export * from './logic'; +export * from './visualization'; diff --git a/submodules/renderer/src/api/room/object/logic/IRoomObjectEventHandler.ts b/submodules/renderer/src/api/room/object/logic/IRoomObjectEventHandler.ts new file mode 100644 index 0000000..26e17ed --- /dev/null +++ b/submodules/renderer/src/api/room/object/logic/IRoomObjectEventHandler.ts @@ -0,0 +1,19 @@ +import { IDisposable, IEventDispatcher } from '../../../common'; +import { IRoomObjectUpdateMessage } from '../../IRoomObjectUpdateMessage'; +import { IRoomObjectController } from '../IRoomObjectController'; +import { IRoomObjectMouseHandler } from './IRoomObjectMouseHandler'; + +export interface IRoomObjectEventHandler extends IRoomObjectMouseHandler, IDisposable +{ + initialize(data: unknown): void; + update(totalTimeRunning: number): void; + processUpdateMessage(message: IRoomObjectUpdateMessage): void; + getEventTypes(): string[]; + useObject(): void; + setObject(object: IRoomObjectController): void; + tearDown(): void; + object: IRoomObjectController; + eventDispatcher: IEventDispatcher; + widget: string; + contextMenu: string; +} diff --git a/submodules/renderer/src/api/room/object/logic/IRoomObjectLogicFactory.ts b/submodules/renderer/src/api/room/object/logic/IRoomObjectLogicFactory.ts new file mode 100644 index 0000000..142b519 --- /dev/null +++ b/submodules/renderer/src/api/room/object/logic/IRoomObjectLogicFactory.ts @@ -0,0 +1,10 @@ +import { IEventDispatcher } from '../../../common'; +import { IRoomObjectEventHandler } from './IRoomObjectEventHandler'; + +export interface IRoomObjectLogicFactory +{ + getLogic(type: string): IRoomObjectEventHandler; + registerEventFunction(func: Function): void; + removeEventFunction(func: Function): void; + events: IEventDispatcher; +} diff --git a/submodules/renderer/src/api/room/object/logic/IRoomObjectMouseHandler.ts b/submodules/renderer/src/api/room/object/logic/IRoomObjectMouseHandler.ts new file mode 100644 index 0000000..4240c56 --- /dev/null +++ b/submodules/renderer/src/api/room/object/logic/IRoomObjectMouseHandler.ts @@ -0,0 +1,7 @@ +import { IRoomGeometry } from '../../IRoomGeometry'; +import { IRoomSpriteMouseEvent } from '../../IRoomSpriteMouseEvent'; + +export interface IRoomObjectMouseHandler +{ + mouseEvent(event: IRoomSpriteMouseEvent, geometry: IRoomGeometry): void; +} diff --git a/submodules/renderer/src/api/room/object/logic/index.ts b/submodules/renderer/src/api/room/object/logic/index.ts new file mode 100644 index 0000000..5892efe --- /dev/null +++ b/submodules/renderer/src/api/room/object/logic/index.ts @@ -0,0 +1,3 @@ +export * from './IRoomObjectEventHandler'; +export * from './IRoomObjectLogicFactory'; +export * from './IRoomObjectMouseHandler'; diff --git a/submodules/renderer/src/api/room/object/visualization/IPlaneDrawingData.ts b/submodules/renderer/src/api/room/object/visualization/IPlaneDrawingData.ts new file mode 100644 index 0000000..0aae6af --- /dev/null +++ b/submodules/renderer/src/api/room/object/visualization/IPlaneDrawingData.ts @@ -0,0 +1,14 @@ +import { Point } from '@pixi/math'; + +export interface IPlaneDrawingData +{ + isBottomAligned(): boolean; + z: number; + cornerPoints: Point[]; + color: number; + maskAssetNames: string[]; + maskAssetLocations: Point[]; + maskAssetFlipHs: boolean[]; + maskAssetFlipVs: boolean[]; + assetNameColumns: string[][]; +} diff --git a/submodules/renderer/src/api/room/object/visualization/IPlaneVisualization.ts b/submodules/renderer/src/api/room/object/visualization/IPlaneVisualization.ts new file mode 100644 index 0000000..65b5de2 --- /dev/null +++ b/submodules/renderer/src/api/room/object/visualization/IPlaneVisualization.ts @@ -0,0 +1,6 @@ +import { IRoomPlane } from './IRoomPlane'; + +export interface IPlaneVisualization +{ + planes: IRoomPlane[]; +} diff --git a/submodules/renderer/src/api/room/object/visualization/IRoomObjectGraphicVisualization.ts b/submodules/renderer/src/api/room/object/visualization/IRoomObjectGraphicVisualization.ts new file mode 100644 index 0000000..8fb20d2 --- /dev/null +++ b/submodules/renderer/src/api/room/object/visualization/IRoomObjectGraphicVisualization.ts @@ -0,0 +1,7 @@ +import { IGraphicAssetCollection } from '../../../asset'; +import { IRoomObjectVisualization } from './IRoomObjectVisualization'; + +export interface IRoomObjectGraphicVisualization extends IRoomObjectVisualization +{ + asset: IGraphicAssetCollection; +} diff --git a/submodules/renderer/src/api/room/object/visualization/IRoomObjectSprite.ts b/submodules/renderer/src/api/room/object/visualization/IRoomObjectSprite.ts new file mode 100644 index 0000000..c6914ad --- /dev/null +++ b/submodules/renderer/src/api/room/object/visualization/IRoomObjectSprite.ts @@ -0,0 +1,33 @@ +import { Filter, Resource, Texture } from '@pixi/core'; +import { Container } from '@pixi/display'; + +export interface IRoomObjectSprite +{ + id: number; + name: string; + type: string; + spriteType: number; + texture: Texture; + container: Container; + width: number; + height: number; + offsetX: number; + offsetY: number; + flipH: boolean; + flipV: boolean; + direction: number; + alpha: number; + blendMode: number; + color: number; + relativeDepth: number; + varyingDepth: boolean; + libraryAssetName: string; + clickHandling: boolean; + visible: boolean; + tag: string; + posture: string; + alphaTolerance: number; + filters: Filter[]; + updateCounter: number; + updateContainer: boolean; +} diff --git a/submodules/renderer/src/api/room/object/visualization/IRoomObjectSpriteVisualization.ts b/submodules/renderer/src/api/room/object/visualization/IRoomObjectSpriteVisualization.ts new file mode 100644 index 0000000..e3dd4cd --- /dev/null +++ b/submodules/renderer/src/api/room/object/visualization/IRoomObjectSpriteVisualization.ts @@ -0,0 +1,12 @@ +import { RoomObjectSpriteData } from '../../RoomObjectSpriteData'; +import { IRoomObjectGraphicVisualization } from './IRoomObjectGraphicVisualization'; +import { IRoomObjectSprite } from './IRoomObjectSprite'; + +export interface IRoomObjectSpriteVisualization extends IRoomObjectGraphicVisualization +{ + getSprite(index: number): IRoomObjectSprite; + getSpriteList(): RoomObjectSpriteData[]; + sprites: IRoomObjectSprite[]; + updateObjectCounter: number; + updateModelCounter: number; +} diff --git a/submodules/renderer/src/api/room/object/visualization/IRoomObjectVisualization.ts b/submodules/renderer/src/api/room/object/visualization/IRoomObjectVisualization.ts new file mode 100644 index 0000000..445fb90 --- /dev/null +++ b/submodules/renderer/src/api/room/object/visualization/IRoomObjectVisualization.ts @@ -0,0 +1,18 @@ +import { RenderTexture } from '@pixi/core'; +import { Rectangle } from '@pixi/math'; +import { IRoomGeometry } from '../../IRoomGeometry'; +import { IRoomObject } from '../IRoomObject'; +import { IObjectVisualizationData } from './IRoomObjectVisualizationData'; + +export interface IRoomObjectVisualization +{ + initialize(data: IObjectVisualizationData): boolean; + dispose(): void; + update(geometry: IRoomGeometry, time: number, update: boolean, skipUpdate: boolean): void; + getBoundingRectangle(): Rectangle; + getImage(bgColor: number, originalId: number): RenderTexture; + instanceId: number; + object: IRoomObject; + image: RenderTexture; + updateSpriteCounter: number; +} diff --git a/submodules/renderer/src/api/room/object/visualization/IRoomObjectVisualizationData.ts b/submodules/renderer/src/api/room/object/visualization/IRoomObjectVisualizationData.ts new file mode 100644 index 0000000..4337029 --- /dev/null +++ b/submodules/renderer/src/api/room/object/visualization/IRoomObjectVisualizationData.ts @@ -0,0 +1,7 @@ +import { IAssetData } from '../../../asset'; + +export interface IObjectVisualizationData +{ + initialize(asset: IAssetData): boolean; + dispose(): void; +} diff --git a/submodules/renderer/src/api/room/object/visualization/IRoomObjectVisualizationFactory.ts b/submodules/renderer/src/api/room/object/visualization/IRoomObjectVisualizationFactory.ts new file mode 100644 index 0000000..a28adae --- /dev/null +++ b/submodules/renderer/src/api/room/object/visualization/IRoomObjectVisualizationFactory.ts @@ -0,0 +1,9 @@ +import { IAssetData } from '../../../asset'; +import { IRoomObjectGraphicVisualization } from './IRoomObjectGraphicVisualization'; +import { IObjectVisualizationData } from './IRoomObjectVisualizationData'; + +export interface IRoomObjectVisualizationFactory +{ + getVisualization(type: string): IRoomObjectGraphicVisualization; + getVisualizationData(type: string, visualization: string, asset: IAssetData): IObjectVisualizationData; +} diff --git a/submodules/renderer/src/api/room/object/visualization/IRoomPlane.ts b/submodules/renderer/src/api/room/object/visualization/IRoomPlane.ts new file mode 100644 index 0000000..8c00839 --- /dev/null +++ b/submodules/renderer/src/api/room/object/visualization/IRoomPlane.ts @@ -0,0 +1,13 @@ +import { IRoomGeometry } from '../../IRoomGeometry'; +import { IVector3D } from '../../IVector3D'; +import { IPlaneDrawingData } from './IPlaneDrawingData'; + +export interface IRoomPlane +{ + uniqueId: number; + location: IVector3D; + leftSide: IVector3D; + rightSide: IVector3D; + color: number; + getDrawingDatas(_arg_1: IRoomGeometry): IPlaneDrawingData[]; +} diff --git a/submodules/renderer/src/api/room/object/visualization/ISortableSprite.ts b/submodules/renderer/src/api/room/object/visualization/ISortableSprite.ts new file mode 100644 index 0000000..b4c0e75 --- /dev/null +++ b/submodules/renderer/src/api/room/object/visualization/ISortableSprite.ts @@ -0,0 +1,9 @@ +import { IRoomObjectSprite } from './IRoomObjectSprite'; + +export interface ISortableSprite +{ + x: number; + y: number; + z: number; + sprite: IRoomObjectSprite; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/room/object/visualization/index.ts b/submodules/renderer/src/api/room/object/visualization/index.ts new file mode 100644 index 0000000..681f37e --- /dev/null +++ b/submodules/renderer/src/api/room/object/visualization/index.ts @@ -0,0 +1,10 @@ +export * from './IPlaneDrawingData'; +export * from './IPlaneVisualization'; +export * from './IRoomObjectGraphicVisualization'; +export * from './IRoomObjectSprite'; +export * from './IRoomObjectSpriteVisualization'; +export * from './IRoomObjectVisualization'; +export * from './IRoomObjectVisualizationData'; +export * from './IRoomObjectVisualizationFactory'; +export * from './IRoomPlane'; +export * from './ISortableSprite'; diff --git a/submodules/renderer/src/api/room/renderer/IRoomCanvasMouseListener.ts b/submodules/renderer/src/api/room/renderer/IRoomCanvasMouseListener.ts new file mode 100644 index 0000000..bcd97ff --- /dev/null +++ b/submodules/renderer/src/api/room/renderer/IRoomCanvasMouseListener.ts @@ -0,0 +1,8 @@ +import { IRoomGeometry } from '../IRoomGeometry'; +import { IRoomSpriteMouseEvent } from '../IRoomSpriteMouseEvent'; +import { IRoomObject } from '../object'; + +export interface IRoomCanvasMouseListener +{ + processRoomCanvasMouseEvent(event: IRoomSpriteMouseEvent, object: IRoomObject, geometry: IRoomGeometry): void +} diff --git a/submodules/renderer/src/api/room/renderer/IRoomRenderer.ts b/submodules/renderer/src/api/room/renderer/IRoomRenderer.ts new file mode 100644 index 0000000..4477917 --- /dev/null +++ b/submodules/renderer/src/api/room/renderer/IRoomRenderer.ts @@ -0,0 +1,9 @@ +import { IRoomRendererBase } from './IRoomRendererBase'; +import { IRoomRenderingCanvas } from './IRoomRenderingCanvas'; + +export interface IRoomRenderer extends IRoomRendererBase +{ + getCanvas(id: number): IRoomRenderingCanvas; + createCanvas(id: number, width: number, height: number, scale: number): IRoomRenderingCanvas; + roomObjectVariableAccurateZ: string; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/room/renderer/IRoomRendererBase.ts b/submodules/renderer/src/api/room/renderer/IRoomRendererBase.ts new file mode 100644 index 0000000..2c00706 --- /dev/null +++ b/submodules/renderer/src/api/room/renderer/IRoomRendererBase.ts @@ -0,0 +1,10 @@ +import { IRoomObject } from '../object'; + +export interface IRoomRendererBase +{ + addObject(object: IRoomObject): void; + removeObject(object: IRoomObject): void; + dispose(): void; + reset(): void; + update(time: number, update?: boolean): void; +} diff --git a/submodules/renderer/src/api/room/renderer/IRoomRendererFactory.ts b/submodules/renderer/src/api/room/renderer/IRoomRendererFactory.ts new file mode 100644 index 0000000..1456669 --- /dev/null +++ b/submodules/renderer/src/api/room/renderer/IRoomRendererFactory.ts @@ -0,0 +1,6 @@ +import { IRoomRenderer } from './IRoomRenderer'; + +export interface IRoomRendererFactory +{ + createRenderer(): IRoomRenderer; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/room/renderer/IRoomRenderingCanvas.ts b/submodules/renderer/src/api/room/renderer/IRoomRenderingCanvas.ts new file mode 100644 index 0000000..98888ce --- /dev/null +++ b/submodules/renderer/src/api/room/renderer/IRoomRenderingCanvas.ts @@ -0,0 +1,39 @@ +import { RenderTexture } from '@pixi/core'; +import { DisplayObject } from '@pixi/display'; +import { Point } from '@pixi/math'; +import { IRoomGeometry } from '../IRoomGeometry'; +import { ISortableSprite } from '../object'; +import { RoomObjectSpriteData } from '../RoomObjectSpriteData'; +import { IRoomCanvasMouseListener } from './IRoomCanvasMouseListener'; + +export interface IRoomRenderingCanvas +{ + dispose(): void; + initialize(width: number, height: number): void; + setMask(flag: boolean): void; + setScale(scale: number, point?: Point, offsetPoint?: Point, override?: boolean, asDelta?: boolean): void; + render(time: number, update?: boolean): void; + update(): void; + setMouseListener(listener: IRoomCanvasMouseListener): void; + skipSpriteVisibilityChecking(): void; + resumeSpriteVisibilityChecking(): void; + getPlaneSortableSprites(): ISortableSprite[]; + handleMouseEvent(x: number, y: number, type: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean, buttonDown: boolean): boolean; + getSortableSpriteList(): RoomObjectSpriteData[]; + getDisplayAsTexture(): RenderTexture; + moveLeft(): void; + moveRight(): void; + moveUp(): void; + moveDown(): void; + id: number; + geometry: IRoomGeometry; + master: DisplayObject; + display: DisplayObject; + screenOffsetX: number; + screenOffsetY: number; + scale: number; + width: number; + height: number; + restrictsScaling: boolean; + canvasUpdated: boolean; +} diff --git a/submodules/renderer/src/api/room/renderer/IRoomSpriteCanvasContainer.ts b/submodules/renderer/src/api/room/renderer/IRoomSpriteCanvasContainer.ts new file mode 100644 index 0000000..be65859 --- /dev/null +++ b/submodules/renderer/src/api/room/renderer/IRoomSpriteCanvasContainer.ts @@ -0,0 +1,8 @@ +import { IRoomObject } from '../object'; + +export interface IRoomSpriteCanvasContainer +{ + getRoomObject(instanceId: number): IRoomObject; + objects: Map; + roomObjectVariableAccurateZ: string; +} diff --git a/submodules/renderer/src/api/room/renderer/index.ts b/submodules/renderer/src/api/room/renderer/index.ts new file mode 100644 index 0000000..8a236c0 --- /dev/null +++ b/submodules/renderer/src/api/room/renderer/index.ts @@ -0,0 +1,6 @@ +export * from './IRoomCanvasMouseListener'; +export * from './IRoomRenderer'; +export * from './IRoomRendererBase'; +export * from './IRoomRendererFactory'; +export * from './IRoomRenderingCanvas'; +export * from './IRoomSpriteCanvasContainer'; diff --git a/submodules/renderer/src/api/ui/MouseEventType.ts b/submodules/renderer/src/api/ui/MouseEventType.ts new file mode 100644 index 0000000..b5c5f84 --- /dev/null +++ b/submodules/renderer/src/api/ui/MouseEventType.ts @@ -0,0 +1,12 @@ +export class MouseEventType +{ + public static MOUSE_CLICK: string = 'click'; + public static DOUBLE_CLICK: string = 'double_click'; + public static MOUSE_MOVE: string = 'mousemove'; + public static MOUSE_DOWN: string = 'mousedown'; + public static MOUSE_DOWN_LONG: string = 'mousedown_long'; + public static MOUSE_UP: string = 'mouseup'; + public static ROLL_OVER: string = 'mouseover'; + public static ROLL_OUT: string = 'mouseout'; + public static RIGHT_CLICK: string = 'contextmenu'; +} diff --git a/submodules/renderer/src/api/ui/TouchEventType.ts b/submodules/renderer/src/api/ui/TouchEventType.ts new file mode 100644 index 0000000..3f6eec9 --- /dev/null +++ b/submodules/renderer/src/api/ui/TouchEventType.ts @@ -0,0 +1,8 @@ +export class TouchEventType +{ + public static TOUCH_START: string = 'touchstart'; + public static TOUCH_MOVE: string = 'touchmove'; + public static TOUCH_CANCEL: string = 'touchcancel'; + public static TOUCH_END: string = 'touchend'; + public static TOUCH_LONG: string = 'touchlong'; +} diff --git a/submodules/renderer/src/api/ui/index.ts b/submodules/renderer/src/api/ui/index.ts new file mode 100644 index 0000000..acab5a8 --- /dev/null +++ b/submodules/renderer/src/api/ui/index.ts @@ -0,0 +1,4 @@ +export * from './MouseEventType'; +export * from './TouchEventType'; +export * from './widget'; +export * from './widget/enums'; diff --git a/submodules/renderer/src/api/ui/widget/enums/AvatarExpressionEnum.ts b/submodules/renderer/src/api/ui/widget/enums/AvatarExpressionEnum.ts new file mode 100644 index 0000000..389f8d4 --- /dev/null +++ b/submodules/renderer/src/api/ui/widget/enums/AvatarExpressionEnum.ts @@ -0,0 +1,28 @@ +export class AvatarExpressionEnum +{ + public static NONE: AvatarExpressionEnum = new AvatarExpressionEnum(0); + public static WAVE: AvatarExpressionEnum = new AvatarExpressionEnum(1); + public static BLOW: AvatarExpressionEnum = new AvatarExpressionEnum(2); + public static LAUGH: AvatarExpressionEnum = new AvatarExpressionEnum(3); + public static CRY: AvatarExpressionEnum = new AvatarExpressionEnum(4); + public static IDLE: AvatarExpressionEnum = new AvatarExpressionEnum(5); + public static JUMP: AvatarExpressionEnum = new AvatarExpressionEnum(6); + public static RESPECT: AvatarExpressionEnum = new AvatarExpressionEnum(7); + + private _ordinal: number; + + constructor(k: number) + { + this._ordinal = k; + } + + public get ordinal(): number + { + return this._ordinal; + } + + public equals(k: AvatarExpressionEnum): boolean + { + return (k) && (k._ordinal == this._ordinal); + } +} diff --git a/submodules/renderer/src/api/ui/widget/enums/ContextMenuEnum.ts b/submodules/renderer/src/api/ui/widget/enums/ContextMenuEnum.ts new file mode 100644 index 0000000..7c53378 --- /dev/null +++ b/submodules/renderer/src/api/ui/widget/enums/ContextMenuEnum.ts @@ -0,0 +1,12 @@ +export class ContextMenuEnum +{ + public static DUMMY: string = 'DUMMY'; + public static FRIEND_FURNITURE: string = 'FRIEND_FURNITURE'; + public static MONSTERPLANT_SEED: string = 'MONSTERPLANT_SEED'; + public static MYSTERY_BOX: string = 'MYSTERY_BOX'; + public static EFFECT_BOX: string = 'EFFECT_BOX'; + public static MYSTERY_TROPHY: string = 'MYSTERY_TROPHY'; + public static RANDOM_TELEPORT: string = 'RANDOM_TELEPORT'; + public static PURCHASABLE_CLOTHING: string = 'PURCHASABLE_CLOTHING'; + public static GENERIC_USABLE: string = 'GENERIC_USABLE'; +} diff --git a/submodules/renderer/src/api/ui/widget/enums/FriendWidgetEngravingWidgetTypeEnum.ts b/submodules/renderer/src/api/ui/widget/enums/FriendWidgetEngravingWidgetTypeEnum.ts new file mode 100644 index 0000000..4417687 --- /dev/null +++ b/submodules/renderer/src/api/ui/widget/enums/FriendWidgetEngravingWidgetTypeEnum.ts @@ -0,0 +1,8 @@ +export class FriendWidgetEngravingWidgetTypeEnum +{ + public static LOVE_LOCK: number = 0; + public static CARVE_A_TREE: number = 1; + public static FRIENDS_PORTRAIT: number = 2; + public static WILD_WEST_WANTED: number = 3; + public static HABBOWEEN: number = 4; +} diff --git a/submodules/renderer/src/api/ui/widget/enums/RoomWidgetEnum.ts b/submodules/renderer/src/api/ui/widget/enums/RoomWidgetEnum.ts new file mode 100644 index 0000000..4b746b5 --- /dev/null +++ b/submodules/renderer/src/api/ui/widget/enums/RoomWidgetEnum.ts @@ -0,0 +1,57 @@ +export class RoomWidgetEnum +{ + public static CHAT_WIDGET: string = 'RWE_CHAT_WIDGET'; + public static INFOSTAND: string = 'RWE_INFOSTAND'; + public static ME_MENU: string = 'RWE_ME_MENU'; + public static CHAT_INPUT_WIDGET: string = 'RWE_CHAT_INPUT_WIDGET'; + public static FURNI_PLACEHOLDER: string = 'RWE_FURNI_PLACEHOLDER'; + public static FURNI_CREDIT_WIDGET: string = 'RWE_FURNI_CREDIT_WIDGET'; + public static FURNI_STICKIE_WIDGET: string = 'RWE_FURNI_STICKIE_WIDGET'; + public static FURNI_TROPHY_WIDGET: string = 'RWE_FURNI_TROPHY_WIDGET'; + public static FURNI_LOVELOCK_WIDGET: string = 'RWE_FURNI_LOVELOCK_WIDGET'; + public static FURNI_PRESENT_WIDGET: string = 'RWE_FURNI_PRESENT_WIDGET'; + public static FURNI_ECOTRONBOX_WIDGET: string = 'RWE_FURNI_ECOTRONBOX_WIDGET'; + public static FURNI_PET_PACKAGE_WIDGET: string = 'RWE_FURNI_PET_PACKAGE_WIDGET'; + public static PLAYLIST_EDITOR_WIDGET: string = 'RWE_PLAYLIST_EDITOR_WIDGET'; + public static DOORBELL: string = 'RWE_DOORBELL'; + public static LOADINGBAR: string = 'RWE_LOADINGBAR'; + public static ROOM_QUEUE: string = 'RWE_ROOM_QUEUE'; + public static ROOM_POLL: string = 'RWE_ROOM_POLL'; + public static ROOM_VOTE: string = 'RWE_ROOM_VOTE'; + public static USER_CHOOSER: string = 'RWE_USER_CHOOSER'; + public static FURNI_CHOOSER: string = 'RWE_FURNI_CHOOSER'; + public static ROOM_DIMMER: string = 'RWE_ROOM_DIMMER'; + public static FRIEND_REQUEST: string = 'RWE_FRIEND_REQUEST'; + public static CLOTHING_CHANGE: string = 'RWE_CLOTHING_CHANGE'; + public static CONVERSION_TRACKING: string = 'RWE_CONVERSION_TRACKING'; + public static USER_NOTIFICATION: string = 'RWE_USER_NOTIFICATION'; + public static FRIENDS_BAR: string = 'RWE_FRIENDS_BAR'; + public static PURSE_WIDGET: string = 'RWE_PURSE_WIDGET'; + public static AVATAR_INFO: string = 'RWE_AVATAR_INFO'; + public static WELCOME_GIFT: string = 'RWE_WELCOME_GIFT'; + public static SPAMWALL_POSTIT_WIDGET: string = 'RWE_SPAMWALL_POSTIT_WIDGET'; + public static EFFECTS: string = 'RWE_EFFECTS'; + public static MANNEQUIN: string = 'RWE_MANNEQUIN'; + public static FURNITURE_CONTEXT_MENU: string = 'RWE_FURNITURE_CONTEXT_MENU'; + public static LOCATION_WIDGET: string = 'RWE_LOCATION_WIDGET'; + public static CAMERA: string = 'RWE_CAMERA'; + public static ROOM_THUMBNAIL_CAMERA: string = 'RWE_ROOM_THUMBNAIL_CAMERA'; + public static ROOM_BACKGROUND_COLOR: string = 'RWE_ROOM_BACKGROUND_COLOR'; + public static CUSTOM_USER_NOTIFICATION: string = 'RWE_CUSTOM_USER_NOTIFICATION'; + public static FURNI_ACHIEVEMENT_RESOLUTION_ENGRAVING: string = 'RWE_FURNI_ACHIEVEMENT_RESOLUTION_ENGRAVING'; + public static FRIEND_FURNI_CONFIRM: string = 'RWE_FRIEND_FURNI_CONFIRM'; + public static FRIEND_FURNI_ENGRAVING: string = 'RWE_FRIEND_FURNI_ENGRAVING'; + public static HIGH_SCORE_DISPLAY: string = 'RWE_HIGH_SCORE_DISPLAY'; + public static INTERNAL_LINK: string = 'RWE_INTERNAL_LINK'; + public static CUSTOM_STACK_HEIGHT: string = 'RWE_CUSTOM_STACK_HEIGHT'; + public static YOUTUBE: string = 'RWE_YOUTUBE'; + public static RENTABLESPACE: string = 'RWE_RENTABLESPACE'; + public static VIMEO: string = 'RWE_VIMEO'; + public static ROOM_TOOLS: string = 'RWE_ROOM_TOOLS'; + public static EXTERNAL_IMAGE: string = 'RWE_EXTERNAL_IMAGE'; + public static WORD_QUIZZ: string = 'RWE_WORD_QUIZZ'; + public static UI_HELP_BUBBLE: string = 'RWE_UI_HELP_BUBBLE'; + public static ROOM_LINK: string = 'RWE_ROOM_LINK'; + public static CRAFTING: string = 'RWE_CRAFTING'; + public static ROOMGAME_CHECKERS: string = 'RWE_GAME_CHECKERS'; +} diff --git a/submodules/renderer/src/api/ui/widget/enums/RoomWidgetEnumItemExtradataParameter.ts b/submodules/renderer/src/api/ui/widget/enums/RoomWidgetEnumItemExtradataParameter.ts new file mode 100644 index 0000000..d252e69 --- /dev/null +++ b/submodules/renderer/src/api/ui/widget/enums/RoomWidgetEnumItemExtradataParameter.ts @@ -0,0 +1,10 @@ +export class RoomWidgetEnumItemExtradataParameter +{ + public static INFOSTAND_EXTRA_PARAM: string = 'RWEIEP_INFOSTAND_EXTRA_PARAM'; + public static JUKEBOX: string = 'RWEIEP_JUKEBOX'; + public static USABLE_PRODUCT: string = 'RWEIEP_USABLE_PRODUCT'; + public static SONGDISK: string = 'RWEIEP_SONGDISK'; + public static CRACKABLE_FURNI: string = 'RWEIEP_CRACKABLE_FURNI'; + public static BRANDING_OPTIONS: string = 'RWEIEP_BRANDING_OPTIONS'; + public static USABLE: string = 'RWEIEP_USABLE'; +} diff --git a/submodules/renderer/src/api/ui/widget/enums/RoomWidgetFurniInfoUsagePolicyEnum.ts b/submodules/renderer/src/api/ui/widget/enums/RoomWidgetFurniInfoUsagePolicyEnum.ts new file mode 100644 index 0000000..523205c --- /dev/null +++ b/submodules/renderer/src/api/ui/widget/enums/RoomWidgetFurniInfoUsagePolicyEnum.ts @@ -0,0 +1,6 @@ +export class RoomWidgetFurniInfoUsagePolicyEnum +{ + public static NOBODY: number = 0; + public static CONTROLLER: number = 1; + public static EVERYBODY: number = 2; +} diff --git a/submodules/renderer/src/api/ui/widget/enums/SystemChatStyleEnum.ts b/submodules/renderer/src/api/ui/widget/enums/SystemChatStyleEnum.ts new file mode 100644 index 0000000..15e3428 --- /dev/null +++ b/submodules/renderer/src/api/ui/widget/enums/SystemChatStyleEnum.ts @@ -0,0 +1,6 @@ +export class SystemChatStyleEnum +{ + public static NORMAL: number = 0; + public static GENERIC: number = 1; + public static BOT: number = 2; +} \ No newline at end of file diff --git a/submodules/renderer/src/api/ui/widget/enums/index.ts b/submodules/renderer/src/api/ui/widget/enums/index.ts new file mode 100644 index 0000000..48f242d --- /dev/null +++ b/submodules/renderer/src/api/ui/widget/enums/index.ts @@ -0,0 +1,7 @@ +export * from './AvatarExpressionEnum'; +export * from './ContextMenuEnum'; +export * from './FriendWidgetEngravingWidgetTypeEnum'; +export * from './RoomWidgetEnum'; +export * from './RoomWidgetEnumItemExtradataParameter'; +export * from './RoomWidgetFurniInfoUsagePolicyEnum'; +export * from './SystemChatStyleEnum'; diff --git a/submodules/renderer/src/api/ui/widget/index.ts b/submodules/renderer/src/api/ui/widget/index.ts new file mode 100644 index 0000000..1479085 --- /dev/null +++ b/submodules/renderer/src/api/ui/widget/index.ts @@ -0,0 +1 @@ +export * from './enums'; diff --git a/submodules/renderer/src/api/utils/AdvancedMap.ts b/submodules/renderer/src/api/utils/AdvancedMap.ts new file mode 100644 index 0000000..1bea641 --- /dev/null +++ b/submodules/renderer/src/api/utils/AdvancedMap.ts @@ -0,0 +1,159 @@ +import { IAdvancedMap } from './IAdvancedMap'; + +export class AdvancedMap implements IAdvancedMap +{ + private _length: number; + private _dictionary: Map; + private _array: U[]; + private _keys: T[]; + + constructor(map: Map = null) + { + this._length = 0; + this._dictionary = new Map(); + this._array = []; + this._keys = []; + + if(map) for(const [key, value] of map.entries()) this.add(key, value); + } + + public get length(): number + { + return this._length; + } + + public get disposed(): boolean + { + return (!this._dictionary); + } + + public dispose(): void + { + if(!this._dictionary) + { + for(const key of this._dictionary.keys()) this._dictionary.delete(key); + + this._dictionary = null; + } + + this._length = 0; + this._array = null; + this._keys = null; + } + + public reset(): void + { + for(const key of this._dictionary.keys()) this._dictionary.delete(key); + + this._length = 0; + this._array = []; + this._keys = []; + } + + public unshift(key: T, value: U): boolean + { + if(this._dictionary.get(key) !== null) return false; + + this._dictionary.set(key, value); + + this._array.unshift(value); + this._keys.unshift(key); + + this._length++; + + return true; + } + + public add(key: T, value: U): boolean + { + if(this._dictionary.get(key) !== undefined) return false; + + this._dictionary.set(key, value); + + this._array[this._length] = value; + this._keys[this._length] = key; + + this._length++; + + return true; + } + + public remove(key: T): U + { + const value = this._dictionary.get(key); + + if(!value) return null; + + const index = this._array.indexOf(value); + + if(index >= 0) + { + this._array.splice(index, 1); + this._keys.splice(index, 1); + + this._length--; + } + + this._dictionary.delete(key); + + return value; + } + + public getWithIndex(index: number): U + { + if((index < 0) || (index >= this._length)) return null; + + return this._array[index]; + } + + public getKey(index: number): T + { + if((index < 0) || (index >= this._length)) return null; + + return this._keys[index]; + } + + public getKeys(): T[] + { + return this._keys.slice(); + } + + public hasKey(key: T): boolean + { + return (this._keys.indexOf(key) > -1); + } + + public getValue(key: T): U + { + return this._dictionary.get(key); + } + + public getValues(): U[] + { + return this._array.slice(); + } + + public hasValue(value: U): boolean + { + return (this._array.indexOf(value) > -1); + } + + public indexOf(value: U): number + { + return this._array.indexOf(value); + } + + public concatenate(newValues: IAdvancedMap): void + { + for(const k of (newValues as AdvancedMap)._keys) this.add(k, newValues.getValue(k)); + } + + public clone(): IAdvancedMap + { + const map = new AdvancedMap(); + + map.concatenate(this); + + return map; + } +} diff --git a/submodules/renderer/src/api/utils/ArrayBufferToBase64.ts b/submodules/renderer/src/api/utils/ArrayBufferToBase64.ts new file mode 100644 index 0000000..aa8eb74 --- /dev/null +++ b/submodules/renderer/src/api/utils/ArrayBufferToBase64.ts @@ -0,0 +1,11 @@ +export const ArrayBufferToBase64 = (buffer: ArrayBuffer) => +{ + let binary = ''; + + const bytes = new Uint8Array(buffer); + const len = bytes.byteLength; + + for(let i = 0; i < len; i++) (binary += String.fromCharCode(bytes[i])); + + return window.btoa(binary); +}; diff --git a/submodules/renderer/src/api/utils/BinaryReader.ts b/submodules/renderer/src/api/utils/BinaryReader.ts new file mode 100644 index 0000000..e25ddb1 --- /dev/null +++ b/submodules/renderer/src/api/utils/BinaryReader.ts @@ -0,0 +1,82 @@ +import { IBinaryReader } from './IBinaryReader'; + +export class BinaryReader implements IBinaryReader +{ + private _position: number; + private _dataView: DataView; + + constructor(buffer: ArrayBuffer) + { + this._position = 0; + this._dataView = new DataView(buffer); + } + + public readBytes(length: number): IBinaryReader + { + const buffer = new BinaryReader(this._dataView.buffer.slice(this._position, this._position + length)); + + this._position += length; + + return buffer; + } + + public readByte(): number + { + const byte = this._dataView.getInt8(this._position); + + this._position++; + + return byte; + } + + public readShort(): number + { + const short = this._dataView.getInt16(this._position); + + this._position += 2; + + return short; + } + + public readInt(): number + { + const int = this._dataView.getInt32(this._position); + + this._position += 4; + + return int; + } + + public readFloat(): number + { + const float = this._dataView.getFloat32(this._position); + + this._position += 4; + + return float; + } + + public readDouble(): number + { + const double = this._dataView.getFloat64(this._position); + + this._position += 8; + + return double; + } + + public remaining(): number + { + return this._dataView.byteLength - this._position; + } + + public toString(encoding?: string): string + { + return new TextDecoder().decode(this._dataView.buffer); + } + + public toArrayBuffer(): ArrayBuffer + { + return this._dataView.buffer; + } +} diff --git a/submodules/renderer/src/api/utils/BinaryWriter.ts b/submodules/renderer/src/api/utils/BinaryWriter.ts new file mode 100644 index 0000000..1bcae19 --- /dev/null +++ b/submodules/renderer/src/api/utils/BinaryWriter.ts @@ -0,0 +1,109 @@ +import { IBinaryWriter } from './IBinaryWriter'; + +export class BinaryWriter implements IBinaryWriter +{ + private _buffer: Uint8Array; + private _position: number; + + constructor() + { + this._buffer = new Uint8Array(); + this._position = 0; + } + + public writeByte(byte: number): IBinaryWriter + { + const array = new Uint8Array(1); + + array[0] = byte; + + this.appendArray(array); + + return this; + } + + public writeBytes(bytes: ArrayBuffer | number[]): IBinaryWriter + { + const array = new Uint8Array(bytes); + + this.appendArray(array); + + return this; + } + + public writeShort(short: number): IBinaryWriter + { + const array = new Uint8Array(2); + + array[0] = short >> 8; + array[1] = short & 0xFF; + + this.appendArray(array); + + return this; + } + + public writeInt(integer: number): IBinaryWriter + { + const array = new Uint8Array(4); + + array[0] = integer >> 24; + array[1] = integer >> 16; + array[2] = integer >> 8; + array[3] = integer & 0xFF; + + this.appendArray(array); + + return this; + } + + public writeString(string: string, includeLength: boolean = true): IBinaryWriter + { + const array = new TextEncoder().encode(string); + + if(includeLength) + { + this.writeShort(array.length); + this.appendArray(array); + } + else + { + this.appendArray(array); + } + + return this; + } + + private appendArray(array: Uint8Array): void + { + if(!array) return; + + const mergedArray = new Uint8Array(((this.position + array.length) > this._buffer.length) ? (this.position + array.length) : this._buffer.length); + + mergedArray.set(this._buffer); + mergedArray.set(array, this.position); + + this._buffer = mergedArray; + this.position += array.length; + } + + public getBuffer(): ArrayBuffer + { + return this._buffer.buffer; + } + + public get position(): number + { + return this._position; + } + + public set position(pos: number) + { + this._position = pos; + } + + public toString(encoding?: string): string + { + return new TextDecoder(encoding).decode(this._buffer); + } +} diff --git a/submodules/renderer/src/api/utils/Dict.ts b/submodules/renderer/src/api/utils/Dict.ts new file mode 100644 index 0000000..241c64a --- /dev/null +++ b/submodules/renderer/src/api/utils/Dict.ts @@ -0,0 +1,3 @@ +export type Dict = { + [key: string]: T; +}; diff --git a/submodules/renderer/src/api/utils/IAdvancedMap.ts b/submodules/renderer/src/api/utils/IAdvancedMap.ts new file mode 100644 index 0000000..f10c570 --- /dev/null +++ b/submodules/renderer/src/api/utils/IAdvancedMap.ts @@ -0,0 +1,22 @@ +import { IDisposable } from '../common'; + +export interface IAdvancedMap extends IDisposable +{ + dispose(): void; + reset(): void; + unshift(key: T, value: U): boolean; + add(key: T, value: U): boolean; + remove(key: T): U; + getWithIndex(index: number): U; + getKey(index: number): T; + getKeys(): T[]; + hasKey(key: T): boolean; + getValue(key: T): U; + getValues(): U[]; + hasValue(value: U): boolean; + indexOf(value: U): number; + concatenate(newValues: IAdvancedMap): void; + clone(): IAdvancedMap; + readonly length: number; + readonly disposed: boolean +} diff --git a/submodules/renderer/src/api/utils/IBinaryReader.ts b/submodules/renderer/src/api/utils/IBinaryReader.ts new file mode 100644 index 0000000..6ad2657 --- /dev/null +++ b/submodules/renderer/src/api/utils/IBinaryReader.ts @@ -0,0 +1,12 @@ +export interface IBinaryReader +{ + readBytes(length: number): IBinaryReader; + readByte(): number; + readShort(): number; + readInt(): number; + readFloat(): number; + readDouble(): number; + remaining(): number; + toString(encoding?: string): string; + toArrayBuffer(): ArrayBuffer; +} diff --git a/submodules/renderer/src/api/utils/IBinaryWriter.ts b/submodules/renderer/src/api/utils/IBinaryWriter.ts new file mode 100644 index 0000000..f3135c0 --- /dev/null +++ b/submodules/renderer/src/api/utils/IBinaryWriter.ts @@ -0,0 +1,11 @@ +export interface IBinaryWriter +{ + writeByte(byte: number): IBinaryWriter; + writeBytes(bytes: ArrayBuffer | number[]): IBinaryWriter; + writeShort(short: number): IBinaryWriter; + writeInt(integer: number): IBinaryWriter; + writeString(string: string, includeLength?: boolean): IBinaryWriter; + getBuffer(): ArrayBuffer; + position: number; + toString(encoding?: string): string; +} diff --git a/submodules/renderer/src/api/utils/NitroBundle.ts b/submodules/renderer/src/api/utils/NitroBundle.ts new file mode 100644 index 0000000..37e4992 --- /dev/null +++ b/submodules/renderer/src/api/utils/NitroBundle.ts @@ -0,0 +1,60 @@ +import { BaseTexture } from '@pixi/core'; +import { Data, inflate } from 'pako'; +import { ArrayBufferToBase64 } from './ArrayBufferToBase64'; +import { BinaryReader } from './BinaryReader'; + +export class NitroBundle +{ + private static TEXT_DECODER: TextDecoder = new TextDecoder('utf-8'); + + private _jsonFile: Object = null; + private _image: string = null; + private _imageData: Uint8Array = null; + private _baseTexture: BaseTexture = null; + + constructor(arrayBuffer: ArrayBuffer) + { + this.parse(arrayBuffer); + } + + public parse(arrayBuffer: ArrayBuffer): void + { + const binaryReader = new BinaryReader(arrayBuffer); + + let fileCount = binaryReader.readShort(); + + while(fileCount > 0) + { + const fileNameLength = binaryReader.readShort(); + const fileName = binaryReader.readBytes(fileNameLength).toString(); + const fileLength = binaryReader.readInt(); + const buffer = binaryReader.readBytes(fileLength); + + if(fileName.endsWith('.json')) + { + const decompressed = inflate((buffer.toArrayBuffer() as Data)); + + this._jsonFile = JSON.parse(NitroBundle.TEXT_DECODER.decode(decompressed)); + } + else + { + const decompressed = inflate((buffer.toArrayBuffer() as Data)); + const base64 = ArrayBufferToBase64(decompressed); + + this._baseTexture = new BaseTexture('data:image/png;base64,' + base64); + } + + fileCount--; + } + } + + get jsonFile(): Object + { + return this._jsonFile; + } + + public get baseTexture(): BaseTexture + { + return this._baseTexture; + } +} diff --git a/submodules/renderer/src/api/utils/index.ts b/submodules/renderer/src/api/utils/index.ts new file mode 100644 index 0000000..51632ff --- /dev/null +++ b/submodules/renderer/src/api/utils/index.ts @@ -0,0 +1,9 @@ +export * from './AdvancedMap'; +export * from './ArrayBufferToBase64'; +export * from './BinaryReader'; +export * from './BinaryWriter'; +export * from './Dict'; +export * from './IAdvancedMap'; +export * from './IBinaryReader'; +export * from './IBinaryWriter'; +export * from './NitroBundle'; diff --git a/submodules/renderer/src/core/NitroCore.ts b/submodules/renderer/src/core/NitroCore.ts new file mode 100644 index 0000000..6f4e4fb --- /dev/null +++ b/submodules/renderer/src/core/NitroCore.ts @@ -0,0 +1,41 @@ +import { ICommunicationManager, IConfigurationManager, INitroCore } from '../api'; +import { Disposable } from './common'; +import { CommunicationManager } from './communication'; +import { ConfigurationManager } from './configuration'; +import { NitroVersion } from './NitroVersion'; + +export class NitroCore extends Disposable implements INitroCore +{ + private _configuration: IConfigurationManager; + private _communication: ICommunicationManager; + + constructor() + { + super(); + + NitroVersion.sayHello(); + + this._configuration = new ConfigurationManager(); + this._communication = new CommunicationManager(); + } + + protected onDispose(): void + { + if(this._communication) + { + this._communication.dispose(); + + this._communication = null; + } + } + + public get configuration(): IConfigurationManager + { + return this._configuration; + } + + public get communication(): ICommunicationManager + { + return this._communication; + } +} diff --git a/submodules/renderer/src/core/NitroVersion.ts b/submodules/renderer/src/core/NitroVersion.ts new file mode 100644 index 0000000..72c3105 --- /dev/null +++ b/submodules/renderer/src/core/NitroVersion.ts @@ -0,0 +1,30 @@ +export class NitroVersion +{ + public static RENDERER_VERSION: string = '1.6.6'; + public static UI_VERSION: string = ''; + + public static sayHello(): void + { + if(navigator.userAgent.toLowerCase().indexOf('chrome') > -1) + { + const args = [ + `\n %c %c %c Nitro ${NitroVersion.UI_VERSION} - Renderer ${NitroVersion.RENDERER_VERSION} %c %c %c https://discord.nitrodev.co %c %c \n\n`, + 'background: #ffffff; padding:5px 0;', + 'background: #ffffff; padding:5px 0;', + 'color: #ffffff; background: #000000; padding:5px 0;', + 'background: #ffffff; padding:5px 0;', + 'background: #ffffff; padding:5px 0;', + 'background: #000000; padding:5px 0;', + 'background: #ffffff; padding:5px 0;', + 'background: #ffffff; padding:5px 0;' + ]; + + self.console.log(...args); + } + + else if(self.console) + { + self.console.log(`Nitro ${NitroVersion.UI_VERSION} - Renderer ${NitroVersion.RENDERER_VERSION} `); + } + } +} diff --git a/submodules/renderer/src/core/common/Disposable.ts b/submodules/renderer/src/core/common/Disposable.ts new file mode 100644 index 0000000..bb65b2d --- /dev/null +++ b/submodules/renderer/src/core/common/Disposable.ts @@ -0,0 +1,40 @@ +import { IDisposable } from '../../api'; + +export class Disposable implements IDisposable +{ + protected _isDisposed: boolean; + protected _isDisposing: boolean; + + constructor() + { + this._isDisposed = false; + this._isDisposing = false; + } + + public dispose(): void + { + if(this._isDisposed || this._isDisposing) return; + + this._isDisposing = true; + + this.onDispose(); + + this._isDisposed = true; + this._isDisposing = false; + } + + protected onDispose(): void + { + return; + } + + public get disposed(): boolean + { + return this._isDisposed; + } + + public get isDisposing(): boolean + { + return this._isDisposing; + } +} diff --git a/submodules/renderer/src/core/common/EventDispatcher.ts b/submodules/renderer/src/core/common/EventDispatcher.ts new file mode 100644 index 0000000..f6280de --- /dev/null +++ b/submodules/renderer/src/core/common/EventDispatcher.ts @@ -0,0 +1,106 @@ +import { IDisposable, IEventDispatcher, INitroEvent, NitroLogger } from '../../api'; +import { Disposable } from './Disposable'; + +export class EventDispatcher extends Disposable implements IEventDispatcher, IDisposable +{ + private _listeners: Map; + + constructor() + { + super(); + + this._listeners = new Map(); + } + + protected onDispose(): void + { + this.removeAllListeners(); + + super.onDispose(); + } + + public addEventListener(type: string, callback: Function): void + { + if(!type || !callback) return; + + const existing = this._listeners.get(type); + + if(!existing) + { + this._listeners.set(type, [callback]); + + return; + } + + existing.push(callback); + } + + public removeEventListener(type: string, callback: any): void + { + if(!type || !callback) return; + + const existing = this._listeners.get(type); + + if(!existing || !existing.length) return; + + for(const [i, cb] of existing.entries()) + { + if(!cb || (cb !== callback)) continue; + + existing.splice(i, 1); + + if(!existing.length) this._listeners.delete(type); + + return; + } + } + + public dispatchEvent(event: INitroEvent): boolean + { + if(!event) return false; + + NitroLogger.events('Dispatched Event', event.type); + + this.processEvent(event); + + return true; + } + + private processEvent(event: INitroEvent): void + { + const existing = this._listeners.get(event.type); + + if(!existing || !existing.length) return; + + const callbacks = []; + + for(const callback of existing) + { + if(!callback) continue; + + callbacks.push(callback); + } + + while(callbacks.length) + { + const callback = callbacks.shift(); + + try + { + callback(event); + } + + catch (err) + { + NitroLogger.error(err.stack); + + return; + } + } + } + + public removeAllListeners(): void + { + this._listeners.clear(); + } +} diff --git a/submodules/renderer/src/core/common/NitroManager.ts b/submodules/renderer/src/core/common/NitroManager.ts new file mode 100644 index 0000000..802ec66 --- /dev/null +++ b/submodules/renderer/src/core/common/NitroManager.ts @@ -0,0 +1,66 @@ +import { IEventDispatcher, INitroManager } from '../../api'; +import { Disposable } from './Disposable'; +import { EventDispatcher } from './EventDispatcher'; + +export class NitroManager extends Disposable implements INitroManager +{ + private _events: IEventDispatcher; + + private _isLoaded: boolean; + private _isLoading: boolean; + + constructor() + { + super(); + + this._events = new EventDispatcher(); + + this._isLoaded = false; + this._isLoading = false; + } + + public init(): void + { + if(this._isLoaded || this._isLoading || this.isDisposing) return; + + this._isLoading = true; + + this.onInit(); + + this._isLoaded = true; + this._isLoading = false; + } + + protected onInit(): void + { + return; + } + + protected onDispose(): void + { + if(this._events) this._events.dispose(); + + super.onDispose(); + } + + public reload(): void + { + this.dispose(); + this.init(); + } + + public get events(): IEventDispatcher + { + return this._events; + } + + public get isLoaded(): boolean + { + return this._isLoaded; + } + + public get isLoading(): boolean + { + return this._isLoading; + } +} diff --git a/submodules/renderer/src/core/common/index.ts b/submodules/renderer/src/core/common/index.ts new file mode 100644 index 0000000..9e5ab33 --- /dev/null +++ b/submodules/renderer/src/core/common/index.ts @@ -0,0 +1,3 @@ +export * from './Disposable'; +export * from './EventDispatcher'; +export * from './NitroManager'; diff --git a/submodules/renderer/src/core/communication/CommunicationManager.ts b/submodules/renderer/src/core/communication/CommunicationManager.ts new file mode 100644 index 0000000..8e0c0d8 --- /dev/null +++ b/submodules/renderer/src/core/communication/CommunicationManager.ts @@ -0,0 +1,50 @@ +import { ICommunicationManager, IConnection, IConnectionStateListener, IUpdateReceiver } from '../../api'; +import { Disposable } from '../common'; +import { SocketConnection } from './SocketConnection'; + +export class CommunicationManager extends Disposable implements ICommunicationManager, IUpdateReceiver +{ + private _connections: IConnection[]; + + constructor() + { + super(); + + this._connections = []; + } + + protected onDispose(): void + { + if(!this._connections || !this._connections.length) return; + + for(const connection of this._connections.values()) connection && connection.dispose(); + } + + public createConnection(stateListener: IConnectionStateListener = null): IConnection + { + const connection = new SocketConnection(this, stateListener); + + if(!connection) return; + + this._connections.push(connection); + + return connection; + } + + public update(time: number): void + { + let index = 0; + + while(index < this._connections.length) + { + const connection = this._connections[index]; + + connection.processReceivedData(); + + if(this.disposed) return; + + if(connection.disposed) this._connections.splice(index, 1); + else index++; + } + } +} diff --git a/submodules/renderer/src/core/communication/SocketConnection.ts b/submodules/renderer/src/core/communication/SocketConnection.ts new file mode 100644 index 0000000..4d493f7 --- /dev/null +++ b/submodules/renderer/src/core/communication/SocketConnection.ts @@ -0,0 +1,355 @@ +import { ICodec, ICommunicationManager, IConnection, IConnectionStateListener, IMessageComposer, IMessageConfiguration, IMessageDataWrapper, IMessageEvent, NitroLogger, WebSocketEventEnum } from '../../api'; +import { SocketConnectionEvent } from '../../events'; +import { EventDispatcher } from '../common'; +import { EvaWireFormat } from './codec'; +import { MessageClassManager } from './messages'; + +export class SocketConnection extends EventDispatcher implements IConnection +{ + private _communicationManager: ICommunicationManager; + private _stateListener: IConnectionStateListener; + private _socket: WebSocket; + private _messages: MessageClassManager; + private _codec: ICodec; + private _dataBuffer: ArrayBuffer; + private _isReady: boolean; + + private _pendingClientMessages: IMessageComposer[]; + private _pendingServerMessages: IMessageDataWrapper[]; + + private _isAuthenticated: boolean; + + constructor(communicationManager: ICommunicationManager, stateListener: IConnectionStateListener) + { + super(); + + this._communicationManager = communicationManager; + this._stateListener = stateListener; + this._socket = null; + this._messages = new MessageClassManager(); + this._codec = new EvaWireFormat(); + this._dataBuffer = null; + this._isReady = false; + + this._pendingClientMessages = []; + this._pendingServerMessages = []; + + this._isAuthenticated = false; + + this.onOpen = this.onOpen.bind(this); + this.onClose = this.onClose.bind(this); + this.onError = this.onError.bind(this); + this.onMessage = this.onMessage.bind(this); + } + + public init(socketUrl: string): void + { + if(this._stateListener) + { + this._stateListener.connectionInit(socketUrl); + } + + this.createSocket(socketUrl); + } + + protected onDispose(): void + { + super.onDispose(); + + this.destroySocket(); + + this._communicationManager = null; + this._stateListener = null; + this._messages = null; + this._codec = null; + this._dataBuffer = null; + } + + public onReady(): void + { + if(this._isReady) return; + + this._isReady = true; + + if(this._pendingServerMessages && this._pendingServerMessages.length) this.processWrappers(...this._pendingServerMessages); + + if(this._pendingClientMessages && this._pendingClientMessages.length) this.send(...this._pendingClientMessages); + + this._pendingServerMessages = []; + this._pendingClientMessages = []; + } + + private createSocket(socketUrl: string): void + { + if(!socketUrl) return; + + this.destroySocket(); + + this._dataBuffer = new ArrayBuffer(0); + this._socket = new WebSocket(socketUrl); + + this._socket.addEventListener(WebSocketEventEnum.CONNECTION_OPENED, this.onOpen); + this._socket.addEventListener(WebSocketEventEnum.CONNECTION_CLOSED, this.onClose); + this._socket.addEventListener(WebSocketEventEnum.CONNECTION_ERROR, this.onError); + this._socket.addEventListener(WebSocketEventEnum.CONNECTION_MESSAGE, this.onMessage); + } + + private destroySocket(): void + { + if(!this._socket) return; + + this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_OPENED, this.onOpen); + this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_CLOSED, this.onClose); + this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_ERROR, this.onError); + this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_MESSAGE, this.onMessage); + + if(this._socket.readyState === WebSocket.OPEN) this._socket.close(); + + this._socket = null; + } + + private onOpen(event: Event): void + { + this.dispatchConnectionEvent(SocketConnectionEvent.CONNECTION_OPENED, event); + } + + private onClose(event: CloseEvent): void + { + this.dispatchConnectionEvent(SocketConnectionEvent.CONNECTION_CLOSED, event); + } + + private onError(event: Event): void + { + this.dispatchConnectionEvent(SocketConnectionEvent.CONNECTION_ERROR, event); + } + + private onMessage(event: MessageEvent): void + { + if(!event) return; + + //this.dispatchConnectionEvent(SocketConnectionEvent.CONNECTION_MESSAGE, event); + + const reader = new FileReader(); + + reader.readAsArrayBuffer(event.data); + + reader.onloadend = () => + { + this._dataBuffer = this.concatArrayBuffers(this._dataBuffer, (reader.result as ArrayBuffer)); + + this.processReceivedData(); + }; + } + + private dispatchConnectionEvent(type: string, event: Event): void + { + this.dispatchEvent(new SocketConnectionEvent(type, this, event)); + } + + public authenticated(): void + { + this._isAuthenticated = true; + } + + public send(...composers: IMessageComposer[]): boolean + { + if(this.disposed || !composers) return false; + + composers = [...composers]; + + if(this._isAuthenticated && !this._isReady) + { + if(!this._pendingClientMessages) this._pendingClientMessages = []; + + this._pendingClientMessages.push(...composers); + + return false; + } + + for(const composer of composers) + { + if(!composer) continue; + + const header = this._messages.getComposerId(composer); + + if(header === -1) + { + NitroLogger.packets('Unknown Composer', composer.constructor.name); + + continue; + } + + const message = composer.getMessageArray(); + const encoded = this._codec.encode(header, message); + + if(!encoded) + { + NitroLogger.packets('Encoding Failed', composer.constructor.name); + + continue; + } + + NitroLogger.packets('OutgoingComposer', header, composer.constructor.name, message); + + this.write(encoded.getBuffer()); + } + + return true; + } + + private write(buffer: ArrayBuffer): void + { + if(this._socket.readyState !== WebSocket.OPEN) return; + + this._socket.send(buffer); + } + + public processReceivedData(): void + { + try + { + this.processData(); + } + + catch (err) + { + NitroLogger.error(err); + } + } + + private processData(): void + { + const wrappers = this.splitReceivedMessages(); + + if(!wrappers || !wrappers.length) return; + + if(this._isAuthenticated && !this._isReady) + { + if(!this._pendingServerMessages) this._pendingServerMessages = []; + + this._pendingServerMessages.push(...wrappers); + + return; + } + + this.processWrappers(...wrappers); + } + + private processWrappers(...wrappers: IMessageDataWrapper[]): void + { + if(!wrappers || !wrappers.length) return; + + for(const wrapper of wrappers) + { + if(!wrapper) continue; + + const messages = this.getMessagesForWrapper(wrapper); + + if(!messages || !messages.length) continue; + + NitroLogger.packets('IncomingMessage', wrapper.header, messages[0].constructor.name, messages[0].parser); + + this.handleMessages(...messages); + } + } + + private splitReceivedMessages(): IMessageDataWrapper[] + { + if(!this._dataBuffer || !this._dataBuffer.byteLength) return null; + + return this._codec.decode(this); + } + + private concatArrayBuffers(buffer1: ArrayBuffer, buffer2: ArrayBuffer): ArrayBuffer + { + const array = new Uint8Array(buffer1.byteLength + buffer2.byteLength); + + array.set(new Uint8Array(buffer1), 0); + array.set(new Uint8Array(buffer2), buffer1.byteLength); + + return array.buffer; + } + + private getMessagesForWrapper(wrapper: IMessageDataWrapper): IMessageEvent[] + { + if(!wrapper) return null; + + const events = this._messages.getEvents(wrapper.header); + + if(!events || !events.length) + { + NitroLogger.packets('IncomingMessage', wrapper.header, 'UNREGISTERED', wrapper); + + return; + } + + try + { + //@ts-ignore + const parser = new events[0].parserClass(); + + if(!parser || !parser.flush() || !parser.parse(wrapper)) return null; + + for(const event of events) (event.parser = parser); + } + + catch (e) + { + NitroLogger.error('Error parsing message', e, events[0].constructor.name); + + return null; + } + + return events; + } + + private handleMessages(...messages: IMessageEvent[]): void + { + messages = [...messages]; + + for(const message of messages) + { + if(!message) continue; + + message.connection = this; + + if(message.callBack) message.callBack(message); + } + } + + public registerMessages(configuration: IMessageConfiguration): void + { + if(!configuration) return; + + this._messages.registerMessages(configuration); + } + + public addMessageEvent(event: IMessageEvent): void + { + if(!event || !this._messages) return; + + this._messages.registerMessageEvent(event); + } + + public removeMessageEvent(event: IMessageEvent): void + { + if(!event || !this._messages) return; + + this._messages.removeMessageEvent(event); + } + + public get isAuthenticated(): boolean + { + return this._isAuthenticated; + } + + public get dataBuffer(): ArrayBuffer + { + return this._dataBuffer; + } + + public set dataBuffer(buffer: ArrayBuffer) + { + this._dataBuffer = buffer; + } +} diff --git a/submodules/renderer/src/core/communication/codec/Byte.ts b/submodules/renderer/src/core/communication/codec/Byte.ts new file mode 100644 index 0000000..dbcb29c --- /dev/null +++ b/submodules/renderer/src/core/communication/codec/Byte.ts @@ -0,0 +1,14 @@ +export class Byte +{ + private _value: number; + + constructor(value: number) + { + this._value = value; + } + + public get value(): number + { + return this._value; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/core/communication/codec/Short.ts b/submodules/renderer/src/core/communication/codec/Short.ts new file mode 100644 index 0000000..f23125e --- /dev/null +++ b/submodules/renderer/src/core/communication/codec/Short.ts @@ -0,0 +1,14 @@ +export class Short +{ + private _value: number; + + constructor(value: number) + { + this._value = value; + } + + public get value(): number + { + return this._value; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/core/communication/codec/evawire/EvaWireDataWrapper.ts b/submodules/renderer/src/core/communication/codec/evawire/EvaWireDataWrapper.ts new file mode 100644 index 0000000..60eca85 --- /dev/null +++ b/submodules/renderer/src/core/communication/codec/evawire/EvaWireDataWrapper.ts @@ -0,0 +1,78 @@ +import { IBinaryReader, IMessageDataWrapper } from '../../../../api'; + +export class EvaWireDataWrapper implements IMessageDataWrapper +{ + private _header: number; + private _buffer: IBinaryReader; + + constructor(header: number, buffer: IBinaryReader) + { + this._header = header; + this._buffer = buffer; + } + + public readBytes(length: number): IBinaryReader + { + if(!this._buffer) return null; + + return this._buffer.readBytes(length); + } + + public readByte(): number + { + if(!this._buffer) return -1; + + return this._buffer.readByte(); + } + + public readBoolean(): boolean + { + return (this.readByte() === 1); + } + + public readShort(): number + { + if(!this._buffer) return -1; + + return this._buffer.readShort(); + } + + public readInt(): number + { + if(!this._buffer) return -1; + + return this._buffer.readInt(); + } + + public readFloat(): number + { + if(!this._buffer) return -1; + + return this._buffer.readFloat(); + } + + public readDouble(): number + { + if(!this._buffer) return -1; + + return this._buffer.readDouble(); + } + + public readString(): string + { + const length = this.readShort(); + const buffer = this._buffer.readBytes(length); + + return buffer.toString('utf8'); + } + + public get header(): number + { + return this._header; + } + + public get bytesAvailable(): boolean + { + return (this._buffer && (this._buffer.remaining() > 0)); + } +} diff --git a/submodules/renderer/src/core/communication/codec/evawire/EvaWireFormat.ts b/submodules/renderer/src/core/communication/codec/evawire/EvaWireFormat.ts new file mode 100644 index 0000000..0acbff8 --- /dev/null +++ b/submodules/renderer/src/core/communication/codec/evawire/EvaWireFormat.ts @@ -0,0 +1,88 @@ +import { BinaryReader, BinaryWriter, IBinaryWriter, ICodec, IConnection, IMessageDataWrapper } from '../../../../api'; +import { Byte } from '../Byte'; +import { Short } from '../Short'; +import { EvaWireDataWrapper } from './EvaWireDataWrapper'; + +export class EvaWireFormat implements ICodec +{ + public encode(header: number, messages: any[]): IBinaryWriter + { + const writer = new BinaryWriter(); + + writer.writeShort(header); + + for(const value of messages) + { + let type: string = typeof value; + + if(type === 'object') + { + if(value === null) type = 'null'; + else if(value instanceof Byte) type = 'byte'; + else if(value instanceof Short) type = 'short'; + else if(value instanceof ArrayBuffer) type = 'arraybuffer'; + } + + switch(type) + { + case 'undefined': + case 'null': + writer.writeShort(0); + break; + case 'byte': + writer.writeByte(value.value); + break; + case 'short': + writer.writeShort(value.value); + break; + case 'number': + writer.writeInt(value); + break; + case 'boolean': + writer.writeByte(value ? 1 : 0); + break; + case 'string': + if(!value) writer.writeShort(0); + else + { + writer.writeString(value, true); + } + break; + case 'arraybuffer': + writer.writeBytes(value); + break; + } + } + + const buffer = writer.getBuffer(); + + if(!buffer) return null; + + return new BinaryWriter().writeInt(buffer.byteLength).writeBytes(buffer); + } + + public decode(connection: IConnection): IMessageDataWrapper[] + { + if(!connection || !connection.dataBuffer || !connection.dataBuffer.byteLength) return null; + + const wrappers: IMessageDataWrapper[] = []; + + while(connection.dataBuffer.byteLength) + { + if(connection.dataBuffer.byteLength < 4) break; + + const container = new BinaryReader(connection.dataBuffer); + const length = container.readInt(); + + if(length > (connection.dataBuffer.byteLength - 4)) break; + + const extracted = container.readBytes(length); + + wrappers.push(new EvaWireDataWrapper(extracted.readShort(), extracted)); + + connection.dataBuffer = connection.dataBuffer.slice(length + 4); + } + + return wrappers; + } +} diff --git a/submodules/renderer/src/core/communication/codec/evawire/index.ts b/submodules/renderer/src/core/communication/codec/evawire/index.ts new file mode 100644 index 0000000..6b63cda --- /dev/null +++ b/submodules/renderer/src/core/communication/codec/evawire/index.ts @@ -0,0 +1,2 @@ +export * from './EvaWireDataWrapper'; +export * from './EvaWireFormat'; diff --git a/submodules/renderer/src/core/communication/codec/index.ts b/submodules/renderer/src/core/communication/codec/index.ts new file mode 100644 index 0000000..cb49e18 --- /dev/null +++ b/submodules/renderer/src/core/communication/codec/index.ts @@ -0,0 +1,3 @@ +export * from './Byte'; +export * from './evawire'; +export * from './Short'; diff --git a/submodules/renderer/src/core/communication/index.ts b/submodules/renderer/src/core/communication/index.ts new file mode 100644 index 0000000..d9e31cd --- /dev/null +++ b/submodules/renderer/src/core/communication/index.ts @@ -0,0 +1,5 @@ +export * from './codec'; +export * from './codec/evawire'; +export * from './CommunicationManager'; +export * from './messages'; +export * from './SocketConnection'; diff --git a/submodules/renderer/src/core/communication/messages/MessageClassManager.ts b/submodules/renderer/src/core/communication/messages/MessageClassManager.ts new file mode 100644 index 0000000..f4f7e00 --- /dev/null +++ b/submodules/renderer/src/core/communication/messages/MessageClassManager.ts @@ -0,0 +1,128 @@ +import { IMessageComposer, IMessageConfiguration, IMessageEvent } from '../../../api'; +import { MessageEvent } from '../../../events'; + +export class MessageClassManager +{ + private _messageIdByEvent: Map; + private _messageIdByComposer: Map; + private _messageInstancesById: Map; + + constructor() + { + this._messageIdByEvent = new Map(); + this._messageIdByComposer = new Map(); + this._messageInstancesById = new Map(); + } + + public dispose(): void + { + this._messageIdByEvent.clear(); + this._messageIdByComposer.clear(); + this._messageInstancesById.clear(); + } + + public registerMessages(configuration: IMessageConfiguration): void + { + for(const [header, handler] of configuration.events) this.registerMessageEventClass(header, handler); + + for(const [header, handler] of configuration.composers) this.registerMessageComposerClass(header, handler); + } + + private registerMessageEventClass(header: number, handler: Function): void + { + if(!header || !handler) return; + + this._messageIdByEvent.set(handler, header); + } + + private registerMessageComposerClass(header: number, handler: Function): void + { + if(!header || !handler) return; + + this._messageIdByComposer.set(handler, header); + } + + public registerMessageEvent(event: IMessageEvent): void + { + if(!event) return; + + const header = this.getEventId(event); + + if(!header) return; + + let existing = this._messageInstancesById.get(header); + + if(!existing || !existing.length) + { + existing = []; + + this._messageInstancesById.set(header, existing); + } + + existing.push(event); + } + + public removeMessageEvent(event: IMessageEvent): void + { + if(!event) return; + + const header = this.getEventId(event); + + if(!header) return; + + const existing = this._messageInstancesById.get(header); + + if(!existing) return; + + for(const [index, message] of existing.entries()) + { + if(!message) continue; + + if(message !== event) continue; + + existing.splice(index, 1); + + if(existing.length === 0) this._messageInstancesById.delete(header); + + message.dispose(); + + return; + } + } + + public getEvents(header: number): IMessageEvent[] + { + if(!header) return; + + const existing = this._messageInstancesById.get(header); + + if(!existing) return; + + return existing; + } + + public getEventId(event: IMessageEvent): number + { + if(!event) return -1; + + //@ts-ignore + const name = (event instanceof MessageEvent ? event.constructor : event) as Function; + + const existing = this._messageIdByEvent.get(name); + + if(!existing) return -1; + + return existing; + } + + public getComposerId(composer: IMessageComposer): number + { + if(!composer) return -1; + + const existing = this._messageIdByComposer.get(composer.constructor); + + if(!existing) return -1; + + return existing; + } +} diff --git a/submodules/renderer/src/core/communication/messages/index.ts b/submodules/renderer/src/core/communication/messages/index.ts new file mode 100644 index 0000000..deb18a3 --- /dev/null +++ b/submodules/renderer/src/core/communication/messages/index.ts @@ -0,0 +1 @@ +export * from './MessageClassManager'; diff --git a/submodules/renderer/src/core/configuration/ConfigurationEvent.ts b/submodules/renderer/src/core/configuration/ConfigurationEvent.ts new file mode 100644 index 0000000..6f4c5be --- /dev/null +++ b/submodules/renderer/src/core/configuration/ConfigurationEvent.ts @@ -0,0 +1,12 @@ +import { NitroEvent } from '../../events'; + +export class ConfigurationEvent extends NitroEvent +{ + public static LOADED: string = 'NCE_LOADED'; + public static FAILED: string = 'NCE_FAILED'; + + constructor(type: string) + { + super(type); + } +} diff --git a/submodules/renderer/src/core/configuration/ConfigurationManager.ts b/submodules/renderer/src/core/configuration/ConfigurationManager.ts new file mode 100644 index 0000000..bedf4b1 --- /dev/null +++ b/submodules/renderer/src/core/configuration/ConfigurationManager.ts @@ -0,0 +1,93 @@ +import { IConfigurationManager, NitroConfiguration } from '../../api'; +import { NitroManager } from '../common'; +import { ConfigurationEvent } from './ConfigurationEvent'; + +export class ConfigurationManager extends NitroManager implements IConfigurationManager +{ + private _definitions: Map; + private _config: any; + private _pendingUrls: string[]; + private _missingKeys: string[]; + + constructor() + { + super(); + + this._definitions = new Map(); + this._config = []; + this._pendingUrls = []; + this._missingKeys = []; + + this.onConfigurationLoaded = this.onConfigurationLoaded.bind(this); + } + + protected onInit(): void + { + NitroConfiguration.parseConfiguration(this.getDefaultConfig(), true); + + this._pendingUrls = NitroConfiguration.getValue('config.urls').slice(); + + this.loadNextConfiguration(); + } + + private loadNextConfiguration(): void + { + if(!this._pendingUrls.length) + { + this.dispatchConfigurationEvent(ConfigurationEvent.LOADED); + + return; + } + + this.loadConfigurationFromUrl(this._pendingUrls[0]); + } + + public loadConfigurationFromUrl(url: string): void + { + if(!url || (url === '')) + { + this.dispatchConfigurationEvent(ConfigurationEvent.FAILED); + + return; + } + + fetch(url) + .then(response => response.json()) + .then(data => this.onConfigurationLoaded(data, url)) + .catch(err => this.onConfigurationFailed(err)); + } + + private onConfigurationLoaded(data: { [index: string]: any }, url: string): void + { + if(!data) return; + + if(NitroConfiguration.parseConfiguration(data)) + { + const index = this._pendingUrls.indexOf(url); + + if(index >= 0) this._pendingUrls.splice(index, 1); + + this.loadNextConfiguration(); + + return; + } + + this.dispatchConfigurationEvent(ConfigurationEvent.FAILED); + } + + private onConfigurationFailed(error: Error): void + { + this.dispatchConfigurationEvent(ConfigurationEvent.FAILED); + } + + private dispatchConfigurationEvent(type: string): void + { + this.events && this.events.dispatchEvent(new ConfigurationEvent(type)); + } + + public getDefaultConfig(): { [index: string]: any } + { + //@ts-ignore + return NitroConfig as { [index: string]: any }; + } +} diff --git a/submodules/renderer/src/core/configuration/index.ts b/submodules/renderer/src/core/configuration/index.ts new file mode 100644 index 0000000..1b3e284 --- /dev/null +++ b/submodules/renderer/src/core/configuration/index.ts @@ -0,0 +1,2 @@ +export * from './ConfigurationEvent'; +export * from './ConfigurationManager'; diff --git a/submodules/renderer/src/core/index.ts b/submodules/renderer/src/core/index.ts new file mode 100644 index 0000000..67ca055 --- /dev/null +++ b/submodules/renderer/src/core/index.ts @@ -0,0 +1,8 @@ +export * from './common'; +export * from './communication'; +export * from './communication/codec'; +export * from './communication/codec/evawire'; +export * from './communication/messages'; +export * from './configuration'; +export * from './NitroCore'; +export * from './NitroVersion'; diff --git a/submodules/renderer/src/events/NitroSettingsEvent.ts b/submodules/renderer/src/events/NitroSettingsEvent.ts new file mode 100644 index 0000000..62635a0 --- /dev/null +++ b/submodules/renderer/src/events/NitroSettingsEvent.ts @@ -0,0 +1,116 @@ +import { NitroEvent } from './core'; + +export class NitroSettingsEvent extends NitroEvent +{ + public static SETTINGS_UPDATED: string = 'NSE_SETTINGS_UPDATED'; + + private _volumeSystem: number; + private _volumeFurni: number; + private _volumeTrax: number; + private _oldChat: boolean; + private _roomInvites: boolean; + private _cameraFollow: boolean; + private _flags: number; + private _chatType: number; + + constructor() + { + super(NitroSettingsEvent.SETTINGS_UPDATED); + } + + public clone(): NitroSettingsEvent + { + const clone = new NitroSettingsEvent(); + + clone._volumeSystem = this._volumeSystem; + clone._volumeFurni = this._volumeFurni; + clone._volumeTrax = this._volumeTrax; + clone._oldChat = this._oldChat; + clone._roomInvites = this._roomInvites; + clone._cameraFollow = this._cameraFollow; + clone._flags = this._flags; + clone._chatType = this._chatType; + + return clone; + } + + public get volumeSystem(): number + { + return this._volumeSystem; + } + + public set volumeSystem(volume: number) + { + this._volumeSystem = volume; + } + + public get volumeFurni(): number + { + return this._volumeFurni; + } + + public set volumeFurni(volume: number) + { + this._volumeFurni = volume; + } + + public get volumeTrax(): number + { + return this._volumeTrax; + } + + public set volumeTrax(volume: number) + { + this._volumeTrax = volume; + } + + public get oldChat(): boolean + { + return this._oldChat; + } + + public set oldChat(value: boolean) + { + this._oldChat = value; + } + + public get roomInvites(): boolean + { + return this._roomInvites; + } + + public set roomInvites(value: boolean) + { + this._roomInvites = value; + } + + public get cameraFollow(): boolean + { + return this._cameraFollow; + } + + public set cameraFollow(value: boolean) + { + this._cameraFollow = value; + } + + public get flags(): number + { + return this._flags; + } + + public set flags(flags: number) + { + this._flags = flags; + } + + public get chatType(): number + { + return this._chatType; + } + + public set chatType(type: number) + { + this._chatType = type; + } +} diff --git a/submodules/renderer/src/events/NitroSoundEvent.ts b/submodules/renderer/src/events/NitroSoundEvent.ts new file mode 100644 index 0000000..5e70223 --- /dev/null +++ b/submodules/renderer/src/events/NitroSoundEvent.ts @@ -0,0 +1,19 @@ +import { NitroEvent } from './core'; + +export class NitroSoundEvent extends NitroEvent +{ + public static PLAY_SOUND: string = 'NSOE_PLAY_SOUND'; + + private _sampleCode: string; + + constructor(type: string, sampleCode: string) + { + super(type); + this._sampleCode = sampleCode; + } + + public get sampleCode(): string + { + return this._sampleCode; + } +} diff --git a/submodules/renderer/src/events/NitroToolbarAnimateIconEvent.ts b/submodules/renderer/src/events/NitroToolbarAnimateIconEvent.ts new file mode 100644 index 0000000..5aa3f7f --- /dev/null +++ b/submodules/renderer/src/events/NitroToolbarAnimateIconEvent.ts @@ -0,0 +1,34 @@ +import { NitroToolbarEvent } from './NitroToolbarEvent'; + +export class NitroToolbarAnimateIconEvent extends NitroToolbarEvent +{ + public static ANIMATE_ICON: string = 'NTAIE_ANIMATE_ICON'; + + private _image: HTMLImageElement; + private _x: number; + private _y: number; + + constructor(image: HTMLImageElement, x: number, y: number) + { + super(NitroToolbarAnimateIconEvent.ANIMATE_ICON); + + this._image = image; + this._x = x; + this._y = y; + } + + public get image(): HTMLImageElement + { + return this._image; + } + + public get x(): number + { + return this._x; + } + + public get y(): number + { + return this._y; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/events/NitroToolbarEvent.ts b/submodules/renderer/src/events/NitroToolbarEvent.ts new file mode 100644 index 0000000..d9cbc63 --- /dev/null +++ b/submodules/renderer/src/events/NitroToolbarEvent.ts @@ -0,0 +1,35 @@ +import { NitroEvent } from './core'; + +export class NitroToolbarEvent extends NitroEvent +{ + public static TOOLBAR_CLICK: string = 'NTE_TOOLBAR_CLICK'; + public static SELECT_OWN_AVATAR: string = 'NTE_SELECT_OWN_AVATAR'; + + private _iconId: string; + private _iconName: string; + + constructor(type: string) + { + super(type); + } + + public get iconId(): string + { + return this._iconId; + } + + public set iconId(id: string) + { + this._iconId = id; + } + + public get iconName(): string + { + return this._iconName; + } + + public set iconName(name: string) + { + this._iconName = name; + } +} diff --git a/submodules/renderer/src/events/avatar/AvatarRenderEffectLibraryEvent.ts b/submodules/renderer/src/events/avatar/AvatarRenderEffectLibraryEvent.ts new file mode 100644 index 0000000..de48624 --- /dev/null +++ b/submodules/renderer/src/events/avatar/AvatarRenderEffectLibraryEvent.ts @@ -0,0 +1,21 @@ +import { IEffectAssetDownloadLibrary } from '../../api'; +import { NitroEvent } from '../core'; + +export class AvatarRenderEffectLibraryEvent extends NitroEvent +{ + public static DOWNLOAD_COMPLETE: string = 'ARELE_DOWNLOAD_COMPLETE'; + + private _library: IEffectAssetDownloadLibrary; + + constructor(type: string, library: IEffectAssetDownloadLibrary) + { + super(type); + + this._library = library; + } + + public get library(): IEffectAssetDownloadLibrary + { + return this._library; + } +} diff --git a/submodules/renderer/src/events/avatar/AvatarRenderEvent.ts b/submodules/renderer/src/events/avatar/AvatarRenderEvent.ts new file mode 100644 index 0000000..d3292e6 --- /dev/null +++ b/submodules/renderer/src/events/avatar/AvatarRenderEvent.ts @@ -0,0 +1,4 @@ +export class AvatarRenderEvent +{ + public static AVATAR_RENDER_READY: string = 'AVATAR_RENDER_READY'; +} \ No newline at end of file diff --git a/submodules/renderer/src/events/avatar/AvatarRenderLibraryEvent.ts b/submodules/renderer/src/events/avatar/AvatarRenderLibraryEvent.ts new file mode 100644 index 0000000..9f2dec8 --- /dev/null +++ b/submodules/renderer/src/events/avatar/AvatarRenderLibraryEvent.ts @@ -0,0 +1,21 @@ +import { IAvatarAssetDownloadLibrary } from '../../api'; +import { NitroEvent } from '../core'; + +export class AvatarRenderLibraryEvent extends NitroEvent +{ + public static DOWNLOAD_COMPLETE: string = 'ARLE_DOWNLOAD_COMPLETE'; + + private _library: IAvatarAssetDownloadLibrary; + + constructor(type: string, library: IAvatarAssetDownloadLibrary) + { + super(type); + + this._library = library; + } + + public get library(): IAvatarAssetDownloadLibrary + { + return this._library; + } +} diff --git a/submodules/renderer/src/events/avatar/index.ts b/submodules/renderer/src/events/avatar/index.ts new file mode 100644 index 0000000..3fb9605 --- /dev/null +++ b/submodules/renderer/src/events/avatar/index.ts @@ -0,0 +1,3 @@ +export * from './AvatarRenderEffectLibraryEvent'; +export * from './AvatarRenderEvent'; +export * from './AvatarRenderLibraryEvent'; diff --git a/submodules/renderer/src/events/camera/RoomCameraWidgetManagerEvent.ts b/submodules/renderer/src/events/camera/RoomCameraWidgetManagerEvent.ts new file mode 100644 index 0000000..5989627 --- /dev/null +++ b/submodules/renderer/src/events/camera/RoomCameraWidgetManagerEvent.ts @@ -0,0 +1,11 @@ +import { NitroEvent } from '../core'; + +export class RoomCameraWidgetManagerEvent extends NitroEvent +{ + public static INITIALIZED: string = 'RCWM_INITIALIZED'; + + constructor(type: string) + { + super(type); + } +} diff --git a/submodules/renderer/src/events/camera/index.ts b/submodules/renderer/src/events/camera/index.ts new file mode 100644 index 0000000..b6e32e2 --- /dev/null +++ b/submodules/renderer/src/events/camera/index.ts @@ -0,0 +1 @@ +export * from './RoomCameraWidgetManagerEvent'; diff --git a/submodules/renderer/src/events/communication/NitroCommunicationDemoEvent.ts b/submodules/renderer/src/events/communication/NitroCommunicationDemoEvent.ts new file mode 100644 index 0000000..e326f42 --- /dev/null +++ b/submodules/renderer/src/events/communication/NitroCommunicationDemoEvent.ts @@ -0,0 +1,27 @@ +import { IConnection } from '../../api'; +import { NitroEvent } from '../core'; + +export class NitroCommunicationDemoEvent extends NitroEvent +{ + public static CONNECTION_ESTABLISHED = 'NCE_ESTABLISHED'; + public static CONNECTION_CLOSED = 'NCE_CLOSED'; + public static CONNECTION_ERROR = 'NCE_ERROR'; + public static CONNECTION_HANDSHAKING = 'NCE_HANDSHAKING'; + public static CONNECTION_HANDSHAKED = 'NCE_HANDSHAKED'; + public static CONNECTION_HANDSHAKE_FAILED = 'NCE_HANDSHAKE_FAILED'; + public static CONNECTION_AUTHENTICATED = 'NCE_AUTHENTICATED'; + + private _connection: IConnection; + + constructor(type: string, connection: IConnection) + { + super(type); + + this._connection = connection; + } + + public get connection(): IConnection + { + return this._connection; + } +} diff --git a/submodules/renderer/src/events/communication/index.ts b/submodules/renderer/src/events/communication/index.ts new file mode 100644 index 0000000..d795b92 --- /dev/null +++ b/submodules/renderer/src/events/communication/index.ts @@ -0,0 +1 @@ +export * from './NitroCommunicationDemoEvent'; diff --git a/submodules/renderer/src/events/core/MessageEvent.ts b/submodules/renderer/src/events/core/MessageEvent.ts new file mode 100644 index 0000000..012c8c2 --- /dev/null +++ b/submodules/renderer/src/events/core/MessageEvent.ts @@ -0,0 +1,55 @@ +import { IConnection, IMessageEvent, IMessageParser } from '../../api'; + +export class MessageEvent implements IMessageEvent +{ + private _callBack: Function; + private _parserClass: Function; + private _parser: IMessageParser; + private _connection: IConnection; + + constructor(callBack: Function, parser: { new(): IMessageParser }) + { + this._callBack = callBack; + this._parserClass = parser; + this._parser = null; + this._connection = null; + } + + public dispose(): void + { + this._callBack = null; + this._parserClass = null; + this._parser = null; + this._connection = null; + } + + public get callBack(): Function + { + return this._callBack; + } + + public get parserClass(): Function + { + return this._parserClass; + } + + public get parser(): IMessageParser + { + return this._parser; + } + + public set parser(parser: IMessageParser) + { + this._parser = parser; + } + + public get connection(): IConnection + { + return this._connection; + } + + public set connection(connection: IConnection) + { + this._connection = connection; + } +} diff --git a/submodules/renderer/src/events/core/NitroEvent.ts b/submodules/renderer/src/events/core/NitroEvent.ts new file mode 100644 index 0000000..204f113 --- /dev/null +++ b/submodules/renderer/src/events/core/NitroEvent.ts @@ -0,0 +1,16 @@ +import { INitroEvent } from '../../api'; + +export class NitroEvent implements INitroEvent +{ + private _type: string; + + constructor(type: string) + { + this._type = type; + } + + public get type(): string + { + return this._type; + } +} diff --git a/submodules/renderer/src/events/core/SocketConnectionEvent.ts b/submodules/renderer/src/events/core/SocketConnectionEvent.ts new file mode 100644 index 0000000..5df9c5a --- /dev/null +++ b/submodules/renderer/src/events/core/SocketConnectionEvent.ts @@ -0,0 +1,31 @@ +import { IConnection } from '../../api'; +import { NitroEvent } from './NitroEvent'; + +export class SocketConnectionEvent extends NitroEvent +{ + public static CONNECTION_OPENED = 'SCE_OPEN'; + public static CONNECTION_CLOSED = 'SCE_CLOSED'; + public static CONNECTION_ERROR = 'SCE_ERROR'; + public static CONNECTION_MESSAGE = 'SCE_MESSAGE'; + + private _connection: IConnection; + private _originalEvent: Event; + + constructor(type: string, connection: IConnection, originalEvent: Event) + { + super(type); + + this._connection = connection; + this._originalEvent = event; + } + + public get connection(): IConnection + { + return this._connection; + } + + public get originalEvent(): Event + { + return this._originalEvent; + } +} diff --git a/submodules/renderer/src/events/core/index.ts b/submodules/renderer/src/events/core/index.ts new file mode 100644 index 0000000..4657952 --- /dev/null +++ b/submodules/renderer/src/events/core/index.ts @@ -0,0 +1,3 @@ +export * from './MessageEvent'; +export * from './NitroEvent'; +export * from './SocketConnectionEvent'; diff --git a/submodules/renderer/src/events/index.ts b/submodules/renderer/src/events/index.ts new file mode 100644 index 0000000..17b2121 --- /dev/null +++ b/submodules/renderer/src/events/index.ts @@ -0,0 +1,11 @@ +export * from './avatar'; +export * from './camera'; +export * from './communication'; +export * from './core'; +export * from './localization'; +export * from './NitroSettingsEvent'; +export * from './NitroSoundEvent'; +export * from './NitroToolbarAnimateIconEvent'; +export * from './NitroToolbarEvent'; +export * from './room'; +export * from './session'; diff --git a/submodules/renderer/src/events/localization/NitroLocalizationEvent.ts b/submodules/renderer/src/events/localization/NitroLocalizationEvent.ts new file mode 100644 index 0000000..a011d39 --- /dev/null +++ b/submodules/renderer/src/events/localization/NitroLocalizationEvent.ts @@ -0,0 +1,12 @@ +import { NitroEvent } from '../core'; + +export class NitroLocalizationEvent extends NitroEvent +{ + public static LOADED: string = 'NLE_LOADED'; + public static FAILED: string = 'NLE_FAILED'; + + constructor(type: string) + { + super(type); + } +} diff --git a/submodules/renderer/src/events/localization/index.ts b/submodules/renderer/src/events/localization/index.ts new file mode 100644 index 0000000..30cf817 --- /dev/null +++ b/submodules/renderer/src/events/localization/index.ts @@ -0,0 +1 @@ +export * from './NitroLocalizationEvent'; diff --git a/submodules/renderer/src/events/room/RoomBackgroundColorEvent.ts b/submodules/renderer/src/events/room/RoomBackgroundColorEvent.ts new file mode 100644 index 0000000..03152df --- /dev/null +++ b/submodules/renderer/src/events/room/RoomBackgroundColorEvent.ts @@ -0,0 +1,34 @@ +import { RoomEngineEvent } from './RoomEngineEvent'; + +export class RoomBackgroundColorEvent extends RoomEngineEvent +{ + public static ROOM_COLOR: string = 'REE_ROOM_COLOR'; + + private _color: number; + private _brightness: number; + private _bgOnly: boolean; + + constructor(roomId: number, color: number, _arg_3: number, _arg_4: boolean) + { + super(RoomBackgroundColorEvent.ROOM_COLOR, roomId); + + this._color = color; + this._brightness = _arg_3; + this._bgOnly = _arg_4; + } + + public get color(): number + { + return this._color; + } + + public get brightness(): number + { + return this._brightness; + } + + public get bgOnly(): boolean + { + return this._bgOnly; + } +} diff --git a/submodules/renderer/src/events/room/RoomContentLoadedEvent.ts b/submodules/renderer/src/events/room/RoomContentLoadedEvent.ts new file mode 100644 index 0000000..1cdc9fb --- /dev/null +++ b/submodules/renderer/src/events/room/RoomContentLoadedEvent.ts @@ -0,0 +1,22 @@ +import { NitroEvent } from '../core'; + +export class RoomContentLoadedEvent extends NitroEvent +{ + public static RCLE_SUCCESS: string = 'RCLE_SUCCESS'; + public static RCLE_FAILURE: string = 'RCLE_FAILURE'; + public static RCLE_CANCEL: string = 'RCLE_CANCEL'; + + private _contentType: string; + + constructor(type: string, contentType: string) + { + super(type); + + this._contentType = contentType; + } + + public get contentType(): string + { + return this._contentType; + } +} diff --git a/submodules/renderer/src/events/room/RoomDragEvent.ts b/submodules/renderer/src/events/room/RoomDragEvent.ts new file mode 100644 index 0000000..e41931b --- /dev/null +++ b/submodules/renderer/src/events/room/RoomDragEvent.ts @@ -0,0 +1,27 @@ +import { RoomEngineEvent } from './RoomEngineEvent'; + +export class RoomDragEvent extends RoomEngineEvent +{ + public static ROOM_DRAG: string = 'RDE_ROOM_DRAG'; + + private _offsetX: number; + private _offsetY: number; + + constructor(roomId: number, offsetX: number, offsetY: number) + { + super(RoomDragEvent.ROOM_DRAG, roomId); + + this._offsetX = offsetX; + this._offsetY = offsetY; + } + + public get offsetX(): number + { + return this._offsetX; + } + + public get offsetY(): number + { + return this._offsetY; + } +} diff --git a/submodules/renderer/src/events/room/RoomEngineDimmerStateEvent.ts b/submodules/renderer/src/events/room/RoomEngineDimmerStateEvent.ts new file mode 100644 index 0000000..85ca480 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomEngineDimmerStateEvent.ts @@ -0,0 +1,48 @@ +import { RoomEngineEvent } from './RoomEngineEvent'; + +export class RoomEngineDimmerStateEvent extends RoomEngineEvent +{ + public static ROOM_COLOR: string = 'REDSE_ROOM_COLOR'; + + private _state: number; + private _presetId: number; + private _effectId: number; + private _color: number; + private _brightness: number; + + constructor(k: number, state: number, presetId: number, effectId: number, color: number, brightness: number) + { + super(RoomEngineDimmerStateEvent.ROOM_COLOR, k); + + this._state = state; + this._presetId = presetId; + this._effectId = effectId; + this._color = color; + this._brightness = brightness; + } + + public get state(): number + { + return this._state; + } + + public get presetId(): number + { + return this._presetId; + } + + public get effectId(): number + { + return this._effectId; + } + + public get color(): number + { + return this._color; + } + + public get brightness(): number + { + return this._brightness; + } +} diff --git a/submodules/renderer/src/events/room/RoomEngineEvent.ts b/submodules/renderer/src/events/room/RoomEngineEvent.ts new file mode 100644 index 0000000..4d90867 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomEngineEvent.ts @@ -0,0 +1,26 @@ +import { NitroEvent } from '../core'; + +export class RoomEngineEvent extends NitroEvent +{ + public static INITIALIZED: string = 'REE_INITIALIZED'; + public static ENGINE_INITIALIZED: string = 'REE_ENGINE_INITIALIZED'; + public static OBJECTS_INITIALIZED: string = 'REE_OBJECTS_INITIALIZED'; + public static NORMAL_MODE: string = 'REE_NORMAL_MODE'; + public static GAME_MODE: string = 'REE_GAME_MODE'; + public static ROOM_ZOOMED: string = 'REE_ROOM_ZOOMED'; + public static DISPOSED: string = 'REE_DISPOSED'; + + private _roomId: number; + + constructor(type: string, roomId: number) + { + super(type); + + this._roomId = roomId; + } + + public get roomId(): number + { + return this._roomId; + } +} diff --git a/submodules/renderer/src/events/room/RoomEngineObjectEvent.ts b/submodules/renderer/src/events/room/RoomEngineObjectEvent.ts new file mode 100644 index 0000000..75ff09b --- /dev/null +++ b/submodules/renderer/src/events/room/RoomEngineObjectEvent.ts @@ -0,0 +1,39 @@ +import { RoomEngineEvent } from './RoomEngineEvent'; + +export class RoomEngineObjectEvent extends RoomEngineEvent +{ + public static SELECTED: string = 'REOE_SELECTED'; + public static DESELECTED: string = 'REOE_DESELECTED'; + public static ADDED: string = 'REOE_ADDED'; + public static REMOVED: string = 'REOE_REMOVED'; + public static PLACED: string = 'REOE_PLACED'; + public static PLACED_ON_USER: string = 'REOE_PLACED_ON_USER'; + public static CONTENT_UPDATED: string = 'REOE_CONTENT_UPDATED'; + public static REQUEST_MOVE: string = 'REOE_REQUEST_MOVE'; + public static REQUEST_ROTATE: string = 'REOE_REQUEST_ROTATE'; + public static REQUEST_MANIPULATION: string = 'REOE_REQUEST_MANIPULATION'; + public static MOUSE_ENTER: string = 'REOE_MOUSE_ENTER'; + public static MOUSE_LEAVE: string = 'REOE_MOUSE_LEAVE'; + public static DOUBLE_CLICK: string = 'REOE_DOUBLE_CLICK'; + + private _objectId: number; + private _category: number; + + constructor(type: string, roomId: number, objectId: number, category: number) + { + super(type, roomId); + + this._objectId = objectId; + this._category = category; + } + + public get objectId(): number + { + return this._objectId; + } + + public get category(): number + { + return this._category; + } +} diff --git a/submodules/renderer/src/events/room/RoomEngineObjectPlacedEvent.ts b/submodules/renderer/src/events/room/RoomEngineObjectPlacedEvent.ts new file mode 100644 index 0000000..cd008df --- /dev/null +++ b/submodules/renderer/src/events/room/RoomEngineObjectPlacedEvent.ts @@ -0,0 +1,74 @@ +import { RoomEngineObjectEvent } from './RoomEngineObjectEvent'; + +export class RoomEngineObjectPlacedEvent extends RoomEngineObjectEvent +{ + private _wallLocation: string = ''; + private _x: number = 0; + private _y: number = 0; + private _z: number = 0; + private _direction: number = 0; + private _placedInRoom: boolean = false; + private _placedOnFloor: boolean = false; + private _placedOnWall: boolean = false; + private _instanceData: string = null; + + constructor(type: string, roomId: number, objectId: number, category: number, wallLocation: string, x: number, y: number, z: number, direction: number, placedInRoom: boolean, placedOnFloor: boolean, placedOnWall: boolean, instanceData: string) + { + super(type, roomId, objectId, category); + + this._wallLocation = wallLocation; + this._x = x; + this._y = y; + this._z = z; + this._direction = direction; + this._placedInRoom = placedInRoom; + this._placedOnFloor = placedOnFloor; + this._placedOnWall = placedOnWall; + this._instanceData = instanceData; + } + + public get wallLocation(): string + { + return this._wallLocation; + } + + public get x(): number + { + return this._x; + } + + public get y(): number + { + return this._y; + } + + public get z(): number + { + return this._z; + } + + public get direction(): number + { + return this._direction; + } + + public get placedInRoom(): boolean + { + return this._placedInRoom; + } + + public get placedOnFloor(): boolean + { + return this._placedOnFloor; + } + + public get placedOnWall(): boolean + { + return this._placedOnWall; + } + + public get instanceData(): string + { + return this._instanceData; + } +} diff --git a/submodules/renderer/src/events/room/RoomEngineObjectPlacedOnUserEvent.ts b/submodules/renderer/src/events/room/RoomEngineObjectPlacedOnUserEvent.ts new file mode 100644 index 0000000..0ccb087 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomEngineObjectPlacedOnUserEvent.ts @@ -0,0 +1,25 @@ +import { RoomEngineObjectEvent } from './RoomEngineObjectEvent'; + +export class RoomEngineObjectPlacedOnUserEvent extends RoomEngineObjectEvent +{ + private _droppedObjectId: number; + private _droppedObjectCategory: number; + + constructor(k: string, roomId: number, objectId: number, category: number, droppedObjectId: number, droppedObjectCategory: number) + { + super(k, roomId, objectId, category); + + this._droppedObjectId = droppedObjectId; + this._droppedObjectCategory = droppedObjectCategory; + } + + public get droppedObjectId(): number + { + return this._droppedObjectId; + } + + public get droppedObjectCategory(): number + { + return this._droppedObjectCategory; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/events/room/RoomEngineObjectPlaySoundEvent.ts b/submodules/renderer/src/events/room/RoomEngineObjectPlaySoundEvent.ts new file mode 100644 index 0000000..c5e39fd --- /dev/null +++ b/submodules/renderer/src/events/room/RoomEngineObjectPlaySoundEvent.ts @@ -0,0 +1,28 @@ +import { RoomEngineObjectEvent } from './RoomEngineObjectEvent'; + +export class RoomEngineObjectPlaySoundEvent extends RoomEngineObjectEvent +{ + public static PLAY_SOUND: string = 'REOPSE_PLAY_SOUND'; + public static PLAY_SOUND_AT_PITCH: string = 'REOPSE_PLAY_SOUND_AT_PITCH'; + + private _soundId: string; + private _pitch: number; + + constructor(type: string, roomId: number, objectId: number, objectCategory: number, soundId: string, pitch: number = 1) + { + super(type, roomId, objectId, objectCategory); + + this._soundId = soundId; + this._pitch = pitch; + } + + public get soundId(): string + { + return this._soundId; + } + + public get pitch(): number + { + return this._pitch; + } +} diff --git a/submodules/renderer/src/events/room/RoomEngineRoomAdEvent.ts b/submodules/renderer/src/events/room/RoomEngineRoomAdEvent.ts new file mode 100644 index 0000000..3325373 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomEngineRoomAdEvent.ts @@ -0,0 +1,9 @@ +import { RoomEngineObjectEvent } from './RoomEngineObjectEvent'; + +export class RoomEngineRoomAdEvent extends RoomEngineObjectEvent +{ + public static FURNI_CLICK: string = 'RERAE_FURNI_CLICK'; + public static FURNI_DOUBLE_CLICK: string = 'RERAE_FURNI_DOUBLE_CLICK'; + public static TOOLTIP_SHOW: string = 'RERAE_TOOLTIP_SHOW'; + public static TOOLTIP_HIDE: string = 'RERAE_TOOLTIP_HIDE'; +} diff --git a/submodules/renderer/src/events/room/RoomEngineSamplePlaybackEvent.ts b/submodules/renderer/src/events/room/RoomEngineSamplePlaybackEvent.ts new file mode 100644 index 0000000..ba4e04e --- /dev/null +++ b/submodules/renderer/src/events/room/RoomEngineSamplePlaybackEvent.ts @@ -0,0 +1,30 @@ +import { RoomEngineObjectEvent } from './RoomEngineObjectEvent'; + +export class RoomEngineSamplePlaybackEvent extends RoomEngineObjectEvent +{ + public static ROOM_OBJECT_INITIALIZED: string = 'ROPSPE_ROOM_OBJECT_INITIALIZED'; + public static ROOM_OBJECT_DISPOSED: string = 'ROPSPE_ROOM_OBJECT_DISPOSED'; + public static PLAY_SAMPLE: string = 'ROPSPE_PLAY_SAMPLE'; + public static CHANGE_PITCH: string = 'ROPSPE_CHANGE_PITCH'; + + private _sampleId: number; + private _pitch: number; + + constructor(k: string, roomId: number, objectId: number, objectCategory: number, sampleId: number, pitch: number = 1) + { + super(k, roomId, objectId, objectCategory); + + this._sampleId = sampleId; + this._pitch = pitch; + } + + public get sampleId(): number + { + return this._sampleId; + } + + public get pitch(): number + { + return this._pitch; + } +} diff --git a/submodules/renderer/src/events/room/RoomEngineTriggerWidgetEvent.ts b/submodules/renderer/src/events/room/RoomEngineTriggerWidgetEvent.ts new file mode 100644 index 0000000..ba1c8cb --- /dev/null +++ b/submodules/renderer/src/events/room/RoomEngineTriggerWidgetEvent.ts @@ -0,0 +1,58 @@ +import { RoomEngineObjectEvent } from './RoomEngineObjectEvent'; + +export class RoomEngineTriggerWidgetEvent extends RoomEngineObjectEvent +{ + public static OPEN_WIDGET: string = 'RETWE_OPEN_WIDGET'; + public static CLOSE_WIDGET: string = 'RETWE_CLOSE_WIDGET'; + public static OPEN_FURNI_CONTEXT_MENU: string = 'RETWE_OPEN_FURNI_CONTEXT_MENU'; + public static CLOSE_FURNI_CONTEXT_MENU: string = 'RETWE_CLOSE_FURNI_CONTEXT_MENU'; + public static REQUEST_PLACEHOLDER: string = 'RETWE_REQUEST_PLACEHOLDER'; + public static REQUEST_CREDITFURNI: string = 'RETWE_REQUEST_CREDITFURNI'; + public static REQUEST_STACK_HEIGHT: string = 'RETWE_REQUEST_STACK_HEIGHT'; + public static REQUEST_EXTERNAL_IMAGE: string = 'RETWE_REQUEST_EXTERNAL_IMAGE'; + public static REQUEST_STICKIE: string = 'RETWE_REQUEST_STICKIE'; + public static REQUEST_PRESENT: string = 'RETWE_REQUEST_PRESENT'; + public static REQUEST_TROPHY: string = 'RETWE_REQUEST_TROPHY'; + public static REQUEST_TEASER: string = 'RETWE_REQUEST_TEASER'; + public static REQUEST_ECOTRONBOX: string = 'RETWE_REQUEST_ECOTRONBOX'; + public static REQUEST_DIMMER: string = 'RETWE_REQUEST_DIMMER'; + public static REMOVE_DIMMER: string = 'RETWE_REMOVE_DIMMER'; + public static REQUEST_CLOTHING_CHANGE: string = 'RETWE_REQUEST_CLOTHING_CHANGE'; + public static REQUEST_PLAYLIST_EDITOR: string = 'RETWE_REQUEST_PLAYLIST_EDITOR'; + public static REQUEST_MANNEQUIN: string = 'RETWE_REQUEST_MANNEQUIN'; + public static REQUEST_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG: string = 'ROWRE_REQUEST_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG'; + public static REQUEST_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG: string = 'ROWRE_REQUEST_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG'; + public static REQUEST_BACKGROUND_COLOR: string = 'RETWE_REQUEST_BACKGROUND_COLOR'; + public static REQUEST_MYSTERYBOX_OPEN_DIALOG: string = 'RETWE_REQUEST_MYSTERYBOX_OPEN_DIALOG'; + public static REQUEST_EFFECTBOX_OPEN_DIALOG: string = 'RETWE_REQUEST_EFFECTBOX_OPEN_DIALOG'; + public static REQUEST_MYSTERYTROPHY_OPEN_DIALOG: string = 'RETWE_REQUEST_MYSTERYTROPHY_OPEN_DIALOG'; + public static REQUEST_ACHIEVEMENT_RESOLUTION_ENGRAVING: string = 'RETWE_REQUEST_ACHIEVEMENT_RESOLUTION_ENGRAVING'; + public static REQUEST_ACHIEVEMENT_RESOLUTION_FAILED: string = 'RETWE_REQUEST_ACHIEVEMENT_RESOLUTION_FAILED'; + public static REQUEST_FRIEND_FURNITURE_CONFIRM: string = 'RETWE_REQUEST_FRIEND_FURNITURE_CONFIRM'; + public static REQUEST_FRIEND_FURNITURE_ENGRAVING: string = 'RETWE_REQUEST_FRIEND_FURNITURE_ENGRAVING'; + public static REQUEST_BADGE_DISPLAY_ENGRAVING: string = 'RETWE_REQUEST_BADGE_DISPLAY_ENGRAVING'; + public static REQUEST_HIGH_SCORE_DISPLAY: string = 'RETWE_REQUEST_HIGH_SCORE_DISPLAY'; + public static REQUEST_HIDE_HIGH_SCORE_DISPLAY: string = 'RETWE_REQUEST_HIDE_HIGH_SCORE_DISPLAY'; + public static REQUEST_INTERNAL_LINK: string = 'RETWE_REQUEST_INTERNAL_LINK'; + public static REQUEST_ROOM_LINK: string = 'RETWE_REQUEST_ROOM_LINK'; + public static REQUEST_YOUTUBE: string = 'RETWE_REQUEST_YOUTUBE'; + + private _widget: string; + + constructor(type: string, roomId: number, objectId: number, category: number, widget: string = null) + { + super(type, roomId, objectId, category); + + this._widget = widget; + } + + public get widget(): string + { + return this._widget; + } + + public get contextMenu(): string + { + return this._widget; + } +} diff --git a/submodules/renderer/src/events/room/RoomEngineUseProductEvent.ts b/submodules/renderer/src/events/room/RoomEngineUseProductEvent.ts new file mode 100644 index 0000000..c8e78aa --- /dev/null +++ b/submodules/renderer/src/events/room/RoomEngineUseProductEvent.ts @@ -0,0 +1,28 @@ +import { RoomEngineObjectEvent } from './RoomEngineObjectEvent'; + +export class RoomEngineUseProductEvent extends RoomEngineObjectEvent +{ + public static USE_PRODUCT_FROM_ROOM: string = 'REUPE_USE_PRODUCT_FROM_ROOM'; + public static USE_PRODUCT_FROM_INVENTORY: string = 'REUPE_USE_PRODUCT_FROM_INVENTORY'; + + private _inventoryStripId: number; + private _furnitureTypeId: number; + + constructor(type: string, roomId: number, objectId: number, category: number, inventoryStripId = -1, furnitureTypeId = -1) + { + super(type, roomId, objectId, category); + + this._inventoryStripId = inventoryStripId; + this._furnitureTypeId = furnitureTypeId; + } + + public get inventoryStripId(): number + { + return this._inventoryStripId; + } + + public get furnitureTypeId(): number + { + return this._furnitureTypeId; + } +} diff --git a/submodules/renderer/src/events/room/RoomObjectBadgeAssetEvent.ts b/submodules/renderer/src/events/room/RoomObjectBadgeAssetEvent.ts new file mode 100644 index 0000000..f3c72c7 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectBadgeAssetEvent.ts @@ -0,0 +1,28 @@ +import { IRoomObject } from '../../api'; +import { RoomObjectEvent } from './RoomObjectEvent'; + +export class RoomObjectBadgeAssetEvent extends RoomObjectEvent +{ + public static LOAD_BADGE: string = 'ROBAE_LOAD_BADGE'; + + private _badgeId: string; + private _groupBadge: boolean; + + constructor(k: string, _arg_2: IRoomObject, badgeId: string, groupBadge: boolean = true) + { + super(k, _arg_2); + + this._badgeId = badgeId; + this._groupBadge = groupBadge; + } + + public get badgeId(): string + { + return this._badgeId; + } + + public get groupBadge(): boolean + { + return this._groupBadge; + } +} diff --git a/submodules/renderer/src/events/room/RoomObjectDataRequestEvent.ts b/submodules/renderer/src/events/room/RoomObjectDataRequestEvent.ts new file mode 100644 index 0000000..96ace98 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectDataRequestEvent.ts @@ -0,0 +1,13 @@ +import { IRoomObject } from '../../api'; +import { RoomObjectEvent } from './RoomObjectEvent'; + +export class RoomObjectDataRequestEvent extends RoomObjectEvent +{ + public static RODRE_CURRENT_USER_ID: string = 'RODRE_CURRENT_USER_ID'; + public static RODRE_URL_PREFIX: string = 'RODRE_URL_PREFIX'; + + constructor(type: string, object: IRoomObject) + { + super(type, object); + } +} diff --git a/submodules/renderer/src/events/room/RoomObjectDimmerStateUpdateEvent.ts b/submodules/renderer/src/events/room/RoomObjectDimmerStateUpdateEvent.ts new file mode 100644 index 0000000..2ef3d49 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectDimmerStateUpdateEvent.ts @@ -0,0 +1,49 @@ +import { IRoomObject } from '../../api'; +import { RoomObjectEvent } from './RoomObjectEvent'; + +export class RoomObjectDimmerStateUpdateEvent extends RoomObjectEvent +{ + public static DIMMER_STATE: string = 'RODSUE_DIMMER_STATE'; + + private _state: number; + private _presetId: number; + private _effectId: number; + private _color: number; + private _brightness: number; + + constructor(object: IRoomObject, state: number, presetId: number, effectId: number, color: number, brightness: number) + { + super(RoomObjectDimmerStateUpdateEvent.DIMMER_STATE, object); + + this._state = state; + this._presetId = presetId; + this._effectId = effectId; + this._color = color; + this._brightness = brightness; + } + + public get state(): number + { + return this._state; + } + + public get presetId(): number + { + return this._presetId; + } + + public get effectId(): number + { + return this._effectId; + } + + public get color(): number + { + return this._color; + } + + public get brightness(): number + { + return this._brightness; + } +} diff --git a/submodules/renderer/src/events/room/RoomObjectEvent.ts b/submodules/renderer/src/events/room/RoomObjectEvent.ts new file mode 100644 index 0000000..954f0a9 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectEvent.ts @@ -0,0 +1,33 @@ +import { IRoomObject } from '../../api'; +import { NitroEvent } from '../../events'; + +export class RoomObjectEvent extends NitroEvent +{ + private _object: IRoomObject; + + constructor(type: string, object: IRoomObject) + { + super(type); + + this._object = object; + } + + public get object(): IRoomObject + { + return this._object; + } + + public get objectId(): number + { + if(!this._object) return -1; + + return this._object.id; + } + + public get objectType(): string + { + if(!this._object) return null; + + return this._object.type; + } +} diff --git a/submodules/renderer/src/events/room/RoomObjectFloorHoleEvent.ts b/submodules/renderer/src/events/room/RoomObjectFloorHoleEvent.ts new file mode 100644 index 0000000..965077f --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectFloorHoleEvent.ts @@ -0,0 +1,13 @@ +import { IRoomObject } from '../../api'; +import { RoomObjectEvent } from './RoomObjectEvent'; + +export class RoomObjectFloorHoleEvent extends RoomObjectEvent +{ + public static ADD_HOLE: string = 'ROFHO_ADD_HOLE'; + public static REMOVE_HOLE: string = 'ROFHO_REMOVE_HOLE'; + + constructor(k: string, _arg_2: IRoomObject) + { + super(k, _arg_2); + } +} diff --git a/submodules/renderer/src/events/room/RoomObjectFurnitureActionEvent.ts b/submodules/renderer/src/events/room/RoomObjectFurnitureActionEvent.ts new file mode 100644 index 0000000..f338e8a --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectFurnitureActionEvent.ts @@ -0,0 +1,20 @@ +import { RoomObjectEvent } from './RoomObjectEvent'; + +export class RoomObjectFurnitureActionEvent extends RoomObjectEvent +{ + public static DICE_OFF: string = 'ROFCAE_DICE_OFF'; + public static DICE_ACTIVATE: string = 'ROFCAE_DICE_ACTIVATE'; + public static USE_HABBOWHEEL: string = 'ROFCAE_USE_HABBOWHEEL'; + public static STICKIE: string = 'ROFCAE_STICKIE'; + public static ENTER_ONEWAYDOOR: string = 'ROFCAE_ENTER_ONEWAYDOOR'; + public static SOUND_MACHINE_INIT: string = 'ROFCAE_SOUND_MACHINE_INIT'; + public static SOUND_MACHINE_START: string = 'ROFCAE_SOUND_MACHINE_START'; + public static SOUND_MACHINE_STOP: string = 'ROFCAE_SOUND_MACHINE_STOP'; + public static SOUND_MACHINE_DISPOSE: string = 'ROFCAE_SOUND_MACHINE_DISPOSE'; + public static JUKEBOX_INIT: string = 'ROFCAE_JUKEBOX_INIT'; + public static JUKEBOX_START: string = 'ROFCAE_JUKEBOX_START'; + public static JUKEBOX_MACHINE_STOP: string = 'ROFCAE_JUKEBOX_MACHINE_STOP'; + public static JUKEBOX_DISPOSE: string = 'ROFCAE_JUKEBOX_DISPOSE'; + public static MOUSE_BUTTON: string = 'ROFCAE_MOUSE_BUTTON'; + public static MOUSE_ARROW: string = 'ROFCAE_MOUSE_ARROW'; +} diff --git a/submodules/renderer/src/events/room/RoomObjectHSLColorEnableEvent.ts b/submodules/renderer/src/events/room/RoomObjectHSLColorEnableEvent.ts new file mode 100644 index 0000000..d28d550 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectHSLColorEnableEvent.ts @@ -0,0 +1,42 @@ +import { IRoomObject } from '../../api'; +import { RoomObjectEvent } from './RoomObjectEvent'; + +export class RoomObjectHSLColorEnableEvent extends RoomObjectEvent +{ + public static ROOM_BACKGROUND_COLOR: string = 'ROHSLCEE_ROOM_BACKGROUND_COLOR'; + + private _enable: boolean; + private _hue: number; + private _saturation: number; + private _lightness: number; + + constructor(k: string, _arg_2: IRoomObject, _arg_3: boolean, _arg_4: number, _arg_5: number, _arg_6: number) + { + super(k, _arg_2); + + this._enable = _arg_3; + this._hue = _arg_4; + this._saturation = _arg_5; + this._lightness = _arg_6; + } + + public get enable(): boolean + { + return this._enable; + } + + public get hue(): number + { + return this._hue; + } + + public get saturation(): number + { + return this._saturation; + } + + public get lightness(): number + { + return this._lightness; + } +} diff --git a/submodules/renderer/src/events/room/RoomObjectHSLColorEnabledEvent.ts b/submodules/renderer/src/events/room/RoomObjectHSLColorEnabledEvent.ts new file mode 100644 index 0000000..b4a3f9e --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectHSLColorEnabledEvent.ts @@ -0,0 +1,41 @@ +import { RoomEngineEvent } from './RoomEngineEvent'; + +export class RoomObjectHSLColorEnabledEvent extends RoomEngineEvent +{ + public static ROOM_BACKGROUND_COLOR: string = 'ROHSLCEE_ROOM_BACKGROUND_COLOR'; + + private _enable: boolean; + private _hue: number; + private _saturation: number; + private _lightness: number; + + constructor(k: string, _arg_2: number, _arg_3: boolean, _arg_4: number, _arg_5: number, _arg_6: number) + { + super(k, _arg_2); + + this._enable = _arg_3; + this._hue = _arg_4; + this._saturation = _arg_5; + this._lightness = _arg_6; + } + + public get enable(): boolean + { + return this._enable; + } + + public get hue(): number + { + return this._hue; + } + + public get saturation(): number + { + return this._saturation; + } + + public get lightness(): number + { + return this._lightness; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/events/room/RoomObjectMouseEvent.ts b/submodules/renderer/src/events/room/RoomObjectMouseEvent.ts new file mode 100644 index 0000000..21ceef8 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectMouseEvent.ts @@ -0,0 +1,100 @@ +import { IRoomObject } from '../../api'; +import { RoomObjectEvent } from './RoomObjectEvent'; + +export class RoomObjectMouseEvent extends RoomObjectEvent +{ + public static CLICK: string = 'ROE_MOUSE_CLICK'; + public static DOUBLE_CLICK: string = 'ROE_MOUSE_DOUBLE_CLICK'; + public static MOUSE_MOVE: string = 'ROE_MOUSE_MOVE'; + public static MOUSE_DOWN: string = 'ROE_MOUSE_DOWN'; + public static MOUSE_DOWN_LONG: string = 'ROE_MOUSE_DOWN_LONG'; + public static MOUSE_UP: string = 'ROE_MOUSE_UP'; + public static MOUSE_ENTER: string = 'ROE_MOUSE_ENTER'; + public static MOUSE_LEAVE: string = 'ROE_MOUSE_LEAVE'; + + private _eventId: string = ''; + private _altKey: boolean; + private _ctrlKey: boolean; + private _shiftKey: boolean; + private _buttonDown: boolean; + private _localX: number; + private _localY: number; + private _spriteOffsetX: number; + private _spriteOffsetY: number; + + constructor(type: string, object: IRoomObject, eventId: string, altKey: boolean = false, ctrlKey: boolean = false, shiftKey: boolean = false, buttonDown: boolean = false) + { + super(type, object); + + this._eventId = eventId; + this._altKey = altKey; + this._ctrlKey = ctrlKey; + this._shiftKey = shiftKey; + this._buttonDown = buttonDown; + } + + public get eventId(): string + { + return this._eventId; + } + + public get altKey(): boolean + { + return this._altKey; + } + + public get ctrlKey(): boolean + { + return this._ctrlKey; + } + + public get shiftKey(): boolean + { + return this._shiftKey; + } + + public get buttonDown(): boolean + { + return this._buttonDown; + } + + public get localX(): number + { + return this._localX; + } + + public set localX(k: number) + { + this._localX = k; + } + + public get localY(): number + { + return this._localY; + } + + public set localY(k: number) + { + this._localY = k; + } + + public get spriteOffsetX(): number + { + return this._spriteOffsetX; + } + + public set spriteOffsetX(k: number) + { + this._spriteOffsetX = k; + } + + public get spriteOffsetY(): number + { + return this._spriteOffsetY; + } + + public set spriteOffsetY(k: number) + { + this._spriteOffsetY = k; + } +} diff --git a/submodules/renderer/src/events/room/RoomObjectMoveEvent.ts b/submodules/renderer/src/events/room/RoomObjectMoveEvent.ts new file mode 100644 index 0000000..9c994fe --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectMoveEvent.ts @@ -0,0 +1,13 @@ +import { IRoomObject } from '../../api'; +import { RoomObjectEvent } from './RoomObjectEvent'; + +export class RoomObjectMoveEvent extends RoomObjectEvent +{ + public static POSITION_CHANGED: string = 'ROME_POSITION_CHANGED'; + public static OBJECT_REMOVED: string = 'ROME_OBJECT_REMOVED'; + + constructor(k: string, _arg_2: IRoomObject) + { + super(k, _arg_2); + } +} diff --git a/submodules/renderer/src/events/room/RoomObjectPlaySoundIdEvent.ts b/submodules/renderer/src/events/room/RoomObjectPlaySoundIdEvent.ts new file mode 100644 index 0000000..315b983 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectPlaySoundIdEvent.ts @@ -0,0 +1,29 @@ +import { IRoomObject } from '../../api'; +import { RoomObjectFurnitureActionEvent } from './RoomObjectFurnitureActionEvent'; + +export class RoomObjectPlaySoundIdEvent extends RoomObjectFurnitureActionEvent +{ + public static PLAY_SOUND: string = 'ROPSIE_PLAY_SOUND'; + public static PLAY_SOUND_AT_PITCH: string = 'ROPSIE_PLAY_SOUND_AT_PITCH'; + + private _soundId: string; + private _pitch: number; + + constructor(type: string, object: IRoomObject, soundId: string, pitch: number = 1) + { + super(type, object); + + this._soundId = soundId; + this._pitch = pitch; + } + + public get soundId(): string + { + return this._soundId; + } + + public get pitch(): number + { + return this._pitch; + } +} diff --git a/submodules/renderer/src/events/room/RoomObjectRoomAdEvent.ts b/submodules/renderer/src/events/room/RoomObjectRoomAdEvent.ts new file mode 100644 index 0000000..259e5e3 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectRoomAdEvent.ts @@ -0,0 +1,32 @@ +import { IRoomObject } from '../../api'; +import { RoomObjectEvent } from './RoomObjectEvent'; + +export class RoomObjectRoomAdEvent extends RoomObjectEvent +{ + public static ROOM_AD_LOAD_IMAGE: string = 'RORAE_ROOM_AD_LOAD_IMAGE'; + public static ROOM_AD_FURNI_CLICK: string = 'RORAE_ROOM_AD_FURNI_CLICK'; + public static ROOM_AD_FURNI_DOUBLE_CLICK: string = 'RORAE_ROOM_AD_FURNI_DOUBLE_CLICK'; + public static ROOM_AD_TOOLTIP_SHOW: string = 'RORAE_ROOM_AD_TOOLTIP_SHOW'; + public static ROOM_AD_TOOLTIP_HIDE: string = 'RORAE_ROOM_AD_TOOLTIP_HIDE'; + + private _imageUrl: string = ''; + private _clickUrl: string = ''; + + constructor(type: string, object: IRoomObject, imageUrl: string = '', clickUrl: string = '') + { + super(type, object); + + this._imageUrl = imageUrl; + this._clickUrl = clickUrl; + } + + public get imageUrl(): string + { + return this._imageUrl; + } + + public get clickUrl(): string + { + return this._clickUrl; + } +} diff --git a/submodules/renderer/src/events/room/RoomObjectSamplePlaybackEvent.ts b/submodules/renderer/src/events/room/RoomObjectSamplePlaybackEvent.ts new file mode 100644 index 0000000..43bf3b6 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectSamplePlaybackEvent.ts @@ -0,0 +1,31 @@ +import { IRoomObject } from '../../api'; +import { RoomObjectEvent } from './RoomObjectEvent'; + +export class RoomObjectSamplePlaybackEvent extends RoomObjectEvent +{ + public static ROOM_OBJECT_INITIALIZED: string = 'ROPSPE_ROOM_OBJECT_INITIALIZED'; + public static ROOM_OBJECT_DISPOSED: string = 'ROPSPE_ROOM_OBJECT_DISPOSED'; + public static PLAY_SAMPLE: string = 'ROPSPE_PLAY_SAMPLE'; + public static CHANGE_PITCH: string = 'ROPSPE_CHANGE_PITCH'; + + private _sampleId: number; + private _pitch: number; + + constructor(k: string, object: IRoomObject, sampleId: number, pitch: number = 1) + { + super(k, object); + + this._sampleId = sampleId; + this._pitch = pitch; + } + + public get sampleId(): number + { + return this._sampleId; + } + + public get pitch(): number + { + return this._pitch; + } +} diff --git a/submodules/renderer/src/events/room/RoomObjectSoundMachineEvent.ts b/submodules/renderer/src/events/room/RoomObjectSoundMachineEvent.ts new file mode 100644 index 0000000..9576f1e --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectSoundMachineEvent.ts @@ -0,0 +1,13 @@ +import { RoomEngineObjectEvent } from './RoomEngineObjectEvent'; + +export class RoomObjectSoundMachineEvent extends RoomEngineObjectEvent +{ + public static SOUND_MACHINE_INIT: string = 'ROSM_SOUND_MACHINE_INIT'; + public static SOUND_MACHINE_SWITCHED_ON: string = 'ROSM_SOUND_MACHINE_SWITCHED_ON'; + public static SOUND_MACHINE_SWITCHED_OFF: string = 'ROSM_SOUND_MACHINE_SWITCHED_OFF'; + public static SOUND_MACHINE_DISPOSE: string = 'ROSM_SOUND_MACHINE_DISPOSE'; + public static JUKEBOX_INIT: string = 'ROSM_JUKEBOX_INIT'; + public static JUKEBOX_SWITCHED_ON: string = 'ROSM_JUKEBOX_SWITCHED_ON'; + public static JUKEBOX_SWITCHED_OFF: string = 'ROSM_JUKEBOX_SWITCHED_OFF'; + public static JUKEBOX_DISPOSE: string = 'ROSM_JUKEBOX_DISPOSE'; +} diff --git a/submodules/renderer/src/events/room/RoomObjectStateChangedEvent.ts b/submodules/renderer/src/events/room/RoomObjectStateChangedEvent.ts new file mode 100644 index 0000000..f9e7d36 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectStateChangedEvent.ts @@ -0,0 +1,22 @@ +import { IRoomObject } from '../../api'; +import { RoomObjectEvent } from './RoomObjectEvent'; + +export class RoomObjectStateChangedEvent extends RoomObjectEvent +{ + public static STATE_CHANGE: string = 'ROSCE_STATE_CHANGE'; + public static STATE_RANDOM: string = 'ROSCE_STATE_RANDOM'; + + private _state: number; + + constructor(type: string, object: IRoomObject, state: number = 0) + { + super(type, object); + + this._state = state; + } + + public get state(): number + { + return this._state; + } +} diff --git a/submodules/renderer/src/events/room/RoomObjectTileMouseEvent.ts b/submodules/renderer/src/events/room/RoomObjectTileMouseEvent.ts new file mode 100644 index 0000000..f9641fc --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectTileMouseEvent.ts @@ -0,0 +1,48 @@ +import { IRoomObject } from '../../api'; +import { RoomObjectMouseEvent } from './RoomObjectMouseEvent'; + +export class RoomObjectTileMouseEvent extends RoomObjectMouseEvent +{ + private _tileX: number; + private _tileY: number; + private _tileZ: number; + + constructor(type: string, object: IRoomObject, eventId: string, tileX: number, tileY: number, tileZ: number, altKey: boolean = false, ctrlKey: boolean = false, shiftKey: boolean = false, buttonDown: boolean = false) + { + super(type, object, eventId, altKey, ctrlKey, shiftKey, buttonDown); + + this._tileX = tileX; + this._tileY = tileY; + this._tileZ = tileZ; + } + + public get tileX(): number + { + return this._tileX; + } + + public get tileY(): number + { + return this._tileY; + } + + public get tileZ(): number + { + return this._tileZ; + } + + public get tileXAsInt(): number + { + return Math.trunc(this._tileX + 0.499); + } + + public get tileYAsInt(): number + { + return Math.trunc(this._tileY + 0.499); + } + + public get tileZAsInt(): number + { + return Math.trunc(this._tileZ + 0.499); + } +} diff --git a/submodules/renderer/src/events/room/RoomObjectWallMouseEvent.ts b/submodules/renderer/src/events/room/RoomObjectWallMouseEvent.ts new file mode 100644 index 0000000..e139e1a --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectWallMouseEvent.ts @@ -0,0 +1,59 @@ +import { IRoomObject, IVector3D, Vector3d } from '../../api'; +import { RoomObjectMouseEvent } from './RoomObjectMouseEvent'; + +export class RoomObjectWallMouseEvent extends RoomObjectMouseEvent +{ + private _wallLocation: IVector3D; + private _wallWd: IVector3D; + private _wallHt: IVector3D; + private _x: number; + private _y: number; + private _direction: number; + + constructor(type: string, object: IRoomObject, eventId: string, wallLocation: IVector3D, wallWidth: IVector3D, wallHeight: IVector3D, x: number, y: number, direction: number, altKey: boolean = false, ctrlKey: boolean = false, shiftKey: boolean = false, buttonDown: boolean = false) + { + super(type, object, eventId, altKey, ctrlKey, shiftKey, buttonDown); + + this._wallLocation = new Vector3d(); + this._wallWd = new Vector3d(); + this._wallHt = new Vector3d(); + + this._wallLocation.assign(wallLocation); + this._wallWd.assign(wallWidth); + this._wallHt.assign(wallHeight); + + this._x = x; + this._y = y; + this._direction = direction; + } + + public get wallLocation(): IVector3D + { + return this._wallLocation; + } + + public get wallWidth(): IVector3D + { + return this._wallWd; + } + + public get wallHeight(): IVector3D + { + return this._wallHt; + } + + public get x(): number + { + return this._x; + } + + public get y(): number + { + return this._y; + } + + public get direction(): number + { + return this._direction; + } +} diff --git a/submodules/renderer/src/events/room/RoomObjectWidgetRequestEvent.ts b/submodules/renderer/src/events/room/RoomObjectWidgetRequestEvent.ts new file mode 100644 index 0000000..d058e0c --- /dev/null +++ b/submodules/renderer/src/events/room/RoomObjectWidgetRequestEvent.ts @@ -0,0 +1,48 @@ +import { IRoomObject } from '../../api'; +import { RoomObjectEvent } from './RoomObjectEvent'; + +export class RoomObjectWidgetRequestEvent extends RoomObjectEvent +{ + public static OPEN_WIDGET: string = 'ROWRE_OPEN_WIDGET'; + public static CLOSE_WIDGET: string = 'ROWRE_CLOSE_WIDGET'; + public static OPEN_FURNI_CONTEXT_MENU: string = 'ROWRE_OPEN_FURNI_CONTEXT_MENU'; + public static CLOSE_FURNI_CONTEXT_MENU: string = 'ROWRE_CLOSE_FURNI_CONTEXT_MENU'; + public static PLACEHOLDER: string = 'ROWRE_PLACEHOLDER'; + public static CREDITFURNI: string = 'ROWRE_CREDITFURNI'; + public static STACK_HEIGHT: string = 'ROWRE_STACK_HEIGHT'; + public static EXTERNAL_IMAGE: string = 'ROWRE_EXTERNAL_IMAGE'; + public static STICKIE: string = 'ROWRE_STICKIE'; + public static PRESENT: string = 'ROWRE_PRESENT'; + public static TROPHY: string = 'ROWRE_TROPHY'; + public static TEASER: string = 'ROWRE_TEASER'; + public static ECOTRONBOX: string = 'ROWRE_ECOTRONBOX'; + public static DIMMER: string = 'ROWRE_DIMMER'; + public static WIDGET_REMOVE_DIMMER: string = 'ROWRE_WIDGET_REMOVE_DIMMER'; + public static CLOTHING_CHANGE: string = 'ROWRE_CLOTHING_CHANGE'; + public static JUKEBOX_PLAYLIST_EDITOR: string = 'ROWRE_JUKEBOX_PLAYLIST_EDITOR'; + public static MANNEQUIN: string = 'ROWRE_MANNEQUIN'; + public static PET_PRODUCT_MENU: string = 'ROWRE_PET_PRODUCT_MENU'; + public static GUILD_FURNI_CONTEXT_MENU: string = 'ROWRE_GUILD_FURNI_CONTEXT_MENU'; + public static MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG: string = 'ROWRE_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG'; + public static PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG: string = 'ROWRE_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG'; + public static BACKGROUND_COLOR: string = 'ROWRE_BACKGROUND_COLOR'; + public static MYSTERYBOX_OPEN_DIALOG: string = 'ROWRE_MYSTERYBOX_OPEN_DIALOG'; + public static EFFECTBOX_OPEN_DIALOG: string = 'ROWRE_EFFECTBOX_OPEN_DIALOG'; + public static MYSTERYTROPHY_OPEN_DIALOG: string = 'ROWRE_MYSTERYTROPHY_OPEN_DIALOG'; + public static ACHIEVEMENT_RESOLUTION_OPEN: string = 'ROWRE_ACHIEVEMENT_RESOLUTION_OPEN'; + public static ACHIEVEMENT_RESOLUTION_ENGRAVING: string = 'ROWRE_ACHIEVEMENT_RESOLUTION_ENGRAVING'; + public static ACHIEVEMENT_RESOLUTION_FAILED: string = 'ROWRE_ACHIEVEMENT_RESOLUTION_FAILED'; + public static FRIEND_FURNITURE_CONFIRM: string = 'ROWRE_FRIEND_FURNITURE_CONFIRM'; + public static FRIEND_FURNITURE_ENGRAVING: string = 'ROWRE_FRIEND_FURNITURE_ENGRAVING'; + public static BADGE_DISPLAY_ENGRAVING: string = 'ROWRE_BADGE_DISPLAY_ENGRAVING'; + public static HIGH_SCORE_DISPLAY: string = 'ROWRE_HIGH_SCORE_DISPLAY'; + public static HIDE_HIGH_SCORE_DISPLAY: string = 'ROWRE_HIDE_HIGH_SCORE_DISPLAY'; + public static INERNAL_LINK: string = 'ROWRE_INTERNAL_LINK'; + public static ROOM_LINK: string = 'ROWRE_ROOM_LINK'; + public static YOUTUBE: string = 'ROWRE_YOUTUBE'; + + constructor(type: string, roomObject: IRoomObject) + { + super(type, roomObject); + } +} diff --git a/submodules/renderer/src/events/room/RoomSpriteMouseEvent.ts b/submodules/renderer/src/events/room/RoomSpriteMouseEvent.ts new file mode 100644 index 0000000..2edd522 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomSpriteMouseEvent.ts @@ -0,0 +1,117 @@ +import { IRoomSpriteMouseEvent } from '../../api'; + +export class RoomSpriteMouseEvent implements IRoomSpriteMouseEvent +{ + private _type: string; + private _eventId: string; + private _canvasId: string; + private _spriteTag: string; + private _screenX: number; + private _screenY: number; + private _localX: number; + private _localY: number; + private _ctrlKey: boolean; + private _altKey: boolean; + private _shiftKey: boolean; + private _buttonDown: boolean; + private _spriteOffsetX: number; + private _spriteOffsetY: number; + + constructor(type: string, eventId: string, canvasId: string, spriteTag: string, screenX: number, screenY: number, localX: number = 0, localY: number = 0, ctrlKey: boolean = false, altKey: boolean = false, shiftKey: boolean = false, buttonDown: boolean = false) + { + this._type = type; + this._eventId = eventId; + this._canvasId = canvasId; + this._spriteTag = spriteTag; + this._screenX = screenX; + this._screenY = screenY; + this._localX = localX; + this._localY = localY; + this._ctrlKey = ctrlKey; + this._altKey = altKey; + this._shiftKey = shiftKey; + this._buttonDown = buttonDown; + this._spriteOffsetX = 0; + this._spriteOffsetY = 0; + } + + public get type(): string + { + return this._type; + } + + public get eventId(): string + { + return this._eventId; + } + + public get canvasId(): string + { + return this._canvasId; + } + + public get spriteTag(): string + { + return this._spriteTag; + } + + public get screenX(): number + { + return this._screenX; + } + + public get screenY(): number + { + return this._screenY; + } + + public get localX(): number + { + return this._localX; + } + + public get localY(): number + { + return this._localY; + } + + public get ctrlKey(): boolean + { + return this._ctrlKey; + } + + public get altKey(): boolean + { + return this._altKey; + } + + public get shiftKey(): boolean + { + return this._shiftKey; + } + + public get buttonDown(): boolean + { + return this._buttonDown; + } + + public get spriteOffsetX(): number + { + return this._spriteOffsetX; + } + + public set spriteOffsetX(k: number) + { + this._spriteOffsetX = k; + } + + public get spriteOffsetY(): number + { + return this._spriteOffsetY; + } + + public set spriteOffsetY(k: number) + { + this._spriteOffsetY = k; + } +} diff --git a/submodules/renderer/src/events/room/RoomToObjectEvent.ts b/submodules/renderer/src/events/room/RoomToObjectEvent.ts new file mode 100644 index 0000000..fbd5c53 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomToObjectEvent.ts @@ -0,0 +1,9 @@ +import { NitroEvent } from '../core'; + +export class RoomToObjectEvent extends NitroEvent +{ + public constructor(type: string) + { + super(type); + } +} diff --git a/submodules/renderer/src/events/room/RoomToObjectOwnAvatarMoveEvent.ts b/submodules/renderer/src/events/room/RoomToObjectOwnAvatarMoveEvent.ts new file mode 100644 index 0000000..878ef2c --- /dev/null +++ b/submodules/renderer/src/events/room/RoomToObjectOwnAvatarMoveEvent.ts @@ -0,0 +1,21 @@ +import { IVector3D } from '../../api'; +import { RoomToObjectEvent } from './RoomToObjectEvent'; + +export class RoomToObjectOwnAvatarMoveEvent extends RoomToObjectEvent +{ + public static ROAME_MOVE_TO: string = 'ROAME_MOVE_TO'; + + private _targetLocation: IVector3D; + + constructor(type: string, targetLocation: IVector3D) + { + super(type); + + this._targetLocation = targetLocation; + } + + public get targetLocation(): IVector3D + { + return this._targetLocation; + } +} diff --git a/submodules/renderer/src/events/room/RoomZoomEvent.ts b/submodules/renderer/src/events/room/RoomZoomEvent.ts new file mode 100644 index 0000000..1119774 --- /dev/null +++ b/submodules/renderer/src/events/room/RoomZoomEvent.ts @@ -0,0 +1,34 @@ +import { RoomEngineEvent } from './RoomEngineEvent'; + +export class RoomZoomEvent extends RoomEngineEvent +{ + public static ROOM_ZOOM: string = 'REE_ROOM_ZOOM'; + + private _level: number; + private _forceFlip: boolean; + private _asDelta: boolean; + + constructor(roomId: number, level: number, forceFlip: boolean = false, asDelta: boolean = false) + { + super(RoomZoomEvent.ROOM_ZOOM, roomId); + + this._level = level; + this._forceFlip = forceFlip; + this._asDelta = asDelta; + } + + public get level(): number + { + return this._level; + } + + public get forceFlip(): boolean + { + return this._forceFlip; + } + + public get asDelta(): boolean + { + return this._asDelta; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/events/room/index.ts b/submodules/renderer/src/events/room/index.ts new file mode 100644 index 0000000..51b6bed --- /dev/null +++ b/submodules/renderer/src/events/room/index.ts @@ -0,0 +1,35 @@ +export * from './RoomBackgroundColorEvent'; +export * from './RoomContentLoadedEvent'; +export * from './RoomDragEvent'; +export * from './RoomEngineDimmerStateEvent'; +export * from './RoomEngineEvent'; +export * from './RoomEngineObjectEvent'; +export * from './RoomEngineObjectPlacedEvent'; +export * from './RoomEngineObjectPlacedOnUserEvent'; +export * from './RoomEngineObjectPlaySoundEvent'; +export * from './RoomEngineRoomAdEvent'; +export * from './RoomEngineSamplePlaybackEvent'; +export * from './RoomEngineTriggerWidgetEvent'; +export * from './RoomEngineUseProductEvent'; +export * from './RoomObjectBadgeAssetEvent'; +export * from './RoomObjectDataRequestEvent'; +export * from './RoomObjectDimmerStateUpdateEvent'; +export * from './RoomObjectEvent'; +export * from './RoomObjectFloorHoleEvent'; +export * from './RoomObjectFurnitureActionEvent'; +export * from './RoomObjectHSLColorEnabledEvent'; +export * from './RoomObjectHSLColorEnableEvent'; +export * from './RoomObjectMouseEvent'; +export * from './RoomObjectMoveEvent'; +export * from './RoomObjectPlaySoundIdEvent'; +export * from './RoomObjectRoomAdEvent'; +export * from './RoomObjectSamplePlaybackEvent'; +export * from './RoomObjectSoundMachineEvent'; +export * from './RoomObjectStateChangedEvent'; +export * from './RoomObjectTileMouseEvent'; +export * from './RoomObjectWallMouseEvent'; +export * from './RoomObjectWidgetRequestEvent'; +export * from './RoomSpriteMouseEvent'; +export * from './RoomToObjectEvent'; +export * from './RoomToObjectOwnAvatarMoveEvent'; +export * from './RoomZoomEvent'; diff --git a/submodules/renderer/src/events/session/BadgeImageReadyEvent.ts b/submodules/renderer/src/events/session/BadgeImageReadyEvent.ts new file mode 100644 index 0000000..22b6390 --- /dev/null +++ b/submodules/renderer/src/events/session/BadgeImageReadyEvent.ts @@ -0,0 +1,28 @@ +import { Resource, Texture } from '@pixi/core'; +import { NitroEvent } from '../core'; + +export class BadgeImageReadyEvent extends NitroEvent +{ + public static IMAGE_READY: string = 'BIME_BADGE_IMAGE_READY'; + + private _badgeId: string; + private _image: Texture; + + constructor(badgeId: string, image: Texture) + { + super(BadgeImageReadyEvent.IMAGE_READY); + + this._badgeId = badgeId; + this._image = image; + } + + public get badgeId(): string + { + return this._badgeId; + } + + public get image(): Texture + { + return this._image; + } +} diff --git a/submodules/renderer/src/events/session/MysteryBoxKeysUpdateEvent.ts b/submodules/renderer/src/events/session/MysteryBoxKeysUpdateEvent.ts new file mode 100644 index 0000000..7f6a073 --- /dev/null +++ b/submodules/renderer/src/events/session/MysteryBoxKeysUpdateEvent.ts @@ -0,0 +1,27 @@ +import { NitroEvent } from '../core'; + +export class MysteryBoxKeysUpdateEvent extends NitroEvent +{ + public static MYSTERY_BOX_KEYS_UPDATE: string = 'mbke_update'; + + private _boxColor: string; + private _keyColor: string; + + constructor(boxColor: string, keyColor: string) + { + super(MysteryBoxKeysUpdateEvent.MYSTERY_BOX_KEYS_UPDATE); + + this._boxColor = boxColor; + this._keyColor = keyColor; + } + + public get boxColor(): string + { + return this._boxColor; + } + + public get keyColor(): string + { + return this._keyColor; + } +} diff --git a/submodules/renderer/src/events/session/PerksUpdatedEvent.ts b/submodules/renderer/src/events/session/PerksUpdatedEvent.ts new file mode 100644 index 0000000..e7b9679 --- /dev/null +++ b/submodules/renderer/src/events/session/PerksUpdatedEvent.ts @@ -0,0 +1,11 @@ +import { NitroEvent } from '../core'; + +export class PerksUpdatedEvent extends NitroEvent +{ + public static PERKS_UPDATED: string = 'PUE_perks_updated'; + + constructor() + { + super(PerksUpdatedEvent.PERKS_UPDATED); + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionChatEvent.ts b/submodules/renderer/src/events/session/RoomSessionChatEvent.ts new file mode 100644 index 0000000..10ec0b7 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionChatEvent.ts @@ -0,0 +1,69 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionChatEvent extends RoomSessionEvent +{ + public static CHAT_EVENT: string = 'RSCE_CHAT_EVENT'; + public static FLOOD_EVENT: string = 'RSCE_FLOOD_EVENT'; + + public static CHAT_TYPE_SPEAK: number = 0; + public static CHAT_TYPE_WHISPER: number = 1; + public static CHAT_TYPE_SHOUT: number = 2; + public static CHAT_TYPE_RESPECT: number = 3; + public static CHAT_TYPE_PETRESPECT: number = 4; + public static CHAT_TYPE_HAND_ITEM_RECEIVED: number = 5; + public static CHAT_TYPE_PETTREAT: number = 6; + public static CHAT_TYPE_PETREVIVE: number = 7; + public static CHAT_TYPE_PET_REBREED_FERTILIZE: number = 8; + public static CHAT_TYPE_PET_SPEED_FERTILIZE: number = 9; + public static CHAT_TYPE_MUTE_REMAINING: number = 10; + + private _objectId: number; + private _message: string; + private _chatType: number; + private _links: string[]; + private _extraParam: number; + private _style: number; + + constructor(type: string, session: IRoomSession, objectId: number, message: string, chatType: number, style: number = 0, links: string[] = null, extraParam: number = -1) + { + super(type, session); + + this._objectId = objectId; + this._message = message; + this._chatType = chatType; + this._links = links; + this._extraParam = extraParam; + this._style = style; + } + + public get objectId(): number + { + return this._objectId; + } + + public get message(): string + { + return this._message; + } + + public get chatType(): number + { + return this._chatType; + } + + public get links(): string[] + { + return this._links; + } + + public get extraParam(): number + { + return this._extraParam; + } + + public get style(): number + { + return this._style; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionConfirmPetBreedingEvent.ts b/submodules/renderer/src/events/session/RoomSessionConfirmPetBreedingEvent.ts new file mode 100644 index 0000000..79b502c --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionConfirmPetBreedingEvent.ts @@ -0,0 +1,50 @@ +import { IRoomSession } from '../../api'; +import { BreedingPetInfo, RarityCategoryData } from '../../nitro'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionConfirmPetBreedingEvent extends RoomSessionEvent +{ + public static CONFIRM_PET_BREEDING: string = 'RSPFUE_CONFIRM_PET_BREEDING'; + + private _nestId: number; + private _pet1: BreedingPetInfo; + private _pet2: BreedingPetInfo; + private _rarityCategories: RarityCategoryData[]; + private _resultPetTypeId: number; + + constructor(session: IRoomSession, nestId: number, pet1: BreedingPetInfo, pet2: BreedingPetInfo, rarityCategories: RarityCategoryData[], resultPetTypeId: number) + { + super(RoomSessionConfirmPetBreedingEvent.CONFIRM_PET_BREEDING, session); + + this._nestId = nestId; + this._pet1 = pet1; + this._pet2 = pet2; + this._rarityCategories = rarityCategories; + this._resultPetTypeId = resultPetTypeId; + } + + public get nestId(): number + { + return this._nestId; + } + + public get pet1(): BreedingPetInfo + { + return this._pet1; + } + + public get pet2(): BreedingPetInfo + { + return this._pet2; + } + + public get rarityCategories(): RarityCategoryData[] + { + return this._rarityCategories; + } + + public get resultPetTypeId(): number + { + return this._resultPetTypeId; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionConfirmPetBreedingResultEvent.ts b/submodules/renderer/src/events/session/RoomSessionConfirmPetBreedingResultEvent.ts new file mode 100644 index 0000000..8b25710 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionConfirmPetBreedingResultEvent.ts @@ -0,0 +1,28 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionConfirmPetBreedingResultEvent extends RoomSessionEvent +{ + public static RSPFUE_CONFIRM_PET_BREEDING_RESULT: string = 'RSPFUE_CONFIRM_PET_BREEDING_RESULT'; + + private _breedingNestStuffId: number; + private _result: number; + + constructor(session: IRoomSession, breedingNestStuffId: number, result: number) + { + super(RoomSessionConfirmPetBreedingResultEvent.RSPFUE_CONFIRM_PET_BREEDING_RESULT, session); + + this._breedingNestStuffId = breedingNestStuffId; + this._result = result; + } + + public get breedingNestStuffId(): number + { + return this._breedingNestStuffId; + } + + public get result(): number + { + return this._result; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionDanceEvent.ts b/submodules/renderer/src/events/session/RoomSessionDanceEvent.ts new file mode 100644 index 0000000..22cab6b --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionDanceEvent.ts @@ -0,0 +1,28 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionDanceEvent extends RoomSessionEvent +{ + public static RSDE_DANCE: string = 'RSDE_DANCE'; + + private _roomIndex: number; + private _danceId: number; + + constructor(session: IRoomSession, roomIndex: number, danceId: number) + { + super(RoomSessionDanceEvent.RSDE_DANCE, session); + + this._roomIndex = roomIndex; + this._danceId = danceId; + } + + public get roomIndex(): number + { + return this._roomIndex; + } + + public get danceId(): number + { + return this._danceId; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionDimmerPresetsEvent.ts b/submodules/renderer/src/events/session/RoomSessionDimmerPresetsEvent.ts new file mode 100644 index 0000000..6ae9d5c --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionDimmerPresetsEvent.ts @@ -0,0 +1,45 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionDimmerPresetsEventPresetItem } from './RoomSessionDimmerPresetsEventPresetItem'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionDimmerPresetsEvent extends RoomSessionEvent +{ + public static ROOM_DIMMER_PRESETS: string = 'RSDPE_PRESETS'; + + private _selectedPresetId: number = 0; + private _presets: RoomSessionDimmerPresetsEventPresetItem[]; + + constructor(type: string, session: IRoomSession) + { + super(type, session); + + this._presets = []; + } + + public storePreset(id: number, type: number, color: number, brightness: number): void + { + this._presets[(id - 1)] = new RoomSessionDimmerPresetsEventPresetItem(id, type, color, brightness); + } + + public getPreset(id: number): RoomSessionDimmerPresetsEventPresetItem + { + if((id < 0) || (id >= this._presets.length)) return null; + + return this._presets[id]; + } + + public get presetCount(): number + { + return this._presets.length; + } + + public get selectedPresetId(): number + { + return this._selectedPresetId; + } + + public set selectedPresetId(id: number) + { + this._selectedPresetId = id; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionDimmerPresetsEventPresetItem.ts b/submodules/renderer/src/events/session/RoomSessionDimmerPresetsEventPresetItem.ts new file mode 100644 index 0000000..9a05be0 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionDimmerPresetsEventPresetItem.ts @@ -0,0 +1,35 @@ +export class RoomSessionDimmerPresetsEventPresetItem +{ + private _id: number; + private _type: number; + private _color: number; + private _brightness: number; + + constructor(id: number, type: number, color: number, brightness: number) + { + this._id = id; + this._type = type; + this._color = color; + this._brightness = brightness; + } + + public get id(): number + { + return this._id; + } + + public get type(): number + { + return this._type; + } + + public get color(): number + { + return this._color; + } + + public get brightness(): number + { + return this._brightness; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionDoorbellEvent.ts b/submodules/renderer/src/events/session/RoomSessionDoorbellEvent.ts new file mode 100644 index 0000000..e393454 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionDoorbellEvent.ts @@ -0,0 +1,23 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionDoorbellEvent extends RoomSessionEvent +{ + public static DOORBELL: string = 'RSDE_DOORBELL'; + public static RSDE_REJECTED: string = 'RSDE_REJECTED'; + public static RSDE_ACCEPTED: string = 'RSDE_ACCEPTED'; + + private _userName: string = ''; + + constructor(type: string, session: IRoomSession, userName: string) + { + super(type, session); + + this._userName = userName; + } + + public get userName(): string + { + return this._userName; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionErrorMessageEvent.ts b/submodules/renderer/src/events/session/RoomSessionErrorMessageEvent.ts new file mode 100644 index 0000000..807ba3b --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionErrorMessageEvent.ts @@ -0,0 +1,32 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionErrorMessageEvent extends RoomSessionEvent +{ + public static RSEME_KICKED: string = 'RSEME_KICKED'; + public static RSEME_PETS_FORBIDDEN_IN_HOTEL: string = 'RSEME_PETS_FORBIDDEN_IN_HOTEL'; + public static RSEME_PETS_FORBIDDEN_IN_FLAT: string = 'RSEME_PETS_FORBIDDEN_IN_FLAT'; + public static RSEME_MAX_PETS: string = 'RSEME_MAX_PETS'; + public static RSEME_MAX_NUMBER_OF_OWN_PETS: string = 'RSEME_MAX_NUMBER_OF_OWN_PETS'; + public static RSEME_NO_FREE_TILES_FOR_PET: string = 'RSEME_NO_FREE_TILES_FOR_PET'; + public static RSEME_SELECTED_TILE_NOT_FREE_FOR_PET: string = 'RSEME_SELECTED_TILE_NOT_FREE_FOR_PET'; + public static RSEME_BOTS_FORBIDDEN_IN_HOTEL: string = 'RSEME_BOTS_FORBIDDEN_IN_HOTEL'; + public static RSEME_BOTS_FORBIDDEN_IN_FLAT: string = 'RSEME_BOTS_FORBIDDEN_IN_FLAT'; + public static RSEME_BOT_LIMIT_REACHED: string = 'RSEME_BOT_LIMIT_REACHED'; + public static RSEME_SELECTED_TILE_NOT_FREE_FOR_BOT: string = 'RSEME_SELECTED_TILE_NOT_FREE_FOR_BOT'; + public static RSEME_BOT_NAME_NOT_ACCEPTED: string = 'RSEME_BOT_NAME_NOT_ACCEPTED'; + + private _message: string; + + constructor(k: string, _arg_2: IRoomSession, _arg_3: string = null) + { + super(k, _arg_2); + + this._message = _arg_3; + } + + public get message(): string + { + return this._message; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionEvent.ts b/submodules/renderer/src/events/session/RoomSessionEvent.ts new file mode 100644 index 0000000..dfa6786 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionEvent.ts @@ -0,0 +1,31 @@ +import { IRoomSession } from '../../api'; +import { NitroEvent } from '../core'; + +export class RoomSessionEvent extends NitroEvent +{ + public static CREATED: string = 'RSE_CREATED'; + public static STARTED: string = 'RSE_STARTED'; + public static ENDED: string = 'RSE_ENDED'; + public static ROOM_DATA: string = 'RSE_ROOM_DATA'; + + private _session: IRoomSession; + private _openLandingView: boolean; + + constructor(type: string, session: IRoomSession, openLandingView: boolean = true) + { + super(type); + + this._session = session; + this._openLandingView = openLandingView; + } + + public get session(): IRoomSession + { + return this._session; + } + + public get openLandingView(): boolean + { + return this._openLandingView; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionFavoriteGroupUpdateEvent.ts b/submodules/renderer/src/events/session/RoomSessionFavoriteGroupUpdateEvent.ts new file mode 100644 index 0000000..0e2d05b --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionFavoriteGroupUpdateEvent.ts @@ -0,0 +1,42 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionFavoriteGroupUpdateEvent extends RoomSessionEvent +{ + public static FAVOURITE_GROUP_UPDATE: string = 'RSFGUE_FAVOURITE_GROUP_UPDATE'; + + private _roomIndex: number; + private _habboGroupId: number; + private _habboGroupName: string; + private _status: number; + + constructor(session: IRoomSession, roomIndex: number, groupId: number, status: number, groupName: string) + { + super(RoomSessionFavoriteGroupUpdateEvent.FAVOURITE_GROUP_UPDATE, session); + + this._roomIndex = roomIndex; + this._habboGroupId = groupId; + this._habboGroupName = groupName; + this._status = status; + } + + public get roomIndex(): number + { + return this._roomIndex; + } + + public get habboGroupId(): number + { + return this._habboGroupId; + } + + public get habboGroupName(): string + { + return this._habboGroupName; + } + + public get status(): number + { + return this._status; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionFriendRequestEvent.ts b/submodules/renderer/src/events/session/RoomSessionFriendRequestEvent.ts new file mode 100644 index 0000000..37f63dc --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionFriendRequestEvent.ts @@ -0,0 +1,35 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionFriendRequestEvent extends RoomSessionEvent +{ + public static RSFRE_FRIEND_REQUEST: string = 'RSFRE_FRIEND_REQUEST'; + + private _requestId: number = 0; + private _userId: number = 0; + private _userName: string; + + constructor(session: IRoomSession, requestId: number, userId: number, userName: string) + { + super(RoomSessionFriendRequestEvent.RSFRE_FRIEND_REQUEST, session); + + this._requestId = requestId; + this._userId = userId; + this._userName = userName; + } + + public get requestId(): number + { + return this._requestId; + } + + public get userId(): number + { + return this._userId; + } + + public get userName(): string + { + return this._userName; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionNestBreedingSuccessEvent.ts b/submodules/renderer/src/events/session/RoomSessionNestBreedingSuccessEvent.ts new file mode 100644 index 0000000..3ca7638 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionNestBreedingSuccessEvent.ts @@ -0,0 +1,28 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionNestBreedingSuccessEvent extends RoomSessionEvent +{ + public static NEST_BREEDING_SUCCESS: string = 'RSPFUE_NEST_BREEDING_SUCCESS'; + + private _rarityCategory: number; + private _petId: number; + + constructor(session: IRoomSession, petId: number, rarityCategory: number) + { + super(RoomSessionNestBreedingSuccessEvent.NEST_BREEDING_SUCCESS, session); + + this._petId = petId; + this._rarityCategory = rarityCategory; + } + + public get rarityCategory(): number + { + return this._rarityCategory; + } + + public get petId(): number + { + return this._petId; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionPetBreedingEvent.ts b/submodules/renderer/src/events/session/RoomSessionPetBreedingEvent.ts new file mode 100644 index 0000000..0d5db4a --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionPetBreedingEvent.ts @@ -0,0 +1,35 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionPetBreedingEvent extends RoomSessionEvent +{ + public static PET_BREEDING: string = 'RSPFUE_PET_BREEDING'; + + private _state: number; + private _ownPetId: number; + private _otherPetId: number; + + constructor(session: IRoomSession, state: number, ownPetId: number, otherPetId: number) + { + super(RoomSessionPetBreedingEvent.PET_BREEDING, session); + + this._state = state; + this._ownPetId = ownPetId; + this._otherPetId = otherPetId; + } + + public get state(): number + { + return this._state; + } + + public get ownPetId(): number + { + return this._ownPetId; + } + + public get otherPetId(): number + { + return this._otherPetId; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionPetBreedingResultEvent.ts b/submodules/renderer/src/events/session/RoomSessionPetBreedingResultEvent.ts new file mode 100644 index 0000000..d189cae --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionPetBreedingResultEvent.ts @@ -0,0 +1,28 @@ +import { IPetBreedingResultData, IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionPetBreedingResultEvent extends RoomSessionEvent +{ + public static PET_BREEDING_RESULT: string = 'RSPFUE_PET_BREEDING_RESULT'; + + private _resultData: IPetBreedingResultData; + private _otherResultData: IPetBreedingResultData; + + constructor(session: IRoomSession, resultData: IPetBreedingResultData, otherResultData: IPetBreedingResultData) + { + super(RoomSessionPetBreedingResultEvent.PET_BREEDING_RESULT, session); + + this._resultData = resultData; + this._otherResultData = otherResultData; + } + + public get resultData(): IPetBreedingResultData + { + return this._resultData; + } + + public get otherResultData(): IPetBreedingResultData + { + return this._otherResultData; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionPetCommandsUpdateEvent.ts b/submodules/renderer/src/events/session/RoomSessionPetCommandsUpdateEvent.ts new file mode 100644 index 0000000..89ec845 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionPetCommandsUpdateEvent.ts @@ -0,0 +1,35 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionPetCommandsUpdateEvent extends RoomSessionEvent +{ + public static PET_COMMANDS: string = 'RSPIUE_ENABLED_PET_COMMANDS'; + + private _petId: number; + private _allCommandIds: number[]; + private _enabledCommandIds: number[]; + + constructor(k: IRoomSession, id: number, commands: number[], enabledCommands: number[]) + { + super(RoomSessionPetCommandsUpdateEvent.PET_COMMANDS, k); + + this._petId = id; + this._allCommandIds = commands; + this._enabledCommandIds = enabledCommands; + } + + public get id(): number + { + return this._petId; + } + + public get commands(): number[] + { + return this._allCommandIds; + } + + public get enabledCommands(): number[] + { + return this._enabledCommandIds; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionPetFigureUpdateEvent.ts b/submodules/renderer/src/events/session/RoomSessionPetFigureUpdateEvent.ts new file mode 100644 index 0000000..5f317cb --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionPetFigureUpdateEvent.ts @@ -0,0 +1,28 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionPetFigureUpdateEvent extends RoomSessionEvent +{ + public static PET_FIGURE_UPDATE: string = 'RSPFUE_PET_FIGURE_UPDATE'; + + private _petId: number; + private _figure: string; + + constructor(roomSession: IRoomSession, id: number, figure: string) + { + super(RoomSessionPetFigureUpdateEvent.PET_FIGURE_UPDATE, roomSession); + + this._petId = id; + this._figure = figure; + } + + public get id(): number + { + return this._petId; + } + + public get figure(): string + { + return this._figure; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionPetInfoUpdateEvent.ts b/submodules/renderer/src/events/session/RoomSessionPetInfoUpdateEvent.ts new file mode 100644 index 0000000..23c238c --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionPetInfoUpdateEvent.ts @@ -0,0 +1,21 @@ +import { IRoomPetData, IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionPetInfoUpdateEvent extends RoomSessionEvent +{ + public static PET_INFO: string = 'RSPIUE_PET_INFO'; + + private _petInfo: IRoomPetData; + + constructor(k: IRoomSession, _arg_2: IRoomPetData) + { + super(RoomSessionPetInfoUpdateEvent.PET_INFO, k); + + this._petInfo = _arg_2; + } + + public get petInfo(): IRoomPetData + { + return this._petInfo; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionPetLevelUpdateEvent.ts b/submodules/renderer/src/events/session/RoomSessionPetLevelUpdateEvent.ts new file mode 100644 index 0000000..4122816 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionPetLevelUpdateEvent.ts @@ -0,0 +1,28 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionPetLevelUpdateEvent extends RoomSessionEvent +{ + public static PET_LEVEL_UPDATE: string = 'RSPLUE_PET_LEVEL_UPDATE'; + + private _petId: number; + private _level: number; + + constructor(session: IRoomSession, petId: number, level: number) + { + super(RoomSessionPetLevelUpdateEvent.PET_LEVEL_UPDATE, session); + + this._petId = petId; + this._level = level; + } + + public get petId(): number + { + return this._petId; + } + + public get level(): number + { + return this._level; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionPetPackageEvent.ts b/submodules/renderer/src/events/session/RoomSessionPetPackageEvent.ts new file mode 100644 index 0000000..87dac71 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionPetPackageEvent.ts @@ -0,0 +1,43 @@ +import { IRoomSession } from '../../api'; +import { PetFigureData } from '../../nitro'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionPetPackageEvent extends RoomSessionEvent +{ + public static RSOPPE_OPEN_PET_PACKAGE_REQUESTED: string = 'RSOPPE_OPEN_PET_PACKAGE_REQUESTED'; + public static RSOPPE_OPEN_PET_PACKAGE_RESULT: string = 'RSOPPE_OPEN_PET_PACKAGE_RESULT'; + + private _objectId: number = -1; + private _figureData: PetFigureData; + private _nameValidationStatus: number = 0; + private _nameValidationInfo: string = null; + + constructor(petPackageName: string, session: IRoomSession, objectId: number, figureData: PetFigureData, nameValidationStatus: number, nameValidationInfo: string) + { + super(petPackageName, session); + this._objectId = objectId; + this._figureData = figureData; + this._nameValidationStatus = nameValidationStatus; + this._nameValidationInfo = nameValidationInfo; + } + + public get objectId(): number + { + return this._objectId; + } + + public get figureData(): PetFigureData + { + return this._figureData; + } + + public get nameValidationStatus(): number + { + return this._nameValidationStatus; + } + + public get nameValidationInfo(): string + { + return this._nameValidationInfo; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionPetStatusUpdateEvent.ts b/submodules/renderer/src/events/session/RoomSessionPetStatusUpdateEvent.ts new file mode 100644 index 0000000..d62f018 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionPetStatusUpdateEvent.ts @@ -0,0 +1,49 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionPetStatusUpdateEvent extends RoomSessionEvent +{ + public static PET_STATUS_UPDATE: string = 'RSPFUE_PET_STATUS_UPDATE'; + + private _petId: number; + private _canBreed: boolean; + private _canHarvest: boolean; + private _canRevive: boolean; + private _hasBreedingPermission: boolean; + + constructor(roomSession: IRoomSession, petId: number, canBreed: boolean, canHarvest: boolean, canRevive: boolean, hasBreedingPermission: boolean) + { + super(RoomSessionPetStatusUpdateEvent.PET_STATUS_UPDATE, roomSession); + + this._petId = petId; + this._canBreed = canBreed; + this._canHarvest = canHarvest; + this._canRevive = canRevive; + this._hasBreedingPermission = hasBreedingPermission; + } + + public get petId(): number + { + return this._petId; + } + + public get canBreed(): boolean + { + return this._canBreed; + } + + public get canHarvest(): boolean + { + return this._canHarvest; + } + + public get canRevive(): boolean + { + return this._canRevive; + } + + public get hasBreedingPermission(): boolean + { + return this._hasBreedingPermission; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionPollEvent.ts b/submodules/renderer/src/events/session/RoomSessionPollEvent.ts new file mode 100644 index 0000000..551ead7 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionPollEvent.ts @@ -0,0 +1,100 @@ +import { IPollQuestion, IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionPollEvent extends RoomSessionEvent +{ + public static OFFER: string = 'RSPE_POLL_OFFER'; + public static ERROR: string = 'RSPE_POLL_ERROR'; + public static CONTENT: string = 'RSPE_POLL_CONTENT'; + + private _id: number = -1; + private _headline: string; + private _summary: string; + private _numQuestions: number = 0; + private _startMessage: string = ''; + private _endMessage: string = ''; + private _questionArray: IPollQuestion[] = null; + private _npsPoll: boolean = false; + + constructor(k: string, _arg_2: IRoomSession, _arg_3: number) + { + super(k, _arg_2); + + this._id = _arg_3; + } + + public get id(): number + { + return this._id; + } + + public get headline(): string + { + return this._headline; + } + + public set headline(k: string) + { + this._headline = k; + } + + public get summary(): string + { + return this._summary; + } + + public set summary(k: string) + { + this._summary = k; + } + + public get numQuestions(): number + { + return this._numQuestions; + } + + public set numQuestions(k: number) + { + this._numQuestions = k; + } + + public get startMessage(): string + { + return this._startMessage; + } + + public set startMessage(k: string) + { + this._startMessage = k; + } + + public get endMessage(): string + { + return this._endMessage; + } + + public set endMessage(k: string) + { + this._endMessage = k; + } + + public get questionArray(): IPollQuestion[] + { + return this._questionArray; + } + + public set questionArray(k: IPollQuestion[]) + { + this._questionArray = k; + } + + public get npsPoll(): boolean + { + return this._npsPoll; + } + + public set npsPoll(k: boolean) + { + this._npsPoll = k; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionPresentEvent.ts b/submodules/renderer/src/events/session/RoomSessionPresentEvent.ts new file mode 100644 index 0000000..d589987 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionPresentEvent.ts @@ -0,0 +1,64 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionPresentEvent extends RoomSessionEvent +{ + public static RSPE_PRESENT_OPENED: string = 'RSPE_PRESENT_OPENED'; + + private _classId: number = 0; + private _itemType: string = ''; + private _productCode: string; + private _placedItemId: number = 0; + private _placedItemType: string = ''; + private _placedInRoom: boolean; + private _petFigureString: string; + + constructor(k: string, _arg_2: IRoomSession, classId: number, itemType: string, productCode: string, placedItemId: number, placedItemType: string, placedInRoom: boolean, petFigureString: string) + { + super(k, _arg_2); + + this._classId = classId; + this._itemType = itemType; + this._productCode = productCode; + this._placedItemId = placedItemId; + this._placedItemType = placedItemType; + this._placedInRoom = placedInRoom; + this._petFigureString = petFigureString; + } + + public get classId(): number + { + return this._classId; + } + + + public get itemType(): string + { + return this._itemType; + } + + public get productCode(): string + { + return this._productCode; + } + + public get placedItemId(): number + { + return this._placedItemId; + } + + public get placedInRoom(): boolean + { + return this._placedInRoom; + } + + public get placedItemType(): string + { + return this._placedItemType; + } + + public get petFigureString(): string + { + return this._petFigureString; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionPropertyUpdateEvent.ts b/submodules/renderer/src/events/session/RoomSessionPropertyUpdateEvent.ts new file mode 100644 index 0000000..bf284b4 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionPropertyUpdateEvent.ts @@ -0,0 +1,12 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionPropertyUpdateEvent extends RoomSessionEvent +{ + public static RSDUE_ALLOW_PETS: string = 'RSDUE_ALLOW_PETS'; + + constructor(k: string, _arg_2: IRoomSession) + { + super(k, _arg_2); + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionQueueEvent.ts b/submodules/renderer/src/events/session/RoomSessionQueueEvent.ts new file mode 100644 index 0000000..7cc3462 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionQueueEvent.ts @@ -0,0 +1,57 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionQueueEvent extends RoomSessionEvent +{ + public static QUEUE_STATUS: string = 'RSQE_QUEUE_STATUS'; + public static QUEUE_TYPE_CLUB: string = 'c'; + public static QUEUE_TYPE_NORMAL: string = 'd'; + public static QUEUE_TARGET_VISITOR: number = 2; + public static QUEUE_TARGET_SPECTATOR: number = 1; + + private _name: string; + private _target: number; + private _queues: Map; + private _isActive: boolean; + private _activeQueue: string; + + constructor(k: IRoomSession, _arg_2: string, _arg_3: number, _arg_4: boolean = false) + { + super(RoomSessionQueueEvent.QUEUE_STATUS, k); + + this._name = _arg_2; + this._target = _arg_3; + this._queues = new Map(); + this._isActive = _arg_4; + } + + public get isActive(): boolean + { + return this._isActive; + } + + public get queueSetName(): string + { + return this._name; + } + + public get queueSetTarget(): number + { + return this._target; + } + + public get queueTypes(): string[] + { + return Array.from(this._queues.keys()); + } + + public getQueueSize(k: string): number + { + return this._queues.get(k); + } + + public addQueue(k: string, _arg_2: number): void + { + this._queues.set(k, _arg_2); + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionSpectatorModeEvent.ts b/submodules/renderer/src/events/session/RoomSessionSpectatorModeEvent.ts new file mode 100644 index 0000000..aed9685 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionSpectatorModeEvent.ts @@ -0,0 +1,12 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionSpectatorModeEvent extends RoomSessionEvent +{ + public static SPECTATOR_MODE: string = 'RSSME_SPECTATOR_MODE'; + + constructor(type: string, session: IRoomSession) + { + super(type, session); + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionUserBadgesEvent.ts b/submodules/renderer/src/events/session/RoomSessionUserBadgesEvent.ts new file mode 100644 index 0000000..9d28c1a --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionUserBadgesEvent.ts @@ -0,0 +1,29 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionUserBadgesEvent extends RoomSessionEvent +{ + public static RSUBE_BADGES: string = 'RSUBE_BADGES'; + + private _userId: number = 0; + private _badges: string[]; + + constructor(k: IRoomSession, _arg_2: number, _arg_3: string[]) + { + super(RoomSessionUserBadgesEvent.RSUBE_BADGES, k); + + this._badges = []; + this._userId = _arg_2; + this._badges = _arg_3; + } + + public get userId(): number + { + return this._userId; + } + + public get badges(): string[] + { + return this._badges; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionUserDataUpdateEvent.ts b/submodules/renderer/src/events/session/RoomSessionUserDataUpdateEvent.ts new file mode 100644 index 0000000..6e8d239 --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionUserDataUpdateEvent.ts @@ -0,0 +1,21 @@ +import { IRoomSession, IRoomUserData } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionUserDataUpdateEvent extends RoomSessionEvent +{ + public static USER_DATA_UPDATED: string = 'RMUDUE_USER_DATA_UPDATED'; + + private _addedUsers: IRoomUserData[]; + + constructor(session: IRoomSession, addedUsers: IRoomUserData[]) + { + super(RoomSessionUserDataUpdateEvent.USER_DATA_UPDATED, session); + + this._addedUsers = addedUsers; + } + + public get addedUsers(): IRoomUserData[] + { + return this._addedUsers; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionUserFigureUpdateEvent.ts b/submodules/renderer/src/events/session/RoomSessionUserFigureUpdateEvent.ts new file mode 100644 index 0000000..40c410a --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionUserFigureUpdateEvent.ts @@ -0,0 +1,49 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionUserFigureUpdateEvent extends RoomSessionEvent +{ + public static USER_FIGURE: string = 'RSUBE_FIGURE'; + + private _roomIndex: number = 0; + private _figure: string = ''; + private _gender: string = ''; + private _customInfo: string = ''; + private _achievementScore: number; + + constructor(session: IRoomSession, roomIndex: number, figure: string, gender: string, customInfo: string, achievementScore: number) + { + super(RoomSessionUserFigureUpdateEvent.USER_FIGURE, session); + + this._roomIndex = roomIndex; + this._figure = figure; + this._gender = gender; + this._customInfo = customInfo; + this._achievementScore = achievementScore; + } + + public get roomIndex(): number + { + return this._roomIndex; + } + + public get figure(): string + { + return this._figure; + } + + public get gender(): string + { + return this._gender; + } + + public get customInfo(): string + { + return this._customInfo; + } + + public get activityPoints(): number + { + return this._achievementScore; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionUserTagsEvent.ts b/submodules/renderer/src/events/session/RoomSessionUserTagsEvent.ts new file mode 100644 index 0000000..057b7bc --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionUserTagsEvent.ts @@ -0,0 +1,27 @@ +import { NitroEvent } from '../core'; + +export class RoomSessionUserTagsEvent extends NitroEvent +{ + public static UTRE_USER_TAGS_RECEIVED: string = 'UTRE_USER_TAGS_RECEIVED'; + + private _userId: number; + private _tags: string[]; + + constructor(k: number, _arg_2: string[]) + { + super(RoomSessionUserTagsEvent.UTRE_USER_TAGS_RECEIVED); + + this._userId = k; + this._tags = _arg_2; + } + + public get userId(): number + { + return this._userId; + } + + public get tags(): string[] + { + return this._tags; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionVoteEvent.ts b/submodules/renderer/src/events/session/RoomSessionVoteEvent.ts new file mode 100644 index 0000000..d8d778b --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionVoteEvent.ts @@ -0,0 +1,50 @@ +import { IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + + +export class RoomSessionVoteEvent extends RoomSessionEvent +{ + public static VOTE_QUESTION: string = 'RSPE_VOTE_QUESTION'; + public static VOTE_RESULT: string = 'RSPE_VOTE_RESULT'; + + private _question: string = ''; + private _choices: string[]; + private _SafeStr_7651: string[]; + private _SafeStr_7654: number = 0; + + constructor(_arg_1: string, _arg_2: IRoomSession, _arg_3: string, _arg_4: string[], _arg_5: string[] = null, _arg_6: number = 0) + { + super(_arg_1, _arg_2); + + this._choices = []; + this._SafeStr_7651 = []; + this._question = _arg_3; + this._choices = _arg_4; + this._SafeStr_7651 = _arg_5; + if(this._SafeStr_7651 == null) + { + this._SafeStr_7651 = []; + } + this._SafeStr_7654 = _arg_6; + } + + public get question(): string + { + return this._question; + } + + public get choices(): string[] + { + return this._choices.slice(); + } + + public get _SafeStr_4173(): string[] + { + return this._SafeStr_7651.slice(); + } + + public get _SafeStr_4174(): number + { + return this._SafeStr_7654; + } +} diff --git a/submodules/renderer/src/events/session/RoomSessionWordQuizEvent.ts b/submodules/renderer/src/events/session/RoomSessionWordQuizEvent.ts new file mode 100644 index 0000000..df5a1db --- /dev/null +++ b/submodules/renderer/src/events/session/RoomSessionWordQuizEvent.ts @@ -0,0 +1,111 @@ +import { IQuestion, IRoomSession } from '../../api'; +import { RoomSessionEvent } from './RoomSessionEvent'; + +export class RoomSessionWordQuizEvent extends RoomSessionEvent +{ + public static QUESTION: string = 'RWPUW_NEW_QUESTION'; + public static FINISHED: string = 'RWPUW_QUESION_FINSIHED'; + public static ANSWERED: string = 'RWPUW_QUESTION_ANSWERED'; + + private _id: number = -1; + private _pollType: string = null; + private _pollId: number = -1; + private _questionId: number = -1; + private _duration: number = -1; + private _question: IQuestion = null; + private _userId: number = -1; + private _value: string; + private _answerCounts: Map; + + constructor(k: string, _arg_2: IRoomSession, _arg_3: number = -1) + { + super(k, _arg_2); + + this._id = _arg_3; + } + + public get id(): number + { + return this._id; + } + + public get pollType(): string + { + return this._pollType; + } + + public set pollType(pollType: string) + { + this._pollType = pollType; + } + + public get pollId(): number + { + return this._pollId; + } + + public set pollId(k: number) + { + this._pollId = k; + } + + public get questionId(): number + { + return this._questionId; + } + + public set questionId(k: number) + { + this._questionId = k; + } + + public get duration(): number + { + return this._duration; + } + + public set duration(k: number) + { + this._duration = k; + } + + public get question(): IQuestion + { + return this._question; + } + + public set question(k: IQuestion) + { + this._question = k; + } + + public get userId(): number + { + return this._userId; + } + + public set userId(k: number) + { + this._userId = k; + } + + public get value(): string + { + return this._value; + } + + public set value(value: string) + { + this._value = value; + } + + public get answerCounts(): Map + { + return this._answerCounts; + } + + public set answerCounts(k: Map) + { + this._answerCounts = k; + } +} diff --git a/submodules/renderer/src/events/session/SessionDataPreferencesEvent.ts b/submodules/renderer/src/events/session/SessionDataPreferencesEvent.ts new file mode 100644 index 0000000..7e362d9 --- /dev/null +++ b/submodules/renderer/src/events/session/SessionDataPreferencesEvent.ts @@ -0,0 +1,20 @@ +import { NitroEvent } from '../core'; + +export class SessionDataPreferencesEvent extends NitroEvent +{ + public static UPDATED: string = 'APUE_UPDATED'; + + private _uiFlags: number; + + constructor(k: number) + { + super(SessionDataPreferencesEvent.UPDATED); + + this._uiFlags = k; + } + + public get uiFlags(): number + { + return this._uiFlags; + } +} diff --git a/submodules/renderer/src/events/session/UserNameUpdateEvent.ts b/submodules/renderer/src/events/session/UserNameUpdateEvent.ts new file mode 100644 index 0000000..9b8051e --- /dev/null +++ b/submodules/renderer/src/events/session/UserNameUpdateEvent.ts @@ -0,0 +1,20 @@ +import { NitroEvent } from '../core'; + +export class UserNameUpdateEvent extends NitroEvent +{ + public static UNUE_NAME_UPDATED: string = 'unue_name_updated'; + + private _name: string; + + constructor(name: string) + { + super(UserNameUpdateEvent.UNUE_NAME_UPDATED); + + this._name = name; + } + + public get name(): string + { + return this._name; + } +} diff --git a/submodules/renderer/src/events/session/index.ts b/submodules/renderer/src/events/session/index.ts new file mode 100644 index 0000000..82421b0 --- /dev/null +++ b/submodules/renderer/src/events/session/index.ts @@ -0,0 +1,36 @@ +export * from './BadgeImageReadyEvent'; +export * from './MysteryBoxKeysUpdateEvent'; +export * from './PerksUpdatedEvent'; +export * from './RoomSessionChatEvent'; +export * from './RoomSessionConfirmPetBreedingEvent'; +export * from './RoomSessionConfirmPetBreedingResultEvent'; +export * from './RoomSessionDanceEvent'; +export * from './RoomSessionDimmerPresetsEvent'; +export * from './RoomSessionDimmerPresetsEventPresetItem'; +export * from './RoomSessionDoorbellEvent'; +export * from './RoomSessionErrorMessageEvent'; +export * from './RoomSessionEvent'; +export * from './RoomSessionFavoriteGroupUpdateEvent'; +export * from './RoomSessionFriendRequestEvent'; +export * from './RoomSessionNestBreedingSuccessEvent'; +export * from './RoomSessionPetBreedingEvent'; +export * from './RoomSessionPetBreedingResultEvent'; +export * from './RoomSessionPetCommandsUpdateEvent'; +export * from './RoomSessionPetFigureUpdateEvent'; +export * from './RoomSessionPetInfoUpdateEvent'; +export * from './RoomSessionPetLevelUpdateEvent'; +export * from './RoomSessionPetPackageEvent'; +export * from './RoomSessionPetStatusUpdateEvent'; +export * from './RoomSessionPollEvent'; +export * from './RoomSessionPresentEvent'; +export * from './RoomSessionPropertyUpdateEvent'; +export * from './RoomSessionQueueEvent'; +export * from './RoomSessionSpectatorModeEvent'; +export * from './RoomSessionUserBadgesEvent'; +export * from './RoomSessionUserDataUpdateEvent'; +export * from './RoomSessionUserFigureUpdateEvent'; +export * from './RoomSessionUserTagsEvent'; +export * from './RoomSessionVoteEvent'; +export * from './RoomSessionWordQuizEvent'; +export * from './SessionDataPreferencesEvent'; +export * from './UserNameUpdateEvent'; diff --git a/submodules/renderer/src/index.ts b/submodules/renderer/src/index.ts new file mode 100644 index 0000000..64121b0 --- /dev/null +++ b/submodules/renderer/src/index.ts @@ -0,0 +1,6 @@ +export * from './api'; +export * from './core'; +export * from './events'; +export * from './nitro'; +export * from './pixi-proxy'; +export * from './room'; diff --git a/submodules/renderer/src/nitro/INitro.ts b/submodules/renderer/src/nitro/INitro.ts new file mode 100644 index 0000000..4d25089 --- /dev/null +++ b/submodules/renderer/src/nitro/INitro.ts @@ -0,0 +1,31 @@ +import { Application } from '@pixi/app'; +import { IAvatarRenderManager, IEventDispatcher, ILinkEventTracker, INitroCommunicationManager, INitroCore, INitroLocalizationManager, IRoomCameraWidgetManager, IRoomEngine, IRoomManager, IRoomSessionManager, ISessionDataManager, ISoundManager } from '../api'; + +export interface INitro +{ + init(): void; + dispose(): void; + getConfiguration(key: string, value?: T): T; + getLocalization(key: string): string; + getLocalizationWithParameter(key: string, parameter: string, replacement: string): string; + getLocalizationWithParameters(key: string, parameters: string[], replacements: string[]): string; + addLinkEventTracker(tracker: ILinkEventTracker): void; + removeLinkEventTracker(tracker: ILinkEventTracker): void; + createLinkEvent(link: string): void; + application: Application; + core: INitroCore; + events: IEventDispatcher; + localization: INitroLocalizationManager; + communication: INitroCommunicationManager; + avatar: IAvatarRenderManager; + roomEngine: IRoomEngine; + sessionDataManager: ISessionDataManager; + roomSessionManager: IRoomSessionManager; + roomManager: IRoomManager; + cameraManager: IRoomCameraWidgetManager; + soundManager: ISoundManager; + width: number; + height: number; + isReady: boolean; + isDisposed: boolean; +} diff --git a/submodules/renderer/src/nitro/Nitro.ts b/submodules/renderer/src/nitro/Nitro.ts new file mode 100644 index 0000000..f821c6e --- /dev/null +++ b/submodules/renderer/src/nitro/Nitro.ts @@ -0,0 +1,365 @@ +import { Application, IApplicationOptions } from '@pixi/app'; +import { SCALE_MODES } from '@pixi/constants'; +import { settings } from '@pixi/settings'; +import { IAvatarRenderManager, IEventDispatcher, ILinkEventTracker, INitroCommunicationManager, INitroCore, INitroLocalizationManager, IRoomCameraWidgetManager, IRoomEngine, IRoomManager, IRoomSessionManager, ISessionDataManager, ISoundManager, NitroConfiguration, NitroLogger } from '../api'; +import { ConfigurationEvent, EventDispatcher, NitroCore } from '../core'; +import { NitroEvent, RoomEngineEvent } from '../events'; +import { GetTicker, PixiApplicationProxy } from '../pixi-proxy'; +import { RoomManager } from '../room'; +import { AvatarRenderManager } from './avatar'; +import { RoomCameraWidgetManager } from './camera'; +import { NitroCommunicationManager } from './communication'; +import { LegacyExternalInterface } from './externalInterface'; +import { GameMessageHandler } from './game'; +import { INitro } from './INitro'; +import { NitroLocalizationManager } from './localization'; +import './Plugins'; +import { LandscapeRasterizer, RoomEngine } from './room'; +import { RoomSessionManager, SessionDataManager } from './session'; +import { SoundManager } from './sound'; +import { HabboWebTools } from './utils/HabboWebTools'; + +LegacyExternalInterface.available; + +settings.SCALE_MODE = (!(window.devicePixelRatio % 1)) ? SCALE_MODES.NEAREST : SCALE_MODES.LINEAR; +settings.ROUND_PIXELS = true; +settings.GC_MAX_IDLE = 120; + +export class Nitro implements INitro +{ + public static WEBGL_CONTEXT_LOST: string = 'NE_WEBGL_CONTEXT_LOST'; + public static WEBGL_UNAVAILABLE: string = 'NE_WEBGL_UNAVAILABLE'; + public static READY: string = 'NE_READY!'; + + private static INSTANCE: INitro = null; + + private _application: Application; + private _core: INitroCore; + private _events: IEventDispatcher; + private _communication: INitroCommunicationManager; + private _localization: INitroLocalizationManager; + private _avatar: IAvatarRenderManager; + private _roomEngine: IRoomEngine; + private _sessionDataManager: ISessionDataManager; + private _roomSessionManager: IRoomSessionManager; + private _roomManager: IRoomManager; + private _cameraManager: IRoomCameraWidgetManager; + private _soundManager: ISoundManager; + private _linkTrackers: ILinkEventTracker[]; + + private _isReady: boolean; + private _isDisposed: boolean; + + constructor(core: INitroCore, options?: IApplicationOptions) + { + if(!Nitro.INSTANCE) Nitro.INSTANCE = this; + + this._application = new PixiApplicationProxy(options); + this._core = core; + this._events = new EventDispatcher(); + this._communication = new NitroCommunicationManager(core.communication); + this._localization = new NitroLocalizationManager(this._communication); + this._avatar = new AvatarRenderManager(); + this._roomEngine = new RoomEngine(this._communication); + this._sessionDataManager = new SessionDataManager(this._communication); + this._roomSessionManager = new RoomSessionManager(this._communication, this._roomEngine); + this._roomManager = new RoomManager(this._roomEngine, this._roomEngine.visualizationFactory, this._roomEngine.logicFactory); + this._cameraManager = new RoomCameraWidgetManager(); + this._soundManager = new SoundManager(); + this._linkTrackers = []; + + this._isReady = false; + this._isDisposed = false; + + this._core.configuration.events.addEventListener(ConfigurationEvent.LOADED, this.onConfigurationLoadedEvent.bind(this)); + this._roomEngine.events.addEventListener(RoomEngineEvent.ENGINE_INITIALIZED, this.onRoomEngineReady.bind(this)); + } + + public static bootstrap(): void + { + if(Nitro.INSTANCE) + { + Nitro.INSTANCE.dispose(); + + Nitro.INSTANCE = null; + } + + const canvas = document.createElement('canvas'); + + const instance = new this(new NitroCore(), { + autoDensity: false, + width: window.innerWidth, + height: window.innerHeight, + resolution: window.devicePixelRatio, + view: canvas + }); + + canvas.addEventListener('webglcontextlost', () => instance.events.dispatchEvent(new NitroEvent(Nitro.WEBGL_CONTEXT_LOST))); + } + + public init(): void + { + if(this._isReady || this._isDisposed) return; + + if(this._avatar) this._avatar.init(); + + if(this._soundManager) this._soundManager.init(); + + if(this._roomEngine) + { + this._roomEngine.sessionDataManager = this._sessionDataManager; + this._roomEngine.roomSessionManager = this._roomSessionManager; + this._roomEngine.roomManager = this._roomManager; + + if(this._sessionDataManager) this._sessionDataManager.init(); + if(this._roomSessionManager) this._roomSessionManager.init(); + + this._roomEngine.init(); + } + + if(!this._communication.connection) + { + throw new Error('No connection found'); + } + + new GameMessageHandler(this._communication.connection); + + this._isReady = true; + } + + public dispose(): void + { + if(this._isDisposed) return; + + if(this._roomManager) + { + this._roomManager.dispose(); + + this._roomManager = null; + } + + if(this._roomSessionManager) + { + this._roomSessionManager.dispose(); + + this._roomSessionManager = null; + } + + if(this._sessionDataManager) + { + this._sessionDataManager.dispose(); + + this._sessionDataManager = null; + } + + if(this._roomEngine) + { + this._roomEngine.dispose(); + + this._roomEngine = null; + } + + if(this._avatar) + { + this._avatar.dispose(); + + this._avatar = null; + } + + if(this._soundManager) + { + this._soundManager.dispose(); + + this._soundManager = null; + } + + if(this._communication) + { + this._communication.dispose(); + + this._communication = null; + } + + if(this._application) + { + this._application.destroy(); + + this._application = null; + } + + this._isDisposed = true; + this._isReady = false; + } + + private onConfigurationLoadedEvent(event: ConfigurationEvent): void + { + GetTicker().maxFPS = NitroConfiguration.getValue('system.fps.max', 24); + + NitroLogger.LOG_DEBUG = NitroConfiguration.getValue('system.log.debug', true); + NitroLogger.LOG_WARN = NitroConfiguration.getValue('system.log.warn', false); + NitroLogger.LOG_ERROR = NitroConfiguration.getValue('system.log.error', false); + NitroLogger.LOG_EVENTS = NitroConfiguration.getValue('system.log.events', false); + NitroLogger.LOG_PACKETS = NitroConfiguration.getValue('system.log.packets', false); + + LandscapeRasterizer.LANDSCAPES_ENABLED = NitroConfiguration.getValue('room.landscapes.enabled', true); + } + + private onRoomEngineReady(event: RoomEngineEvent): void + { + this.startSendingHeartBeat(); + } + + public getConfiguration(key: string, value: T = null): T + { + return NitroConfiguration.getValue(key, value); + } + + public getLocalization(key: string): string + { + return this._localization.getValue(key); + } + + public getLocalizationWithParameter(key: string, parameter: string, replacement: string): string + { + return this._localization.getValueWithParameter(key, parameter, replacement); + } + + public getLocalizationWithParameters(key: string, parameters: string[], replacements: string[]): string + { + return this._localization.getValueWithParameters(key, parameters, replacements); + } + + public addLinkEventTracker(tracker: ILinkEventTracker): void + { + if(this._linkTrackers.indexOf(tracker) >= 0) return; + + this._linkTrackers.push(tracker); + } + + public removeLinkEventTracker(tracker: ILinkEventTracker): void + { + const index = this._linkTrackers.indexOf(tracker); + + if(index === -1) return; + + this._linkTrackers.splice(index, 1); + } + + public createLinkEvent(link: string): void + { + if(!link || (link === '')) return; + + for(const tracker of this._linkTrackers) + { + if(!tracker) continue; + + const prefix = tracker.eventUrlPrefix; + + if(prefix.length > 0) + { + if(link.substr(0, prefix.length) === prefix) tracker.linkReceived(link); + } + else + { + tracker.linkReceived(link); + } + } + } + + private startSendingHeartBeat(): void + { + this.sendHeartBeat(); + + setInterval(this.sendHeartBeat, 10000); + } + + private sendHeartBeat(): void + { + HabboWebTools.sendHeartBeat(); + } + + public get application(): Application + { + return this._application; + } + + public get core(): INitroCore + { + return this._core; + } + + public get events(): IEventDispatcher + { + return this._events; + } + + public get localization(): INitroLocalizationManager + { + return this._localization; + } + + public get communication(): INitroCommunicationManager + { + return this._communication; + } + + public get avatar(): IAvatarRenderManager + { + return this._avatar; + } + + public get roomEngine(): IRoomEngine + { + return this._roomEngine; + } + + public get sessionDataManager(): ISessionDataManager + { + return this._sessionDataManager; + } + + public get roomSessionManager(): IRoomSessionManager + { + return this._roomSessionManager; + } + + public get roomManager(): IRoomManager + { + return this._roomManager; + } + + public get cameraManager(): IRoomCameraWidgetManager + { + return this._cameraManager; + } + + public get soundManager(): ISoundManager + { + return this._soundManager; + } + + public get width(): number + { + return this._application.renderer.width; + } + + public get height(): number + { + return this._application.renderer.height; + } + + public get isReady(): boolean + { + return this._isReady; + } + + public get isDisposed(): boolean + { + return this._isDisposed; + } + + public static get instance(): INitro + { + return this.INSTANCE || null; + } +} diff --git a/submodules/renderer/src/nitro/Plugins.ts b/submodules/renderer/src/nitro/Plugins.ts new file mode 100644 index 0000000..5cf5e8c --- /dev/null +++ b/submodules/renderer/src/nitro/Plugins.ts @@ -0,0 +1,23 @@ +import '@pixi/canvas-display'; +import { BatchRenderer, extensions } from '@pixi/core'; +import { Extract } from '@pixi/extract'; +import '@pixi/graphics-extras'; +import { InteractionManager } from '@pixi/interaction'; +import { AppLoaderPlugin } from '@pixi/loaders'; +import '@pixi/math-extras'; +import '@pixi/mixin-cache-as-bitmap'; +import '@pixi/mixin-get-child-by-name'; +import '@pixi/mixin-get-global-position'; +import '@pixi/polyfill'; +import { TilingSpriteRenderer } from '@pixi/sprite-tiling'; +import { SpritesheetLoader } from '@pixi/spritesheet'; +import { TickerPlugin } from '@pixi/ticker'; + +extensions.add( + BatchRenderer, + Extract, + TilingSpriteRenderer, + InteractionManager, + SpritesheetLoader, + AppLoaderPlugin, + TickerPlugin); diff --git a/submodules/renderer/src/nitro/avatar/AvatarAssetDownloadLibrary.ts b/submodules/renderer/src/nitro/avatar/AvatarAssetDownloadLibrary.ts new file mode 100644 index 0000000..f87d1b0 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/AvatarAssetDownloadLibrary.ts @@ -0,0 +1,72 @@ +import { IAssetManager, IAvatarAssetDownloadLibrary } from '../../api'; +import { EventDispatcher } from '../../core'; +import { AvatarRenderLibraryEvent } from '../../events'; + +export class AvatarAssetDownloadLibrary extends EventDispatcher implements IAvatarAssetDownloadLibrary +{ + public static DOWNLOAD_COMPLETE: string = 'AADL_DOWNLOAD_COMPLETE'; + + private static NOT_LOADED: number = 0; + private static LOADING: number = 1; + private static LOADED: number = 2; + + private _state: number; + private _libraryName: string; + private _revision: string; + private _downloadUrl: string; + private _assets: IAssetManager; + + constructor(id: string, revision: string, assets: IAssetManager, assetUrl: string) + { + super(); + + this._state = AvatarAssetDownloadLibrary.NOT_LOADED; + this._libraryName = id; + this._revision = revision; + this._downloadUrl = assetUrl; + this._assets = assets; + + this._downloadUrl = this._downloadUrl.replace(/%libname%/gi, this._libraryName); + this._downloadUrl = this._downloadUrl.replace(/%revision%/gi, this._revision); + + const asset = this._assets.getCollection(this._libraryName); + + if(asset) this._state = AvatarAssetDownloadLibrary.LOADED; + } + + public async downloadAsset(): Promise + { + if(!this._assets || (this._state === AvatarAssetDownloadLibrary.LOADING) || (this._state === AvatarAssetDownloadLibrary.LOADED)) return; + + const asset = this._assets.getCollection(this._libraryName); + + if(asset) + { + this._state = AvatarAssetDownloadLibrary.LOADED; + + this.dispatchEvent(new AvatarRenderLibraryEvent(AvatarRenderLibraryEvent.DOWNLOAD_COMPLETE, this)); + + return; + } + + this._state = AvatarAssetDownloadLibrary.LOADING; + + const status = await this._assets.downloadAsset(this._downloadUrl); + + if(!status) return; + + this._state = AvatarAssetDownloadLibrary.LOADED; + + this.dispatchEvent(new AvatarRenderLibraryEvent(AvatarRenderLibraryEvent.DOWNLOAD_COMPLETE, this)); + } + + public get libraryName(): string + { + return this._libraryName; + } + + public get isLoaded(): boolean + { + return (this._state === AvatarAssetDownloadLibrary.LOADED); + } +} diff --git a/submodules/renderer/src/nitro/avatar/AvatarAssetDownloadManager.ts b/submodules/renderer/src/nitro/avatar/AvatarAssetDownloadManager.ts new file mode 100644 index 0000000..2580250 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/AvatarAssetDownloadManager.ts @@ -0,0 +1,337 @@ +import { IAssetManager, IAvatarFigureContainer, IAvatarImageListener, INitroEvent, NitroConfiguration, NitroLogger } from '../../api'; +import { EventDispatcher } from '../../core'; +import { AvatarRenderEvent, AvatarRenderLibraryEvent, NitroEvent } from '../../events'; +import { AvatarAssetDownloadLibrary } from './AvatarAssetDownloadLibrary'; +import { AvatarStructure } from './AvatarStructure'; + +export class AvatarAssetDownloadManager extends EventDispatcher +{ + public static DOWNLOADER_READY: string = 'AADM_DOWNLOADER_READY'; + public static LIBRARY_LOADED: string = 'AADM_LIBRARY_LOADED'; + + private static MAX_DOWNLOADS: number = 2; + + private _assets: IAssetManager; + private _structure: AvatarStructure; + + private _missingMandatoryLibs: string[]; + private _figureMap: Map; + private _pendingContainers: [IAvatarFigureContainer, IAvatarImageListener][]; + private _figureListeners: Map; + private _incompleteFigures: Map; + private _pendingDownloadQueue: AvatarAssetDownloadLibrary[]; + private _currentDownloads: AvatarAssetDownloadLibrary[]; + private _libraryNames: string[]; + private _isReady: boolean; + + constructor(assets: IAssetManager, structure: AvatarStructure) + { + super(); + + this._assets = assets; + this._structure = structure; + + this._missingMandatoryLibs = NitroConfiguration.getValue('avatar.mandatory.libraries'); + this._figureMap = new Map(); + this._pendingContainers = []; + this._figureListeners = new Map(); + this._incompleteFigures = new Map(); + this._pendingDownloadQueue = []; + this._currentDownloads = []; + this._libraryNames = []; + this._isReady = false; + + this.onLibraryLoaded = this.onLibraryLoaded.bind(this); + this.onAvatarRenderReady = this.onAvatarRenderReady.bind(this); + + this.loadFigureMap(); + + this._structure.renderManager.events.addEventListener(AvatarRenderEvent.AVATAR_RENDER_READY, this.onAvatarRenderReady); + } + + private loadFigureMap(): void + { + const request = new XMLHttpRequest(); + + try + { + request.open('GET', NitroConfiguration.getValue('avatar.figuremap.url')); + + request.send(); + + request.onloadend = e => + { + if(request.responseText) + { + const data = JSON.parse(request.responseText); + + this.processFigureMap(data.libraries); + + this.processMissingLibraries(); + + this._isReady = true; + + this.dispatchEvent(new NitroEvent(AvatarAssetDownloadManager.DOWNLOADER_READY)); + } + }; + + request.onerror = e => + { + throw new Error('invalid_avatar_figure_map'); + }; + } + + catch (e) + { + NitroLogger.error(e); + } + } + + private processFigureMap(data: any): void + { + if(!data) return; + + for(const library of data) + { + if(!library) continue; + + const id = (library.id as string); + const revision = (library.revision || ''); + + if(this._libraryNames.indexOf(id) >= 0) continue; + + this._libraryNames.push(id); + + const downloadLibrary = new AvatarAssetDownloadLibrary(id, revision, this._assets, NitroConfiguration.getValue('avatar.asset.url')); + + downloadLibrary.addEventListener(AvatarRenderLibraryEvent.DOWNLOAD_COMPLETE, this.onLibraryLoaded); + + for(const part of library.parts) + { + const id = (part.id as string); + const type = (part.type as string); + const partString = (type + ':' + id); + + let existing = this._figureMap.get(partString); + + if(!existing) existing = []; + + existing.push(downloadLibrary); + + this._figureMap.set(partString, existing); + } + } + } + + private onAvatarRenderReady(event: INitroEvent): void + { + if(!event) return; + + for(const [container, listener] of this._pendingContainers) + { + this.downloadAvatarFigure(container, listener); + } + + this._pendingContainers = []; + } + + private onLibraryLoaded(event: AvatarRenderLibraryEvent): void + { + if(!event || !event.library) return; + + const loadedFigures: string[] = []; + + for(const [figure, libraries] of this._incompleteFigures.entries()) + { + let isReady = true; + + for(const library of libraries) + { + if(!library || library.isLoaded) continue; + + isReady = false; + + break; + } + + if(isReady) + { + loadedFigures.push(figure); + + const listeners = this._figureListeners.get(figure); + + if(listeners) + { + for(const listener of listeners) + { + if(!listener || listener.disposed) continue; + + listener.resetFigure(figure); + } + } + + this._figureListeners.delete(figure); + + this.dispatchEvent(new NitroEvent(AvatarAssetDownloadManager.LIBRARY_LOADED)); + } + } + + for(const figure of loadedFigures) + { + if(!figure) continue; + + this._incompleteFigures.delete(figure); + } + + let index = 0; + + while(index < this._currentDownloads.length) + { + const download = this._currentDownloads[index]; + + if(download) + { + if(download.libraryName === event.library.libraryName) this._currentDownloads.splice(index, 1); + } + + index++; + } + } + + public processMissingLibraries(): void + { + const libraries = this._missingMandatoryLibs.slice(); + + for(const library of libraries) + { + if(!library) continue; + + const map = this._figureMap.get(library); + + if(map) for(const avatar of map) avatar && this.downloadLibrary(avatar); + } + } + + public isAvatarFigureContainerReady(container: IAvatarFigureContainer): boolean + { + if(!this._isReady || !this._structure.renderManager.isReady) + { + return false; + } + + const pendingLibraries = this.getAvatarFigurePendingLibraries(container); + + return !pendingLibraries.length; + } + + private getAvatarFigurePendingLibraries(container: IAvatarFigureContainer): AvatarAssetDownloadLibrary[] + { + const pendingLibraries: AvatarAssetDownloadLibrary[] = []; + + if(!container || !this._structure) return pendingLibraries; + + const figureData = this._structure.figureData; + + if(!figureData) return pendingLibraries; + + const setKeys = container.getPartTypeIds(); + + for(const key of setKeys) + { + const set = figureData.getSetType(key); + + if(!set) continue; + + const figurePartSet = set.getPartSet(container.getPartSetId(key)); + + if(!figurePartSet) continue; + + for(const part of figurePartSet.parts) + { + if(!part) continue; + + const name = (part.type + ':' + part.id); + const existing = this._figureMap.get(name); + + if(existing === undefined) continue; + + for(const library of existing) + { + if(!library || library.isLoaded) continue; + + if(pendingLibraries.indexOf(library) >= 0) continue; + + pendingLibraries.push(library); + } + } + } + + return pendingLibraries; + } + + public downloadAvatarFigure(container: IAvatarFigureContainer, listener: IAvatarImageListener): void + { + if(!this._isReady || !this._structure.renderManager.isReady) + { + this._pendingContainers.push([container, listener]); + + return; + } + + const figure = container.getFigureString(); + const pendingLibraries = this.getAvatarFigurePendingLibraries(container); + + if(pendingLibraries && pendingLibraries.length) + { + if(listener && !listener.disposed) + { + let listeners = this._figureListeners.get(figure); + + if(!listeners) + { + listeners = []; + + this._figureListeners.set(figure, listeners); + } + + listeners.push(listener); + } + + this._incompleteFigures.set(figure, pendingLibraries); + + for(const library of pendingLibraries) + { + if(!library) continue; + + this.downloadLibrary(library); + } + } + else + { + if(listener && !listener.disposed) listener.resetFigure(figure); + } + } + + private downloadLibrary(library: AvatarAssetDownloadLibrary): void + { + if(!library || library.isLoaded) return; + + if((this._pendingDownloadQueue.indexOf(library) >= 0) || (this._currentDownloads.indexOf(library) >= 0)) return; + + this._pendingDownloadQueue.push(library); + + this.processDownloadQueue(); + } + + private processDownloadQueue(): void + { + while(this._pendingDownloadQueue.length) + { + const library = this._pendingDownloadQueue[0]; + + library.downloadAsset(); + + this._currentDownloads.push(this._pendingDownloadQueue.shift()); + } + } +} diff --git a/submodules/renderer/src/nitro/avatar/AvatarFigureContainer.ts b/submodules/renderer/src/nitro/avatar/AvatarFigureContainer.ts new file mode 100644 index 0000000..abef07b --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/AvatarFigureContainer.ts @@ -0,0 +1,116 @@ +import { IAvatarFigureContainer } from '../../api'; + +export class AvatarFigureContainer implements IAvatarFigureContainer +{ + private _parts: Map>; + + constructor(figure: string) + { + this._parts = new Map(); + + this.parseFigure(figure); + } + + public getPartTypeIds(): IterableIterator + { + return this.partSets().keys(); + } + + public hasPartType(k: string): boolean + { + return !!this.partSets().get(k); + } + + public getPartSetId(k: string): number + { + const existing = this.partSets().get(k); + + if(!existing) return 0; + + return existing.get('setid'); + } + + public getPartColorIds(k: string): number[] + { + const existing = this.partSets().get(k); + + if(!existing) return null; + + return existing.get('colorids'); + } + + public updatePart(setType: string, partSetId: number, colorIds: number[]): void + { + const set: Map = new Map(); + + set.set('type', setType); + set.set('setid', partSetId); + set.set('colorids', colorIds); + + const existingSets = this.partSets(); + + existingSets.delete(setType); + existingSets.set(setType, set); + } + + public removePart(k: string): void + { + this.partSets().delete(k); + } + + public getFigureString(): string + { + const parts: string[] = []; + + for(const key of this.partSets().keys()) + { + if(!key) continue; + + let setParts = []; + + setParts.push(key); + setParts.push(this.getPartSetId(key)); + + setParts = setParts.concat(this.getPartColorIds(key)); + + parts.push(setParts.join('-')); + } + + return parts.join('.'); + } + + private partSets(): Map> + { + if(!this._parts) this._parts = new Map(); + + return this._parts; + } + + private parseFigure(figure: string): void + { + if(!figure) figure = ''; + + for(const part of figure.split('.')) + { + const pieces = part.split('-'); + + if(pieces.length >= 2) + { + const type = pieces[0]; + const setId = parseInt(pieces[1]); + const colors = []; + + let index = 2; + + while(index < pieces.length) + { + colors.push(parseInt(pieces[index])); + + index++; + } + + this.updatePart(type, setId, colors); + } + } + } +} diff --git a/submodules/renderer/src/nitro/avatar/AvatarImage.ts b/submodules/renderer/src/nitro/avatar/AvatarImage.ts new file mode 100644 index 0000000..30f15f4 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/AvatarImage.ts @@ -0,0 +1,1100 @@ +import { RenderTexture, Texture } from '@pixi/core'; +import { Container } from '@pixi/display'; +import { ColorMatrixFilter } from '@pixi/filter-color-matrix'; +import { Rectangle } from '@pixi/math'; +import { Sprite } from '@pixi/sprite'; +import { AdvancedMap, AvatarAction, AvatarDirectionAngle, AvatarScaleType, AvatarSetType, IActionDefinition, IActiveActionData, IAdvancedMap, IAnimationLayerData, IAvatarDataContainer, IAvatarEffectListener, IAvatarFigureContainer, IAvatarImage, IGraphicAsset, IPartColor, ISpriteDataContainer } from '../../api'; +import { GetTickerTime, NitroContainer, NitroSprite, PaletteMapFilter, PixiApplicationProxy, TextureUtils } from '../../pixi-proxy'; +import { ActiveActionData } from './actions'; +import { AssetAliasCollection } from './alias'; +import { AvatarFigureContainer } from './AvatarFigureContainer'; +import { AvatarStructure } from './AvatarStructure'; +import { AvatarImageCache } from './cache'; +import { EffectAssetDownloadManager } from './EffectAssetDownloadManager'; + +export class AvatarImage implements IAvatarImage, IAvatarEffectListener +{ + private static CHANNELS_EQUAL: string = 'CHANNELS_EQUAL'; + private static CHANNELS_UNIQUE: string = 'CHANNELS_UNIQUE'; + private static CHANNELS_RED: string = 'CHANNELS_RED'; + private static CHANNELS_GREEN: string = 'CHANNELS_GREEN'; + private static CHANNELS_BLUE: string = 'CHANNELS_BLUE'; + private static CHANNELS_DESATURATED: string = 'CHANNELS_DESATURATED'; + private static DEFAULT_ACTION: string = 'Default'; + private static DEFAULT_DIRECTION: number = 2; + private static DEFAULT_AVATAR_SET: string = AvatarSetType.FULL; + + protected _structure: AvatarStructure; + protected _scale: string; + protected _mainDirection: number; + protected _headDirection: number; + protected _mainAction: IActiveActionData; + protected _disposed: boolean; + protected _canvasOffsets: number[]; + protected _assets: AssetAliasCollection; + protected _cache: AvatarImageCache; + protected _figure: AvatarFigureContainer; + protected _avatarSpriteData: IAvatarDataContainer; + protected _actions: ActiveActionData[]; + protected _image: RenderTexture; + protected _reusableTexture: RenderTexture; + + private _defaultAction: IActiveActionData; + private _frameCounter: number = 0; + private _directionOffset: number = 0; + private _changes: boolean; + private _sprites: ISpriteDataContainer[]; + private _isAnimating: boolean = false; + private _animationHasResetOnToggle: boolean = false; + private _actionsSorted: boolean = false; + private _sortedActions: IActiveActionData[]; + private _lastActionsString: string; + private _currentActionsString: string; + private _fullImageCache: IAdvancedMap; + private _fullImageCacheSize: number = 5; + protected _isCachedImage: boolean = false; + private _useFullImageCache: boolean = false; + private _effectIdInUse: number = -1; + private _animationFrameCount: number; + private _cachedBodyParts: string[]; + private _cachedBodyPartsDirection: number = -1; + private _cachedBodyPartsGeometryType: string = null; + private _cachedBodyPartsAvatarSet: string = null; + private _effectManager: EffectAssetDownloadManager; + private _effectListener: IAvatarEffectListener; + + constructor(k: AvatarStructure, _arg_2: AssetAliasCollection, _arg_3: AvatarFigureContainer, _arg_4: string, _arg_5: EffectAssetDownloadManager, _arg_6: IAvatarEffectListener = null) + { + this._canvasOffsets = []; + this._actions = []; + this._cachedBodyParts = []; + this._changes = true; + this._disposed = false; + this._effectManager = _arg_5; + this._structure = k; + this._assets = _arg_2; + this._scale = _arg_4; + this._effectListener = _arg_6; + if(this._scale == null) + { + this._scale = AvatarScaleType.LARGE; + } + if(_arg_3 == null) + { + _arg_3 = new AvatarFigureContainer('hr-893-45.hd-180-2.ch-210-66.lg-270-82.sh-300-91.wa-2007-.ri-1-'); + } + this._figure = _arg_3; + this._cache = new AvatarImageCache(this._structure, this, this._assets, this._scale); + this.setDirection(AvatarImage.DEFAULT_AVATAR_SET, AvatarImage.DEFAULT_DIRECTION); + this._actions = []; + this._defaultAction = new ActiveActionData(AvatarAction.POSTURE_STAND); + this._defaultAction.definition = this._structure.getActionDefinition(AvatarImage.DEFAULT_ACTION); + this.resetActions(); + this._fullImageCache = new AdvancedMap(); + this._animationFrameCount = 0; + } + + public getServerRenderData(): any[] + { + this.getAvatarPartsForCamera(AvatarSetType.FULL); + + return this._cache.getServerRenderData(); + } + + public dispose(): void + { + if(this._disposed) return; + + this._structure = null; + this._assets = null; + this._mainAction = null; + this._figure = null; + this._avatarSpriteData = null; + this._actions = null; + + if(this._image) + { + this._image.destroy(); + + this._image = null; + } + + if(this._cache) + { + this._cache.dispose(); + this._cache = null; + } + + if(this._fullImageCache) + { + for(const k of this._fullImageCache.getValues()) (k && k.destroy()); + + this._fullImageCache = null; + } + + this._image = null; + this._canvasOffsets = null; + this._disposed = true; + } + + public get disposed(): boolean + { + return this._disposed; + } + + public getFigure(): IAvatarFigureContainer + { + return this._figure; + } + + public getScale(): string + { + return this._scale; + } + + public getPartColor(k: string): IPartColor + { + return this._structure.getPartColor(this._figure, k); + } + + public setDirection(k: string, _arg_2: number): void + { + _arg_2 = (_arg_2 + this._directionOffset); + + if(_arg_2 < AvatarDirectionAngle.MIN_DIRECTION) + { + _arg_2 = (AvatarDirectionAngle.MAX_DIRECTION + (_arg_2 + 1)); + } + + if(_arg_2 > AvatarDirectionAngle.MAX_DIRECTION) + { + _arg_2 = (_arg_2 - (AvatarDirectionAngle.MAX_DIRECTION + 1)); + } + + if(this._structure.isMainAvatarSet(k)) + { + this._mainDirection = _arg_2; + } + + if((k === AvatarSetType.HEAD) || (k === AvatarSetType.FULL)) + { + if((k === AvatarSetType.HEAD) && (this.isHeadTurnPreventedByAction())) + { + _arg_2 = this._mainDirection; + } + + this._headDirection = _arg_2; + } + + this._cache.setDirection(k, _arg_2); + this._changes = true; + } + + public setDirectionAngle(k: string, _arg_2: number): void + { + this.setDirection(k, Math.floor(_arg_2 / 45)); + } + + public getSprites(): ISpriteDataContainer[] + { + return this._sprites; + } + + public getCanvasOffsets(): number[] + { + return this._canvasOffsets; + } + + public getLayerData(k: ISpriteDataContainer): IAnimationLayerData + { + return this._structure.getBodyPartData(k.animation.id, this._frameCounter, k.id); + } + + public updateAnimationByFrames(k: number = 1): void + { + this._frameCounter += k; + this._changes = true; + } + + public resetAnimationFrameCounter(): void + { + this._frameCounter = 0; + this._changes = true; + } + + private getFullImageCacheKey(): string + { + if(!this._useFullImageCache) return null; + + if(((this._sortedActions.length == 1) && (this._mainDirection == this._headDirection))) + { + return (this._mainDirection + this._currentActionsString) + (this._frameCounter % 4); + } + + if(this._sortedActions.length == 2) + { + for(const k of this._sortedActions) + { + if(((k.actionType == 'fx') && ((((k.actionParameter == '33') || (k.actionParameter == '34')) || (k.actionParameter == '35')) || (k.actionParameter == '36')))) + { + return (this._mainDirection + this._currentActionsString) + 0; + } + + if(((k.actionType == 'fx') && ((k.actionParameter == '38') || (k.actionParameter == '39')))) + { + return (((this._mainDirection + '_') + this._headDirection) + this._currentActionsString) + (this._frameCounter % 11); + } + + if((k.actionType === 'dance') && ((k.actionParameter === '1') || (k.actionParameter === '2') || (k.actionParameter === '3') || (k.actionParameter === '4'))) + { + let frame = (this._frameCounter % 8); + + if((k.actionParameter === '3')) frame = (this._frameCounter % 10); + + if((k.actionParameter === '4')) frame = (this._frameCounter % 16); + + return (((this._mainDirection + k.actionType) + k.actionParameter) + frame); + } + } + } + + return null; + } + + private getBodyParts(k: string, _arg_2: string, _arg_3: number): string[] + { + if((((!(_arg_3 == this._cachedBodyPartsDirection)) || (!(_arg_2 == this._cachedBodyPartsGeometryType))) || (!(k == this._cachedBodyPartsAvatarSet)))) + { + this._cachedBodyPartsDirection = _arg_3; + this._cachedBodyPartsGeometryType = _arg_2; + this._cachedBodyPartsAvatarSet = k; + this._cachedBodyParts = this._structure.getBodyParts(k, _arg_2, _arg_3); + } + return this._cachedBodyParts; + } + + public getAvatarPartsForCamera(k: string): void + { + let _local_4: string; + if(this._mainAction == null) + { + return; + } + const _local_2 = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType); + if(_local_2 == null) + { + return; + } + const _local_3 = this.getBodyParts(k, this._mainAction.definition.geometryType, this._mainDirection); + let _local_6 = (_local_3.length - 1); + while(_local_6 >= 0) + { + _local_4 = _local_3[_local_6]; + const _local_5 = this._cache.getImageContainer(_local_4, this._frameCounter, true); + _local_6--; + } + } + + public getImage(setType: string, hightlight: boolean, scale: number = 1, cache: boolean = true): RenderTexture + { + if(!this._changes) return this._image; + + if(!this._mainAction) return null; + + if(!this._actionsSorted) this.endActionAppends(); + + const avatarCanvas = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType); + + if(!avatarCanvas) return null; + + if(this._image && ((this._image.width !== avatarCanvas.width) || (this._image.height !== avatarCanvas.height))) + { + if(this._reusableTexture) + { + this._reusableTexture.destroy(true); + + this._reusableTexture = null; + } + + this._image = null; + this._isCachedImage = false; + } + + const _local_6 = this.getBodyParts(setType, this._mainAction.definition.geometryType, this._mainDirection); + + this._image = null; + + const container = new NitroContainer(); + + let isCachable = true; + let partCount = (_local_6.length - 1); + + while(partCount >= 0) + { + const set = _local_6[partCount]; + const part = this._cache.getImageContainer(set, this._frameCounter); + + if(part) + { + const partCacheContainer = part.image; + + if(!partCacheContainer) + { + container.destroy({ + children: true + }); + + return null; + } + + isCachable = ((isCachable) && (part.isCacheable)); + + const point = part.regPoint.clone(); + + if(point) + { + point.x += avatarCanvas.offset.x; + point.y += avatarCanvas.offset.y; + + point.x += avatarCanvas.regPoint.x; + point.y += avatarCanvas.regPoint.y; + + const partContainer = new NitroContainer(); + + partContainer.addChild(partCacheContainer); + + if(partContainer) + { + partContainer.position.set(point.x, point.y); + + container.addChild(partContainer); + } + } + } + + partCount--; + } + + if(this._avatarSpriteData) + { + if(!container.filters) container.filters = []; + + if(this._avatarSpriteData.colorTransform) container.filters.push(this._avatarSpriteData.colorTransform); + + if(this._avatarSpriteData.paletteIsGrayscale) + { + this.convertToGrayscale(container); + + container.filters.push(new PaletteMapFilter(this._avatarSpriteData.reds, PaletteMapFilter.CHANNEL_RED)); + } + } + + if(!cache) + { + return TextureUtils.generateTexture(container, new Rectangle(0, 0, avatarCanvas.width, avatarCanvas.height)); + } + + if(this._reusableTexture) + { + PixiApplicationProxy.instance.renderer.render(container, { + renderTexture: this._reusableTexture, + clear: true + }); + + //@ts-ignore + this._reusableTexture.baseTexture.hitMap = null; + } + else + { + this._reusableTexture = TextureUtils.generateTexture(container, new Rectangle(0, 0, avatarCanvas.width, avatarCanvas.height)); + } + + if(!this._reusableTexture) return null; + + /* + if(this._avatarSpriteData) + { + if(this._avatarSpriteData.paletteIsGrayscale) + { + this._reusableTexture = this.applyPalette(this._reusableTexture, this._avatarSpriteData.reds, [], []); + } + } + */ + + this._image = this._reusableTexture; + this._changes = false; + + return this._image; + } + + public applyPalette(texture: RenderTexture, reds: number[] = [], greens: number[] = [], blues: number[] = []): RenderTexture + { + const textureCanvas = TextureUtils.generateCanvas(texture); + const textureCtx = textureCanvas.getContext('2d'); + const textureImageData = textureCtx.getImageData(0, 0, textureCanvas.width, textureCanvas.height); + const data = textureImageData.data; + + for(let i = 0; i < data.length; i += 4) + { + if(reds.length == 256) + { + let paletteColor = reds[data[i]]; + if(paletteColor === undefined) paletteColor = 0; + + data[i] = ((paletteColor >> 16) & 0xFF); + data[i + 1] = ((paletteColor >> 8) & 0xFF); + data[i + 2] = (paletteColor & 0xFF); + } + + if(greens.length == 256) + { + let paletteColor = greens[data[i + 1]]; + if(paletteColor === undefined) paletteColor = 0; + + data[i] = ((paletteColor >> 16) & 0xFF); + data[i + 1] = ((paletteColor >> 8) & 0xFF); + data[i + 2] = (paletteColor & 0xFF); + } + if(blues.length == 256) + { + let paletteColor = greens[data[i + 2]]; + if(paletteColor === undefined) paletteColor = 0; + + data[i] = ((paletteColor >> 16) & 0xFF); + data[i + 1] = ((paletteColor >> 8) & 0xFF); + data[i + 2] = (paletteColor & 0xFF); + } + } + + textureCtx.putImageData(textureImageData, 0, 0); + + const newTexture = new Sprite(Texture.from(textureCanvas)); + + PixiApplicationProxy.instance.renderer.render(newTexture, { + renderTexture: texture, + clear: true + }); + + return texture; + } + + public getImageAsSprite(setType: string, scale: number = 1): Sprite + { + if(!this._mainAction) return null; + + if(!this._actionsSorted) this.endActionAppends(); + + const avatarCanvas = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType); + + if(!avatarCanvas) return null; + + const setTypes = this.getBodyParts(setType, this._mainAction.definition.geometryType, this._mainDirection); + const container = new NitroSprite(); + const sprite = new NitroSprite(Texture.EMPTY); + + sprite.width = avatarCanvas.width; + sprite.height = avatarCanvas.height; + + container.addChild(sprite); + + let partCount = (setTypes.length - 1); + + while(partCount >= 0) + { + const set = setTypes[partCount]; + const part = this._cache.getImageContainer(set, this._frameCounter); + + if(part) + { + const partCacheContainer = part.image; + + if(!partCacheContainer) + { + container.destroy({ + children: true + }); + + return null; + } + + const point = part.regPoint.clone(); + + if(point) + { + point.x += avatarCanvas.offset.x; + point.y += avatarCanvas.offset.y; + + point.x += avatarCanvas.regPoint.x; + point.y += avatarCanvas.regPoint.y; + + const partContainer = new NitroContainer(); + + partContainer.addChild(partCacheContainer); + + partContainer.position.set(point.x, point.y); + + container.addChild(partContainer); + } + } + + partCount--; + } + + return container; + } + + public getCroppedImage(setType: string, scale: number = 1): HTMLImageElement + { + if(!this._mainAction) return null; + + if(!this._actionsSorted) this.endActionAppends(); + + const avatarCanvas = this._structure.getCanvas(this._scale, this._mainAction.definition.geometryType); + + if(!avatarCanvas) return null; + + const setTypes = this.getBodyParts(setType, this._mainAction.definition.geometryType, this._mainDirection); + const container = new NitroContainer(); + + let partCount = (setTypes.length - 1); + + while(partCount >= 0) + { + const set = setTypes[partCount]; + const part = this._cache.getImageContainer(set, this._frameCounter); + + if(part) + { + const partCacheContainer = part.image; + + if(!partCacheContainer) + { + container.destroy({ + children: true + }); + + return null; + } + + const point = part.regPoint.clone(); + + if(point) + { + point.x += avatarCanvas.offset.x; + point.y += avatarCanvas.offset.y; + + point.x += avatarCanvas.regPoint.x; + point.y += avatarCanvas.regPoint.y; + + const partContainer = new NitroContainer(); + + partContainer.addChild(partCacheContainer); + + if(partContainer) + { + partContainer.position.set(point.x, point.y); + + container.addChild(partContainer); + } + } + } + + partCount--; + } + + const texture = TextureUtils.generateTexture(container, new Rectangle(0, 0, avatarCanvas.width, avatarCanvas.height)); + + const image = TextureUtils.generateImage(texture); + + if(!image) return null; + + return image; + } + + protected getFullImage(k: string): RenderTexture + { + const existing = this._fullImageCache.getValue(k); + + if(existing) + { + if(!existing.valid) + { + this._fullImageCache.remove(k); + + existing.destroy(true); + } + + return existing; + } + + return null; + } + + protected cacheFullImage(k: string, _arg_2: RenderTexture): void + { + const existing = this._fullImageCache.getValue(k); + + if(existing) + { + this._fullImageCache.remove(k); + + existing.destroy(true); + } + + if(this._fullImageCache.length === this._fullImageCacheSize) + { + const oldestKey = this._fullImageCache.getKey(0); + + if(oldestKey) + { + const removed = this._fullImageCache.remove(oldestKey); + + removed.destroy(true); + } + } + + this._fullImageCache.add(k, _arg_2); + } + + public getAsset(k: string): IGraphicAsset + { + return this._assets.getAsset(k); + } + + public getDirection(): number + { + return this._mainDirection; + } + + public initActionAppends(): void + { + this._actions = []; + this._actionsSorted = false; + this._currentActionsString = ''; + this._useFullImageCache = false; + } + + public endActionAppends(): void + { + let k: ActiveActionData; + + if(!this.sortActions()) return; + + for(const k of this._sortedActions) + { + if(k.actionType === AvatarAction.EFFECT) + { + if(!this._effectManager.isAvatarEffectReady(parseInt(k.actionParameter))) this._effectManager.downloadAvatarEffect(parseInt(k.actionParameter), this); + } + } + + this.resetActions(); + this.setActionsToParts(); + } + + public appendAction(k: string, ..._args: any[]): boolean + { + let _local_3 = ''; + + this._actionsSorted = false; + + if(_args && (_args.length > 0)) _local_3 = _args[0]; + + if((_local_3 !== undefined) && (_local_3 !== null)) _local_3 = _local_3.toString(); + + switch(k) + { + case AvatarAction.POSTURE: + switch(_local_3) + { + case AvatarAction.POSTURE_LAY: + case AvatarAction.POSTURE_WALK: + case AvatarAction.POSTURE_STAND: + case AvatarAction.POSTURE_SWIM: + case AvatarAction.POSTURE_FLOAT: + case AvatarAction.POSTURE_SIT: + case AvatarAction.SNOWWAR_RUN: + case AvatarAction.SNOWWAR_DIE_FRONT: + case AvatarAction.SNOWWAR_DIE_BACK: + case AvatarAction.SNOWWAR_PICK: + case AvatarAction.SNOWWAR_THROW: + if((_local_3 === AvatarAction.POSTURE_LAY) || (_local_3 === AvatarAction.POSTURE_LAY) || (_local_3 === AvatarAction.POSTURE_LAY)) + { + if(_local_3 === AvatarAction.POSTURE_LAY) + { + if(this._mainDirection == 0) + { + this.setDirection(AvatarSetType.FULL, 4); + } + else + { + this.setDirection(AvatarSetType.FULL, 2); + } + } + + this._useFullImageCache = true; + this._useFullImageCache = true; + } + + this.addActionData(_local_3); + break; + } + break; + case AvatarAction.GESTURE: + switch(_local_3) + { + case AvatarAction.GESTURE_AGGRAVATED: + case AvatarAction.GESTURE_SAD: + case AvatarAction.GESTURE_SMILE: + case AvatarAction.GESTURE_SURPRISED: + this.addActionData(_local_3); + break; + } + break; + case AvatarAction.EFFECT: + case AvatarAction.DANCE: + case AvatarAction.TALK: + case AvatarAction.EXPRESSION_WAVE: + case AvatarAction.SLEEP: + case AvatarAction.SIGN: + case AvatarAction.EXPRESSION_RESPECT: + case AvatarAction.EXPRESSION_BLOW_A_KISS: + case AvatarAction.EXPRESSION_LAUGH: + case AvatarAction.EXPRESSION_CRY: + case AvatarAction.EXPRESSION_IDLE: + case AvatarAction.EXPRESSION_SNOWBOARD_OLLIE: + case AvatarAction.EXPRESSION_SNOWBORD_360: + case AvatarAction.EXPRESSION_RIDE_JUMP: + if(_local_3 === AvatarAction.EFFECT) + { + if((((((_local_3 === '33') || (_local_3 === '34')) || (_local_3 === '35')) || (_local_3 === '36')) || (_local_3 === '38')) || (_local_3 === '39')) + { + this._useFullImageCache = true; + } + } + + this.addActionData(k, _local_3); + break; + case AvatarAction.CARRY_OBJECT: + case AvatarAction.USE_OBJECT: { + const _local_4 = this._structure.getActionDefinitionWithState(k); + if(_local_4) _local_3 = _local_4.getParameterValue(_local_3); + this.addActionData(k, _local_3); + break; + } + } + + return true; + } + + protected addActionData(k: string, _arg_2: string = ''): void + { + let _local_3: ActiveActionData; + if(!this._actions) this._actions = []; + + let _local_4 = 0; + while(_local_4 < this._actions.length) + { + _local_3 = this._actions[_local_4]; + if(((_local_3.actionType == k) && (_local_3.actionParameter == _arg_2))) + { + return; + } + _local_4++; + } + this._actions.push(new ActiveActionData(k, _arg_2, this._frameCounter)); + } + + public isAnimating(): boolean + { + return (this._isAnimating) || (this._animationFrameCount > 1); + } + + private resetActions(): boolean + { + this._animationHasResetOnToggle = false; + this._isAnimating = false; + this._sprites = []; + this._avatarSpriteData = null; + this._directionOffset = 0; + this._structure.removeDynamicItems(this); + this._mainAction = this._defaultAction; + this._mainAction.definition = this._defaultAction.definition; + this.resetBodyPartCache(this._defaultAction); + return true; + } + + private isHeadTurnPreventedByAction(): boolean + { + let _local_2: IActionDefinition; + let _local_3: ActiveActionData; + let k: boolean; + if(this._sortedActions == null) + { + return false; + } + for(const _local_3 of this._sortedActions) + { + _local_2 = this._structure.getActionDefinitionWithState(_local_3.actionType); + if(((!(_local_2 == null)) && (_local_2.getPreventHeadTurn(_local_3.actionParameter)))) + { + k = true; + } + } + return k; + } + + private sortActions(): boolean + { + let _local_2: boolean; + let _local_3: boolean; + let _local_4: ActiveActionData; + let _local_5: number; + let k: boolean; + + this._currentActionsString = ''; + this._sortedActions = this._structure.sortActions(this._actions); + this._animationFrameCount = this._structure.maxFrames(this._sortedActions); + + if(!this._sortedActions) + { + this._canvasOffsets = [0, 0, 0]; + + if(this._lastActionsString !== '') + { + k = true; + + this._lastActionsString = ''; + } + } + else + { + this._canvasOffsets = this._structure.getCanvasOffsets(this._sortedActions, this._scale, this._mainDirection); + + for(const _local_4 of this._sortedActions) + { + this._currentActionsString = (this._currentActionsString + (_local_4.actionType + _local_4.actionParameter)); + + if(_local_4.actionType === AvatarAction.EFFECT) + { + const _local_5 = parseInt(_local_4.actionParameter); + + if(this._effectIdInUse !== _local_5) _local_2 = true; + + this._effectIdInUse = _local_5; + + _local_3 = true; + } + } + + if(!_local_3) + { + if(this._effectIdInUse > -1) _local_2 = true; + + this._effectIdInUse = -1; + } + + if(_local_2) this._cache.disposeInactiveActions(0); + + if(this._lastActionsString != this._currentActionsString) + { + k = true; + + this._lastActionsString = this._currentActionsString; + } + } + + this._actionsSorted = true; + + return k; + } + + private setActionsToParts(): void + { + if(!this._sortedActions == null) return; + + const _local_3: number = GetTickerTime(); + const _local_4: string[] = []; + + for(const k of this._sortedActions) _local_4.push(k.actionType); + + for(const k of this._sortedActions) + { + if((k && k.definition) && k.definition.isAnimation) + { + const _local_2 = this._structure.getAnimation(((k.definition.state + '.') + k.actionParameter)); + + if(_local_2 && _local_2.hasOverriddenActions()) + { + const _local_5 = _local_2.overriddenActionNames(); + + if(_local_5) + { + for(const _local_6 of _local_5) + { + if(_local_4.indexOf(_local_6) >= 0) k.overridingAction = _local_2.overridingAction(_local_6); + } + } + } + + if(_local_2 && _local_2.resetOnToggle) + { + this._animationHasResetOnToggle = true; + } + } + } + + for(const k of this._sortedActions) + { + if(!((!(k)) || (!(k.definition)))) + { + if(k.definition.isAnimation && (k.actionParameter === '')) k.actionParameter = '1'; + + this.setActionToParts(k, _local_3); + + if(k.definition.isAnimation) + { + this._isAnimating = k.definition.isAnimated(k.actionParameter); + + const _local_2 = this._structure.getAnimation(((k.definition.state + '.') + k.actionParameter)); + + if(_local_2) + { + this._sprites = this._sprites.concat(_local_2.spriteData); + + if(_local_2.hasDirectionData()) this._directionOffset = _local_2.directionData.offset; + + if(_local_2.hasAvatarData()) this._avatarSpriteData = _local_2.avatarData; + } + } + } + } + } + + private setActionToParts(k: IActiveActionData, _arg_2: number): void + { + if(((k == null) || (k.definition == null))) + { + return; + } + if(k.definition.assetPartDefinition == '') + { + return; + } + if(k.definition.isMain) + { + this._mainAction = k; + this._cache.setGeometryType(k.definition.geometryType); + } + this._cache.setAction(k, _arg_2); + this._changes = true; + } + + private resetBodyPartCache(k: IActiveActionData): void + { + if(!k) return; + + if(k.definition.assetPartDefinition === '') return; + + if(k.definition.isMain) + { + this._mainAction = k; + this._cache.setGeometryType(k.definition.geometryType); + } + + this._cache.resetBodyPartCache(k); + this._changes = true; + } + + public get avatarSpriteData(): IAvatarDataContainer + { + return this._avatarSpriteData; + } + + private convertToGrayscale(container: Container, channel: string = 'CHANNELS_EQUAL'): Container + { + let _local_3 = 0.33; + let _local_4 = 0.33; + let _local_5 = 0.33; + const _local_6 = 1; + + switch(channel) + { + case AvatarImage.CHANNELS_UNIQUE: + _local_3 = 0.3; + _local_4 = 0.59; + _local_5 = 0.11; + break; + case AvatarImage.CHANNELS_RED: + _local_3 = 1; + _local_4 = 0; + _local_5 = 0; + break; + case AvatarImage.CHANNELS_GREEN: + _local_3 = 0; + _local_4 = 1; + _local_5 = 0; + break; + case AvatarImage.CHANNELS_BLUE: + _local_3 = 0; + _local_4 = 0; + _local_5 = 1; + break; + case AvatarImage.CHANNELS_DESATURATED: + _local_3 = 0.3086; + _local_4 = 0.6094; + _local_5 = 0.082; + break; + } + + const colorFilter = new ColorMatrixFilter(); + + colorFilter.matrix = [_local_3, _local_4, _local_5, 0, 0, _local_3, _local_4, _local_5, 0, 0, _local_3, _local_4, _local_5, 0, 0, 0, 0, 0, 1, 0]; + + container.filters.push(colorFilter); + + return container; + } + + private errorThis(k: string): void + { + } + + private logThis(k: string): void + { + } + + public isPlaceholder(): boolean + { + return false; + } + + public forceActionUpdate(): void + { + this._lastActionsString = ''; + } + + public get animationHasResetOnToggle(): boolean + { + return this._animationHasResetOnToggle; + } + + public get mainAction(): string + { + return this._mainAction.actionType; + } + + public resetEffect(effect: number): void + { + if(effect === this._effectIdInUse) + { + this.resetActions(); + this.setActionsToParts(); + + this._animationHasResetOnToggle = true; + this._changes = true; + + if(this._effectListener) this._effectListener.resetEffect(effect); + } + } +} diff --git a/submodules/renderer/src/nitro/avatar/AvatarImageBodyPartContainer.ts b/submodules/renderer/src/nitro/avatar/AvatarImageBodyPartContainer.ts new file mode 100644 index 0000000..6ef966f --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/AvatarImageBodyPartContainer.ts @@ -0,0 +1,89 @@ +import { Container } from '@pixi/display'; +import { Point } from '@pixi/math'; + +export class AvatarImageBodyPartContainer +{ + private _image: Container; + private _regPoint: Point; + private _offset: Point; + private _isCacheable: boolean; + + constructor(k: Container, _arg_2: Point, _arg_3: boolean) + { + this._image = k; + this._regPoint = _arg_2; + this._offset = new Point(0, 0); + this._regPoint = _arg_2; + this._isCacheable = _arg_3; + + this.cleanPoints(); + } + + public dispose(): void + { + if(this._image) + { + this._image.destroy({ + children: true + }); + } + + this._image = null; + this._regPoint = null; + this._offset = null; + } + + private cleanPoints(): void + { + // this._regPoint.x = this._regPoint.x; + // this._regPoint.y = this._regPoint.y; + // this._offset.x = this._offset.x; + // this._offset.y = this._offset.y; + } + + public setRegPoint(k: Point): void + { + this._regPoint = k; + + this.cleanPoints(); + } + + public get image(): Container + { + return this._image; + } + + public set image(k: Container) + { + if(this._image && (this._image !== k)) + { + this._image.destroy({ + children: true + }); + } + + this._image = k; + } + + public get regPoint(): Point + { + const clone = this._regPoint.clone(); + + clone.x += this._offset.x; + clone.y += this._offset.y; + + return clone; + } + + public set offset(k: Point) + { + this._offset = k; + + this.cleanPoints(); + } + + public get isCacheable(): boolean + { + return this._isCacheable; + } +} diff --git a/submodules/renderer/src/nitro/avatar/AvatarImagePartContainer.ts b/submodules/renderer/src/nitro/avatar/AvatarImagePartContainer.ts new file mode 100644 index 0000000..a632ab7 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/AvatarImagePartContainer.ts @@ -0,0 +1,136 @@ +import { IActionDefinition, IPartColor } from '../../api'; +import { AdjustmentFilter } from '../../pixi-proxy'; +import { AvatarAnimationFrame } from './structure'; + +export class AvatarImagePartContainer +{ + private _bodyPartId: string; + private _partType: string; + private _flippedPartType: string; + private _partId: string; + private _color: IPartColor; + private _frames: AvatarAnimationFrame[]; + private _action: IActionDefinition; + private _isColorable: boolean; + private _isBlendable: boolean; + private _blendTransform: AdjustmentFilter; + private _paletteMapId: number; + + constructor(bodyPartId: string, partType: string, partId: string, partColor: IPartColor, frames: AvatarAnimationFrame[], action: IActionDefinition, isColorable: boolean, paletteMapId: number, flippedPartType: string = '', isBlendable: boolean = false, _arg_11: number = 1) + { + this._bodyPartId = bodyPartId; + this._partType = partType; + this._partId = partId; + this._color = partColor; + this._frames = frames; + this._action = action; + this._isColorable = isColorable; + this._paletteMapId = paletteMapId; + this._flippedPartType = flippedPartType; + this._isBlendable = isBlendable; + this._blendTransform = null; + + if(this._partType === 'ey') this._isColorable = false; + } + + public getFrameIndex(k: number): number + { + if(!this._frames || !this._frames.length) return 0; + + const frameNumber = (k % this._frames.length); + + if(this._frames[frameNumber] instanceof AvatarAnimationFrame) + { + return this._frames[frameNumber].number; + } + + return frameNumber; + } + + public getFrameDefinition(k: number): AvatarAnimationFrame + { + const frameNumber = (k % this._frames.length); + + if(this._frames && (this._frames.length > frameNumber)) + { + if(this._frames[frameNumber] instanceof AvatarAnimationFrame) + { + return this._frames[frameNumber]; + } + } + + return null; + } + + public getCacheableKey(k: number): string + { + const frameNumber = (k % this._frames.length); + + if(this._frames && (this._frames.length > frameNumber)) + { + if(this._frames[frameNumber] instanceof AvatarAnimationFrame) + { + const frame = this._frames[frameNumber]; + + return (this.partId + ':' + frame.assetPartDefinition + ':' + frame.number); + } + } + + return (this.partId + ':' + frameNumber); + } + + public get bodyPartId(): string + { + return this._bodyPartId; + } + + public get partType(): string + { + return this._partType; + } + + public get partId(): string + { + return this._partId; + } + + public get color(): IPartColor + { + return this._color; + } + + public get action(): IActionDefinition + { + return this._action; + } + + public get isColorable(): boolean + { + return this._isColorable; + } + + public set isColorable(k: boolean) + { + this._isColorable = k; + } + + public get paletteMapId(): number + { + return this._paletteMapId; + } + + public get flippedPartType(): string + { + return this._flippedPartType; + } + + public get isBlendable(): boolean + { + return this._isBlendable; + } + + public toString(): string + { + return [this._bodyPartId, this._partType, this._partId].join(':'); + } +} diff --git a/submodules/renderer/src/nitro/avatar/AvatarRenderManager.ts b/submodules/renderer/src/nitro/avatar/AvatarRenderManager.ts new file mode 100644 index 0000000..8249966 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/AvatarRenderManager.ts @@ -0,0 +1,468 @@ +import { AvatarSetType, GetAssetManager, IAssetManager, IAvatarEffectListener, IAvatarFigureContainer, IAvatarImage, IAvatarImageListener, IAvatarRenderManager, IFigureData, IFigurePartSet, IFigureSetData, IGraphicAsset, INitroEvent, IStructureData, NitroConfiguration, NitroLogger } from '../../api'; +import { NitroManager } from '../../core'; +import { AvatarRenderEvent, NitroEvent } from '../../events'; +import { FigureDataContainer } from '../utils'; +import { AssetAliasCollection } from './alias'; +import { AvatarAssetDownloadManager } from './AvatarAssetDownloadManager'; +import { AvatarFigureContainer } from './AvatarFigureContainer'; +import { AvatarImage } from './AvatarImage'; +import { AvatarStructure } from './AvatarStructure'; +import { HabboAvatarAnimations } from './data/HabboAvatarAnimations'; +import { HabboAvatarGeometry } from './data/HabboAvatarGeometry'; +import { HabboAvatarPartSets } from './data/HabboAvatarPartSets'; +import { EffectAssetDownloadManager } from './EffectAssetDownloadManager'; +import { PlaceHolderAvatarImage } from './PlaceHolderAvatarImage'; +import { AvatarStructureDownload } from './structure'; + +export class AvatarRenderManager extends NitroManager implements IAvatarRenderManager +{ + private static DEFAULT_FIGURE: string = 'hd-99999-99999'; + + private _aliasCollection: AssetAliasCollection; + + private _structure: AvatarStructure; + private _avatarAssetDownloadManager: AvatarAssetDownloadManager; + private _effectAssetDownloadManager: EffectAssetDownloadManager; + + private _placeHolderFigure: AvatarFigureContainer; + + private _figureMapReady: boolean; + private _effectMapReady: boolean; + private _actionsReady: boolean; + private _structureReady: boolean; + private _geometryReady: boolean; + private _partSetsReady: boolean; + private _animationsReady: boolean; + private _isReady: boolean; + + constructor() + { + super(); + + this._structure = null; + this._avatarAssetDownloadManager = null; + + this._placeHolderFigure = null; + + this._figureMapReady = false; + this._effectMapReady = false; + this._actionsReady = false; + this._geometryReady = false; + this._partSetsReady = false; + this._animationsReady = false; + this._isReady = false; + + this.onAvatarAssetDownloaderReady = this.onAvatarAssetDownloaderReady.bind(this); + this.onAvatarAssetDownloaded = this.onAvatarAssetDownloaded.bind(this); + this.onEffectAssetDownloaderReady = this.onEffectAssetDownloaderReady.bind(this); + this.onEffectAssetDownloaded = this.onEffectAssetDownloaded.bind(this); + this.onAvatarStructureDownloadDone = this.onAvatarStructureDownloadDone.bind(this); + } + + public onInit(): void + { + this._structure = new AvatarStructure(this); + + this.loadGeometry(); + this.loadPartSets(); + this.loadActions(); + this.loadAnimations(); + this.loadFigureData(); + + this._aliasCollection = new AssetAliasCollection(this, GetAssetManager()); + + this._aliasCollection.init(); + + if(!this._avatarAssetDownloadManager) + { + this._avatarAssetDownloadManager = new AvatarAssetDownloadManager(GetAssetManager(), this._structure); + + this._avatarAssetDownloadManager.addEventListener(AvatarAssetDownloadManager.DOWNLOADER_READY, this.onAvatarAssetDownloaderReady); + this._avatarAssetDownloadManager.addEventListener(AvatarAssetDownloadManager.LIBRARY_LOADED, this.onAvatarAssetDownloaded); + } + + if(!this._effectAssetDownloadManager) + { + this._effectAssetDownloadManager = new EffectAssetDownloadManager(GetAssetManager(), this._structure); + + this._effectAssetDownloadManager.addEventListener(EffectAssetDownloadManager.DOWNLOADER_READY, this.onEffectAssetDownloaderReady); + this._effectAssetDownloadManager.addEventListener(EffectAssetDownloadManager.LIBRARY_LOADED, this.onEffectAssetDownloaded); + } + + this.checkReady(); + } + + public onDispose(): void + { + if(this._avatarAssetDownloadManager) + { + this._avatarAssetDownloadManager.removeEventListener(AvatarAssetDownloadManager.DOWNLOADER_READY, this.onAvatarAssetDownloaderReady); + + this._avatarAssetDownloadManager.removeEventListener(AvatarAssetDownloadManager.LIBRARY_LOADED, this.onAvatarAssetDownloaded); + } + + if(this._effectAssetDownloadManager) + { + this._effectAssetDownloadManager.removeEventListener(EffectAssetDownloadManager.DOWNLOADER_READY, this.onEffectAssetDownloaderReady); + + this._effectAssetDownloadManager.removeEventListener(EffectAssetDownloadManager.LIBRARY_LOADED, this.onEffectAssetDownloaded); + } + } + + private loadGeometry(): void + { + if(!this._structure) return; + + this._structure.initGeometry(HabboAvatarGeometry.geometry); + + this._geometryReady = true; + + this.checkReady(); + } + + private loadPartSets(): void + { + if(!this._structure) return; + + this._structure.initPartSets(HabboAvatarPartSets.partSets); + + this._partSetsReady = true; + + this.checkReady(); + } + + private loadActions(): void + { + const defaultActions = NitroConfiguration.getValue('avatar.default.actions'); + + if(defaultActions) this._structure.initActions(GetAssetManager(), defaultActions); + + const request = new XMLHttpRequest(); + + try + { + request.open('GET', NitroConfiguration.getValue('avatar.actions.url')); + + request.send(); + + request.onloadend = e => + { + if(!this._structure) return; + + this._structure.updateActions(JSON.parse(request.responseText)); + + this._actionsReady = true; + + this.checkReady(); + }; + + request.onerror = e => + { + throw new Error('invalid_avatar_actions'); + }; + } + + catch (e) + { + NitroLogger.error(e); + } + } + + private loadAnimations(): void + { + if(!this._structure) return; + + this._structure.initAnimation(HabboAvatarAnimations.animations); + + this._animationsReady = true; + + this.checkReady(); + } + + private loadFigureData(): void + { + const defaultFigureData = NitroConfiguration.getValue('avatar.default.figuredata'); + + if(!defaultFigureData || (typeof defaultFigureData === 'string')) + { + NitroLogger.error('XML figuredata is no longer supported'); + + return; + } + + if(this._structure) this._structure.initFigureData(defaultFigureData); + + const structureDownloader = new AvatarStructureDownload(NitroConfiguration.getValue('avatar.figuredata.url'), (this._structure.figureData as IFigureSetData)); + + structureDownloader.addEventListener(AvatarStructureDownload.AVATAR_STRUCTURE_DONE, this.onAvatarStructureDownloadDone); + } + + private onAvatarStructureDownloadDone(event: INitroEvent): void + { + this._structureReady = true; + + this._structure.init(); + + this.checkReady(); + } + + private onAvatarAssetDownloaderReady(event: INitroEvent): void + { + if(!event) return; + + this._figureMapReady = true; + + this.checkReady(); + } + + private onAvatarAssetDownloaded(event: INitroEvent): void + { + if(!event) return; + + this._aliasCollection.reset(); + } + + private onEffectAssetDownloaderReady(event: INitroEvent): void + { + if(!event) return; + + this._effectMapReady = true; + + this.checkReady(); + } + + private onEffectAssetDownloaded(event: INitroEvent): void + { + if(!event) return; + + this._aliasCollection.reset(); + } + + private checkReady(): void + { + if(this._isReady) return; + + if(!this._geometryReady || !this._partSetsReady || !this._actionsReady || !this._animationsReady || !this._figureMapReady || !this._effectMapReady || !this._structureReady) return; + + this._isReady = true; + + if(this.events) this.events.dispatchEvent(new NitroEvent(AvatarRenderEvent.AVATAR_RENDER_READY)); + } + + public createFigureContainer(figure: string): IAvatarFigureContainer + { + return new AvatarFigureContainer(figure); + } + + public isFigureContainerReady(container: IAvatarFigureContainer): boolean + { + if(!this._avatarAssetDownloadManager) return false; + + return this._avatarAssetDownloadManager.isAvatarFigureContainerReady(container); + } + + public createAvatarImage(figure: string, size: string, gender: string, listener: IAvatarImageListener = null, effectListener: IAvatarEffectListener = null): IAvatarImage + { + if(!this._structure || !this._avatarAssetDownloadManager) return null; + + const figureContainer = new AvatarFigureContainer(figure); + + if(gender) this.validateAvatarFigure(figureContainer, gender); + + if(this._avatarAssetDownloadManager.isAvatarFigureContainerReady(figureContainer)) + { + return new AvatarImage(this._structure, this._aliasCollection, figureContainer, size, this._effectAssetDownloadManager, effectListener); + } + + if(!this._placeHolderFigure) this._placeHolderFigure = new AvatarFigureContainer(AvatarRenderManager.DEFAULT_FIGURE); + + this._avatarAssetDownloadManager.downloadAvatarFigure(figureContainer, listener); + + return new PlaceHolderAvatarImage(this._structure, this._aliasCollection, this._placeHolderFigure, size, this._effectAssetDownloadManager); + } + + public downloadAvatarFigure(container: IAvatarFigureContainer, listener: IAvatarImageListener): void + { + if(!this._avatarAssetDownloadManager) return; + + this._avatarAssetDownloadManager.downloadAvatarFigure(container, listener); + } + + private validateAvatarFigure(container: AvatarFigureContainer, gender: string): boolean + { + let isValid = false; + + const typeIds = this._structure.getMandatorySetTypeIds(gender, 2); + + if(typeIds) + { + const figureData = this._structure.figureData; + + for(const id of typeIds) + { + if(!container.hasPartType(id)) + { + const figurePartSet = this._structure.getDefaultPartSet(id, gender); + + if(figurePartSet) + { + container.updatePart(id, figurePartSet.id, [0]); + + isValid = true; + } + } + else + { + const setType = figureData.getSetType(id); + + if(setType) + { + const figurePartSet = setType.getPartSet(container.getPartSetId(id)); + + if(!figurePartSet) + { + const partSet = this._structure.getDefaultPartSet(id, gender); + + if(partSet) + { + container.updatePart(id, partSet.id, [0]); + + isValid = true; + } + } + } + } + } + } + + return !(isValid); + } + + public getFigureClubLevel(container: IAvatarFigureContainer, gender: string, searchParts: string[] = null): number + { + if(!this._structure) return 0; + + const figureData = this._structure.figureData; + const parts = Array.from(container.getPartTypeIds()); + + let clubLevel = 0; + + for(const part of parts) + { + const set = figureData.getSetType(part); + + if(!set) continue; + + const setId = container.getPartSetId(part); + const partSet = set.getPartSet(setId); + + if(partSet) + { + clubLevel = Math.max(partSet.clubLevel, clubLevel); + + const palette = figureData.getPalette(set.paletteID); + const colors = container.getPartColorIds(part); + + for(const colorId of colors) + { + const color = palette.getColor(colorId); + + if(!color) continue; + + clubLevel = Math.max(color.clubLevel, clubLevel); + } + } + } + + if(!searchParts) searchParts = this._structure.getBodyPartsUnordered(AvatarSetType.FULL); + + for(const part of searchParts) + { + const set = figureData.getSetType(part); + + if(!set) continue; + + if(parts.indexOf(part) === -1) clubLevel = Math.max(set.optionalFromClubLevel(gender), clubLevel); + } + + return clubLevel; + } + + public isValidFigureSetForGender(setId: number, gender: string): boolean + { + const structure = this.structureData; + const partSet = structure.getFigurePartSet(setId); + + return !!(partSet && ((partSet.gender.toUpperCase() === 'U') || (partSet.gender.toUpperCase() === gender.toUpperCase()))); + } + + public getFigureStringWithFigureIds(figure: string, gender: string, _arg_3: number[]): string + { + const container = new FigureDataContainer(); + + container.loadAvatarData(figure, gender); + + const partSets: IFigurePartSet[] = this.resolveFigureSets(_arg_3); + + for(const partSet of partSets) + { + container.savePartData(partSet.type, partSet.id, container.getColourIds(partSet.type)); + } + + return container.getFigureString(); + } + + private resolveFigureSets(setIds: number[]): IFigurePartSet[] + { + const structure = this.structureData; + const partSets: IFigurePartSet[] = []; + + for(const setId of setIds) + { + const partSet = structure.getFigurePartSet(setId); + + if(partSet) partSets.push(partSet); + } + + return partSets; + } + + public getMandatoryAvatarPartSetIds(k: string, _arg_2: number): string[] + { + if(!this._structure) return null; + + return this._structure.getMandatorySetTypeIds(k, _arg_2); + } + + public getAssetByName(name: string): IGraphicAsset + { + return this._aliasCollection.getAsset(name); + } + + public get assets(): IAssetManager + { + return GetAssetManager(); + } + + public get isReady(): boolean + { + return this._isReady; + } + + public get structure(): AvatarStructure + { + return this._structure; + } + + public get structureData(): IStructureData + { + if(this._structure) return this._structure.figureData; + + return null; + } + + public get downloadManager(): AvatarAssetDownloadManager + { + return this._avatarAssetDownloadManager; + } +} diff --git a/submodules/renderer/src/nitro/avatar/AvatarStructure.ts b/submodules/renderer/src/nitro/avatar/AvatarStructure.ts new file mode 100644 index 0000000..4d8d0eb --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/AvatarStructure.ts @@ -0,0 +1,635 @@ +import { Point } from '@pixi/math'; +import { AvatarDirectionAngle, IActionDefinition, IActiveActionData, IAssetAnimation, IAssetManager, IAvatarFigureContainer, IAvatarImage, IAvatarRenderManager, IFigureData, IFigurePartSet, IPartColor, IStructureData } from '../../api'; +import { EventDispatcher } from '../../core'; +import { ActionDefinition, AvatarActionManager } from './actions'; +import { Animation, AnimationManager, AvatarAnimationLayerData } from './animation'; +import { AvatarImagePartContainer } from './AvatarImagePartContainer'; +import { AvatarRenderManager } from './AvatarRenderManager'; +import { AvatarModelGeometry } from './geometry'; +import { AnimationAction, AvatarAnimationData, AvatarAnimationFrame, AvatarCanvas, FigureSetData, PartSetsData } from './structure'; + +export class AvatarStructure extends EventDispatcher +{ + private _renderManager: AvatarRenderManager; + private _geometry: AvatarModelGeometry; + private _figureData: FigureSetData; + private _partSetsData: PartSetsData; + private _animationData: AvatarAnimationData; + private _animationManager: AnimationManager; + private _mandatorySetTypeIds: { [index: string]: { [index: number]: string[] } }; + private _actionManager: AvatarActionManager; + private _defaultAction: IActionDefinition; + + constructor(renderManager: AvatarRenderManager) + { + super(); + + this._renderManager = renderManager; + this._geometry = null; + this._figureData = new FigureSetData(); + this._partSetsData = new PartSetsData(); + this._animationData = new AvatarAnimationData(); + this._animationManager = new AnimationManager(); + this._mandatorySetTypeIds = {}; + this._actionManager = null; + this._defaultAction = null; + } + + public init(): void + { + + } + + public dispose(): void + { + if(this.disposed) return; + + super.dispose(); + + this._renderManager = null; + this._figureData = null; + this._partSetsData = null; + this._animationData = null; + this._mandatorySetTypeIds = null; + } + + public initGeometry(k: any): void + { + if(!k) return; + + this._geometry = new AvatarModelGeometry(k); + } + + public initActions(k: IAssetManager, _arg_2: any): void + { + if(!_arg_2) return; + + this._actionManager = new AvatarActionManager(k, _arg_2); + this._defaultAction = this._actionManager.getDefaultAction(); + } + + public updateActions(data: any): void + { + this._actionManager.updateActions(data); + + this._defaultAction = this._actionManager.getDefaultAction(); + } + + public initPartSets(k: any): boolean + { + if(!k) return false; + + if(this._partSetsData.parse(k)) + { + this._partSetsData.getPartDefinition('ri').appendToFigure = true; + this._partSetsData.getPartDefinition('li').appendToFigure = true; + + return true; + } + + return false; + } + + public initAnimation(k: any): boolean + { + if(!k) return false; + + return this._animationData.parse(k); + } + + public initFigureData(k: IFigureData): boolean + { + if(!k) return false; + + return this._figureData.parse(k); + } + + public injectFigureData(data: IFigureData): void + { + this._figureData.injectJSON(data); + } + + public registerAnimations(k: IAssetManager, _arg_2: string = 'fx', _arg_3: number = 200): void + { + let index = 0; + + while(index < _arg_3) + { + const collection = k.getCollection((_arg_2 + index)); + + if(collection) + { + const animationData = collection.data; + + this._animationManager.registerAnimation(this, animationData.animations); + } + + index++; + } + } + + public registerAnimation(data: { [index: string]: IAssetAnimation }): void + { + this._animationManager.registerAnimation(this, data); + } + + public getPartColor(k: IAvatarFigureContainer, _arg_2: string, _arg_3: number = 0): IPartColor + { + const _local_4 = k.getPartColorIds(_arg_2); + + if((!(_local_4)) || (_local_4.length < _arg_3)) return null; + + const _local_5 = this._figureData.getSetType(_arg_2); + + if(_local_5 == null) return null; + + const _local_6 = this._figureData.getPalette(_local_5.paletteID); + + if(!_local_6) return null; + + return _local_6.getColor(_local_4[_arg_3]); + } + + public getBodyPartData(animation: string, frameCount: number, spriteId: string): AvatarAnimationLayerData + { + return this._animationManager.getLayerData(animation, frameCount, spriteId) as AvatarAnimationLayerData; + } + + public getAnimation(k: string): Animation + { + return this._animationManager.getAnimation(k) as Animation; + } + + public getActionDefinition(k: string): ActionDefinition + { + return this._actionManager.getActionDefinition(k); + } + + public getActionDefinitionWithState(k: string): ActionDefinition + { + return this._actionManager.getActionDefinitionWithState(k); + } + + public isMainAvatarSet(k: string): boolean + { + return this._geometry.isMainAvatarSet(k); + } + + public sortActions(k: IActiveActionData[]): IActiveActionData[] + { + return this._actionManager.sortActions(k); + } + + public maxFrames(k: IActiveActionData[]): number + { + let _local_2 = 0; + + for(const _local_3 of k) + { + _local_2 = Math.max(_local_2, this._animationData.getFrameCount(_local_3.definition)); + } + return _local_2; + } + + public getMandatorySetTypeIds(k: string, _arg_2: number): string[] + { + if(!this._mandatorySetTypeIds[k]) + { + this._mandatorySetTypeIds[k] = []; + } + + if(this._mandatorySetTypeIds[k][_arg_2]) + { + return this._mandatorySetTypeIds[k][_arg_2]; + } + + this._mandatorySetTypeIds[k][_arg_2] = this._figureData.getMandatorySetTypeIds(k, _arg_2); + + return this._mandatorySetTypeIds[k][_arg_2]; + } + + public getDefaultPartSet(k: string, _arg_2: string): IFigurePartSet + { + return this._figureData.getDefaultPartSet(k, _arg_2); + } + + public getCanvasOffsets(k: IActiveActionData[], _arg_2: string, _arg_3: number): number[] + { + return this._actionManager.getCanvasOffsets(k, _arg_2, _arg_3); + } + + public getCanvas(k: string, _arg_2: string): AvatarCanvas + { + return this._geometry.getCanvas(k, _arg_2); + } + + public removeDynamicItems(k: IAvatarImage): void + { + this._geometry.removeDynamicItems(k); + } + + public getActiveBodyPartIds(k: IActiveActionData, _arg_2: IAvatarImage): string[] + { + let _local_3: string[] = []; + + const _local_4: string[] = []; + const _local_5 = k.definition.geometryType; + + if(k.definition.isAnimation) + { + const _local_7 = ((k.definition.state + '.') + k.actionParameter); + const _local_8 = this._animationManager.getAnimation(_local_7); + + if(_local_8) + { + _local_3 = _local_8.getAnimatedBodyPartIds(0, k.overridingAction); + + if(_local_8.hasAddData()) + { + const _local_11 = { + id: '', + x: 0, + y: 0, + z: 0, + radius: 0.01, + nx: 0, + ny: 0, + nz: -1, + double: 1 + }; + + const _local_12 = { + setType: '' + }; + + for(const _local_13 of _local_8.addData) + { + const _local_6 = this._geometry.getBodyPart(_local_5, _local_13.align); + + if(_local_6) + { + _local_11.id = _local_13.id; + _local_6.addPart(_local_11, _arg_2); + + _local_12.setType = _local_13.id; + + const _local_10 = this._partSetsData.addPartDefinition(_local_12); + _local_10.appendToFigure = true; + + if(_local_13.base === '') _local_10.staticId = 1; + + if(_local_4.indexOf(_local_6.id) === -1) _local_4.push(_local_6.id); + } + } + } + } + + for(const _local_9 of _local_3) + { + const _local_6 = this._geometry.getBodyPart(_local_5, _local_9); + + if(_local_6 && (_local_4.indexOf(_local_6.id) === -1)) _local_4.push(_local_6.id); + } + } + else + { + _local_3 = this._partSetsData.getActiveParts(k.definition); + + for(const _local_14 of _local_3) + { + const _local_6 = this._geometry.getBodyPartOfItem(_local_5, _local_14, _arg_2); + + if(_local_6 && (_local_4.indexOf(_local_6.id) === -1)) _local_4.push(_local_6.id); + } + } + + return _local_4; + } + + public getBodyPartsUnordered(k: string): string[] + { + return this._geometry.getBodyPartIdsInAvatarSet(k); + } + + public getBodyParts(k: string, _arg_2: string, _arg_3: number): string[] + { + const _local_4 = AvatarDirectionAngle.DIRECTION_TO_ANGLE[_arg_3]; + + return this._geometry.getBodyPartsAtAngle(k, _local_4, _arg_2); + } + + public getFrameBodyPartOffset(k: IActiveActionData, _arg_2: number, _arg_3: number, _arg_4: string): Point + { + const _local_5 = this._animationData.getAction(k.definition); + + if(_local_5) return _local_5.getFrameBodyPartOffset(_arg_2, _arg_3, _arg_4); + + return AnimationAction.DEFAULT_OFFSET; + } + + public getParts(k: string, _arg_2: IAvatarFigureContainer, _arg_3: IActiveActionData, _arg_4: string, _arg_5: number, removes: string[], _arg_7: IAvatarImage, _arg_8: Map = null): AvatarImagePartContainer[] + { + const _local_10: Animation = null; + let _local_34: IActionDefinition = null; + + let _local_20: AvatarAnimationFrame[] = []; + let _local_36: IPartColor = null; + + if(!_arg_3 == null) return []; + + const _local_9 = this._partSetsData.getActiveParts(_arg_3.definition); + const _local_11: AvatarImagePartContainer[] = []; + let _local_14: any[] = [0]; + const _local_15 = this._animationData.getAction(_arg_3.definition); + + if(_arg_3.definition.isAnimation) + { + const _local_24 = ((_arg_3.definition.state + '.') + _arg_3.actionParameter); + const _local_10 = this._animationManager.getAnimation(_local_24); + + if(_local_10) + { + _local_14 = this.getPopulatedArray(_local_10.frameCount(_arg_3.overridingAction)); + + for(const _local_25 of _local_10.getAnimatedBodyPartIds(0, _arg_3.overridingAction)) + { + if(_local_25 === k) + { + const _local_26 = this._geometry.getBodyPart(_arg_4, _local_25); + + if(_local_26) + { + for(const _local_27 of _local_26.getDynamicParts(_arg_7)) + { + _local_9.push(_local_27.id); + } + } + } + } + } + } + + const _local_16 = this._geometry.getParts(_arg_4, k, _arg_5, _local_9, _arg_7); + const _local_21 = _arg_2.getPartTypeIds(); + + for(const _local_17 of _local_21) + { + if(_arg_8) + { + if(_arg_8.get(_local_17)) continue; + } + + const _local_28 = _arg_2.getPartSetId(_local_17); + const _local_29 = _arg_2.getPartColorIds(_local_17); + const _local_30 = this._figureData.getSetType(_local_17); + + + + if(_local_30) + { + const _local_31 = this._figureData.getPalette(_local_30.paletteID); + + if(_local_31) + { + const _local_32 = _local_30.getPartSet(_local_28); + + if(_local_32) + { + removes = removes.concat(_local_32.hiddenLayers); + + for(const _local_33 of _local_32.parts) + { + if(_local_16.indexOf(_local_33.type) > -1) + { + if(_local_15) + { + const _local_19 = _local_15.getPart(_local_33.type); + + if(_local_19) + { + _local_20 = _local_19.frames; + } + else + { + _local_20 = _local_14; + } + } + else + { + _local_20 = _local_14; + } + + _local_34 = _arg_3.definition; + + if(_local_9.indexOf(_local_33.type) === -1) _local_34 = this._defaultAction; + + const _local_13 = this._partSetsData.getPartDefinition(_local_33.type); + + let _local_35 = (!_local_13) ? _local_33.type : _local_13.flippedSetType; + + if(!_local_35 || (_local_35 === '')) _local_35 = _local_33.type; + + if(_local_29 && (_local_29.length > (_local_33.colorLayerIndex - 1))) + { + _local_36 = _local_31.getColor(_local_29[(_local_33.colorLayerIndex - 1)]); + } + + const _local_37 = (_local_33.colorLayerIndex > 0); + const _local_18 = new AvatarImagePartContainer(k, _local_33.type, _local_33.id.toString(), _local_36, _local_20, _local_34, _local_37, _local_33.paletteMap, _local_35); + + _local_11.push(_local_18); + } + } + } + } + } + } + + const _local_22: AvatarImagePartContainer[] = []; + + for(const _local_12 of _local_16) + { + let _local_39: IPartColor = null; + let _local_38 = false; + + const _local_40 = ((_arg_8) && (_arg_8.get(_local_12))); + + for(const _local_23 of _local_11) + { + if(_local_23.partType === _local_12) + { + if(_local_40) + { + _local_39 = _local_23.color; + } + else + { + _local_38 = true; + + if(removes.indexOf(_local_12) === -1) _local_22.push(_local_23); + } + } + } + + if(!_local_38) + { + if(_local_40) + { + const _local_41 = _arg_8.get(_local_12); + + let _local_42 = 0; + let _local_43 = 0; + + while(_local_43 < _local_41.length) + { + _local_42 = (_local_42 + _local_41.charCodeAt(_local_43)); + _local_43++; + } + + if(_local_15) + { + const _local_19 = _local_15.getPart(_local_12); + + if(_local_19) + { + _local_20 = _local_19.frames; + } + else + { + _local_20 = _local_14; + } + } + else + { + _local_20 = _local_14; + } + + const _local_18 = new AvatarImagePartContainer(k, _local_12, _local_41, _local_39, _local_20, _arg_3.definition, (!(_local_39 == null)), -1, _local_12, false, 1); + + _local_22.push(_local_18); + } + else + { + if(_local_9.indexOf(_local_12) > -1) + { + const _local_44 = this._geometry.getBodyPartOfItem(_arg_4, _local_12, _arg_7); + + if(k !== _local_44.id) + { + // + } + else + { + const _local_13 = this._partSetsData.getPartDefinition(_local_12); + + let _local_45 = false; + let _local_46 = 1; + + if(_local_13.appendToFigure) + { + let _local_47 = '1'; + + if(_arg_3.actionParameter !== '') + { + _local_47 = _arg_3.actionParameter; + } + + if(_local_13.hasStaticId()) + { + _local_47 = _local_13.staticId.toString(); + } + + if(_local_10 != null) + { + const _local_48 = _local_10.getAddData(_local_12); + + if(_local_48) + { + _local_45 = _local_48.isBlended; + _local_46 = _local_48.blend; + } + } + + if(_local_15) + { + const _local_19 = _local_15.getPart(_local_12); + + if(_local_19) + { + _local_20 = _local_19.frames; + } + else + { + _local_20 = _local_14; + } + } + else + { + _local_20 = _local_14; + } + + const _local_18 = new AvatarImagePartContainer(k, _local_12, _local_47, null, _local_20, _arg_3.definition, false, -1, _local_12, _local_45, _local_46); + + _local_22.push(_local_18); + } + } + } + } + } + } + + return _local_22; + } + + private getPopulatedArray(k: number): number[] + { + const _local_2: number[] = []; + + let index = 0; + + while(index < k) + { + _local_2.push(index); + + index++; + } + + return _local_2; + } + + public getItemIds(): string[] + { + if(this._actionManager) + { + const k = this._actionManager.getActionDefinition('CarryItem').params; + + const _local_2 = []; + + for(const _local_3 of k.values()) _local_2.push(_local_3); + + return _local_2; + } + + return []; + } + + public get renderManager(): IAvatarRenderManager + { + return this._renderManager; + } + + public get figureData(): IStructureData + { + return this._figureData; + } + + public get partData(): PartSetsData + { + return this._partSetsData; + } + + public get animationManager(): AnimationManager + { + return this._animationManager; + } +} diff --git a/submodules/renderer/src/nitro/avatar/EffectAssetDownloadLibrary.ts b/submodules/renderer/src/nitro/avatar/EffectAssetDownloadLibrary.ts new file mode 100644 index 0000000..04b1ba7 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/EffectAssetDownloadLibrary.ts @@ -0,0 +1,83 @@ +import { IAssetAnimation, IAssetManager, IEffectAssetDownloadLibrary } from '../../api'; +import { EventDispatcher } from '../../core'; +import { AvatarRenderEffectLibraryEvent } from '../../events'; + +export class EffectAssetDownloadLibrary extends EventDispatcher implements IEffectAssetDownloadLibrary +{ + public static DOWNLOAD_COMPLETE: string = 'EADL_DOWNLOAD_COMPLETE'; + + private static NOT_LOADED: number = 0; + private static LOADING: number = 1; + private static LOADED: number = 2; + + private _state: number; + private _libraryName: string; + private _revision: string; + private _downloadUrl: string; + private _assets: IAssetManager; + private _animation: { [index: string]: IAssetAnimation }; + + constructor(id: string, revision: string, assets: IAssetManager, assetUrl: string) + { + super(); + + this._state = EffectAssetDownloadLibrary.NOT_LOADED; + this._libraryName = id; + this._revision = revision; + this._downloadUrl = assetUrl; + this._assets = assets; + this._animation = null; + + this._downloadUrl = this._downloadUrl.replace(/%libname%/gi, this._libraryName); + this._downloadUrl = this._downloadUrl.replace(/%revision%/gi, this._revision); + + const asset = this._assets.getCollection(this._libraryName); + + if(asset) this._state = EffectAssetDownloadLibrary.LOADED; + } + + public async downloadAsset(): Promise + { + if(!this._assets || (this._state === EffectAssetDownloadLibrary.LOADING) || (this._state === EffectAssetDownloadLibrary.LOADED)) return; + + const asset = this._assets.getCollection(this._libraryName); + + if(asset) + { + this._state = EffectAssetDownloadLibrary.LOADED; + + this.dispatchEvent(new AvatarRenderEffectLibraryEvent(AvatarRenderEffectLibraryEvent.DOWNLOAD_COMPLETE, this)); + + return; + } + + this._state = EffectAssetDownloadLibrary.LOADING; + + const status = await this._assets.downloadAsset(this._downloadUrl); + + if(!status) return; + + this._state = EffectAssetDownloadLibrary.LOADED; + + const collection = this._assets.getCollection(this._libraryName); + + if(collection) this._animation = collection.data.animations; + + this.dispatchEvent(new AvatarRenderEffectLibraryEvent(AvatarRenderEffectLibraryEvent.DOWNLOAD_COMPLETE, this)); + } + + public get libraryName(): string + { + return this._libraryName; + } + + public get animation(): { [index: string]: IAssetAnimation } + { + return this._animation; + } + + public get isLoaded(): boolean + { + return (this._state === EffectAssetDownloadLibrary.LOADED); + } +} diff --git a/submodules/renderer/src/nitro/avatar/EffectAssetDownloadManager.ts b/submodules/renderer/src/nitro/avatar/EffectAssetDownloadManager.ts new file mode 100644 index 0000000..4d46c1d --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/EffectAssetDownloadManager.ts @@ -0,0 +1,297 @@ +import { IAssetManager, IAvatarEffectListener, INitroEvent, NitroConfiguration, NitroLogger } from '../../api'; +import { EventDispatcher } from '../../core'; +import { AvatarRenderEffectLibraryEvent, AvatarRenderEvent, NitroEvent } from '../../events'; +import { AvatarStructure } from './AvatarStructure'; +import { EffectAssetDownloadLibrary } from './EffectAssetDownloadLibrary'; + +export class EffectAssetDownloadManager extends EventDispatcher +{ + public static DOWNLOADER_READY: string = 'EADM_DOWNLOADER_READY'; + public static LIBRARY_LOADED: string = 'EADM_LIBRARY_LOADED'; + + private static MAX_DOWNLOADS: number = 2; + + private _assets: IAssetManager; + private _structure: AvatarStructure; + + private _missingMandatoryLibs: string[]; + private _effectMap: Map; + private _initDownloadBuffer: [number, IAvatarEffectListener][]; + private _effectListeners: Map; + private _incompleteEffects: Map; + private _pendingDownloadQueue: EffectAssetDownloadLibrary[]; + private _currentDownloads: EffectAssetDownloadLibrary[]; + private _libraryNames: string[]; + private _isReady: boolean; + + constructor(assets: IAssetManager, structure: AvatarStructure) + { + super(); + + this._assets = assets; + this._structure = structure; + + this._missingMandatoryLibs = NitroConfiguration.getValue('avatar.mandatory.effect.libraries'); + this._effectMap = new Map(); + this._effectListeners = new Map(); + this._incompleteEffects = new Map(); + this._initDownloadBuffer = []; + this._pendingDownloadQueue = []; + this._currentDownloads = []; + this._libraryNames = []; + this._isReady = false; + + this.onLibraryLoaded = this.onLibraryLoaded.bind(this); + this.onAvatarRenderReady = this.onAvatarRenderReady.bind(this); + + this.loadEffectMap(); + + this._structure.renderManager.events.addEventListener(AvatarRenderEvent.AVATAR_RENDER_READY, this.onAvatarRenderReady); + } + + private loadEffectMap(): void + { + const request = new XMLHttpRequest(); + + try + { + request.open('GET', NitroConfiguration.getValue('avatar.effectmap.url')); + + request.send(); + + request.onloadend = e => + { + if(request.responseText) + { + const data = JSON.parse(request.responseText); + + this.processEffectMap(data.effects); + + this.processMissingLibraries(); + + this._isReady = true; + + this.dispatchEvent(new NitroEvent(EffectAssetDownloadManager.DOWNLOADER_READY)); + } + }; + + request.onerror = e => + { + throw new Error('invalid_avatar_effect_map'); + }; + } + + catch (e) + { + NitroLogger.error(e); + } + } + + private processEffectMap(data: any): void + { + if(!data) return; + + for(const effect of data) + { + if(!effect) continue; + + const id = (effect.id as string); + const lib = (effect.lib as string); + const revision = (effect.revision || ''); + + if(this._libraryNames.indexOf(lib) >= 0) continue; + + this._libraryNames.push(lib); + + const downloadLibrary = new EffectAssetDownloadLibrary(lib, revision, this._assets, NitroConfiguration.getValue('avatar.asset.effect.url')); + + downloadLibrary.addEventListener(AvatarRenderEffectLibraryEvent.DOWNLOAD_COMPLETE, this.onLibraryLoaded); + + let existing = this._effectMap.get(id); + + if(!existing) existing = []; + + existing.push(downloadLibrary); + + this._effectMap.set(id, existing); + } + } + + public downloadAvatarEffect(id: number, listener: IAvatarEffectListener): void + { + if(!this._isReady || !this._structure.renderManager.isReady) + { + this._initDownloadBuffer.push([id, listener]); + + return; + } + + const pendingLibraries = this.getAvatarEffectPendingLibraries(id); + + if(pendingLibraries && pendingLibraries.length) + { + if(listener && !listener.disposed) + { + let listeners = this._effectListeners.get(id.toString()); + + if(!listeners) listeners = []; + + listeners.push(listener); + + this._effectListeners.set(id.toString(), listeners); + } + + this._incompleteEffects.set(id.toString(), pendingLibraries); + + for(const library of pendingLibraries) + { + if(!library) continue; + + this.downloadLibrary(library); + } + } + else + { + if(listener && !listener.disposed) listener.resetEffect(id); + } + } + + private onAvatarRenderReady(event: INitroEvent): void + { + if(!event) return; + + for(const [id, listener] of this._initDownloadBuffer) + { + this.downloadAvatarEffect(id, listener); + } + + this._initDownloadBuffer = []; + } + + private onLibraryLoaded(event: AvatarRenderEffectLibraryEvent): void + { + if(!event || !event.library) return; + + const loadedEffects: string[] = []; + + this._structure.registerAnimation(event.library.animation); + + for(const [id, libraries] of this._incompleteEffects.entries()) + { + let isReady = true; + + for(const library of libraries) + { + if(!library || library.isLoaded) continue; + + isReady = false; + + break; + } + + if(isReady) + { + loadedEffects.push(id); + + const listeners = this._effectListeners.get(id); + + for(const listener of listeners) + { + if(!listener || listener.disposed) continue; + + listener.resetEffect(parseInt(id)); + } + + this._effectListeners.delete(id); + + this.dispatchEvent(new NitroEvent(EffectAssetDownloadManager.LIBRARY_LOADED)); + } + } + + for(const id of loadedEffects) this._incompleteEffects.delete(id); + + let index = 0; + + while(index < this._currentDownloads.length) + { + const download = this._currentDownloads[index]; + + if(download) + { + if(download.libraryName === event.library.libraryName) this._currentDownloads.splice(index, 1); + } + + index++; + } + } + + public processMissingLibraries(): void + { + const libraries = this._missingMandatoryLibs.slice(); + + for(const library of libraries) + { + if(!library) continue; + + const map = this._effectMap.get(library); + + if(map) for(const effect of map) effect && this.downloadLibrary(effect); + } + } + + public isAvatarEffectReady(effect: number): boolean + { + if(!this._isReady || !this._structure.renderManager.isReady) + { + return false; + } + + const pendingLibraries = this.getAvatarEffectPendingLibraries(effect); + + return !pendingLibraries.length; + } + + private getAvatarEffectPendingLibraries(id: number): EffectAssetDownloadLibrary[] + { + const pendingLibraries: EffectAssetDownloadLibrary[] = []; + + if(!this._structure) return pendingLibraries; + + const libraries = this._effectMap.get(id.toString()); + + if(libraries) + { + for(const library of libraries) + { + if(!library || library.isLoaded) continue; + + if(pendingLibraries.indexOf(library) === -1) pendingLibraries.push(library); + } + } + + return pendingLibraries; + } + + private downloadLibrary(library: EffectAssetDownloadLibrary): void + { + if(!library || library.isLoaded) return; + + if((this._pendingDownloadQueue.indexOf(library) >= 0) || (this._currentDownloads.indexOf(library) >= 0)) return; + + this._pendingDownloadQueue.push(library); + + this.processDownloadQueue(); + } + + private processDownloadQueue(): void + { + while(this._pendingDownloadQueue.length) + { + const library = this._pendingDownloadQueue[0]; + + library.downloadAsset(); + + this._currentDownloads.push(this._pendingDownloadQueue.shift()); + } + } +} diff --git a/submodules/renderer/src/nitro/avatar/PlaceHolderAvatarImage.ts b/submodules/renderer/src/nitro/avatar/PlaceHolderAvatarImage.ts new file mode 100644 index 0000000..1a56373 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/PlaceHolderAvatarImage.ts @@ -0,0 +1,18 @@ +import { AssetAliasCollection } from './alias'; +import { AvatarFigureContainer } from './AvatarFigureContainer'; +import { AvatarImage } from './AvatarImage'; +import { AvatarStructure } from './AvatarStructure'; +import { EffectAssetDownloadManager } from './EffectAssetDownloadManager'; + +export class PlaceHolderAvatarImage extends AvatarImage +{ + constructor(k: AvatarStructure, _arg_2: AssetAliasCollection, _arg_3: AvatarFigureContainer, _arg_4: string, _arg_5: EffectAssetDownloadManager) + { + super(k, _arg_2, _arg_3, _arg_4, _arg_5, null); + } + + public isPlaceholder(): boolean + { + return true; + } +} diff --git a/submodules/renderer/src/nitro/avatar/actions/ActionDefinition.ts b/submodules/renderer/src/nitro/avatar/actions/ActionDefinition.ts new file mode 100644 index 0000000..cf4163b --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/actions/ActionDefinition.ts @@ -0,0 +1,224 @@ +import { IActionDefinition } from '../../../api'; +import { ActionType } from './ActionType'; + +export class ActionDefinition implements IActionDefinition +{ + private _id: string; + private _state: string; + private _precedence: number; + private _activePartSet: string; + private _assetPartDefinition: string; + private _lay: string; + private _geometryType: string; + private _isMain: boolean; + private _isDefault: boolean; + private _isAnimation: boolean; + private _startFromFrameZero: boolean; + private _prevents: string[]; + private _preventHeadTurn: boolean; + private _types: Map; + private _params: Map; + private _defaultParameterValue: string; + private _canvasOffsets: Map>; + + constructor(data: any) + { + this._id = data.id; + this._state = data.state; + this._precedence = data.precedence; + this._activePartSet = data.activePartSet; + this._assetPartDefinition = data.assetPartDefinition; + this._lay = data.lay; + this._geometryType = data.geometryType; + this._isMain = data.main || false; + this._isDefault = data.isDefault || false; + this._isAnimation = data.animation || false; + this._startFromFrameZero = data.startFromFrameZero || false; + this._prevents = data.prevents || []; + this._preventHeadTurn = data.preventHeadTurn || false; + this._types = new Map(); + this._params = new Map(); + this._defaultParameterValue = ''; + this._canvasOffsets = null; + + if(data.params && (data.params.length > 0)) + { + for(const param of data.params) + { + if(!param) continue; + + if(param.id === 'default') this._defaultParameterValue = param.value; + else this._params.set(param.id, param.value); + } + } + + if(data.types && (data.types.length > 0)) + { + for(const type of data.types) + { + if(!type) continue; + + const action = new ActionType(type); + + this._types.set(action.id, action); + } + } + } + + public setOffsets(k: string, _arg_2: number, _arg_3: number[]): void + { + if(!this._canvasOffsets) this._canvasOffsets = new Map(); + + let existing = this._canvasOffsets.get(k); + + if(!existing) + { + existing = new Map(); + + this._canvasOffsets.set(k, existing); + } + + existing.set(_arg_2, _arg_3); + } + + public getOffsets(k: string, _arg_2: number): number[] + { + if(!this._canvasOffsets) return null; + + const existing = this._canvasOffsets.get(k); + + if(!existing) return null; + + return existing.get(_arg_2); + } + + public getType(id: string): ActionType + { + if(!id) return null; + + const existing = this._types.get(parseInt(id)); + + if(!existing) return null; + + return existing; + } + + public getParameterValue(id: string): string + { + if(!id) return ''; + + const existing = this._params.get(id); + + if(!existing) return this._defaultParameterValue; + + return existing; + } + + public getPrevents(type: string): string[] + { + return this._prevents.concat(this.getTypePrevents(type)); + } + + private getTypePrevents(type: string): string[] + { + if(!type) return []; + + const existing = this._types.get(parseInt(type)); + + if(!existing) return []; + + return existing.prevents; + } + + public getPreventHeadTurn(k: string): boolean + { + if(!k) return this._preventHeadTurn; + + const type = this.getType(k); + + if(!type) return this._preventHeadTurn; + + return type.preventHeadTurn; + } + + public isAnimated(k: string): boolean + { + if(!k) return true; + + const type = this.getType(k); + + if(!type) return true; + + return type.isAnimated; + } + + public get id(): string + { + return this._id; + } + + public get state(): string + { + return this._state; + } + + public get precedence(): number + { + return this._precedence; + } + + public get activePartSet(): string + { + return this._activePartSet; + } + + public get assetPartDefinition(): string + { + return this._assetPartDefinition; + } + + public get lay(): string + { + return this._lay; + } + + public get geometryType(): string + { + return this._geometryType; + } + + public get isMain(): boolean + { + return this._isMain; + } + + public get isDefault(): boolean + { + return this._isDefault; + } + + public get isAnimation(): boolean + { + return this._isAnimation; + } + + public get startFromFrameZero(): boolean + { + return this._startFromFrameZero; + } + + public get prevents(): string[] + { + return this._prevents; + } + + public get preventHeadTurn(): boolean + { + return this._preventHeadTurn; + } + + public get params(): Map + { + return this._params; + } +} diff --git a/submodules/renderer/src/nitro/avatar/actions/ActionType.ts b/submodules/renderer/src/nitro/avatar/actions/ActionType.ts new file mode 100644 index 0000000..d6d0312 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/actions/ActionType.ts @@ -0,0 +1,44 @@ +export class ActionType +{ + private _id: number; + private _value: number; + private _prevents: string[]; + private _preventHeadTurn: boolean; + private _isAnimated: boolean; + + constructor(data: any) + { + this._id = parseInt(data.id); + this._value = parseInt(data.id); + this._prevents = data.prevents || []; + this._preventHeadTurn = data.preventHeadTurn || false; + this._isAnimated = true; + + if((data.animated !== undefined) && (data.animated === false)) this._isAnimated = false; + } + + public get id(): number + { + return this._id; + } + + public get value(): number + { + return this._value; + } + + public get prevents(): string[] + { + return this._prevents; + } + + public get preventHeadTurn(): boolean + { + return this._preventHeadTurn; + } + + public get isAnimated(): boolean + { + return this._isAnimated; + } +} diff --git a/submodules/renderer/src/nitro/avatar/actions/ActiveActionData.ts b/submodules/renderer/src/nitro/avatar/actions/ActiveActionData.ts new file mode 100644 index 0000000..4488354 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/actions/ActiveActionData.ts @@ -0,0 +1,73 @@ +import { IActionDefinition, IActiveActionData } from '../../../api'; + +export class ActiveActionData implements IActiveActionData +{ + private _actionType: string; + private _actionParameter: string; + private _definition: IActionDefinition; + private _startFrame: number; + private _overridingAction: string; + + constructor(action: string, parameter: string = '', startFrame: number = 0) + { + this._actionType = action || ''; + this._actionParameter = parameter || ''; + this._definition = null; + this._startFrame = startFrame || 0; + this._overridingAction = null; + } + + public dispose(): void + { + this._actionType = null; + this._actionParameter = null; + this._definition = null; + } + + public get id(): string + { + if(!this._definition) return ''; + + return this._definition.id + '_' + this._actionParameter; + } + + public get actionType(): string + { + return this._actionType; + } + + public get actionParameter(): string + { + return this._actionParameter; + } + + public set actionParameter(parameter: string) + { + this._actionParameter = parameter; + } + + public get definition(): IActionDefinition + { + return this._definition; + } + + public set definition(definition: IActionDefinition) + { + this._definition = definition; + } + + public get startFrame(): number + { + return this._startFrame; + } + + public get overridingAction(): string + { + return this._overridingAction; + } + + public set overridingAction(action: string) + { + this._overridingAction = action; + } +} diff --git a/submodules/renderer/src/nitro/avatar/actions/AvatarActionManager.ts b/submodules/renderer/src/nitro/avatar/actions/AvatarActionManager.ts new file mode 100644 index 0000000..a50cabd --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/actions/AvatarActionManager.ts @@ -0,0 +1,186 @@ +import { IActiveActionData, IAssetManager } from '../../../api'; +import { ActionDefinition } from './ActionDefinition'; + +export class AvatarActionManager +{ + private _assets: IAssetManager; + private _actions: Map; + private _defaultAction: ActionDefinition; + + constructor(k: IAssetManager, data: any) + { + this._assets = k; + this._actions = new Map(); + this._defaultAction = null; + + this.updateActions(data); + } + + public updateActions(data: any): void + { + if(!data) return; + + for(const action of data.actions) + { + if(!action || !action.state) continue; + + const definition = new ActionDefinition(action); + + this._actions.set(definition.state, definition); + } + + if(data.actionOffsets) this.parseActionOffsets(data.actionOffsets); + } + + private parseActionOffsets(offsets: any): void + { + if(!offsets || !offsets.length) return; + + for(const offset of offsets) + { + const action = this._actions.get(offset.action); + + if(!action) continue; + + for(const canvasOffset of offset.offsets) + { + const size = (canvasOffset.size || ''); + const direction = canvasOffset.direction; + + if((size === '') || (direction === undefined)) continue; + + const x = (canvasOffset.x || 0); + const y = (canvasOffset.y || 0); + const z = (canvasOffset.z || 0); + + action.setOffsets(size, direction, [x, y, z]); + } + } + } + + public getActionDefinition(id: string): ActionDefinition + { + if(!id) return null; + + for(const action of this._actions.values()) + { + if(!action || (action.id !== id)) continue; + + return action; + } + + return null; + } + + public getActionDefinitionWithState(state: string): ActionDefinition + { + const existing = this._actions.get(state); + + if(!existing) return null; + + return existing; + } + + public getDefaultAction(): ActionDefinition + { + if(this._defaultAction) return this._defaultAction; + + for(const action of this._actions.values()) + { + if(!action || !action.isDefault) continue; + + this._defaultAction = action; + + return action; + } + + return null; + } + + public getCanvasOffsets(k: IActiveActionData[], _arg_2: string, _arg_3: number): number[] + { + let canvasOffsets: number[] = []; + + for(const activeAction of k) + { + if(!activeAction) continue; + + const action = this._actions.get(activeAction.actionType); + const offsets = action && action.getOffsets(_arg_2, _arg_3); + + if(offsets) canvasOffsets = offsets; + } + + return canvasOffsets; + } + + public sortActions(actions: IActiveActionData[]): IActiveActionData[] + { + if(!actions) return null; + + actions = this.filterActions(actions); + + const validatedActions: IActiveActionData[] = []; + + for(const action of actions) + { + if(!action) continue; + + const definition = this._actions.get(action.actionType); + + if(!definition) continue; + + action.definition = definition; + + validatedActions.push(action); + } + + validatedActions.sort(this.sortByPrecedence); + + return validatedActions; + } + + private filterActions(actions: IActiveActionData[]): IActiveActionData[] + { + let preventions: string[] = []; + const activeActions: IActiveActionData[] = []; + + for(const action of actions) + { + if(!action) continue; + + const localAction = this._actions.get(action.actionType); + + if(localAction) preventions = preventions.concat(localAction.getPrevents(action.actionParameter)); + } + + for(const action of actions) + { + if(!action) continue; + + let actionType = action.actionType; + + if(action.actionType === 'fx') actionType = (actionType + ('.' + action.actionParameter)); + + if(preventions.indexOf(actionType) >= 0) continue; + + activeActions.push(action); + } + + return activeActions; + } + + private sortByPrecedence(actionOne: IActiveActionData, actionTwo: IActiveActionData): number + { + if(!actionOne || !actionTwo) return 0; + + const precedenceOne = actionOne.definition.precedence; + const precedenceTwo = actionTwo.definition.precedence; + + if(precedenceOne < precedenceTwo) return 1; + + if(precedenceOne > precedenceTwo) return -1; + + return 0; + } +} diff --git a/submodules/renderer/src/nitro/avatar/actions/index.ts b/submodules/renderer/src/nitro/avatar/actions/index.ts new file mode 100644 index 0000000..a849536 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/actions/index.ts @@ -0,0 +1,4 @@ +export * from './ActionDefinition'; +export * from './ActionType'; +export * from './ActiveActionData'; +export * from './AvatarActionManager'; diff --git a/submodules/renderer/src/nitro/avatar/alias/AssetAlias.ts b/submodules/renderer/src/nitro/avatar/alias/AssetAlias.ts new file mode 100644 index 0000000..b1a20a3 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/alias/AssetAlias.ts @@ -0,0 +1,37 @@ +import { IAssetAlias } from '../../../api'; + +export class AssetAlias +{ + private _name: string; + private _link: string; + private _flipH: boolean; + private _flipV: boolean; + + constructor(name: string, alias: IAssetAlias) + { + this._name = name; + this._link = alias.link; + this._flipH = alias.flipH; + this._flipV = alias.flipV; + } + + public get name(): string + { + return this._name; + } + + public get link(): string + { + return this._link; + } + + public get flipH(): boolean + { + return this._flipH; + } + + public get flipV(): boolean + { + return this._flipV; + } +} diff --git a/submodules/renderer/src/nitro/avatar/alias/AssetAliasCollection.ts b/submodules/renderer/src/nitro/avatar/alias/AssetAliasCollection.ts new file mode 100644 index 0000000..80e5c7e --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/alias/AssetAliasCollection.ts @@ -0,0 +1,89 @@ +import { IAssetManager, IGraphicAsset } from '../../../api'; +import { AvatarRenderManager } from '../AvatarRenderManager'; +import { AssetAlias } from './AssetAlias'; + +export class AssetAliasCollection +{ + private _assets: IAssetManager; + private _aliases: Map; + private _avatarRenderManager: AvatarRenderManager; + private _missingAssetNames: string[]; + + constructor(k: AvatarRenderManager, _arg_2: IAssetManager) + { + this._avatarRenderManager = k; + this._aliases = new Map(); + this._assets = _arg_2; + this._missingAssetNames = []; + } + + public dispose(): void + { + this._assets = null; + this._aliases = null; + } + + public reset(): void + { + this.init(); + } + + public init(): void + { + for(const collection of this._assets.collections.values()) + { + if(!collection) continue; + + const aliases = collection.data && collection.data.aliases; + + if(!aliases) continue; + + for(const name in aliases) + { + const alias = aliases[name]; + + if(!alias) continue; + + this._aliases.set(name, new AssetAlias(name, alias)); + } + } + } + + public hasAlias(k: string): boolean + { + const alias = this._aliases.get(k); + + if(alias) return true; + + return false; + } + + public getAssetName(k: string): string + { + let _local_2 = k; + let _local_3 = 5; + + while(this.hasAlias(_local_2) && (_local_3 >= 0)) + { + const _local_4 = this._aliases.get(_local_2); + + _local_2 = _local_4.link; + _local_3--; + } + + return _local_2; + } + + public getAsset(name: string): IGraphicAsset + { + if(!this._assets) return null; + + name = this.getAssetName(name); + + const asset = this._assets.getAsset(name); + + if(!asset) return null; + + return asset; + } +} diff --git a/submodules/renderer/src/nitro/avatar/alias/index.ts b/submodules/renderer/src/nitro/avatar/alias/index.ts new file mode 100644 index 0000000..7d9524c --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/alias/index.ts @@ -0,0 +1,2 @@ +export * from './AssetAlias'; +export * from './AssetAliasCollection'; diff --git a/submodules/renderer/src/nitro/avatar/animation/AddDataContainer.ts b/submodules/renderer/src/nitro/avatar/animation/AddDataContainer.ts new file mode 100644 index 0000000..b20d1f4 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/animation/AddDataContainer.ts @@ -0,0 +1,61 @@ +import { IAssetAnimationAdd } from '../../../api'; + +export class AddDataContainer +{ + private _id: string; + private _align: string; + private _base: string; + private _ink: number; + private _blend: number; + + constructor(k: IAssetAnimationAdd) + { + this._id = k.id || ''; + this._align = k.align || ''; + this._base = k.base || ''; + this._ink = k.ink || 0; + this._blend = 0; + + const _local_2 = k.blend; + + if(_local_2) + { + if(_local_2.length > 0) + { + this._blend = parseInt(_local_2); + + if(this._blend > 1) this._blend = (this._blend / 100); + } + } + } + + public get id(): string + { + return this._id; + } + + public get align(): string + { + return this._align; + } + + public get base(): string + { + return this._base; + } + + public get ink(): number + { + return this._ink; + } + + public get blend(): number + { + return this._blend; + } + + public get isBlended(): boolean + { + return this._blend !== 1; + } +} diff --git a/submodules/renderer/src/nitro/avatar/animation/Animation.ts b/submodules/renderer/src/nitro/avatar/animation/Animation.ts new file mode 100644 index 0000000..74c5b8e --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/animation/Animation.ts @@ -0,0 +1,311 @@ +import { IAnimation, IAssetAnimation, IAssetAnimationFrame } from '../../../api'; +import { AvatarStructure } from '../AvatarStructure'; +import { AddDataContainer } from './AddDataContainer'; +import { AvatarAnimationLayerData } from './AvatarAnimationLayerData'; +import { AvatarDataContainer } from './AvatarDataContainer'; +import { DirectionDataContainer } from './DirectionDataContainer'; +import { SpriteDataContainer } from './SpriteDataContainer'; + +export class Animation implements IAnimation +{ + private static EMPTY_ARRAY: any[] = []; + + private _id: string; + private _description: string; + private _frames: AvatarAnimationLayerData[][]; + private _spriteData: SpriteDataContainer[]; + private _avatarData: AvatarDataContainer; + private _directionData: DirectionDataContainer; + private _removeData: string[]; + private _addData: AddDataContainer[]; + private _overriddenActions: Map; + private _overrideFrames: Map; + private _resetOnToggle: boolean; + + constructor(k: AvatarStructure, _arg_2: IAssetAnimation) + { + this._id = _arg_2.name; + this._description = this._id; + this._frames = []; + this._spriteData = null; + this._avatarData = null; + this._directionData = null; + this._removeData = null; + this._addData = null; + this._overriddenActions = null; + this._overrideFrames = null; + this._resetOnToggle = (_arg_2.resetOnToggle || false); + + if(_arg_2.sprites && _arg_2.sprites.length) + { + this._spriteData = []; + + for(const sprite of _arg_2.sprites) this._spriteData.push(new SpriteDataContainer(this, sprite)); + } + + if(_arg_2.avatars && _arg_2.avatars.length) this._avatarData = new AvatarDataContainer(_arg_2.avatars[0]); + + if(_arg_2.directions && _arg_2.directions.length) this._directionData = new DirectionDataContainer(_arg_2.directions[0]); + + if(_arg_2.removes && _arg_2.removes.length) + { + this._removeData = []; + + for(const remove of _arg_2.removes) this._removeData.push(remove.id); + } + + if(_arg_2.adds && _arg_2.adds.length) + { + this._addData = []; + + for(const add of _arg_2.adds) this._addData.push(new AddDataContainer(add)); + } + + if(_arg_2.overrides && _arg_2.overrides.length) + { + this._overrideFrames = new Map(); + this._overriddenActions = new Map(); + + for(const override of _arg_2.overrides) + { + const name = override.name; + const value = override.override; + + this._overriddenActions.set(value, name); + + const frames: AvatarAnimationLayerData[][] = []; + + this.parseFrames(frames, override.frames, k); + + this._overrideFrames.set(name, frames); + } + } + + this.parseFrames(this._frames, _arg_2.frames, k); + } + + private parseFrames(frames: AvatarAnimationLayerData[][], _arg_2: IAssetAnimationFrame[], _arg_3: AvatarStructure): void + { + if(!_arg_2 || !_arg_2.length) return; + + for(const frame of _arg_2) + { + let repeats = 1; + + if(frame.repeats && (frame.repeats > 1)) repeats = frame.repeats; + + let index = 0; + + while(index < repeats) + { + const layers: AvatarAnimationLayerData[] = []; + + if(frame.bodyparts && frame.bodyparts.length) + { + for(const bodyPart of frame.bodyparts) + { + const definition = _arg_3.getActionDefinition(bodyPart.action); + const layer = new AvatarAnimationLayerData(bodyPart, AvatarAnimationLayerData.BODYPART, definition); + + layers.push(layer); + } + } + + if(frame.fxs && frame.fxs.length) + { + for(const fx of frame.fxs) + { + const definition = _arg_3.getActionDefinition(fx.action); + const layer = new AvatarAnimationLayerData(fx, AvatarAnimationLayerData.FX, definition); + + layers.push(layer); + } + } + + frames.push(layers); + + index++; + } + } + } + + public frameCount(k: string = null): number + { + if(!k) return this._frames.length; + + if(this._overrideFrames) + { + const _local_2 = this._overrideFrames.get(k); + + if(_local_2) return _local_2.length; + } + + return 0; + } + + public hasOverriddenActions(): boolean + { + if(!this._overriddenActions) return false; + + return (this._overriddenActions.size > 0); + } + + public overriddenActionNames(): string[] + { + if(!this._overriddenActions) return null; + + const keys: string[] = []; + + for(const key of this._overriddenActions.keys()) keys.push(key); + + return keys; + } + + public overridingAction(k: string): string + { + if(!this._overriddenActions) return null; + + return this._overriddenActions.get(k); + } + + private getFrame(frameCount: number, _arg_2: string = null): AvatarAnimationLayerData[] + { + if(frameCount < 0) frameCount = 0; + + let layers: AvatarAnimationLayerData[] = []; + + if(!_arg_2) + { + if(this._frames.length > 0) + { + layers = this._frames[(frameCount % this._frames.length)]; + } + } + else + { + const overrideLayers = this._overrideFrames.get(_arg_2); + + if(overrideLayers && (overrideLayers.length > 0)) + { + layers = overrideLayers[(frameCount % overrideLayers.length)]; + } + } + + return layers; + } + + public getAnimatedBodyPartIds(k: number, _arg_2: string = null): string[] + { + const _local_3: string[] = []; + + for(const layer of this.getFrame(k, _arg_2)) + { + if(layer.type === AvatarAnimationLayerData.BODYPART) + { + _local_3.push(layer.id); + } + + else if(layer.type === AvatarAnimationLayerData.FX) + { + if(this._addData && this._addData.length) + { + for(const _local_5 of this._addData) + { + if(_local_5.id === layer.id) _local_3.push(_local_5.align); + } + } + } + } + + return _local_3; + } + + public getLayerData(frameCount: number, spriteId: string, _arg_3: string = null): AvatarAnimationLayerData + { + for(const layer of this.getFrame(frameCount, _arg_3)) + { + if(layer.id === spriteId) return layer; + + if(layer.type === AvatarAnimationLayerData.FX) + { + if(this._addData && this._addData.length) + { + for(const addData of this._addData) + { + if(((addData.align === spriteId) && (addData.id === layer.id))) return layer; + } + } + } + } + + return null; + } + + public hasAvatarData(): boolean + { + return this._avatarData !== null; + } + + public hasDirectionData(): boolean + { + return this._directionData !== null; + } + + public hasAddData(): boolean + { + return this._addData !== null; + } + + public getAddData(k: string): AddDataContainer + { + if(this._addData) + { + for(const _local_2 of this._addData) + { + if(_local_2.id === k) return _local_2; + } + } + + return null; + } + + public get id(): string + { + return this._id; + } + + public get spriteData(): SpriteDataContainer[] + { + return this._spriteData || Animation.EMPTY_ARRAY; + } + + public get avatarData(): AvatarDataContainer + { + return this._avatarData; + } + + public get directionData(): DirectionDataContainer + { + return this._directionData; + } + + public get removeData(): string[] + { + return this._removeData || Animation.EMPTY_ARRAY; + } + + public get addData(): AddDataContainer[] + { + return this._addData || Animation.EMPTY_ARRAY; + } + + public toString(): string + { + return this._description; + } + + public get resetOnToggle(): boolean + { + return this._resetOnToggle; + } +} diff --git a/submodules/renderer/src/nitro/avatar/animation/AnimationManager.ts b/submodules/renderer/src/nitro/avatar/animation/AnimationManager.ts new file mode 100644 index 0000000..73f3f23 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/animation/AnimationManager.ts @@ -0,0 +1,49 @@ +import { IAnimation, IAnimationLayerData, IAnimationManager, IAssetAnimation } from '../../../api'; +import { AvatarStructure } from '../AvatarStructure'; +import { Animation } from './Animation'; + +export class AnimationManager implements IAnimationManager +{ + private _animations: Map; + + constructor() + { + this._animations = new Map(); + } + + public registerAnimation(structure: AvatarStructure, _arg_2: { [index: string]: IAssetAnimation }): boolean + { + if(!_arg_2) return false; + + const animationData = _arg_2[Object.keys(_arg_2)[0]]; + + const animation = new Animation(structure, animationData); + + this._animations.set(animationData.name, animation); + + return true; + } + + public getAnimation(animation: string): Animation + { + const existing = this._animations.get(animation); + + if(!existing) return null; + + return existing; + } + + public getLayerData(animation: string, frameCount: number, spriteId: string): IAnimationLayerData + { + const existing = this.getAnimation(animation); + + if(!existing) return null; + + return existing.getLayerData(frameCount, spriteId); + } + + public get animations(): Map + { + return this._animations; + } +} diff --git a/submodules/renderer/src/nitro/avatar/animation/AvatarAnimationLayerData.ts b/submodules/renderer/src/nitro/avatar/animation/AvatarAnimationLayerData.ts new file mode 100644 index 0000000..d412430 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/animation/AvatarAnimationLayerData.ts @@ -0,0 +1,109 @@ +import { IActionDefinition, IActiveActionData, IAnimationLayerData, IAssetAnimationFramePart } from '../../../api'; +import { ActiveActionData } from '../actions'; + +export class AvatarAnimationLayerData implements IAnimationLayerData +{ + public static BODYPART: string = 'bodypart'; + public static FX: string = 'fx'; + + private _id: string; + private _action: IActiveActionData; + private _animationFrame: number; + private _dx: number; + private _dy: number; + private _dz: number; + private _directionOffset: number; + private _type: string; + private _base: string; + private _items: Map; + + constructor(k: IAssetAnimationFramePart, _arg_2: string, _arg_3: IActionDefinition) + { + this._id = k.id; + this._animationFrame = (k.frame || 0); + this._dx = (k.dx || 0); + this._dy = (k.dy || 0); + this._dz = (k.dz || 0); + this._directionOffset = (k.dd || 0); + this._type = _arg_2; + this._base = (k.base || ''); + this._items = new Map(); + + if(k.items) for(const _local_4 of k.items) this._items.set(_local_4.id, _local_4.base); + + let _local_5 = ''; + + if(this._base !== '') _local_5 = this.baseAsInt().toString(); + + if(_arg_3) + { + this._action = new ActiveActionData(_arg_3.state, this.base); + this._action.definition = _arg_3; + } + } + + public get items(): Map + { + return this._items; + } + + private baseAsInt(): number + { + let k = 0; + let index = 0; + + while(index < this._base.length) + { + k = (k + this._base.charCodeAt(index)); + + index++; + } + + return k; + } + + public get id(): string + { + return this._id; + } + + public get animationFrame(): number + { + return this._animationFrame; + } + + public get dx(): number + { + return this._dx; + } + + public get dy(): number + { + return this._dy; + } + + public get dz(): number + { + return this._dz; + } + + public get dd(): number + { + return this._directionOffset; + } + + public get type(): string + { + return this._type; + } + + public get base(): string + { + return this._base; + } + + public get action(): IActiveActionData + { + return this._action; + } +} diff --git a/submodules/renderer/src/nitro/avatar/animation/AvatarDataContainer.ts b/submodules/renderer/src/nitro/avatar/animation/AvatarDataContainer.ts new file mode 100644 index 0000000..bd6113c --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/animation/AvatarDataContainer.ts @@ -0,0 +1,136 @@ +import { IAssetAnimationAvatar, IAvatarDataContainer } from '../../../api'; +import { AdjustmentFilter } from '../../../pixi-proxy'; + +export class AvatarDataContainer implements IAvatarDataContainer +{ + private _ink: number; + private _foreGround: number; + private _backGround: number; + private _colorTransform: AdjustmentFilter; + private _rgb: number; + private _r: number; + private _g: number; + private _b: number; + private _redMultiplier: number; + private _greenMultiplier: number; + private _blueMultiplier: number; + private _alphaMultiplier: number; + private _colorMap: Map; + private _paletteIsGrayscale: boolean; + + constructor(k: IAssetAnimationAvatar) + { + this._ink = k.ink; + + let foreground = k.foreground; + let background = k.background; + + foreground = foreground.replace('#', ''); + background = background.replace('#', ''); + + this._foreGround = parseInt(foreground, 16); + this._backGround = parseInt(background, 16); + this._colorTransform = null; + this._rgb = parseInt(foreground, 16); + this._r = ((this._rgb >> 16) & 0xFF); + this._g = ((this._rgb >> 8) & 0xFF); + this._b = ((this._rgb >> 0) & 0xFF); + this._redMultiplier = ((this._r / 0xFF) * 1); + this._greenMultiplier = ((this._g / 0xFF) * 1); + this._blueMultiplier = ((this._b / 0xFF) * 1); + this._alphaMultiplier = 1; + this._paletteIsGrayscale = true; + + if(this._ink === 37) + { + this._alphaMultiplier = 0.5; + this._paletteIsGrayscale = false; + } + + this._colorTransform = new AdjustmentFilter({ red: (this._r / 255), green: (this._g / 255), blue: (this._b / 255), alpha: this._alphaMultiplier }); + this._colorMap = this.generatePaletteMapForGrayscale(this._backGround, this._foreGround); + } + + public get ink(): number + { + return this._ink; + } + + public get colorTransform(): AdjustmentFilter + { + return this._colorTransform; + } + + public get reds(): number[] + { + return this._colorMap.get('reds'); + } + + public get greens(): number[] + { + return this._colorMap.get('greens'); + } + + public get blues(): number[] + { + return this._colorMap.get('blues'); + } + + public get alphas(): number[] + { + return this._colorMap.get('alphas'); + } + + public get paletteIsGrayscale(): boolean + { + return this._paletteIsGrayscale; + } + + private generatePaletteMapForGrayscale(background: number, foreground: number): Map + { + const alphaBackground = ((background >> 24) & 0xFF); + const redBackground = ((background >> 16) & 0xFF); + const greenBackground = ((background >> 8) & 0xFF); + const blueBackground = ((background >> 0) & 0xFF); + const alphaForeground = ((foreground >> 24) & 0xFF); + const redForeground = ((foreground >> 16) & 0xFF); + const greenForeground = ((foreground >> 8) & 0xFF); + const blueForeground = ((foreground >> 0) & 0xFF); + const alphaDifference = ((alphaForeground - alphaBackground) / 0xFF); + const redDifference = ((redForeground - redBackground) / 0xFF); + const greenDifference = ((greenForeground - greenBackground) / 0xFF); + const blueDifference = ((blueForeground - blueBackground) / 0xFF); + const _local_15: Map = new Map(); + const _local_16: number[] = []; + const _local_17: number[] = []; + const _local_18: number[] = []; + const _local_19: number[] = []; + let _local_20 = alphaBackground; + let _local_21 = redBackground; + let _local_22 = greenBackground; + let _local_23 = blueBackground; + + for(let i = 0; i < 256; i++) + { + if((((_local_21 == redBackground) && (_local_22 == greenBackground)) && (_local_23 == blueBackground))) + { + _local_20 = 0; + } + _local_20 = (_local_20 + alphaDifference); + _local_21 = (_local_21 + redDifference); + _local_22 = (_local_22 + greenDifference); + _local_23 = (_local_23 + blueDifference); + _local_19.push((_local_20 << 24)); + _local_16.push(((((_local_20 << 24) | (_local_21 << 16)) | (_local_22 << 8)) | _local_23)); + _local_17.push(((((_local_20 << 24) | (_local_21 << 16)) | (_local_22 << 8)) | _local_23)); + _local_18.push(((((_local_20 << 24) | (_local_21 << 16)) | (_local_22 << 8)) | _local_23)); + } + + _local_15.set('alphas', _local_16); + _local_15.set('reds', _local_16); + _local_15.set('greens', _local_17); + _local_15.set('blues', _local_18); + + return _local_15; + } +} diff --git a/submodules/renderer/src/nitro/avatar/animation/DirectionDataContainer.ts b/submodules/renderer/src/nitro/avatar/animation/DirectionDataContainer.ts new file mode 100644 index 0000000..74cb246 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/animation/DirectionDataContainer.ts @@ -0,0 +1,16 @@ +import { IAssetAnimationDirection } from '../../../api'; + +export class DirectionDataContainer +{ + private _offset: number; + + constructor(k: IAssetAnimationDirection) + { + this._offset = k.offset; + } + + public get offset(): number + { + return this._offset; + } +} diff --git a/submodules/renderer/src/nitro/avatar/animation/SpriteDataContainer.ts b/submodules/renderer/src/nitro/avatar/animation/SpriteDataContainer.ts new file mode 100644 index 0000000..e3c818e --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/animation/SpriteDataContainer.ts @@ -0,0 +1,94 @@ +import { IAnimation, IAssetAnimationSprite, ISpriteDataContainer } from '../../../api'; + +export class SpriteDataContainer implements ISpriteDataContainer +{ + private _animation: IAnimation; + private _id: string; + private _ink: number; + private _member: string; + private _hasDirections: boolean; + private _hasStaticY: boolean; + private _dx: number[]; + private _dy: number[]; + private _dz: number[]; + + constructor(k: IAnimation, _arg_2: IAssetAnimationSprite) + { + this._animation = k; + this._id = _arg_2.id; + this._ink = _arg_2.ink; + this._member = _arg_2.member; + this._hasStaticY = _arg_2.staticY ? true : false; + this._hasDirections = _arg_2.directions ? true : false; + this._dx = []; + this._dy = []; + this._dz = []; + + const directions = _arg_2.directionList; + + if(directions && directions.length) + { + for(const direction of directions) + { + const id = direction.id; + + if(id === undefined) continue; + + this._dx[id] = (direction.dx || 0); + this._dy[id] = (direction.dy || 0); + this._dz[id] = (direction.dz || 0); + } + } + } + + public getDirectionOffsetX(k: number): number + { + if(k < this._dx.length) return this._dx[k]; + + return 0; + } + + public getDirectionOffsetY(k: number): number + { + if(k < this._dy.length) return this._dy[k]; + + return 0; + } + + public getDirectionOffsetZ(k: number): number + { + if(k < this._dz.length) return this._dz[k]; + + return 0; + } + + public get animation(): IAnimation + { + return this._animation; + } + + public get id(): string + { + return this._id; + } + + public get ink(): number + { + return this._ink; + } + + public get member(): string + { + return this._member; + } + + public get hasDirections(): boolean + { + return this._hasDirections; + } + + public get hasStaticY(): boolean + { + return this._hasStaticY; + } +} diff --git a/submodules/renderer/src/nitro/avatar/animation/index.ts b/submodules/renderer/src/nitro/avatar/animation/index.ts new file mode 100644 index 0000000..f2e83c4 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/animation/index.ts @@ -0,0 +1,7 @@ +export * from './AddDataContainer'; +export * from './Animation'; +export * from './AnimationManager'; +export * from './AvatarAnimationLayerData'; +export * from './AvatarDataContainer'; +export * from './DirectionDataContainer'; +export * from './SpriteDataContainer'; diff --git a/submodules/renderer/src/nitro/avatar/cache/AvatarImageActionCache.ts b/submodules/renderer/src/nitro/avatar/cache/AvatarImageActionCache.ts new file mode 100644 index 0000000..5cc57fe --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/cache/AvatarImageActionCache.ts @@ -0,0 +1,57 @@ +import { GetTickerTime } from '../../../pixi-proxy'; +import { AvatarImageDirectionCache } from './AvatarImageDirectionCache'; + +export class AvatarImageActionCache +{ + private _cache: Map; + private _lastAccessTime: number; + + constructor() + { + this._cache = new Map(); + + this.setLastAccessTime(GetTickerTime()); + } + + public dispose(): void + { + this.debugInfo('[dispose]'); + + if(!this._cache) return; + + for(const direction of this._cache.values()) + { + if(direction) direction.dispose(); + } + + this._cache.clear(); + } + + public getDirectionCache(k: number): AvatarImageDirectionCache + { + const existing = this._cache.get(k.toString()); + + if(!existing) return null; + + return existing; + } + + public updateDirectionCache(k: number, _arg_2: AvatarImageDirectionCache): void + { + this._cache.set(k.toString(), _arg_2); + } + + public setLastAccessTime(k: number): void + { + this._lastAccessTime = k; + } + + public getLastAccessTime(): number + { + return this._lastAccessTime; + } + + private debugInfo(k: string): void + { + } +} diff --git a/submodules/renderer/src/nitro/avatar/cache/AvatarImageBodyPartCache.ts b/submodules/renderer/src/nitro/avatar/cache/AvatarImageBodyPartCache.ts new file mode 100644 index 0000000..660355a --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/cache/AvatarImageBodyPartCache.ts @@ -0,0 +1,96 @@ +import { IActiveActionData } from '../../../api'; +import { AvatarImageActionCache } from './AvatarImageActionCache'; + +export class AvatarImageBodyPartCache +{ + private _cache: Map; + private _currentAction: IActiveActionData; + private _currentDirection: number; + private _disposed: boolean; + + constructor() + { + this._cache = new Map(); + } + + public setAction(k: IActiveActionData, _arg_2: number): void + { + if(!this._currentAction) this._currentAction = k; + + const _local_3 = this.getActionCache(this._currentAction); + + if(_local_3) _local_3.setLastAccessTime(_arg_2); + + this._currentAction = k; + } + + public dispose(): void + { + if(!this._disposed) + { + if(!this._cache) return; + + this.disposeActions(0, 2147483647); + + this._cache.clear(); + + this._cache = null; + this._disposed = true; + } + } + + public disposeActions(k: number, _arg_2: number): void + { + if(!this._cache || this._disposed) return; + + for(const [key, cache] of this._cache.entries()) + { + if(!cache) continue; + + const _local_3 = cache.getLastAccessTime(); + + if((_arg_2 - _local_3) >= k) + { + cache.dispose(); + + this._cache.delete(key); + } + } + } + + public getAction(): IActiveActionData + { + return this._currentAction; + } + + public setDirection(k: number): void + { + this._currentDirection = k; + } + + public getDirection(): number + { + return this._currentDirection; + } + + public getActionCache(k: IActiveActionData = null): AvatarImageActionCache + { + if(!this._currentAction) return null; + + if(!k) k = this._currentAction; + + if(k.overridingAction) return this._cache.get(k.overridingAction); + + return this._cache.get(k.id); + } + + public updateActionCache(k: IActiveActionData, _arg_2: AvatarImageActionCache): void + { + if(k.overridingAction) this._cache.set(k.overridingAction, _arg_2); + else this._cache.set(k.id, _arg_2); + } + + private debugInfo(k: string): void + { + } +} diff --git a/submodules/renderer/src/nitro/avatar/cache/AvatarImageCache.ts b/submodules/renderer/src/nitro/avatar/cache/AvatarImageCache.ts new file mode 100644 index 0000000..beb4a06 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/cache/AvatarImageCache.ts @@ -0,0 +1,522 @@ +import { Texture } from '@pixi/core'; +import { Matrix, Point, Rectangle } from '@pixi/math'; +import { AvatarDirectionAngle, AvatarFigurePartType, AvatarScaleType, GeometryType, IActiveActionData, IAvatarImage, RoomObjectSpriteData } from '../../../api'; +import { GetTickerTime, NitroContainer, NitroSprite } from '../../../pixi-proxy'; +import { AssetAliasCollection } from '../alias'; +import { AvatarAnimationLayerData } from '../animation'; +import { AvatarImageBodyPartContainer } from '../AvatarImageBodyPartContainer'; +import { AvatarImagePartContainer } from '../AvatarImagePartContainer'; +import { AvatarStructure } from '../AvatarStructure'; +import { AvatarCanvas } from '../structure'; +import { AvatarImageActionCache } from './AvatarImageActionCache'; +import { AvatarImageBodyPartCache } from './AvatarImageBodyPartCache'; +import { AvatarImageDirectionCache } from './AvatarImageDirectionCache'; +import { ImageData } from './ImageData'; + +export class AvatarImageCache +{ + private static DEFAULT_MAX_CACHE_STORAGE_TIME_MS: number = 60000; + + private _structure: AvatarStructure; + private _avatar: IAvatarImage; + private _assets: AssetAliasCollection; + private _scale: string; + private _cache: Map; + private _canvas: AvatarCanvas; + private _disposed: boolean; + private _geometryType: string; + private _unionImages: ImageData[]; + private _matrix: Matrix; + private _serverRenderData: RoomObjectSpriteData[]; + + constructor(k: AvatarStructure, _arg_2: IAvatarImage, _arg_3: AssetAliasCollection, _arg_4: string) + { + this._structure = k; + this._avatar = _arg_2; + this._assets = _arg_3; + this._scale = _arg_4; + this._cache = new Map(); + this._canvas = null; + this._disposed = false; + this._unionImages = []; + this._matrix = new Matrix(); + this._serverRenderData = []; + } + + public dispose(): void + { + if(this._disposed) return; + + this._structure = null; + this._avatar = null; + this._assets = null; + this._canvas = null; + this._disposed = true; + + if(this._cache) + { + for(const cache of this._cache.values()) + { + if(!cache) continue; + + cache.dispose(); + } + + this._cache = null; + } + + if(this._unionImages) + { + for(const image of this._unionImages) + { + if(!image) continue; + + image.dispose(); + } + + this._unionImages = []; + } + } + + public disposeInactiveActions(k: number = 60000): void + { + const time = GetTickerTime(); + + if(this._cache) + { + for(const cache of this._cache.values()) + { + if(!cache) continue; + + cache.disposeActions(k, time); + } + } + } + + public resetBodyPartCache(k: IActiveActionData): void + { + if(this._cache) + { + for(const cache of this._cache.values()) + { + if(!cache) continue; + + cache.setAction(k, 0); + } + } + } + + public setDirection(k: string, _arg_2: number): void + { + const parts = this._structure.getBodyPartsUnordered(k); + + if(parts) + { + for(const part of parts) + { + const actionCache = this.getBodyPartCache(part); + + if(!actionCache) continue; + + actionCache.setDirection(_arg_2); + } + } + } + + public setAction(k: IActiveActionData, _arg_2: number): void + { + const _local_3 = this._structure.getActiveBodyPartIds(k, this._avatar); + + for(const _local_4 of _local_3) + { + const _local_5 = this.getBodyPartCache(_local_4); + + if(_local_5) _local_5.setAction(k, _arg_2); + } + } + + public setGeometryType(k: string): void + { + if(this._geometryType === k) return; + + if((((this._geometryType === GeometryType.SITTING) && (k === GeometryType.VERTICAL)) || ((this._geometryType === GeometryType.VERTICAL) && (k === GeometryType.SITTING)) || ((this._geometryType === GeometryType.SNOWWARS_HORIZONTAL) && (k = GeometryType.SNOWWARS_HORIZONTAL)))) + { + this._geometryType = k; + this._canvas = null; + + return; + } + + this.disposeInactiveActions(0); + + this._geometryType = k; + this._canvas = null; + } + + public getImageContainer(k: string, frameNumber: number, _arg_3: boolean = false): AvatarImageBodyPartContainer + { + let _local_4 = this.getBodyPartCache(k); + + if(!_local_4) + { + _local_4 = new AvatarImageBodyPartCache(); + + this._cache.set(k, _local_4); + } + + let _local_5 = _local_4.getDirection(); + let _local_7 = _local_4.getAction(); + let frameCount = frameNumber; + + if(_local_7.definition.startFromFrameZero) frameCount -= _local_7.startFrame; + + let _local_8 = _local_7; + let _local_9: string[] = []; + let _local_10: Map = new Map(); + const _local_11 = new Point(); + + if(!((!(_local_7)) || (!(_local_7.definition)))) + { + if(_local_7.definition.isAnimation) + { + let _local_15 = _local_5; + + const _local_16 = this._structure.getAnimation(((_local_7.definition.state + '.') + _local_7.actionParameter)); + const _local_17 = (frameNumber - _local_7.startFrame); + + if(_local_16) + { + const _local_18 = _local_16.getLayerData(_local_17, k, _local_7.overridingAction); + + if(_local_18) + { + _local_15 = (_local_5 + _local_18.dd); + + if(_local_18.dd < 0) + { + if(_local_15 < 0) + { + _local_15 = (8 + _local_15); + } + else if(_local_15 > 7) _local_15 = (8 - _local_15); + } + else + { + if(_local_15 < 0) + { + _local_15 = (_local_15 + 8); + } + else if(_local_15 > 7) _local_15 = (_local_15 - 8); + } + + if(this._scale === AvatarScaleType.LARGE) + { + _local_11.x = _local_18.dx; + _local_11.y = _local_18.dy; + } + else + { + _local_11.x = (_local_18.dx / 2); + _local_11.y = (_local_18.dy / 2); + } + + frameCount = _local_18.animationFrame; + + if(_local_18.action) + { + _local_7 = _local_18.action; + } + + if(_local_18.type === AvatarAnimationLayerData.BODYPART) + { + if(_local_18.action != null) + { + _local_8 = _local_18.action; + } + + _local_5 = _local_15; + } + else if(_local_18.type === AvatarAnimationLayerData.FX) _local_5 = _local_15; + + _local_10 = _local_18.items; + } + + _local_9 = _local_16.removeData; + } + } + } + + let _local_12 = _local_4.getActionCache(_local_8); + + if(!_local_12 || _arg_3) + { + _local_12 = new AvatarImageActionCache(); + _local_4.updateActionCache(_local_8, _local_12); + } + + let _local_13 = _local_12.getDirectionCache(_local_5); + + if(!_local_13 || _arg_3) + { + const _local_19 = this._structure.getParts(k, this._avatar.getFigure(), _local_8, this._geometryType, _local_5, _local_9, this._avatar, _local_10); + + _local_13 = new AvatarImageDirectionCache(_local_19); + + _local_12.updateDirectionCache(_local_5, _local_13); + } + + let _local_14 = _local_13.getImageContainer(frameCount); + + if(!_local_14 || _arg_3) + { + const _local_20 = _local_13.getPartList(); + + _local_14 = this.renderBodyPart(_local_5, _local_20, frameCount, _local_7, _arg_3); + + if(_local_14 && !_arg_3) + { + if(_local_14.isCacheable) _local_13.updateImageContainer(_local_14, frameCount); + } + else + { + return null; + } + } + + const offset = this._structure.getFrameBodyPartOffset(_local_8, _local_5, frameCount, k); + + _local_11.x += offset.x; + _local_11.y += offset.y; + + _local_14.offset = _local_11; + + return _local_14; + } + + public getServerRenderData(): any[] + { + this._serverRenderData = []; + + return this._serverRenderData; + } + + public getBodyPartCache(k: string): AvatarImageBodyPartCache + { + let existing = this._cache.get(k); + + if(!existing) + { + existing = new AvatarImageBodyPartCache(); + + this._cache.set(k, existing); + } + + return existing; + } + + private renderBodyPart(direction: number, containers: AvatarImagePartContainer[], frameCount: number, _arg_4: IActiveActionData, renderServerData: boolean = false): AvatarImageBodyPartContainer + { + if(!containers || !containers.length) return null; + + if(!this._canvas) + { + this._canvas = this._structure.getCanvas(this._scale, this._geometryType); + + if(!this._canvas) return null; + } + + const isFlipped = AvatarDirectionAngle.DIRECTION_IS_FLIPPED[direction] || false; + let assetPartDefinition = _arg_4.definition.assetPartDefinition; + let isCacheable = true; + let containerIndex = (containers.length - 1); + + while(containerIndex >= 0) + { + const container = containers[containerIndex]; + + let color = 16777215; + + if(!((direction == 7) && ((container.partType === 'fc') || (container.partType === 'ey')))) + { + if(!((container.partType === 'ri') && !container.partId)) + { + const partId = container.partId; + const animationFrame = container.getFrameDefinition(frameCount); + + let partType = container.partType; + let frameNumber = 0; + + if(animationFrame) + { + frameNumber = animationFrame.number; + + if((animationFrame.assetPartDefinition) && (animationFrame.assetPartDefinition !== '')) assetPartDefinition = animationFrame.assetPartDefinition; + } + else frameNumber = container.getFrameIndex(frameCount); + + let assetDirection = direction; + let flipH = false; + + if(isFlipped) + { + if(((assetPartDefinition === 'wav') && (((partType === AvatarFigurePartType.LEFT_HAND) || (partType === AvatarFigurePartType.LEFT_SLEEVE)) || (partType === AvatarFigurePartType.LEFT_COAT_SLEEVE))) || ((assetPartDefinition === 'drk') && (((partType === AvatarFigurePartType.RIGHT_HAND) || (partType === AvatarFigurePartType.RIGHT_SLEEVE)) || (partType === AvatarFigurePartType.RIGHT_COAT_SLEEVE))) || ((assetPartDefinition === 'blw') && (partType === AvatarFigurePartType.RIGHT_HAND)) || ((assetPartDefinition === 'sig') && (partType === AvatarFigurePartType.LEFT_HAND)) || ((assetPartDefinition === 'respect') && (partType === AvatarFigurePartType.LEFT_HAND)) || (partType === AvatarFigurePartType.RIGHT_HAND_ITEM) || (partType === AvatarFigurePartType.LEFT_HAND_ITEM) || (partType === AvatarFigurePartType.CHEST_PRINT)) + { + flipH = true; + } + else + { + if(direction === 4) assetDirection = 2; + else if(direction === 5) assetDirection = 1; + else if(direction === 6) assetDirection = 0; + + if(container.flippedPartType !== partType) partType = container.flippedPartType; + } + } + + let assetName = (this._scale + '_' + assetPartDefinition + '_' + partType + '_' + partId + '_' + assetDirection + '_' + frameNumber); + let asset = this._assets.getAsset(assetName); + + if(!asset) + { + assetName = (this._scale + '_std_' + partType + '_' + partId + '_' + assetDirection + '_0'); + asset = this._assets.getAsset(assetName); + } + + if(asset) + { + const texture = asset.texture; + + if(!texture || !texture.valid || !texture.baseTexture) + { + isCacheable = false; + } + else + { + if(container.isColorable && container.color) color = container.color.rgb; + + const offset = new Point(-(asset.x), -(asset.y)); + + if(flipH) offset.x = (offset.x + ((this._scale === AvatarScaleType.LARGE) ? 65 : 31)); + + if(renderServerData) + { + const spriteData = new RoomObjectSpriteData(); + + spriteData.name = this._assets.getAssetName(assetName); + spriteData.x = (-(offset.x) - 33); + spriteData.y = -(offset.y); + spriteData.z = (this._serverRenderData.length * -0.0001); + spriteData.width = asset.rectangle.width; + spriteData.height = asset.rectangle.height; + spriteData.flipH = flipH; + + if(assetPartDefinition === 'lay') spriteData.x = (spriteData.x + 53); + + if(isFlipped) + { + spriteData.flipH = (!(spriteData.flipH)); + + if(spriteData.flipH) spriteData.x = (-(spriteData.x) - texture.width); + else spriteData.x = (spriteData.x + 65); + } + + if(container.isColorable) spriteData.color = `${color}`; + + this._serverRenderData.push(spriteData); + } + + this._unionImages.push(new ImageData(texture, asset.rectangle, offset, flipH, color)); + } + } + } + } + + containerIndex--; + } + + if(!this._unionImages.length) return null; + + const imageData = this.createUnionImage(this._unionImages, isFlipped); + const canvasOffset = ((this._scale === AvatarScaleType.LARGE) ? (this._canvas.height - 16) : (this._canvas.height - 8)); + const offset = new Point(-(imageData.regPoint.x), (canvasOffset - imageData.regPoint.y)); + + if(isFlipped && (assetPartDefinition !== 'lay')) offset.x = (offset.x + ((this._scale === AvatarScaleType.LARGE) ? 67 : 31)); + + let imageIndex = (this._unionImages.length - 1); + + while(imageIndex >= 0) + { + const _local_17 = this._unionImages.pop(); + + if(_local_17) _local_17.dispose(); + + imageIndex--; + } + + return new AvatarImageBodyPartContainer(imageData.container, offset, isCacheable); + } + + private convertColorToHex(k: number): string + { + let _local_2: string = (k * 0xFF).toString(16); + if(_local_2.length < 2) + { + _local_2 = ('0' + _local_2); + } + return _local_2; + } + + private createUnionImage(k: ImageData[], isFlipped: boolean): ImageData + { + const bounds = new Rectangle(); + + for(const data of k) data && bounds.enlarge(data.offsetRect); + + const point = new Point(-(bounds.x), -(bounds.y)); + const container = new NitroContainer(); + + const sprite = new NitroSprite(Texture.EMPTY); + + sprite.width = bounds.width; + sprite.height = bounds.height; + + container.addChild(sprite); + + for(const data of k) + { + if(!data) continue; + + const texture = data.texture; + const color = data.colorTransform; + const flipH = (!(isFlipped && data.flipH) && (isFlipped || data.flipH)); + const regPoint = point.clone(); + + regPoint.x -= data.regPoint.x; + regPoint.y -= data.regPoint.y; + + if(isFlipped) regPoint.x = (container.width - (regPoint.x + data.rect.width)); + + if(flipH) + { + this._matrix.a = -1; + this._matrix.tx = ((data.rect.x + data.rect.width) + regPoint.x); + this._matrix.ty = (regPoint.y - data.rect.y); + } + else + { + this._matrix.a = 1; + this._matrix.tx = (regPoint.x - data.rect.x); + this._matrix.ty = (regPoint.y - data.rect.y); + } + + const sprite = new NitroSprite(texture); + + sprite.tint = color; + sprite.transform.setFromMatrix(this._matrix); + + container.addChild(sprite); + } + + return new ImageData(null, container.getLocalBounds(), point, isFlipped, null, container); + } +} diff --git a/submodules/renderer/src/nitro/avatar/cache/AvatarImageDirectionCache.ts b/submodules/renderer/src/nitro/avatar/cache/AvatarImageDirectionCache.ts new file mode 100644 index 0000000..da3a75e --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/cache/AvatarImageDirectionCache.ts @@ -0,0 +1,59 @@ +import { AvatarImageBodyPartContainer } from '../AvatarImageBodyPartContainer'; +import { AvatarImagePartContainer } from '../AvatarImagePartContainer'; + +export class AvatarImageDirectionCache +{ + private _partList: AvatarImagePartContainer[]; + private _images: Map; + + constructor(k: AvatarImagePartContainer[]) + { + this._partList = k; + this._images = new Map(); + } + + public dispose(): void + { + for(const image of this._images.values()) image && image.dispose(); + + this._images = null; + } + + public getPartList(): AvatarImagePartContainer[] + { + return this._partList; + } + + public getImageContainer(k: number): AvatarImageBodyPartContainer + { + const existing = this._images.get(this.getCacheKey(k)); + + if(!existing) return null; + + return existing; + } + + public updateImageContainer(k: AvatarImageBodyPartContainer, _arg_2: number): void + { + const name = this.getCacheKey(_arg_2); + + const existing = this._images.get(name); + + if(existing) existing.dispose(); + + this._images.set(name, k); + } + + private getCacheKey(k: number): string + { + let name = ''; + + for(const part of this._partList) name += (part.getCacheableKey(k) + '/'); + + return name; + } + + private debugInfo(k: string): void + { + } +} diff --git a/submodules/renderer/src/nitro/avatar/cache/ImageData.ts b/submodules/renderer/src/nitro/avatar/cache/ImageData.ts new file mode 100644 index 0000000..82b8339 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/cache/ImageData.ts @@ -0,0 +1,67 @@ +import { Resource, Texture } from '@pixi/core'; +import { Container } from '@pixi/display'; +import { Point, Rectangle } from '@pixi/math'; + +export class ImageData +{ + private _texture: Texture; + private _container: Container; + private _rect: Rectangle; + private _regPoint: Point; + private _flipH: boolean; + private _colorTransform: number; + + constructor(texture: Texture, rectangle: Rectangle, _arg_3: Point, flipH: boolean, color: number, container: Container = null) + { + this._texture = texture; + this._container = container; + this._rect = rectangle; + this._regPoint = _arg_3; + this._flipH = flipH; + this._colorTransform = color; + + if(flipH) this._regPoint.x = (-(this._regPoint.x) + rectangle.width); + } + + public dispose(): void + { + this._texture = null; + this._regPoint = null; + this._colorTransform = null; + } + + public get texture(): Texture + { + return this._texture; + } + + public get container(): Container + { + return this._container; + } + + public get rect(): Rectangle + { + return this._rect; + } + + public get regPoint(): Point + { + return this._regPoint; + } + + public get flipH(): boolean + { + return this._flipH; + } + + public get colorTransform(): number + { + return this._colorTransform; + } + + public get offsetRect(): Rectangle + { + return new Rectangle(-(this._regPoint.x), -(this._regPoint.y), this._rect.width, this._rect.height); + } +} diff --git a/submodules/renderer/src/nitro/avatar/cache/index.ts b/submodules/renderer/src/nitro/avatar/cache/index.ts new file mode 100644 index 0000000..d8d2e53 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/cache/index.ts @@ -0,0 +1,5 @@ +export * from './AvatarImageActionCache'; +export * from './AvatarImageBodyPartCache'; +export * from './AvatarImageCache'; +export * from './AvatarImageDirectionCache'; +export * from './ImageData'; diff --git a/submodules/renderer/src/nitro/avatar/data/HabboAvatarAnimations.ts b/submodules/renderer/src/nitro/avatar/data/HabboAvatarAnimations.ts new file mode 100644 index 0000000..f1fc2cc --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/data/HabboAvatarAnimations.ts @@ -0,0 +1,827 @@ +export const HabboAvatarAnimations = { + 'animations': [ + { + 'id': 'Move', + 'parts': [ + { + 'setType': 'bd', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 1, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 2, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 3, + 'assetPartDefinition': 'wlk' + } + ] + }, + { + 'setType': 'bds', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 1, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 2, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 3, + 'assetPartDefinition': 'wlk' + } + ] + }, + { + 'setType': 'ss', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 1, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 2, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 3, + 'assetPartDefinition': 'wlk' + } + ] + }, + { + 'setType': 'lg', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 1, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 2, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 3, + 'assetPartDefinition': 'wlk' + } + ] + }, + { + 'setType': 'sh', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 1, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 2, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 3, + 'assetPartDefinition': 'wlk' + } + ] + }, + { + 'setType': 'lh', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 1, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 2, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 3, + 'assetPartDefinition': 'wlk' + } + ] + }, + { + 'setType': 'lhs', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 1, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 2, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 3, + 'assetPartDefinition': 'wlk' + } + ] + }, + { + 'setType': 'ls', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 1, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 2, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 3, + 'assetPartDefinition': 'wlk' + } + ] + }, + { + 'setType': 'lc', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 1, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 2, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 3, + 'assetPartDefinition': 'wlk' + } + ] + }, + { + 'setType': 'rh', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 1, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 2, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 3, + 'assetPartDefinition': 'wlk' + } + ] + }, + { + 'setType': 'rhs', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 1, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 2, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 3, + 'assetPartDefinition': 'wlk' + } + ] + }, + { + 'setType': 'rs', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 1, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 2, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 3, + 'assetPartDefinition': 'wlk' + } + ] + }, + { + 'setType': 'rc', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 1, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 2, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 3, + 'assetPartDefinition': 'wlk' + } + ] + }, + { + 'setType': 'ch', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 1, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 2, + 'assetPartDefinition': 'wlk' + }, + { + 'number': 3, + 'assetPartDefinition': 'wlk' + } + ] + } + ] + }, + { + 'id': 'Wave', + 'parts': [ + { + 'setType': 'lh', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wav' + }, + { + 'number': 1, + 'assetPartDefinition': 'wav' + } + ] + }, + { + 'setType': 'lhs', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wav' + }, + { + 'number': 1, + 'assetPartDefinition': 'wav' + } + ] + }, + { + 'setType': 'ls', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wav' + }, + { + 'number': 1, + 'assetPartDefinition': 'wav' + } + ] + }, + { + 'setType': 'lc', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wav' + }, + { + 'number': 1, + 'assetPartDefinition': 'wav' + } + ] + }, + { + 'setType': 'ch', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wav' + }, + { + 'number': 1, + 'assetPartDefinition': 'wav' + }, + { + 'number': 2, + 'assetPartDefinition': 'wav' + }, + { + 'number': 3, + 'assetPartDefinition': 'wav' + } + ] + } + ] + }, + { + 'id': 'Talk', + 'parts': [ + { + 'setType': 'hd', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'spk' + }, + { + 'number': 1, + 'assetPartDefinition': 'spk' + } + ] + }, + { + 'setType': 'fc', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'spk' + }, + { + 'number': 1, + 'assetPartDefinition': 'spk' + } + ] + }, + { + 'setType': 'fa', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'spk' + }, + { + 'number': 1, + 'assetPartDefinition': 'spk' + } + ] + } + ] + }, + { + 'id': 'Sign', + 'parts': [ + { + 'setType': 'lh', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'sig' + } + ] + }, + { + 'setType': 'li', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'sig' + } + ] + }, + { + 'setType': 'ls', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wav' + } + ] + }, + { + 'setType': 'lc', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wav' + } + ] + } + ] + }, + { + 'id': 'Respect', + 'parts': [ + { + 'setType': 'lh', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'respect', + 'repeats': 15 + }, + { + 'number': 1, + 'assetPartDefinition': 'respect', + 'repeats': 15 + } + ] + }, + { + 'setType': 'ls', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wav', + 'repeats': 15 + }, + { + 'number': 1, + 'assetPartDefinition': 'wav', + 'repeats': 15 + } + ] + }, + { + 'setType': 'lc', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'wav', + 'repeats': 15 + }, + { + 'number': 1, + 'assetPartDefinition': 'wav', + 'repeats': 15 + } + ] + } + ] + }, + { + 'id': 'Blow', + 'parts': [ + { + 'setType': 'rh', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'blw', + 'repeats': 10 + }, + { + 'number': 1, + 'assetPartDefinition': 'blw', + 'repeats': 10 + } + ] + }, + { + 'setType': 'rs', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'drk' + } + ] + }, + { + 'setType': 'rc', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'drk' + } + ] + }, + { + 'setType': 'ri', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': '' + } + ] + }, + { + 'setType': 'ey', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'std', + 'repeats': 10 + }, + { + 'number': 0, + 'assetPartDefinition': 'eyb', + 'repeats': 10 + } + ] + }, + { + 'setType': 'fc', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'std', + 'repeats': 10 + }, + { + 'number': 0, + 'assetPartDefinition': 'blw', + 'repeats': 10 + } + ] + } + ] + }, + { + 'id': 'Laugh', + 'parts': [ + { + 'setType': 'rh', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'blw' + } + ] + }, + { + 'setType': 'rs', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'drk' + } + ] + }, + { + 'setType': 'rc', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'drk' + } + ] + }, + { + 'setType': 'ri', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': '' + } + ] + }, + { + 'setType': 'ey', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'std', + 'repeats': 2 + } + ] + }, + { + 'setType': 'fc', + 'frames': [ + { + 'number': 0, + 'assetPartDefinition': 'sml' + } + ] + } + ], + 'offsets': { + 'frames': [ + { + 'id': 0, + 'directions': [ + { + 'id': 0, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 1 + } + ] + }, + { + 'id': 1, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 1 + } + ] + }, + { + 'id': 2, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 1 + } + ] + }, + { + 'id': 3, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 1 + } + ] + }, + { + 'id': 4, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 1 + } + ] + }, + { + 'id': 5, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 1 + } + ] + }, + { + 'id': 6, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 1 + } + ] + }, + { + 'id': 7, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 1 + } + ] + } + ] + }, + { + 'id': 1, + 'directions': [ + { + 'id': 0, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 0 + } + ] + }, + { + 'id': 1, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 0 + } + ] + }, + { + 'id': 2, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 0 + } + ] + }, + { + 'id': 3, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 0 + } + ] + }, + { + 'id': 4, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 0 + } + ] + }, + { + 'id': 5, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 0 + } + ] + }, + { + 'id': 6, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 0 + } + ] + }, + { + 'id': 7, + 'bodyParts': [ + { + 'id': 'head', + 'dx': 0, + 'dy': 0 + } + ] + } + ] + } + ] + } + } + ] +}; diff --git a/submodules/renderer/src/nitro/avatar/data/HabboAvatarGeometry.ts b/submodules/renderer/src/nitro/avatar/data/HabboAvatarGeometry.ts new file mode 100644 index 0000000..e6b9db0 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/data/HabboAvatarGeometry.ts @@ -0,0 +1,1830 @@ +export const HabboAvatarGeometry = { + 'geometry': { + 'direction': 0, + 'camera': { + 'x': 0, + 'y': 0, + 'z': 10 + }, + 'canvases': [ + { + 'scale': 'h', + 'geometries': [ + { + 'id': 'vertical', + 'width': 90, + 'height': 130, + 'dx': 0, + 'dy': 0 + }, + { + 'id': 'sitting', + 'width': 90, + 'height': 130, + 'dx': 0, + 'dy': 0 + }, + { + 'id': 'horizontal', + 'width': 128, + 'height': 80, + 'dx': 30, + 'dy': 0 + }, + { + 'id': 'swhorizontal', + 'width': 192, + 'height': 120, + 'dx': 0, + 'dy': -40 + } + ] + }, + { + 'scale': 'sh', + 'geometries': [ + { + 'id': 'vertical', + 'width': 45, + 'height': 72, + 'dx': 0, + 'dy': 0 + }, + { + 'id': 'sitting', + 'width': 45, + 'height': 72, + 'dx': 0, + 'dy': 0 + }, + { + 'id': 'horizontal', + 'width': 64, + 'height': 50, + 'dx': 15, + 'dy': -10 + }, + { + 'id': 'swhorizontal', + 'width': 96, + 'height': 70, + 'dx': 0, + 'dy': -20 + }, + { + 'id': 'swim', + 'width': 64, + 'height': 70, + 'dx': 25, + 'dy': 10 + } + ] + } + ], + 'avatarSets': [ + { + 'id': 'full', + 'avatarSets': [ + { + 'id': 'body', + 'main': true, + 'bodyParts': [ + { + 'id': 'top' + }, + { + 'id': 'bottom' + }, + { + 'id': 'behind' + }, + { + 'id': 'torso' + }, + { + 'id': 'leftitem' + }, + { + 'id': 'rightitem' + }, + { + 'id': 'leftarm' + }, + { + 'id': 'rightarm' + } + ] + }, + { + 'id': 'head', + 'bodyParts': [ + { + 'id': 'head' + } + ] + } + ] + } + ], + 'types': [ + { + 'id': 'vertical', + 'bodyParts': [ + { + 'id': 'top', + 'x': 0, + 'y': 0, + 'z': 0.0, + 'radius': 2.0 + }, + { + 'id': 'bottom', + 'x': 0, + 'y': 0, + 'z': 0.0, + 'radius': 0.001 + }, + { + 'id': 'behind', + 'x': 0, + 'y': 0, + 'z': 0.2, + 'radius': 0.3 + }, + { + 'id': 'torso', + 'x': 0, + 'y': 0, + 'z': 0.0, + 'radius': 0.4, + 'items': [ + { + 'id': 'bd', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'bds', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'ch', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'sh', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'lg', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.03, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ss', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'cp', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.045, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'wa', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.05, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'cc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.06, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ca', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.07, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'leftitem', + 'x': 0, + 'y': 0, + 'z': -0.29, + 'radius': 0.3, + 'items': [ + { + 'id': 'li', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'rightitem', + 'x': 0, + 'y': 0, + 'z': -0.29, + 'radius': 0.3, + 'items': [ + { + 'id': 'ri', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'leftarm', + 'x': -1, + 'y': 0, + 'z': -0.51, + 'radius': 0.5, + 'items': [ + { + 'id': 'lh', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'lhs', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ls', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'lc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.025, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'rightarm', + 'x': 1, + 'y': 0, + 'z': -0.51, + 'radius': 0.5, + 'items': [ + { + 'id': 'rh', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'rhs', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'rs', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'rc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.025, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'head', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.5, + 'items': [ + { + 'id': 'hd', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'fc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ey', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.03, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'hr', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'hrb', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.05, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'fa', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.06, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ea', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.07, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ha', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.08, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'he', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.09, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + } + ] + }, + { + 'id': 'sitting', + 'bodyParts': [ + { + 'id': 'top', + 'x': 0, + 'y': 0, + 'z': 0.0, + 'radius': 2.0 + }, + { + 'id': 'bottom', + 'x': 0, + 'y': 0, + 'z': 0.0, + 'radius': 0.001 + }, + { + 'id': 'behind', + 'x': 0, + 'y': 0, + 'z': 0.2, + 'radius': 0.3 + }, + { + 'id': 'torso', + 'x': 0, + 'y': 0, + 'z': 0.0, + 'radius': 0.4, + 'items': [ + { + 'id': 'bd', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'bds', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'ch', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.03, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'sh', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'lg', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ss', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'cp', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.045, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'wa', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.05, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'cc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.06, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ca', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.07, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'leftitem', + 'x': 0, + 'y': 0, + 'z': -0.29, + 'radius': 0.3, + 'items': [ + { + 'id': 'li', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'rightitem', + 'x': 0, + 'y': 0, + 'z': -0.29, + 'radius': 0.3, + 'items': [ + { + 'id': 'ri', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'leftarm', + 'x': -1, + 'y': 0, + 'z': -0.51, + 'radius': 0.5, + 'items': [ + { + 'id': 'lh', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'lhs', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ls', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'lc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.025, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'rightarm', + 'x': 1, + 'y': 0, + 'z': -0.51, + 'radius': 0.5, + 'items': [ + { + 'id': 'rh', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'rhs', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'rs', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'rc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.025, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'head', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.5, + 'items': [ + { + 'id': 'hd', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'fc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ey', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.03, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'hr', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'hrb', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.05, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'fa', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.06, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ea', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.07, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ha', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.08, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'he', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.09, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + } + ] + }, + { + 'id': 'horizontal', + 'bodyParts': [ + { + 'id': 'torso', + 'x': 0, + 'y': 0, + 'z': 0.0, + 'radius': 0.4, + 'items': [ + { + 'id': 'bd', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'bds', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'ch', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'cp', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.025, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'sh', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'lg', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.03, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ss', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.03, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'wa', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.05, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'cc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.06, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ca', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.07, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'leftitem', + 'x': 0, + 'y': 0, + 'z': -0.29, + 'radius': 0.3, + 'items': [ + { + 'id': 'li', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'rightitem', + 'x': 0, + 'y': 0, + 'z': -0.29, + 'radius': 0.3, + 'items': [ + { + 'id': 'ri', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'leftarm', + 'x': -1, + 'y': 0, + 'z': -0.51, + 'radius': 0.6, + 'items': [ + { + 'id': 'lh', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'lhs', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ls', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'lc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.025, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'rightarm', + 'x': 1, + 'y': 0, + 'z': -0.51, + 'radius': 0.6, + 'items': [ + { + 'id': 'rh', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'rhs', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'rs', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'rc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.025, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'head', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.5, + 'items': [ + { + 'id': 'hd', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'fc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ey', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.03, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'hr', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'hrb', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.05, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'fa', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.06, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ea', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.07, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ha', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.08, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'he', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.09, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + } + ] + }, + { + 'id': 'swhorizontal', + 'bodyParts': [ + { + 'id': 'torso', + 'x': 0, + 'y': 0, + 'z': 0.0, + 'radius': 0.4, + 'items': [ + { + 'id': 'bd', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'bds', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'ch', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'cp', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.025, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'sh', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'lg', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.03, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ss', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.03, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'wa', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.05, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'cc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.06, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ca', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.07, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'leftitem', + 'x': 0, + 'y': 0, + 'z': -0.29, + 'radius': 0.3, + 'items': [ + { + 'id': 'li', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'rightitem', + 'x': 0, + 'y': 0, + 'z': -0.29, + 'radius': 0.3, + 'items': [ + { + 'id': 'ri', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'leftarm', + 'x': -1, + 'y': 0, + 'z': -0.51, + 'radius': 0.6, + 'items': [ + { + 'id': 'lh', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'lhs', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ls', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'lc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.025, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'rightarm', + 'x': 1, + 'y': 0, + 'z': -0.51, + 'radius': 0.6, + 'items': [ + { + 'id': 'rh', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'rhs', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'rs', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'rc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.025, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'head', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.5, + 'items': [ + { + 'id': 'hd', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'fc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ey', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.03, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'hr', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'hrb', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.05, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'fa', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.06, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ea', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.07, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ha', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.08, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'he', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.09, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + } + ] + }, + { + 'id': 'swim', + 'bodyParts': [ + { + 'id': 'torso', + 'x': 0, + 'y': 0, + 'z': 0.0, + 'radius': 0.4, + 'items': [ + { + 'id': 'bds', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'ss', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.03, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + }, + { + 'id': 'head', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.5, + 'items': [ + { + 'id': 'hd', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.01, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'fc', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.02, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ey', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.03, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'hr', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.04, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'hrb', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.05, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': true + }, + { + 'id': 'fa', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.06, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ea', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.07, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'ha', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.08, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + }, + { + 'id': 'he', + 'x': 0, + 'y': 0, + 'z': 0, + 'radius': 0.09, + 'nx': 0, + 'ny': 0, + 'nz': -1, + 'double': false + } + ] + } + ] + } + ] + } +}; diff --git a/submodules/renderer/src/nitro/avatar/data/HabboAvatarPartSets.ts b/submodules/renderer/src/nitro/avatar/data/HabboAvatarPartSets.ts new file mode 100644 index 0000000..1bd4750 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/data/HabboAvatarPartSets.ts @@ -0,0 +1,418 @@ +export const HabboAvatarPartSets = { + 'partSets': { + 'partSet': [ + { + 'setType': 'ri', + 'flippedSetType': 'ri' + }, + { + 'setType': 'ri', + 'flippedSetType': 'ri' + }, + { + 'setType': 'rh', + 'flippedSetType': 'lh' + }, + { + 'setType': 'rhs', + 'flippedSetType': 'lhs' + }, + { + 'setType': 'rs', + 'swim': '0', + 'flippedSetType': 'ls' + }, + { + 'setType': 'rc', + 'flippedSetType': 'lc' + }, + { + 'setType': 'bd' + }, + { + 'setType': 'bds' + }, + { + 'setType': 'ss' + }, + { + 'setType': 'sh' + }, + { + 'setType': 'lg' + }, + { + 'setType': 'ch' + }, + { + 'setType': 'cp' + }, + { + 'setType': 'cc' + }, + { + 'setType': 'hd' + }, + { + 'setType': 'fc' + }, + { + 'setType': 'ey' + }, + { + 'setType': 'hr' + }, + { + 'setType': 'hrb', + 'removeSetType': 'hr' + }, + { + 'setType': 'li', + 'flippedSetType': 'li' + }, + { + 'setType': 'lh', + 'flippedSetType': 'rh' + }, + { + 'setType': 'lhs', + 'flippedSetType': 'rhs' + }, + { + 'setType': 'ls', + 'flippedSetType': 'rs' + }, + { + 'setType': 'lc', + 'flippedSetType': 'rc' + }, + { + 'setType': 'wa' + }, + { + 'setType': 'ea' + }, + { + 'setType': 'ca' + }, + { + 'setType': 'fa' + }, + { + 'setType': 'ha' + }, + { + 'setType': 'he' + } + ], + 'activePartSets': [ + { + 'id': 'figure', + 'activeParts': [ + { + 'setType': 'rh' + }, + { + 'setType': 'rh' + }, + { + 'setType': 'rhs' + }, + { + 'setType': 'rs' + }, + { + 'setType': 'rc' + }, + { + 'setType': 'bd' + }, + { + 'setType': 'bds' + }, + { + 'setType': 'ss' + }, + { + 'setType': 'sh' + }, + { + 'setType': 'lg' + }, + { + 'setType': 'ch' + }, + { + 'setType': 'cp' + }, + { + 'setType': 'cc' + }, + { + 'setType': 'wa' + }, + { + 'setType': 'hd' + }, + { + 'setType': 'fc' + }, + { + 'setType': 'ey' + }, + { + 'setType': 'hr' + }, + { + 'setType': 'hrb' + }, + { + 'setType': 'lh' + }, + { + 'setType': 'lhs' + }, + { + 'setType': 'ls' + }, + { + 'setType': 'lc' + }, + { + 'setType': 'ea' + }, + { + 'setType': 'ca' + }, + { + 'setType': 'fa' + }, + { + 'setType': 'ha' + }, + { + 'setType': 'he' + } + ] + }, + { + 'id': 'head', + 'activeParts': [ + { + 'setType': 'hd' + }, + { + 'setType': 'fc' + }, + { + 'setType': 'ey' + }, + { + 'setType': 'hr' + }, + { + 'setType': 'hrb' + }, + { + 'setType': 'ea' + }, + { + 'setType': 'fa' + }, + { + 'setType': 'ha' + }, + { + 'setType': 'he' + } + ] + }, + { + 'id': 'speak', + 'activeParts': [ + { + 'setType': 'hd' + }, + { + 'setType': 'hr' + }, + { + 'setType': 'hrb' + }, + { + 'setType': 'fc' + }, + { + 'setType': 'fa' + }, + { + 'setType': 'ha' + } + ] + }, + { + 'id': 'gesture', + 'activeParts': [ + { + 'setType': 'ey' + }, + { + 'setType': 'fc' + } + ] + }, + { + 'id': 'eye', + 'activeParts': [ + { + 'setType': 'ey' + } + ] + }, + { + 'id': 'handRight', + 'activeParts': [ + { + 'setType': 'rh' + }, + { + 'setType': 'rhs' + }, + { + 'setType': 'rs' + }, + { + 'setType': 'rc' + }, + { + 'setType': 'ri' + } + ] + }, + { + 'id': 'handRightAndHead', + 'activeParts': [ + { + 'setType': 'rh' + }, + { + 'setType': 'rhs' + }, + { + 'setType': 'rs' + }, + { + 'setType': 'rc' + }, + { + 'setType': 'ri' + }, + { + 'setType': 'ey' + }, + { + 'setType': 'fc' + }, + { + 'setType': 'hd' + } + ] + }, + { + 'id': 'handLeft', + 'activeParts': [ + { + 'setType': 'lh' + }, + { + 'setType': 'lhs' + }, + { + 'setType': 'ls' + }, + { + 'setType': 'lc' + }, + { + 'setType': 'li' + } + ] + }, + { + 'id': 'walk', + 'activeParts': [ + { + 'setType': 'bd' + }, + { + 'setType': 'bds' + }, + { + 'setType': 'ss' + }, + { + 'setType': 'lg' + }, + { + 'setType': 'lh' + }, + { + 'setType': 'lhs' + }, + { + 'setType': 'rh' + }, + { + 'setType': 'rhs' + }, + { + 'setType': 'ls' + }, + { + 'setType': 'lc' + }, + { + 'setType': 'rs' + }, + { + 'setType': 'rc' + }, + { + 'setType': 'sh' + } + ] + }, + { + 'id': 'sit', + 'activeParts': [ + { + 'setType': 'bd' + }, + { + 'setType': 'bds' + }, + { + 'setType': 'ss' + }, + { + 'setType': 'lg' + }, + { + 'setType': 'sh' + }, + { + 'setType': 'cc' + } + ] + }, + { + 'id': 'itemRight', + 'activeParts': [ + { + 'setType': 'ri' + } + ] + } + ] + } +}; diff --git a/submodules/renderer/src/nitro/avatar/geometry/AvatarModelGeometry.ts b/submodules/renderer/src/nitro/avatar/geometry/AvatarModelGeometry.ts new file mode 100644 index 0000000..0ad6fca --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/geometry/AvatarModelGeometry.ts @@ -0,0 +1,287 @@ +import { IAvatarImage } from '../../../api'; +import { AvatarCanvas } from '../structure'; +import { AvatarSet } from './AvatarSet'; +import { GeometryBodyPart } from './GeometryBodyPart'; +import { Matrix4x4 } from './Matrix4x4'; +import { Vector3D } from './Vector3D'; + +export class AvatarModelGeometry +{ + private _camera: Vector3D; + private _avatarSet: AvatarSet; + private _geometryTypes: Map>; + private _itemIdToBodyPartMap: Map>; + private _transformation: Matrix4x4; + private _canvases: Map>; + + constructor(k: any) + { + this._camera = new Vector3D(0, 0, 10); + this._avatarSet = new AvatarSet(k.avatarSets[0]); + this._geometryTypes = new Map(); + this._itemIdToBodyPartMap = new Map(); + this._transformation = new Matrix4x4(); + this._canvases = new Map(); + + const camera = k.camera; + + if(camera) + { + this._camera.x = parseFloat(camera.x); + this._camera.y = parseFloat(camera.y); + this._camera.z = parseFloat(camera.z); + } + + if(k.canvases && (k.canvases.length > 0)) + { + for(const canvas of k.canvases) + { + if(!canvas) continue; + + const scale = canvas.scale; + const geometries = new Map(); + + if(canvas.geometries && (canvas.geometries.length > 0)) + { + for(const geometry of canvas.geometries) + { + if(!geometry) continue; + + const avatarCanvas = new AvatarCanvas(geometry, scale); + + geometries.set(avatarCanvas.id, avatarCanvas); + } + } + + this._canvases.set(scale, geometries); + } + } + + if(k.types && (k.types.length > 0)) + { + for(const type of k.types) + { + if(!type) continue; + + const bodyParts: Map = new Map(); + const itemIds: Map = new Map(); + + if(type.bodyParts && (type.bodyParts.length > 0)) + { + for(const bodyPart of type.bodyParts) + { + if(!bodyPart) continue; + + const geometryBodyPart = new GeometryBodyPart(bodyPart); + + bodyParts.set(geometryBodyPart.id, geometryBodyPart); + + for(const part of geometryBodyPart.getPartIds(null)) + { + itemIds.set(part, geometryBodyPart); + } + } + } + + this._geometryTypes.set(type.id, bodyParts); + this._itemIdToBodyPartMap.set(type.id, itemIds); + } + } + } + + public removeDynamicItems(k: IAvatarImage): void + { + for(const geometry of this._geometryTypes.values()) + { + if(!geometry) continue; + + for(const part of geometry.values()) + { + if(!part) continue; + + part.removeDynamicParts(k); + } + } + } + + public getBodyPartIdsInAvatarSet(k: string): string[] + { + const avatarSet = this._avatarSet.findAvatarSet(k); + + if(!avatarSet) return []; + + return avatarSet.getBodyParts(); + } + + public isMainAvatarSet(k: string): boolean + { + const avatarSet = this._avatarSet.findAvatarSet(k); + + if(!avatarSet) return false; + + return avatarSet.isMain; + } + + public getCanvas(k: string, _arg_2: string): AvatarCanvas + { + const canvas = this._canvases.get(k); + + if(!canvas) return null; + + return (canvas.get(_arg_2) || null); + } + + private typeExists(k: string): boolean + { + const existing = this._geometryTypes.get(k); + + if(existing) return true; + + return false; + } + + private hasBodyPart(k: string, _arg_2: string): boolean + { + if(this.typeExists(k)) + { + const existing = this._geometryTypes.get(k); + + if(existing && existing.get(_arg_2)) return true; + } + + return false; + } + + private getBodyPartIDs(k: string): string[] + { + const parts = this.getBodyPartsOfType(k); + + const types = []; + + if(parts) + { + for(const part of parts.values()) + { + if(!part) continue; + + types.push(part.id); + } + } + + return types; + } + + private getBodyPartsOfType(k: string): Map + { + if(this.typeExists(k)) return this._geometryTypes.get(k); + + return new Map(); + } + + public getBodyPart(k: string, _arg_2: string): GeometryBodyPart + { + return (this.getBodyPartsOfType(k).get(_arg_2) || null); + } + + public getBodyPartOfItem(k: string, _arg_2: string, _arg_3: IAvatarImage): GeometryBodyPart + { + const itemIds = this._itemIdToBodyPartMap.get(k); + + if(itemIds) + { + const part = itemIds.get(_arg_2); + + if(part) return part; + + const parts = this.getBodyPartsOfType(k); + + if(parts) + { + for(const part of parts.values()) + { + if(!part) continue; + + if(part.hasPart(_arg_2, _arg_3)) return part; + } + } + } + + return null; + } + + private getBodyPartsInAvatarSet(k: Map, _arg_2: string): GeometryBodyPart[] + { + const parts = this.getBodyPartIdsInAvatarSet(_arg_2); + const geometryParts = []; + + for(const part of parts) + { + if(!part) continue; + + const bodyPart = k.get(part); + + if(bodyPart) + { + geometryParts.push(bodyPart); + } + } + + return geometryParts; + } + + public getBodyPartsAtAngle(k: string, _arg_2: number, _arg_3: string): string[] + { + if(!_arg_3) return []; + + const geometryParts = this.getBodyPartsOfType(_arg_3); + const parts = this.getBodyPartsInAvatarSet(geometryParts, k); + const sets: [number, GeometryBodyPart][] = []; + const ids: string[] = []; + + this._transformation = Matrix4x4.getYRotationMatrix(_arg_2); + + for(const part of parts.values()) + { + if(!part) continue; + + part.applyTransform(this._transformation); + + sets.push([part.getDistance(this._camera), part]); + } + + sets.sort((a, b) => + { + const partA = a[0]; + const partB = b[0]; + + if(partA < partB) return -1; + + if(partA > partB) return 1; + + return 0; + }); + + for(const set of sets) + { + if(!set) continue; + + ids.push(set[1].id); + } + + return ids; + } + + public getParts(k: string, _arg_2: string, _arg_3: number, _arg_4: any[], _arg_5: IAvatarImage): string[] + { + if(this.hasBodyPart(k, _arg_2)) + { + const part = this.getBodyPartsOfType(k).get(_arg_2); + + this._transformation = Matrix4x4.getYRotationMatrix(_arg_3); + + return part.getParts(this._transformation, this._camera, _arg_4, _arg_5); + } + + return []; + } +} diff --git a/submodules/renderer/src/nitro/avatar/geometry/AvatarSet.ts b/submodules/renderer/src/nitro/avatar/geometry/AvatarSet.ts new file mode 100644 index 0000000..2dee804 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/geometry/AvatarSet.ts @@ -0,0 +1,92 @@ +export class AvatarSet +{ + private _id: string; + private _isMain: boolean; + private _avatarSets: Map; + private _bodyParts: string[]; + private _allBodyParts: string[]; + + constructor(k: any) + { + this._id = k.id; + this._isMain = k.main || false; + this._avatarSets = new Map(); + this._bodyParts = []; + this._allBodyParts = []; + + if(k.avatarSets && (k.avatarSets.length > 0)) + { + for(const avatarSet of k.avatarSets) + { + if(!avatarSet) continue; + + const set = new AvatarSet(avatarSet); + + this._avatarSets.set(set.id, set); + } + } + + if(k.bodyParts && (k.bodyParts.length > 0)) + { + for(const bodyPart of k.bodyParts) + { + if(!bodyPart) continue; + + this._bodyParts.push(bodyPart.id); + } + } + + let bodyParts = this._bodyParts.concat(); + + for(const avatarSet of this._avatarSets.values()) + { + if(!avatarSet) continue; + + bodyParts = bodyParts.concat(avatarSet.getBodyParts()); + } + + this._allBodyParts = bodyParts; + } + + public findAvatarSet(k: string): AvatarSet + { + if(k === this._id) return this; + + for(const avatarSet of this._avatarSets.values()) + { + if(!avatarSet) continue; + + if(!avatarSet.findAvatarSet(k)) continue; + + return avatarSet; + } + + return null; + } + + public getBodyParts(): string[] + { + return this._allBodyParts.concat(); + } + + public get id(): string + { + return this._id; + } + + public get isMain(): boolean + { + if(this._isMain) return true; + + for(const avatarSet of this._avatarSets.values()) + { + if(!avatarSet) continue; + + if(!avatarSet.isMain) continue; + + return true; + } + + return false; + } +} diff --git a/submodules/renderer/src/nitro/avatar/geometry/GeometryBodyPart.ts b/submodules/renderer/src/nitro/avatar/geometry/GeometryBodyPart.ts new file mode 100644 index 0000000..1c23eb4 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/geometry/GeometryBodyPart.ts @@ -0,0 +1,194 @@ +import { IAvatarImage } from '../../../api'; +import { GeometryItem } from './GeometryItem'; +import { Matrix4x4 } from './Matrix4x4'; +import { Node3D } from './Node3D'; +import { Vector3D } from './Vector3D'; + +export class GeometryBodyPart extends Node3D +{ + private _id: string; + private _radius: number; + private _parts: Map; + private _dynamicParts: Map; + + constructor(k: any) + { + super(parseFloat(k.x), parseFloat(k.y), parseFloat(k.z)); + + this._id = k.id; + this._radius = parseFloat(k.radius); + this._parts = new Map(); + this._dynamicParts = new Map(); + + if(k.items && (k.items.length > 0)) + { + for(const item of k.items) + { + if(!item) continue; + + const geometryItem = new GeometryItem(item); + + this._parts.set(geometryItem.id, geometryItem); + } + } + } + + public getDynamicParts(k: IAvatarImage): GeometryItem[] + { + const existing = this._dynamicParts.get(k); + const parts: GeometryItem[] = []; + + if(existing) + { + for(const index in existing) + { + const item = existing[index]; + + if(!item) continue; + + parts.push(item); + } + } + + return parts; + } + + public getPartIds(k: IAvatarImage): string[] + { + const ids: string[] = []; + + for(const part of this._parts.values()) + { + if(!part) continue; + + ids.push(part.id); + } + + if(k) + { + const existing = this._dynamicParts.get(k); + + if(existing) + { + for(const index in existing) + { + const part = existing[index]; + + if(!part) continue; + + ids.push(part.id); + } + } + } + + return ids; + } + + public removeDynamicParts(k: IAvatarImage): boolean + { + this._dynamicParts.delete(k); + + return true; + } + + public addPart(k: any, _arg_2: IAvatarImage): boolean + { + if(this.hasPart(k.id, _arg_2)) return false; + + let existing = this._dynamicParts.get(_arg_2); + + if(!existing) + { + existing = {}; + + this._dynamicParts.set(_arg_2, existing); + } + + existing[k.id] = new GeometryItem(k, true); + + return true; + } + + public hasPart(k: string, _arg_2: IAvatarImage): boolean + { + let existingPart = (this._parts.get(k) || null); + + if(!existingPart && (this._dynamicParts.get(_arg_2) !== undefined)) + { + existingPart = (this._dynamicParts.get(_arg_2)[k] || null); + } + + return (existingPart !== null); + } + + public getParts(k: Matrix4x4, _arg_2: Vector3D, _arg_3: any[], _arg_4: IAvatarImage): string[] + { + const parts: [number, GeometryItem][] = []; + + for(const part of this._parts.values()) + { + if(!part) continue; + + part.applyTransform(k); + + parts.push([part.getDistance(_arg_2), part]); + } + + const existingDynamic = this._dynamicParts.get(_arg_4); + + if(existingDynamic) + { + for(const index in existingDynamic) + { + const part = existingDynamic[index]; + + if(!part) continue; + + part.applyTransform(k); + + parts.push([part.getDistance(_arg_2), part]); + } + } + + parts.sort((a, b) => + { + const partA = a[0]; + const partB = b[0]; + + if(partA < partB) return -1; + + if(partA > partB) return 1; + + return 0; + }); + + const partIds: string[] = []; + + for(const part of parts) + { + if(!part) continue; + + partIds.push(part[1].id); + } + + return partIds; + } + + public getDistance(k: Vector3D): number + { + const _local_2 = Math.abs(((k.z - this.transformedLocation.z) - this._radius)); + const _local_3 = Math.abs(((k.z - this.transformedLocation.z) + this._radius)); + + return Math.min(_local_2, _local_3); + } + + public get id(): string + { + return this._id; + } + + public get radius(): number + { + return this._radius; + } +} diff --git a/submodules/renderer/src/nitro/avatar/geometry/GeometryItem.ts b/submodules/renderer/src/nitro/avatar/geometry/GeometryItem.ts new file mode 100644 index 0000000..25cd818 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/geometry/GeometryItem.ts @@ -0,0 +1,55 @@ +import { Node3D } from './Node3D'; +import { Vector3D } from './Vector3D'; + +export class GeometryItem extends Node3D +{ + private _id: string; + private _radius: number; + private _normal: Vector3D; + private _isDoubleSided: boolean; + private _isDynamic: boolean; + + constructor(k: any, _arg_2: boolean = false) + { + super(parseFloat(k.x), parseFloat(k.y), parseFloat(k.z)); + + this._id = k.id; + this._radius = parseFloat(k.radius); + this._normal = new Vector3D(parseFloat(k.nx), parseFloat(k.ny), parseFloat(k.nz)); + this._isDoubleSided = k.double || false; + this._isDynamic = _arg_2; + } + + public getDistance(k: Vector3D): number + { + const _local_2 = Math.abs(((k.z - this.transformedLocation.z) - this._radius)); + const _local_3 = Math.abs(((k.z - this.transformedLocation.z) + this._radius)); + + return Math.min(_local_2, _local_3); + } + + public get id(): string + { + return this._id; + } + + public get normal(): Vector3D + { + return this._normal; + } + + public get isDoubleSided(): boolean + { + return this._isDoubleSided; + } + + public toString(): string + { + return ((((this._id + ': ') + this.location) + ' - ') + this.transformedLocation); + } + + public get isDynamic(): boolean + { + return this._isDynamic; + } +} diff --git a/submodules/renderer/src/nitro/avatar/geometry/Matrix4x4.ts b/submodules/renderer/src/nitro/avatar/geometry/Matrix4x4.ts new file mode 100644 index 0000000..24cc063 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/geometry/Matrix4x4.ts @@ -0,0 +1,133 @@ +import { Vector3D } from './Vector3D'; + +export class Matrix4x4 +{ + public static IDENTITY:Matrix4x4 = new Matrix4x4(1, 0, 0, 0, 1, 0, 0, 0, 1); + private static TOLERANS: number = 1E-18; + + private _data: number[]; + + constructor(k: number = 0, _arg_2: number = 0, _arg_3: number = 0, _arg_4: number = 0, _arg_5: number = 0, _arg_6: number = 0, _arg_7: number = 0, _arg_8: number = 0, _arg_9: number = 0) + { + this._data = [k, _arg_2, _arg_3, _arg_4, _arg_5, _arg_6, _arg_7, _arg_8, _arg_9]; + } + + public static getXRotationMatrix(k: number): Matrix4x4 + { + const _local_2 = ((k * Math.PI) / 180); + const _local_3 = Math.cos(_local_2); + const _local_4 = Math.sin(_local_2); + + return new Matrix4x4(1, 0, 0, 0, _local_3, -(_local_4), 0, _local_4, _local_3); + } + + public static getYRotationMatrix(k: number): Matrix4x4 + { + const _local_2 = ((k * Math.PI) / 180); + const _local_3 = Math.cos(_local_2); + const _local_4 = Math.sin(_local_2); + + return new Matrix4x4(_local_3, 0, _local_4, 0, 1, 0, -(_local_4), 0, _local_3); + } + + public static getZRotationMatrix(k: number): Matrix4x4 + { + const _local_2 = ((k * Math.PI) / 180); + const _local_3 = Math.cos(_local_2); + const _local_4 = Math.sin(_local_2); + + return new Matrix4x4(_local_3, -(_local_4), 0, _local_4, _local_3, 0, 0, 0, 1); + } + + public identity(): Matrix4x4 + { + this._data = [1, 0, 0, 0, 1, 0, 0, 0, 1]; + + return this; + } + + public vectorMultiplication(k: Vector3D): Vector3D + { + const _local_2 = (((k.x * this._data[0]) + (k.y * this._data[3])) + (k.z * this._data[6])); + const _local_3 = (((k.x * this._data[1]) + (k.y * this._data[4])) + (k.z * this._data[7])); + const _local_4 = (((k.x * this._data[2]) + (k.y * this._data[5])) + (k.z * this._data[8])); + + return new Vector3D(_local_2, _local_3, _local_4); + } + + public multiply(k:Matrix4x4): Matrix4x4 + { + const _local_2 = (((this._data[0] * k.data[0]) + (this._data[1] * k.data[3])) + (this._data[2] * k.data[6])); + const _local_3 = (((this._data[0] * k.data[1]) + (this._data[1] * k.data[4])) + (this._data[2] * k.data[7])); + const _local_4 = (((this._data[0] * k.data[2]) + (this._data[1] * k.data[5])) + (this._data[2] * k.data[8])); + const _local_5 = (((this._data[3] * k.data[0]) + (this._data[4] * k.data[3])) + (this._data[5] * k.data[6])); + const _local_6 = (((this._data[3] * k.data[1]) + (this._data[4] * k.data[4])) + (this._data[5] * k.data[7])); + const _local_7 = (((this._data[3] * k.data[2]) + (this._data[4] * k.data[5])) + (this._data[5] * k.data[8])); + const _local_8 = (((this._data[6] * k.data[0]) + (this._data[7] * k.data[3])) + (this._data[8] * k.data[6])); + const _local_9 = (((this._data[6] * k.data[1]) + (this._data[7] * k.data[4])) + (this._data[8] * k.data[7])); + const _local_10 = (((this._data[6] * k.data[2]) + (this._data[7] * k.data[5])) + (this._data[8] * k.data[8])); + + return new Matrix4x4(_local_2, _local_3, _local_4, _local_5, _local_6, _local_7, _local_8, _local_9, _local_10); + } + + public scalarMultiply(k: number): void + { + let index = 0; + + while(index < this._data.length) + { + this._data[index] = (this._data[index] * k); + + index++; + } + } + + public rotateX(k: number): Matrix4x4 + { + const _local_2 = ((k * Math.PI) / 180); + const _local_3 = Math.cos(_local_2); + const _local_4 = Math.sin(_local_2); + const _local_5 = new Matrix4x4(1, 0, 0, 0, _local_3, -(_local_4), 0, _local_4, _local_3); + + return _local_5.multiply(this); + } + + public rotateY(k: number): Matrix4x4 + { + const _local_2 = ((k * Math.PI) / 180); + const _local_3 = Math.cos(_local_2); + const _local_4 = Math.sin(_local_2); + const _local_5 = new Matrix4x4(_local_3, 0, _local_4, 0, 1, 0, -(_local_4), 0, _local_3); + + return _local_5.multiply(this); + } + + public rotateZ(k: number): Matrix4x4 + { + const _local_2 = ((k * Math.PI) / 180); + const _local_3 = Math.cos(_local_2); + const _local_4 = Math.sin(_local_2); + const _local_5 = new Matrix4x4(_local_3, -(_local_4), 0, _local_4, _local_3, 0, 0, 0, 1); + + return _local_5.multiply(this); + } + + public skew(): void + { + } + + public transpose(): Matrix4x4 + { + return new Matrix4x4(this._data[0], this._data[3], this._data[6], this._data[1], this._data[4], this._data[7], this._data[2], this._data[5], this._data[8]); + } + + public equals(k: Matrix4x4): boolean + { + return false; + } + + public get data(): number[] + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/avatar/geometry/Node3D.ts b/submodules/renderer/src/nitro/avatar/geometry/Node3D.ts new file mode 100644 index 0000000..310dff4 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/geometry/Node3D.ts @@ -0,0 +1,33 @@ +import { Matrix4x4 } from './Matrix4x4'; +import { Vector3D } from './Vector3D'; + +export class Node3D +{ + private _location: Vector3D; + private _transformedLocation: Vector3D; + private _needsTransformation: boolean; + + constructor(k: number, _arg_2: number, _arg_3: number) + { + this._location = new Vector3D(k, _arg_2, _arg_3); + this._transformedLocation = new Vector3D(); + this._needsTransformation = false; + + if(((!(k == 0)) || (!(_arg_2 == 0))) || (!(_arg_3 == 0))) this._needsTransformation = true; + } + + public get location(): Vector3D + { + return this._location; + } + + public get transformedLocation(): Vector3D + { + return this._transformedLocation; + } + + public applyTransform(k: Matrix4x4): void + { + if(this._needsTransformation) this._transformedLocation = k.vectorMultiplication(this._location); + } +} diff --git a/submodules/renderer/src/nitro/avatar/geometry/Vector3D.ts b/submodules/renderer/src/nitro/avatar/geometry/Vector3D.ts new file mode 100644 index 0000000..4afba81 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/geometry/Vector3D.ts @@ -0,0 +1,120 @@ +export class Vector3D +{ + private _x: number; + private _y: number; + private _z: number; + + constructor(k: number = 0, _arg_2: number = 0, _arg_3: number = 0) + { + this._x = k; + this._y = _arg_2; + this._z = _arg_3; + } + + public static dot(k: Vector3D, _arg_2: Vector3D): number + { + return ((k.x * _arg_2.x) + (k.y * _arg_2.y)) + (k.z * _arg_2.z); + } + + public static cross(k: Vector3D, _arg_2: Vector3D): Vector3D + { + const _local_3 = new Vector3D(); + + _local_3.x = ((k.y * _arg_2.z) - (k.z * _arg_2.y)); + _local_3.y = ((k.z * _arg_2.x) - (k.x * _arg_2.z)); + _local_3.z = ((k.x * _arg_2.y) - (k.y * _arg_2.x)); + + return _local_3; + } + + public static subtract(k: Vector3D, _arg_2: Vector3D): Vector3D + { + return new Vector3D((k.x - _arg_2.x), (k.y - _arg_2.y), (k.z - _arg_2.z)); + } + + public dot(k: Vector3D): number + { + return ((this._x * k.x) + (this._y * k.y)) + (this._z * k.z); + } + + public cross(k: Vector3D): Vector3D + { + const _local_2 = new Vector3D(); + + _local_2.x = ((this._y * k.z) - (this._z * k.y)); + _local_2.y = ((this._z * k.x) - (this._x * k.z)); + _local_2.z = ((this._x * k.y) - (this._y * k.x)); + + return _local_2; + } + + public subtract(k: Vector3D): void + { + this._x = (this._x - k.x); + this._y = (this._y - k.y); + this._z = (this._z - k.z); + } + + public add(k: Vector3D): void + { + this._x = (this._x + k.x); + this._y = (this._y + k.y); + this._z = (this._z + k.z); + } + + public normalize(): void + { + const k = (1 / this.length()); + + this._x = (this._x * k); + this._y = (this._y * k); + this._z = (this._z * k); + } + + public scaleBy(value: number): void + { + this._x *= value; + this._y *= value; + this._z *= value; + } + + public length(): number + { + return Math.sqrt((((this._x * this._x) + (this._y * this._y)) + (this._z * this._z))); + } + + public toString(): string + { + return (((((('Vector3D: (' + this._x) + ',') + this._y) + ',') + this._z) + ')'); + } + + public get x(): number + { + return this._x; + } + + public set x(k: number) + { + this._x = k; + } + + public get y(): number + { + return this._y; + } + + public set y(k: number) + { + this._y = k; + } + + public get z(): number + { + return this._z; + } + + public set z(k: number) + { + this._z = k; + } +} diff --git a/submodules/renderer/src/nitro/avatar/geometry/index.ts b/submodules/renderer/src/nitro/avatar/geometry/index.ts new file mode 100644 index 0000000..4e0b66d --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/geometry/index.ts @@ -0,0 +1,7 @@ +export * from './AvatarModelGeometry'; +export * from './AvatarSet'; +export * from './GeometryBodyPart'; +export * from './GeometryItem'; +export * from './Matrix4x4'; +export * from './Node3D'; +export * from './Vector3D'; diff --git a/submodules/renderer/src/nitro/avatar/index.ts b/submodules/renderer/src/nitro/avatar/index.ts new file mode 100644 index 0000000..86ffe1b --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/index.ts @@ -0,0 +1,24 @@ +export * from './actions'; +export * from './alias'; +export * from './animation'; +export * from './AvatarAssetDownloadLibrary'; +export * from './AvatarAssetDownloadManager'; +export * from './AvatarFigureContainer'; +export * from './AvatarImage'; +export * from './AvatarImageBodyPartContainer'; +export * from './AvatarImagePartContainer'; +export * from './AvatarRenderManager'; +export * from './AvatarStructure'; +export * from './cache'; +export * from './data/HabboAvatarAnimations'; +export * from './data/HabboAvatarGeometry'; +export * from './data/HabboAvatarPartSets'; +export * from './EffectAssetDownloadLibrary'; +export * from './EffectAssetDownloadManager'; +export * from './geometry'; +export * from './pets'; +export * from './PlaceHolderAvatarImage'; +export * from './structure'; +export * from './structure/animation'; +export * from './structure/figure'; +export * from './structure/parts'; diff --git a/submodules/renderer/src/nitro/avatar/pets/PetCustomPart.ts b/submodules/renderer/src/nitro/avatar/pets/PetCustomPart.ts new file mode 100644 index 0000000..7c1f802 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/pets/PetCustomPart.ts @@ -0,0 +1,45 @@ +import { IPetCustomPart } from '../../../api'; + +export class PetCustomPart implements IPetCustomPart +{ + private _layerId: number; + private _partId: number; + private _paletteId: number; + + constructor(layerId: number, partId: number, paletteId: number) + { + this._layerId = layerId; + this._partId = partId; + this._paletteId = paletteId; + } + + public get layerId(): number + { + return this._layerId; + } + + public set layerId(layerId: number) + { + this._layerId = layerId; + } + + public get partId(): number + { + return this._partId; + } + + public set partId(partId: number) + { + this._partId = partId; + } + + public get paletteId(): number + { + return this._paletteId; + } + + public set paletteId(paletteId: number) + { + this._paletteId = paletteId; + } +} diff --git a/submodules/renderer/src/nitro/avatar/pets/PetFigureData.ts b/submodules/renderer/src/nitro/avatar/pets/PetFigureData.ts new file mode 100644 index 0000000..fe59699 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/pets/PetFigureData.ts @@ -0,0 +1,229 @@ +import { IPetCustomPart } from '../../../api'; +import { PetCustomPart } from './PetCustomPart'; + +export class PetFigureData +{ + private _typeId: number; + private _paletteId: number; + private _color: number; + private _headOnly: boolean; + + private _customParts: IPetCustomPart[]; + private _customLayerIds: number[]; + private _customPartIds: number[]; + private _customPaletteIds: number[]; + + constructor(k: string) + { + this._typeId = this.getTypeId(k); + this._paletteId = this.getPaletteId(k); + this._color = this.getColor(k); + this._headOnly = this.getHeadOnly(k); + + const _local_2 = this.getCustomData(k); + + this._customLayerIds = this.getCustomLayerIds(_local_2); + this._customPartIds = this.getCustomPartIds(_local_2); + this._customPaletteIds = this.getCustomPaletteIds(_local_2); + this._customParts = []; + + let i = 0; + + while(i < this._customLayerIds.length) + { + this._customParts.push(new PetCustomPart(this._customLayerIds[i], this._customPartIds[i], this._customPaletteIds[i])); + + i++; + } + } + + public get typeId(): number + { + return this._typeId; + } + + public get paletteId(): number + { + return this._paletteId; + } + + public get color(): number + { + return this._color; + } + + public get customLayerIds(): number[] + { + return this._customLayerIds; + } + + public get customPartIds(): number[] + { + return this._customPartIds; + } + + public get customPaletteIds(): number[] + { + return this._customPaletteIds; + } + + public get customParts(): IPetCustomPart[] + { + return this._customParts; + } + + public getCustomPart(k: number): IPetCustomPart + { + if(this._customParts) + { + for(const _local_2 of this._customParts) + { + if(_local_2.layerId === k) return _local_2; + } + } + + return null; + } + + public get hasCustomParts(): boolean + { + return (!(this._customLayerIds == null)) && (this._customLayerIds.length > 0); + } + + public get headOnly(): boolean + { + return this._headOnly; + } + + public get figureString(): string + { + let figure = ((((this.typeId + ' ') + this.paletteId) + ' ') + this.color.toString(16)); + + figure = (figure + (' ' + this.customParts.length)); + + for(const _local_2 of this.customParts) + { + figure = (figure + (((((' ' + _local_2.layerId) + ' ') + _local_2.partId) + ' ') + _local_2.paletteId)); + } + + return figure; + } + + private getCustomData(k: string): string[] + { + let _local_2: string[] = []; + + if(k) + { + const _local_3 = k.split(' '); + const _local_4 = ((this._headOnly) ? 1 : 0); + const _local_5 = (4 + _local_4); + + if(_local_3.length > _local_5) + { + const _local_6 = (3 + _local_4); + const _local_7 = parseInt(_local_3[_local_6]); + + _local_2 = _local_3.slice(_local_5, (_local_5 + (_local_7 * 3))); + } + } + + return _local_2; + } + + private getCustomLayerIds(data: string[]): number[] + { + const layerIds: number[] = []; + + let i = 0; + + while(i < data.length) + { + layerIds.push(parseInt(data[(i + 0)])); + + i = (i + 3); + } + + return layerIds; + } + + private getCustomPartIds(data: string[]): number[] + { + const partIds: number[] = []; + + let i = 0; + + while(i < data.length) + { + partIds.push(parseInt(data[(i + 1)])); + + i = (i + 3); + } + + return partIds; + } + + private getCustomPaletteIds(data: string[]): number[] + { + const paletteIds: number[] = []; + + let i = 0; + + while(i < data.length) + { + paletteIds.push(parseInt(data[(i + 2)])); + + i = (i + 3); + } + + return paletteIds; + } + + private getTypeId(data: string): number + { + if(data) + { + const parts = data.split(' '); + + if(parts.length >= 1) return parseInt(parts[0]); + } + + return 0; + } + + private getPaletteId(data: string): number + { + if(data) + { + const parts = data.split(' '); + + if(parts.length >= 2) return parseInt(parts[1]); + } + + return 0; + } + + private getColor(data: string): number + { + if(data) + { + const parts = data.split(' '); + + if(parts.length >= 3) return parseInt(parts[2], 16); + } + + return 0xFFFFFF; + } + + private getHeadOnly(data: string): boolean + { + if(data) + { + const parts = data.split(' '); + + if(parts.length >= 4) return parts[3] === 'head'; + } + + return false; + } +} diff --git a/submodules/renderer/src/nitro/avatar/pets/index.ts b/submodules/renderer/src/nitro/avatar/pets/index.ts new file mode 100644 index 0000000..5c93ab1 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/pets/index.ts @@ -0,0 +1,2 @@ +export * from './PetCustomPart'; +export * from './PetFigureData'; diff --git a/submodules/renderer/src/nitro/avatar/structure/AvatarAnimationData.ts b/submodules/renderer/src/nitro/avatar/structure/AvatarAnimationData.ts new file mode 100644 index 0000000..f8b2618 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/AvatarAnimationData.ts @@ -0,0 +1,57 @@ +import { IActionDefinition, IFigureSetData } from '../../../api'; +import { AnimationAction } from './animation'; + +export class AvatarAnimationData implements IFigureSetData +{ + private _actions: Map; + + constructor() + { + this._actions = new Map(); + } + + public parse(data: any): boolean + { + if(data && (data.length > 0)) + { + for(const animation of data) + { + if(!animation) continue; + + const newAnimation = new AnimationAction(animation); + + this._actions.set(newAnimation.id, newAnimation); + } + } + + return true; + } + + public appendJSON(k: any): boolean + { + for(const _local_2 of k.action) + { + this._actions.set(_local_2.id, new AnimationAction(_local_2)); + } + + return true; + } + + public getAction(action: IActionDefinition): AnimationAction + { + const existing = this._actions.get(action.id); + + if(!existing) return null; + + return existing; + } + + public getFrameCount(k: IActionDefinition): number + { + const animationAction = this.getAction(k); + + if(!animationAction) return 0; + + return animationAction.frameCount; + } +} diff --git a/submodules/renderer/src/nitro/avatar/structure/AvatarCanvas.ts b/submodules/renderer/src/nitro/avatar/structure/AvatarCanvas.ts new file mode 100644 index 0000000..9916e68 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/AvatarCanvas.ts @@ -0,0 +1,47 @@ +import { Point } from '@pixi/math'; +import { AvatarScaleType } from '../../../api'; + +export class AvatarCanvas +{ + private _id: string; + private _width: number; + private _height: number; + private _offset: Point; + private _regPoint: Point; + + constructor(k: any, _arg_2: string) + { + this._id = k.id; + this._width = k.width; + this._height = k.height; + this._offset = new Point(k.dx, k.dy); + + if(_arg_2 == AvatarScaleType.LARGE) this._regPoint = new Point(((this._width - 64) / 2), 0); + else this._regPoint = new Point(((this._width - 32) / 2), 0); + } + + public get width(): number + { + return this._width; + } + + public get height(): number + { + return this._height; + } + + public get offset(): Point + { + return this._offset; + } + + public get id(): string + { + return this._id; + } + + public get regPoint(): Point + { + return this._regPoint; + } +} diff --git a/submodules/renderer/src/nitro/avatar/structure/AvatarStructureDownload.ts b/submodules/renderer/src/nitro/avatar/structure/AvatarStructureDownload.ts new file mode 100644 index 0000000..365925c --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/AvatarStructureDownload.ts @@ -0,0 +1,52 @@ +import { IFigureSetData, NitroLogger } from '../../../api'; +import { EventDispatcher } from '../../../core'; +import { NitroEvent } from '../../../events'; + +export class AvatarStructureDownload extends EventDispatcher +{ + public static AVATAR_STRUCTURE_DONE: string = 'AVATAR_STRUCTURE_DONE'; + + private _dataReceiver: IFigureSetData; + + constructor(downloadUrl: string, dataReceiver: IFigureSetData) + { + super(); + + this._dataReceiver = dataReceiver; + + this.download(downloadUrl); + } + + private download(url: string): void + { + const request = new XMLHttpRequest(); + + try + { + request.open('GET', url); + + request.send(); + + request.onloadend = e => + { + const response = request.responseText; + + if(!response || !response.length) throw new Error('invalid_figure_data'); + + if(this._dataReceiver) this._dataReceiver.appendJSON(JSON.parse(response)); + + this.dispatchEvent(new NitroEvent(AvatarStructureDownload.AVATAR_STRUCTURE_DONE)); + }; + + request.onerror = e => + { + throw new Error('invalid_avatar_figure_data'); + }; + } + + catch (e) + { + NitroLogger.error(e); + } + } +} diff --git a/submodules/renderer/src/nitro/avatar/structure/FigureSetData.ts b/submodules/renderer/src/nitro/avatar/structure/FigureSetData.ts new file mode 100644 index 0000000..b855457 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/FigureSetData.ts @@ -0,0 +1,129 @@ +import { IFigureData, IFigurePartSet, IFigureSetData, IPalette, ISetType, IStructureData } from '../../../api'; +import { Palette, SetType } from './figure'; + +export class FigureSetData implements IFigureSetData, IStructureData +{ + private _palettes: Map; + private _setTypes: Map; + + constructor() + { + this._palettes = new Map(); + this._setTypes = new Map(); + } + + public dispose(): void + { + + } + + public parse(data: IFigureData): boolean + { + if(!data) return false; + + for(const palette of data.palettes) + { + const newPalette = new Palette(palette); + + if(!newPalette) continue; + + this._palettes.set(newPalette.id.toString(), newPalette); + } + + for(const set of data.setTypes) + { + const newSet = new SetType(set); + + if(!newSet) continue; + + this._setTypes.set(newSet.type, newSet); + } + + return true; + } + + public injectJSON(data: IFigureData): void + { + for(const setType of data.setTypes) + { + const existingSetType = this._setTypes.get(setType.type); + + if(existingSetType) existingSetType.cleanUp(setType); + else this._setTypes.set(setType.type, new SetType(setType)); + } + + this.appendJSON(data); + } + + public appendJSON(data: IFigureData): boolean + { + if(!data) return false; + + for(const palette of data.palettes) + { + const id = palette.id.toString(); + const existingPalette = this._palettes.get(id); + + if(!existingPalette) this._palettes.set(id, new Palette(palette)); + else existingPalette.append(palette); + } + + for(const setType of data.setTypes) + { + const type = setType.type; + const existingSetType = this._setTypes.get(type); + + if(!existingSetType) this._setTypes.set(type, new SetType(setType)); + else existingSetType.append(setType); + } + + return false; + } + + public getMandatorySetTypeIds(k: string, _arg_2: number): string[] + { + const types: string[] = []; + + for(const set of this._setTypes.values()) + { + if(!set || !set.isMandatory(k, _arg_2)) continue; + + types.push(set.type); + } + + return types; + } + + public getDefaultPartSet(type: string, gender: string): IFigurePartSet + { + const setType = this._setTypes.get(type); + + if(!setType) return null; + + return setType.getDefaultPartSet(gender); + } + + public getSetType(k: string): ISetType + { + return (this._setTypes.get(k) || null); + } + + public getPalette(k: number): IPalette + { + return (this._palettes.get(k.toString()) || null); + } + + public getFigurePartSet(k: number): IFigurePartSet + { + for(const set of this._setTypes.values()) + { + const partSet = set.getPartSet(k); + + if(!partSet) continue; + + return partSet; + } + + return null; + } +} diff --git a/submodules/renderer/src/nitro/avatar/structure/PartSetsData.ts b/submodules/renderer/src/nitro/avatar/structure/PartSetsData.ts new file mode 100644 index 0000000..36548ee --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/PartSetsData.ts @@ -0,0 +1,118 @@ +import { IActionDefinition, IFigureSetData } from '../../../api'; +import { ActionDefinition } from '../actions'; +import { ActivePartSet, PartDefinition } from './parts'; + +export class PartSetsData implements IFigureSetData +{ + private _parts: Map; + private _activePartSets: Map; + + constructor() + { + this._parts = new Map(); + this._activePartSets = new Map(); + } + + public parse(data: any): boolean + { + if(data.partSet && (data.partSet.length > 0)) + { + for(const part of data.partSet) + { + if(!part) continue; + + this._parts.set(part.setType, new PartDefinition(part)); + } + } + + if(data.activePartSets && (data.activePartSets.length > 0)) + { + for(const activePart of data.activePartSets) + { + if(!activePart) continue; + + this._activePartSets.set(activePart.id, new ActivePartSet(activePart)); + } + } + + return true; + } + + public appendJSON(data: any): boolean + { + if(data.partSet && (data.partSet.length > 0)) + { + for(const part of data.partSet) + { + if(!part) continue; + + this._parts.set(part.setType, new PartDefinition(part)); + } + } + + if(data.activePartSets && (data.activePartSets.length > 0)) + { + for(const activePart of data.activePartSets) + { + if(!activePart) continue; + + this._activePartSets.set(activePart.id, new ActivePartSet(activePart)); + } + } + + return false; + } + + public getActiveParts(k: IActionDefinition): string[] + { + const activePartSet = this._activePartSets.get(k.activePartSet); + + if(!activePartSet) return []; + + return activePartSet.parts; + } + + public getPartDefinition(part: string): PartDefinition + { + const existing = this._parts.get(part); + + if(!existing) return null; + + return existing; + } + + public addPartDefinition(k: any): PartDefinition + { + const _local_2 = k.setType as string; + + let existing = this._parts.get(_local_2); + + if(!existing) + { + existing = new PartDefinition(k); + + this._parts.set(_local_2, existing); + } + + return existing; + } + + public getActivePartSet(k: ActionDefinition): ActivePartSet + { + const existing = this._activePartSets.get(k.activePartSet); + + if(!existing) return null; + + return existing; + } + + public get parts(): Map + { + return this._parts; + } + + public get activePartSets(): Map + { + return this._activePartSets; + } +} diff --git a/submodules/renderer/src/nitro/avatar/structure/animation/AnimationAction.ts b/submodules/renderer/src/nitro/avatar/structure/animation/AnimationAction.ts new file mode 100644 index 0000000..0b7e6ae --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/animation/AnimationAction.ts @@ -0,0 +1,138 @@ +import { Point } from '@pixi/math'; +import { AnimationActionPart } from './AnimationActionPart'; + +export class AnimationAction +{ + public static DEFAULT_OFFSET: Point = new Point(0, 0); + + private _id: string; + private _actionParts: Map; + private _bodyPartOffsets: Map>>; + private _frameCount: number; + private _frameIndexes: number[]; + + constructor(data: any) + { + this._id = data.id; + this._actionParts = new Map(); + this._bodyPartOffsets = new Map(); + this._frameCount = 0; + this._frameIndexes = []; + + if(data.parts && (data.parts.length > 0)) + { + for(const part of data.parts) + { + if(!part) continue; + + const newPart = new AnimationActionPart(part); + + this._actionParts.set(part.setType, newPart); + + this._frameCount = Math.max(this._frameCount, newPart.frames.length); + } + } + + if(data.offsets && data.offsets.frames && (data.offsets.frames.length > 0)) + { + for(const frame of data.offsets.frames) + { + if(!frame) continue; + + const frameId = frame.id; + + this._frameCount = Math.max(this._frameCount, frameId); + + const directions: Map> = new Map(); + + this._bodyPartOffsets.set(frameId, directions); + + if(frame.directions && (frame.directions.length > 0)) + { + for(const direction of frame.directions) + { + if(!direction) continue; + + const directionId = direction.id; + + const offsets: Map = new Map(); + + directions.set(directionId, offsets); + + if(direction.bodyParts && (direction.bodyParts.length > 0)) + { + for(const part of direction.bodyParts) + { + if(!part) continue; + + const partId = part.id; + + let dx = 0; + let dy = 0; + + if(part.dx !== undefined) dx = part.dx; + if(part.dy !== undefined) dy = part.dy; + + offsets.set(partId, new Point(dx, dy)); + } + } + } + } + + this._frameIndexes.push(frameId); + + if(frame.repeats !== undefined) + { + let repeats = frame.repeats || 0; + + if(repeats > 1) while(--repeats > 0) this._frameIndexes.push(frameId); + } + } + } + } + + public getPart(type: string): AnimationActionPart + { + if(!type) return null; + + const existing = this._actionParts.get(type); + + if(!existing) return null; + + return existing; + } + + public getFrameBodyPartOffset(frameId: number, frameCount: number, partId: string): Point + { + const frameIndex = (frameCount % this._frameIndexes.length); + const frameNumber = this._frameIndexes[frameIndex]; + const offsets = this._bodyPartOffsets.get(frameNumber); + + if(!offsets) return AnimationAction.DEFAULT_OFFSET; + + const frameOffset = offsets.get(frameId); + + if(!frameOffset) return AnimationAction.DEFAULT_OFFSET; + + const offset = frameOffset.get(partId); + + if(!offset) return AnimationAction.DEFAULT_OFFSET; + + return offset; + } + + public get id(): string + { + return this._id; + } + + public get parts(): Map + { + return this._actionParts; + } + + public get frameCount(): number + { + return this._frameCount; + } +} diff --git a/submodules/renderer/src/nitro/avatar/structure/animation/AnimationActionPart.ts b/submodules/renderer/src/nitro/avatar/structure/animation/AnimationActionPart.ts new file mode 100644 index 0000000..ea16687 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/animation/AnimationActionPart.ts @@ -0,0 +1,30 @@ +import { AvatarAnimationFrame } from './AvatarAnimationFrame'; + +export class AnimationActionPart +{ + private _frames: AvatarAnimationFrame[]; + + constructor(data: any) + { + this._frames = []; + + if(data.frames && (data.frames.length > 0)) + { + for(const frame of data.frames) + { + if(!frame) continue; + + this._frames.push(new AvatarAnimationFrame(frame)); + + let repeats = frame.repeats || 0; + + if(repeats > 1) while(--repeats > 0) this._frames.push(this._frames[(this._frames.length - 1)]); + } + } + } + + public get frames(): AvatarAnimationFrame[] + { + return this._frames; + } +} diff --git a/submodules/renderer/src/nitro/avatar/structure/animation/AvatarAnimationFrame.ts b/submodules/renderer/src/nitro/avatar/structure/animation/AvatarAnimationFrame.ts new file mode 100644 index 0000000..3b9ec35 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/animation/AvatarAnimationFrame.ts @@ -0,0 +1,21 @@ +export class AvatarAnimationFrame +{ + private _number: number; + private _assetPartDefinition: string; + + constructor(data: any) + { + this._number = data.number; + this._assetPartDefinition = data.assetPartDefinition || null; + } + + public get number(): number + { + return this._number; + } + + public get assetPartDefinition(): string + { + return this._assetPartDefinition; + } +} diff --git a/submodules/renderer/src/nitro/avatar/structure/animation/index.ts b/submodules/renderer/src/nitro/avatar/structure/animation/index.ts new file mode 100644 index 0000000..98af842 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/animation/index.ts @@ -0,0 +1,3 @@ +export * from './AnimationAction'; +export * from './AnimationActionPart'; +export * from './AvatarAnimationFrame'; diff --git a/submodules/renderer/src/nitro/avatar/structure/figure/FigurePart.ts b/submodules/renderer/src/nitro/avatar/structure/figure/FigurePart.ts new file mode 100644 index 0000000..f870dc0 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/figure/FigurePart.ts @@ -0,0 +1,58 @@ +import { IFigureDataPart, IFigurePart } from '../../../../api'; + +export class FigurePart implements IFigurePart +{ + private _id: number; + private _type: string; + private _breed: number; + private _index: number; + private _colorLayerIndex: number; + private _paletteMapId: number; + + constructor(data: IFigureDataPart) + { + if(!data) throw new Error('invalid_data'); + + this._id = data.id; + this._type = data.type; + this._index = data.index; + this._colorLayerIndex = data.colorindex; + this._paletteMapId = -1; + this._breed = -1; + } + + public dispose(): void + { + + } + + public get id(): number + { + return this._id; + } + + public get type(): string + { + return this._type; + } + + public get breed(): number + { + return this._breed; + } + + public get index(): number + { + return this._index; + } + + public get colorLayerIndex(): number + { + return this._colorLayerIndex; + } + + public get paletteMap(): number + { + return this._paletteMapId; + } +} diff --git a/submodules/renderer/src/nitro/avatar/structure/figure/FigurePartSet.ts b/submodules/renderer/src/nitro/avatar/structure/figure/FigurePartSet.ts new file mode 100644 index 0000000..f568386 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/figure/FigurePartSet.ts @@ -0,0 +1,141 @@ +import { IFigureDataSet, IFigurePart, IFigurePartSet } from '../../../../api'; +import { FigurePart } from './FigurePart'; + +export class FigurePartSet implements IFigurePartSet +{ + private _id: number; + private _type: string; + private _gender: string; + private _clubLevel: number; + private _isColorable: boolean; + private _isSelectable: boolean; + private _parts: IFigurePart[]; + private _hiddenLayers: string[]; + private _isPreSelectable: boolean; + private _isSellable: boolean; + + constructor(type: string, data: IFigureDataSet) + { + if(!type || !data) throw new Error('invalid_data'); + + this._id = data.id; + this._type = type; + this._gender = data.gender; + this._clubLevel = data.club; + this._isColorable = data.colorable; + this._isSelectable = data.selectable; + this._parts = []; + this._hiddenLayers = []; + this._isPreSelectable = data.preselectable; + this._isSellable = data.sellable; + + for(const part of data.parts) + { + const newPart = new FigurePart(part); + const partIndex = this.getPartIndex(newPart); + + if(partIndex !== -1) this._parts.splice(partIndex, 0, newPart); + else this._parts.push(newPart); + } + + if(data.hiddenLayers) + { + for(const hiddenLayer of data.hiddenLayers) this._hiddenLayers.push(hiddenLayer.partType); + } + } + + public dispose(): void + { + for(const part of this._parts) + { + const figurePart = part as FigurePart; + + figurePart.dispose(); + } + + this._parts = null; + this._hiddenLayers = null; + } + + private getPartIndex(part: FigurePart): number + { + const totalParts = this._parts.length; + + if(!totalParts) return -1; + + for(let i = 0; i < totalParts; i++) + { + const existingPart = this._parts[i]; + + if(!existingPart) continue; + + if(existingPart.type !== part.type || existingPart.index > part.index) continue; + + return i; + } + + return -1; + } + + public getPart(k: string, _arg_2: number): IFigurePart + { + for(const part of this._parts) + { + if((part.type !== k) || (part.id !== _arg_2)) continue; + + return part; + } + + return null; + } + + public get id(): number + { + return this._id; + } + + public get type(): string + { + return this._type; + } + + public get gender(): string + { + return this._gender; + } + + public get clubLevel(): number + { + return this._clubLevel; + } + + public get isColorable(): boolean + { + return this._isColorable; + } + + public get isSelectable(): boolean + { + return this._isSelectable; + } + + public get parts(): IFigurePart[] + { + return this._parts; + } + + public get hiddenLayers(): string[] + { + return this._hiddenLayers; + } + + public get isPreSelectable(): boolean + { + return this._isPreSelectable; + } + + public get isSellable(): boolean + { + return this._isSellable; + } +} diff --git a/submodules/renderer/src/nitro/avatar/structure/figure/Palette.ts b/submodules/renderer/src/nitro/avatar/structure/figure/Palette.ts new file mode 100644 index 0000000..cf179db --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/figure/Palette.ts @@ -0,0 +1,45 @@ +import { AdvancedMap, IAdvancedMap, IFigureDataPalette, IPalette, IPartColor } from '../../../../api'; +import { PartColor } from './PartColor'; + +export class Palette implements IPalette +{ + private _id: number; + private _colors: IAdvancedMap; + + constructor(data: IFigureDataPalette) + { + if(!data) throw new Error('invalid_data'); + + this._id = data.id; + this._colors = new AdvancedMap(); + + this.append(data); + } + + public append(data: IFigureDataPalette): void + { + for(const color of data.colors) + { + const newColor = new PartColor(color); + + this._colors.add(color.id.toString(), newColor); + } + } + + public getColor(id: number): IPartColor + { + if((id === undefined) || id < 0) return null; + + return (this._colors.getValue(id.toString()) || null); + } + + public get id(): number + { + return this._id; + } + + public get colors(): IAdvancedMap + { + return this._colors; + } +} diff --git a/submodules/renderer/src/nitro/avatar/structure/figure/PartColor.ts b/submodules/renderer/src/nitro/avatar/structure/figure/PartColor.ts new file mode 100644 index 0000000..42d0838 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/figure/PartColor.ts @@ -0,0 +1,46 @@ +import { IFigureDataColor, IPartColor } from '../../../../api'; + +export class PartColor implements IPartColor +{ + private _id: number; + private _index: number; + private _clubLevel: number; + private _isSelectable: boolean; + private _rgb: number; + + constructor(data: IFigureDataColor) + { + if(!data) throw new Error('invalid_data'); + + this._id = data.id; + this._index = data.index; + this._clubLevel = (data.club || 0); + this._isSelectable = data.selectable; + this._rgb = parseInt('0x' + data.hexCode, 16); + } + + public get id(): number + { + return this._id; + } + + public get index(): number + { + return this._index; + } + + public get clubLevel(): number + { + return this._clubLevel; + } + + public get isSelectable(): boolean + { + return this._isSelectable; + } + + public get rgb(): number + { + return this._rgb; + } +} diff --git a/submodules/renderer/src/nitro/avatar/structure/figure/SetType.ts b/submodules/renderer/src/nitro/avatar/structure/figure/SetType.ts new file mode 100644 index 0000000..9a87d6d --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/figure/SetType.ts @@ -0,0 +1,103 @@ +import { AdvancedMap, IAdvancedMap, IFigureDataSetType, IFigurePartSet, ISetType } from '../../../../api'; +import { FigurePartSet } from './FigurePartSet'; + +export class SetType implements ISetType +{ + private _type: string; + private _paletteId: number; + private _isMandatory: { [index: string]: boolean[] }; + private _partSets: IAdvancedMap; + + constructor(data: IFigureDataSetType) + { + if(!data) throw new Error('invalid_data'); + + this._type = data.type; + this._paletteId = data.paletteId; + this._isMandatory = {}; + this._isMandatory['F'] = [data.mandatory_f_0, data.mandatory_f_1]; + this._isMandatory['M'] = [data.mandatory_m_0, data.mandatory_m_1]; + this._partSets = new AdvancedMap(); + + this.append(data); + } + + public dispose(): void + { + for(const set of this._partSets.getValues()) + { + const partSet = set as FigurePartSet; + + partSet.dispose(); + } + + this._partSets = null; + } + + public cleanUp(data: IFigureDataSetType): void + { + for(const set of data.sets) + { + const setId = set.id.toString(); + const partSet = (this._partSets.getValue(setId) as FigurePartSet); + + if(partSet) + { + partSet.dispose(); + + this._partSets.remove(setId); + } + } + } + + public append(setType: IFigureDataSetType): void + { + if(!setType || !setType.sets) return; + + for(const set of setType.sets) this._partSets.add(set.id.toString(), new FigurePartSet(this._type, set)); + } + + public getDefaultPartSet(gender: string): IFigurePartSet + { + for(const set of this._partSets.getValues()) + { + if(!set) continue; + + if((set.clubLevel === 0) && ((set.gender === gender) || (set.gender === 'U'))) return set; + } + + return null; + } + + public getPartSet(k: number): IFigurePartSet + { + return this._partSets.getValue(k.toString()); + } + + public get type(): string + { + return this._type; + } + + public get paletteID(): number + { + return this._paletteId; + } + + public isMandatory(k: string, _arg_2: number): boolean + { + return this._isMandatory[k.toUpperCase()][Math.min(_arg_2, 1)]; + } + + public optionalFromClubLevel(k: string): number + { + const _local_2 = this._isMandatory[k.toUpperCase()]; + + return _local_2.indexOf(false); + } + + public get partSets(): IAdvancedMap + { + return this._partSets; + } +} diff --git a/submodules/renderer/src/nitro/avatar/structure/figure/index.ts b/submodules/renderer/src/nitro/avatar/structure/figure/index.ts new file mode 100644 index 0000000..1b9ebc3 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/figure/index.ts @@ -0,0 +1,5 @@ +export * from './FigurePart'; +export * from './FigurePartSet'; +export * from './Palette'; +export * from './PartColor'; +export * from './SetType'; diff --git a/submodules/renderer/src/nitro/avatar/structure/index.ts b/submodules/renderer/src/nitro/avatar/structure/index.ts new file mode 100644 index 0000000..11269ae --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/index.ts @@ -0,0 +1,8 @@ +export * from './animation'; +export * from './AvatarAnimationData'; +export * from './AvatarCanvas'; +export * from './AvatarStructureDownload'; +export * from './figure'; +export * from './FigureSetData'; +export * from './parts'; +export * from './PartSetsData'; diff --git a/submodules/renderer/src/nitro/avatar/structure/parts/ActivePartSet.ts b/submodules/renderer/src/nitro/avatar/structure/parts/ActivePartSet.ts new file mode 100644 index 0000000..4244308 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/parts/ActivePartSet.ts @@ -0,0 +1,26 @@ +export class ActivePartSet +{ + private _id: string; + private _parts: string[]; + + constructor(data: any) + { + this._id = data.id; + this._parts = []; + + if(data.activeParts && (data.activeParts.length > 0)) + { + for(const part of data.activeParts) + { + if(!part) continue; + + this._parts.push(part.setType); + } + } + } + + public get parts(): string[] + { + return this._parts; + } +} diff --git a/submodules/renderer/src/nitro/avatar/structure/parts/PartDefinition.ts b/submodules/renderer/src/nitro/avatar/structure/parts/PartDefinition.ts new file mode 100644 index 0000000..19caa8c --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/parts/PartDefinition.ts @@ -0,0 +1,64 @@ +export class PartDefinition +{ + private _setType: string; + private _flippedSetType: string; + private _removeSetType: string; + private _appendToFigure: boolean; + private _staticId: number; + + constructor(data: any) + { + if(!data) throw new Error('invalid_data'); + + this._setType = data.setType; + this._flippedSetType = data.flippedSetType || null; + this._removeSetType = data.removeSetType || null; + this._appendToFigure = false; + this._staticId = -1; + } + + public hasStaticId(): boolean + { + return this._staticId >= 0; + } + + public get staticId(): number + { + return this._staticId; + } + + public set staticId(k: number) + { + this._staticId = k; + } + + public get setType(): string + { + return this._setType; + } + + public get flippedSetType(): string + { + return this._flippedSetType; + } + + public set flippedSetType(type: string) + { + this._flippedSetType = type; + } + + public get removeSetType(): string + { + return this._removeSetType; + } + + public get appendToFigure(): boolean + { + return this._appendToFigure; + } + + public set appendToFigure(flag: boolean) + { + this._appendToFigure = flag; + } +} diff --git a/submodules/renderer/src/nitro/avatar/structure/parts/index.ts b/submodules/renderer/src/nitro/avatar/structure/parts/index.ts new file mode 100644 index 0000000..31faf62 --- /dev/null +++ b/submodules/renderer/src/nitro/avatar/structure/parts/index.ts @@ -0,0 +1,2 @@ +export * from './ActivePartSet'; +export * from './PartDefinition'; diff --git a/submodules/renderer/src/nitro/camera/RoomCameraWidgetEffect.ts b/submodules/renderer/src/nitro/camera/RoomCameraWidgetEffect.ts new file mode 100644 index 0000000..2b3375c --- /dev/null +++ b/submodules/renderer/src/nitro/camera/RoomCameraWidgetEffect.ts @@ -0,0 +1,61 @@ +import { Resource, Texture } from '@pixi/core'; +import { ColorMatrix } from '@pixi/filter-color-matrix'; +import { IRoomCameraWidgetEffect } from '../../api'; + +export class RoomCameraWidgetEffect implements IRoomCameraWidgetEffect +{ + private _name: string; + private _minLevel: number = -1; + private _texture: Texture = null; + private _colorMatrix: ColorMatrix = null; + private _blendMode: number = null; + + constructor(name: string, minLevel: number = -1, texture: Texture = null, colorMatrix: ColorMatrix = null, blendMode: number = null) + { + this._name = name; + this._minLevel = minLevel; + this._texture = texture; + this._colorMatrix = colorMatrix; + this._blendMode = blendMode; + } + + public get name(): string + { + return this._name; + } + + public get texture(): Texture + { + return this._texture; + } + + public set texture(texture: Texture) + { + this._texture = texture; + } + + public get colorMatrix(): ColorMatrix + { + return this._colorMatrix; + } + + public set colorMatrix(colorMatrix: ColorMatrix) + { + this._colorMatrix = colorMatrix; + } + + public get blendMode(): number + { + return this._blendMode; + } + + public set blendMode(blendMode: number) + { + this._blendMode = blendMode; + } + + public get minLevel(): number + { + return this._minLevel; + } +} diff --git a/submodules/renderer/src/nitro/camera/RoomCameraWidgetManager.ts b/submodules/renderer/src/nitro/camera/RoomCameraWidgetManager.ts new file mode 100644 index 0000000..1270463 --- /dev/null +++ b/submodules/renderer/src/nitro/camera/RoomCameraWidgetManager.ts @@ -0,0 +1,106 @@ +import { Texture } from '@pixi/core'; +import { ColorMatrix, ColorMatrixFilter } from '@pixi/filter-color-matrix'; +import { IEventDispatcher, IRoomCameraWidgetEffect, IRoomCameraWidgetManager, IRoomCameraWidgetSelectedEffect, NitroConfiguration } from '../../api'; +import { EventDispatcher } from '../../core'; +import { RoomCameraWidgetManagerEvent } from '../../events'; +import { NitroContainer, NitroSprite, TextureUtils } from '../../pixi-proxy'; +import { RoomCameraWidgetEffect } from './RoomCameraWidgetEffect'; + +export class RoomCameraWidgetManager implements IRoomCameraWidgetManager +{ + private _effects: Map; + private _events: IEventDispatcher; + private _isLoaded: boolean; + + constructor() + { + this._effects = new Map(); + this._events = new EventDispatcher(); + this._isLoaded = false; + } + + public init(): void + { + if(this._isLoaded) return; + + this._isLoaded = true; + + const imagesUrl = NitroConfiguration.getValue('image.library.url') + 'Habbo-Stories/'; + const effects = NitroConfiguration.getValue<{ name: string, colorMatrix?: ColorMatrix, minLevel: number, blendMode?: number, enabled: boolean }[]>('camera.available.effects'); + + for(const effect of effects) + { + if(!effect.enabled) continue; + + const cameraEffect = new RoomCameraWidgetEffect(effect.name, effect.minLevel); + + if(effect.colorMatrix.length) + { + cameraEffect.colorMatrix = effect.colorMatrix; + } + else + { + cameraEffect.texture = Texture.from(imagesUrl + effect.name + '.png'); + cameraEffect.blendMode = effect.blendMode; + } + + this._effects.set(cameraEffect.name, cameraEffect); + } + + this.events.dispatchEvent(new RoomCameraWidgetManagerEvent(RoomCameraWidgetManagerEvent.INITIALIZED)); + } + + public applyEffects(texture: Texture, selectedEffects: IRoomCameraWidgetSelectedEffect[], isZoomed: boolean): HTMLImageElement + { + const container = new NitroContainer(); + const sprite = new NitroSprite(texture); + + container.addChild(sprite); + + if(isZoomed) sprite.scale.set(2); + + for(const selectedEffect of selectedEffects) + { + const effect = selectedEffect.effect; + + if(!effect) continue; + + if(effect.colorMatrix) + { + const filter = new ColorMatrixFilter(); + + filter.matrix = effect.colorMatrix; + filter.alpha = selectedEffect.alpha; + + if(!sprite.filters) sprite.filters = []; + + sprite.filters.push(filter); + } + else + { + const effectSprite = new NitroSprite(effect.texture); + effectSprite.alpha = selectedEffect.alpha; + effectSprite.blendMode = effect.blendMode; + + container.addChild(effectSprite); + } + } + + return TextureUtils.generateImage(container); + } + + public get effects(): Map + { + return this._effects; + } + + public get events(): IEventDispatcher + { + return this._events; + } + + public get isLoaded(): boolean + { + return this._isLoaded; + } +} diff --git a/submodules/renderer/src/nitro/camera/RoomCameraWidgetSelectedEffect.ts b/submodules/renderer/src/nitro/camera/RoomCameraWidgetSelectedEffect.ts new file mode 100644 index 0000000..c0d9528 --- /dev/null +++ b/submodules/renderer/src/nitro/camera/RoomCameraWidgetSelectedEffect.ts @@ -0,0 +1,23 @@ +import { IRoomCameraWidgetEffect } from '../../api'; + +export class RoomCameraWidgetSelectedEffect +{ + private _effect: IRoomCameraWidgetEffect; + private _alpha: number; + + constructor(effect: IRoomCameraWidgetEffect, alpha: number) + { + this._effect = effect; + this._alpha = alpha; + } + + public get effect(): IRoomCameraWidgetEffect + { + return this._effect; + } + + public get alpha(): number + { + return this._alpha; + } +} diff --git a/submodules/renderer/src/nitro/camera/index.ts b/submodules/renderer/src/nitro/camera/index.ts new file mode 100644 index 0000000..c79058c --- /dev/null +++ b/submodules/renderer/src/nitro/camera/index.ts @@ -0,0 +1,3 @@ +export * from './RoomCameraWidgetEffect'; +export * from './RoomCameraWidgetManager'; +export * from './RoomCameraWidgetSelectedEffect'; diff --git a/submodules/renderer/src/nitro/communication/NitroCommunicationDemo.ts b/submodules/renderer/src/nitro/communication/NitroCommunicationDemo.ts new file mode 100644 index 0000000..ebfbacc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/NitroCommunicationDemo.ts @@ -0,0 +1,191 @@ +import { IConnection, INitroCommunicationDemo, INitroCommunicationManager, NitroConfiguration, NitroLogger } from '../../api'; +import { NitroManager } from '../../core'; +import { NitroCommunicationDemoEvent, SocketConnectionEvent } from '../../events'; +import { GetTickerTime } from '../../pixi-proxy'; +import { Nitro } from '../Nitro'; +import { AuthenticatedEvent, ClientHelloMessageComposer, ClientPingEvent, InfoRetrieveMessageComposer, PongMessageComposer, SSOTicketMessageComposer } from './messages'; + +export class NitroCommunicationDemo extends NitroManager implements INitroCommunicationDemo +{ + private _communication: INitroCommunicationManager; + + private _handShaking: boolean; + private _didConnect: boolean; + + private _pongInterval: any; + + constructor(communication: INitroCommunicationManager) + { + super(); + + this._communication = communication; + + this._handShaking = false; + this._didConnect = false; + + this._pongInterval = null; + + this.onConnectionOpenedEvent = this.onConnectionOpenedEvent.bind(this); + this.onConnectionClosedEvent = this.onConnectionClosedEvent.bind(this); + this.onConnectionErrorEvent = this.onConnectionErrorEvent.bind(this); + this.sendPong = this.sendPong.bind(this); + } + + protected onInit(): void + { + const connection = this._communication.connection; + + if(connection) + { + connection.addEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); + connection.addEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); + connection.addEventListener(SocketConnectionEvent.CONNECTION_ERROR, this.onConnectionErrorEvent); + } + + this._communication.registerMessageEvent(new ClientPingEvent(this.onClientPingEvent.bind(this))); + this._communication.registerMessageEvent(new AuthenticatedEvent(this.onAuthenticatedEvent.bind(this))); + } + + protected onDispose(): void + { + const connection = this._communication.connection; + + if(connection) + { + connection.removeEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); + connection.removeEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); + connection.removeEventListener(SocketConnectionEvent.CONNECTION_ERROR, this.onConnectionErrorEvent); + } + + this._handShaking = false; + + this.stopPonging(); + + super.onDispose(); + } + + private onConnectionOpenedEvent(event: Event): void + { + const connection = this._communication.connection; + + if(!connection) return; + + this._didConnect = true; + + this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_ESTABLISHED, connection); + + if(NitroConfiguration.getValue('system.pong.manually', false)) this.startPonging(); + + this.startHandshake(connection); + + connection.send(new ClientHelloMessageComposer(null, null, null, null)); + + this.tryAuthentication(connection); + } + + private onConnectionClosedEvent(event: CloseEvent): void + { + const connection = this._communication.connection; + + if(!connection) return; + + this.stopPonging(); + + if(this._didConnect) this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_CLOSED, connection); + } + + private onConnectionErrorEvent(event: CloseEvent): void + { + const connection = this._communication.connection; + + if(!connection) return; + + this.stopPonging(); + + this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_ERROR, connection); + } + + private tryAuthentication(connection: IConnection): void + { + if(!connection || !this.getSSO()) + { + if(!this.getSSO()) + { + NitroLogger.error('Login without an SSO ticket is not supported'); + } + + this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED, connection); + + return; + } + + connection.send(new SSOTicketMessageComposer(this.getSSO(), GetTickerTime())); + } + + private onClientPingEvent(event: ClientPingEvent): void + { + if(!event || !event.connection) return; + + this.sendPong(event.connection); + } + + private onAuthenticatedEvent(event: AuthenticatedEvent): void + { + if(!event || !event.connection) return; + + this.completeHandshake(event.connection); + + this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, event.connection); + + event.connection.send(new InfoRetrieveMessageComposer()); + } + + private startHandshake(connection: IConnection): void + { + this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING, connection); + + this._handShaking = true; + } + + private completeHandshake(connection: IConnection): void + { + this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKED, connection); + + this._handShaking = false; + } + + private startPonging(): void + { + this.stopPonging(); + + this._pongInterval = setInterval(this.sendPong, NitroConfiguration.getValue('system.pong.interval.ms', 20000)); + } + + private stopPonging(): void + { + if(!this._pongInterval) return; + + clearInterval(this._pongInterval); + + this._pongInterval = null; + } + + private sendPong(connection: IConnection = null): void + { + connection = ((connection || this._communication.connection) || null); + + if(!connection) return; + + connection.send(new PongMessageComposer()); + } + + private dispatchCommunicationDemoEvent(type: string, connection: IConnection): void + { + Nitro.instance.events.dispatchEvent(new NitroCommunicationDemoEvent(type, connection)); + } + + private getSSO(): string + { + return NitroConfiguration.getValue('sso.ticket', null); + } +} diff --git a/submodules/renderer/src/nitro/communication/NitroCommunicationManager.ts b/submodules/renderer/src/nitro/communication/NitroCommunicationManager.ts new file mode 100644 index 0000000..dc12ec1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/NitroCommunicationManager.ts @@ -0,0 +1,117 @@ +import { ICommunicationManager, IConnection, IConnectionStateListener, IMessageConfiguration, IMessageEvent, INitroCommunicationDemo, INitroCommunicationManager, INitroEvent, NitroConfiguration, NitroLogger } from '../../api'; +import { NitroManager } from '../../core'; +import { NitroCommunicationDemoEvent, SocketConnectionEvent } from '../../events'; +import { Nitro } from '../Nitro'; +import { NitroCommunicationDemo } from './NitroCommunicationDemo'; +import { NitroMessages } from './NitroMessages'; + +export class NitroCommunicationManager extends NitroManager implements INitroCommunicationManager, IConnectionStateListener +{ + private _communication: ICommunicationManager; + private _connection: IConnection; + private _messages: IMessageConfiguration; + + private _demo: INitroCommunicationDemo; + + constructor(communication: ICommunicationManager) + { + super(); + + this._communication = communication; + this._connection = null; + this._messages = new NitroMessages(); + + this._demo = new NitroCommunicationDemo(this); + + this.onConnectionOpenedEvent = this.onConnectionOpenedEvent.bind(this); + this.onConnectionClosedEvent = this.onConnectionClosedEvent.bind(this); + this.onConnectionErrorEvent = this.onConnectionErrorEvent.bind(this); + this.onConnectionAuthenticatedEvent = this.onConnectionAuthenticatedEvent.bind(this); + } + + protected onInit(): void + { + if(this._connection) return; + + Nitro.instance.events.addEventListener(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, this.onConnectionAuthenticatedEvent); + + this._connection = this._communication.createConnection(this); + + this._connection.registerMessages(this._messages); + + this._connection.addEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); + this._connection.addEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); + this._connection.addEventListener(SocketConnectionEvent.CONNECTION_ERROR, this.onConnectionErrorEvent); + + if(this._demo) this._demo.init(); + + this._connection.init(NitroConfiguration.getValue('socket.url')); + } + + protected onDispose(): void + { + if(this._demo) this._demo.dispose(); + + if(this._connection) + { + this._connection.removeEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); + this._connection.removeEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); + this._connection.removeEventListener(SocketConnectionEvent.CONNECTION_ERROR, this.onConnectionErrorEvent); + } + + Nitro.instance.events.removeEventListener(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, this.onConnectionAuthenticatedEvent); + + super.onDispose(); + } + + private onConnectionOpenedEvent(event: Event): void + { + NitroLogger.log('Connection Initialized'); + } + + private onConnectionClosedEvent(event: CloseEvent): void + { + NitroLogger.log('Connection Closed'); + } + + private onConnectionErrorEvent(event: Event): void + { + NitroLogger.log('Connection Error'); + } + + private onConnectionAuthenticatedEvent(event: INitroEvent): void + { + NitroLogger.log('Connection Authenticated'); + + if(this._connection) this._connection.authenticated(); + } + + public connectionInit(socketUrl: string): void + { + NitroLogger.log('Initializing Connection', socketUrl); + } + + public registerMessageEvent(event: IMessageEvent): IMessageEvent + { + if(this._connection) this._connection.addMessageEvent(event); + + return event; + } + + public removeMessageEvent(event: IMessageEvent): void + { + if(!this._connection) return; + + this._connection.removeMessageEvent(event); + } + + public get demo(): INitroCommunicationDemo + { + return this._demo; + } + + public get connection(): IConnection + { + return this._connection; + } +} diff --git a/submodules/renderer/src/nitro/communication/NitroMessages.ts b/submodules/renderer/src/nitro/communication/NitroMessages.ts new file mode 100644 index 0000000..fb2a3fb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/NitroMessages.ts @@ -0,0 +1,1179 @@ +import { IMessageConfiguration } from '../../api'; +import { AcceptFriendMessageComposer, AcceptFriendResultEvent, AcceptGameInviteMessageComposer, AcceptQuestMessageComposer, AccountSafetyLockStatusChangeMessageEvent, AchievementEvent, AchievementNotificationMessageEvent, AchievementResolutionCompletedMessageEvent, AchievementResolutionProgressMessageEvent, AchievementResolutionsMessageEvent, AchievementsEvent, AchievementsScoreEvent, ActivateQuestMessageComposer, ActivityPointNotificationMessageEvent, AddFavouriteRoomMessageComposer, AddJukeboxDiskComposer, AddSpamWallPostItMessageComposer, ApplySnapshotMessageComposer, ApplyTonerComposer, ApproveAllMembershipRequestsMessageComposer, ApproveNameMessageComposer, ApproveNameMessageEvent, AuthenticatedEvent, AuthenticationMessageComposer, AvailabilityStatusMessageEvent, AvailabilityTimeMessageEvent, AvatarEffectActivatedComposer, AvatarEffectActivatedEvent, AvatarEffectAddedEvent, AvatarEffectExpiredEvent, AvatarEffectSelectedComposer, AvatarEffectSelectedEvent, AvatarEffectsEvent, BadgePointLimitsEvent, BadgeReceivedEvent, BadgesEvent, BannedUsersFromRoomEvent, BonusRareInfoMessageEvent, BotAddedToInventoryEvent, BotCommandConfigurationEvent, BotErrorEvent, BotForceOpenContextMenuEvent, BotInventoryMessageEvent, BotPlaceComposer, BotReceivedMessageEvent, BotRemoveComposer, BotRemovedFromInventoryEvent, BotSkillListUpdateEvent, BotSkillSaveComposer, BreedPetsMessageComposer, BuildersClubFurniCountMessageEvent, BuildersClubPlaceRoomItemMessageComposer, BuildersClubPlaceWallItemMessageComposer, BuildersClubQueryFurniCountMessageComposer, BuildersClubSubscriptionStatusMessageEvent, BundleDiscountRulesetMessageEvent, BuyMarketplaceOfferMessageComposer, BuyMarketplaceTokensMessageComposer, CallForHelpDisabledNotifyMessageEvent, CallForHelpFromForumMessageMessageComposer, CallForHelpFromForumThreadMessageComposer, CallForHelpFromIMMessageComposer, CallForHelpFromPhotoMessageComposer, CallForHelpFromSelfieMessageComposer, CallForHelpMessageComposer, CallForHelpPendingCallsDeletedMessageEvent, CallForHelpPendingCallsMessageEvent, CallForHelpReplyMessageEvent, CallForHelpResultMessageEvent, CameraPublishStatusMessageEvent, CameraPurchaseOKMessageEvent, CameraSnapshotMessageEvent, CameraStorageUrlMessageEvent, CampaignCalendarDataMessageEvent, CampaignCalendarDoorOpenedMessageEvent, CancelEventMessageComposer, CancelMarketplaceOfferMessageComposer, CancelMysteryBoxWaitMessageEvent, CancelPetBreedingComposer, CancelQuestMessageComposer, CanCreateRoomEvent, CanCreateRoomEventEvent, CanCreateRoomMessageComposer, CatalogGroupsComposer, CatalogPageExpirationEvent, CatalogPageMessageEvent, CatalogPagesListEvent, CatalogPageWithEarliestExpiryMessageEvent, CatalogPublishedMessageEvent, CategoriesWithVisitorCountEvent, CfhChatlogEvent, CfhSanctionMessageEvent, CfhTopicsInitEvent, ChangeEmailComposer, ChangeEmailResultEvent, ChangeQueueMessageComposer, ChangeUserNameMessageComposer, ChangeUserNameResultMessageEvent, ChatReviewGuideDecidesOnOfferMessageComposer, ChatReviewGuideDetachedMessageComposer, ChatReviewGuideVoteMessageComposer, ChatReviewSessionCreateMessageComposer, ChatReviewSessionDetachedMessageEvent, ChatReviewSessionOfferedToGuideMessageEvent, ChatReviewSessionResultsMessageEvent, ChatReviewSessionStartedMessageEvent, ChatReviewSessionVotingStatusMessageEvent, CheckUserNameMessageComposer, CheckUserNameResultMessageEvent, ClientHelloMessageComposer, ClientPingEvent, CloseIssueDefaultActionMessageComposer, CloseIssuesMessageComposer, ClubGiftInfoEvent, ClubGiftNotificationEvent, ClubGiftSelectedEvent, CommunityGoalEarnedPrizesMessageEvent, CommunityGoalHallOfFameMessageEvent, CommunityGoalProgressMessageEvent, CommunityGoalVoteMessageComposer, CommunityGoalVoteMessageEvent, CompetitionEntrySubmitResultEvent, CompetitionRoomsDataMessageEvent, CompetitionRoomsSearchMessageComposer, CompetitionStatusMessageEvent, CompetitionVotingInfoMessageEvent, CompleteDiffieHandshakeEvent, CompleteDiffieHandshakeMessageComposer, CompostPlantMessageComposer, ConcurrentUsersGoalProgressMessageEvent, ConfirmPetBreedingComposer, ConnectionErrorEvent, ControlYoutubeDisplayPlaybackMessageComposer, ConvertedRoomIdEvent, ConvertGlobalRoomIdMessageComposer, CraftableProductsEvent, CraftComposer, CraftingRecipeEvent, CraftingRecipesAvailableEvent, CraftingResultEvent, CraftSecretComposer, CreateFlatMessageComposer, CurrentTimingCodeMessageEvent, CustomUserNotificationMessageEvent, DeclineFriendMessageComposer, DefaultSanctionMessageComposer, DeleteFavouriteRoomMessageComposer, DeletePendingCallsForHelpMessageComposer, DesktopViewComposer, DesktopViewEvent, DiceValueMessageEvent, DirectSMSClubBuyAvailableMessageEvent, DisconnectMessageComposer, DisconnectReasonEvent, DoorbellMessageEvent, EditEventMessageComposer, ElementPointerMessageEvent, EmailStatusResultEvent, EpicPopupMessageEvent, ExtendedProfileChangedMessageEvent, ExtendRentOrBuyoutFurniMessageComposer, ExtendRentOrBuyoutStripItemMessageComposer, FavoriteMembershipUpdateMessageEvent, FavouriteChangedEvent, FavouritesEvent, FigureSetIdsMessageEvent, FigureUpdateEvent, FindFriendsProcessResultEvent, FindNewFriendsMessageComposer, FireworkChargeDataEvent, FlatAccessDeniedMessageEvent, FlatControllerAddedEvent, FlatControllerRemovedEvent, FlatControllersEvent, FlatCreatedEvent, FloodControlEvent, FloorHeightMapEvent, FollowFriendFailedEvent, FollowFriendMessageComposer, ForumDataMessageEvent, ForumsListMessageEvent, ForwardToACompetitionRoomMessageComposer, ForwardToARandomPromotedRoomMessageComposer, ForwardToASubmittableRoomMessageComposer, ForwardToRandomCompetitionRoomMessageComposer, ForwardToSomeRoomMessageComposer, FriendFurniConfirmLockMessageComposer, FriendListFragmentEvent, FriendListUpdateComposer, FriendListUpdateEvent, FriendNotificationEvent, FriendRequestQuestCompleteMessageComposer, FriendRequestsEvent, FurniRentOrBuyoutOfferMessageEvent, FurnitureAliasesComposer, FurnitureAliasesEvent, FurnitureColorWheelComposer, FurnitureDataEvent, FurnitureDiceActivateComposer, FurnitureDiceDeactivateComposer, FurnitureExchangeComposer, FurnitureFloorAddEvent, FurnitureFloorEvent, FurnitureFloorRemoveEvent, FurnitureFloorUpdateComposer, FurnitureFloorUpdateEvent, FurnitureGroupInfoComposer, FurnitureListAddOrUpdateEvent, FurnitureListComposer, FurnitureListEvent, FurnitureListInvalidateEvent, FurnitureListRemovedEvent, FurnitureMannequinSaveLookComposer, FurnitureMannequinSaveNameComposer, FurnitureMultiStateComposer, FurnitureOneWayDoorComposer, FurniturePickupComposer, FurniturePlaceComposer, FurniturePlacePaintComposer, FurniturePostItPlaceComposer, FurniturePostItPlacedEvent, FurnitureRandomStateComposer, FurnitureStackHeightComposer, FurnitureStackHeightEvent, FurnitureWallAddEvent, FurnitureWallEvent, FurnitureWallMultiStateComposer, FurnitureWallRemoveEvent, FurnitureWallUpdateComposer, FurnitureWallUpdateEvent, Game2AccountGameStatusMessageEvent, Game2CheckGameDirectoryStatusMessageComposer, Game2ExitGameMessageComposer, Game2GameChatMessageComposer, Game2GameDirectoryStatusMessageEvent, Game2GetAccountGameStatusMessageComposer, Game2GetWeeklyFriendsLeaderboardComposer, Game2GetWeeklyLeaderboardComposer, Game2InArenaQueueMessageEvent, Game2JoiningGameFailedMessageEvent, Game2LoadStageReadyMessageComposer, Game2PlayAgainMessageComposer, Game2RequestFullStatusUpdateMessageComposer, Game2StartingGameFailedMessageEvent, Game2StopCounterMessageEvent, Game2UserLeftGameMessageEvent, Game2WeeklyFriendsLeaderboardEvent, Game2WeeklyLeaderboardEvent, GameAchievementsMessageEvent, GameInviteMessageEvent, GameListMessageEvent, GameStatusMessageEvent, GameUnloadedMessageComposer, GenericErrorEvent, GetBadgePointLimitsComposer, GetBonusRareInfoMessageComposer, GetBotInventoryComposer, GetBundleDiscountRulesetComposer, GetCatalogIndexComposer, GetCatalogPageComposer, GetCatalogPageExpirationComposer, GetCatalogPageWithEarliestExpiryComposer, GetCategoriesWithUserCountMessageComposer, GetCfhChatlogMessageComposer, GetCfhStatusMessageComposer, GetClubGiftInfo, GetClubOffersMessageComposer, GetCommunityGoalEarnedPrizesMessageComposer, GetCommunityGoalHallOfFameMessageComposer, GetCommunityGoalProgressMessageComposer, GetConcurrentUsersGoalProgressMessageComposer, GetConcurrentUsersRewardMessageComposer, GetCraftableProductsComposer, GetCraftingRecipeComposer, GetCraftingRecipesAvailableComposer, GetCurrentTimingCodeMessageComposer, GetCustomRoomFilterMessageComposer, GetDailyQuestMessageComposer, GetDirectClubBuyAvailableComposer, GetEmailStatusComposer, GetExtendedProfileByNameMessageComposer, GetFaqCategoryMessageComposer, GetFaqTextMessageComposer, GetForumsListMessageComposer, GetForumStatsMessageComposer, GetFriendRequestsComposer, GetGameAchievementsMessageComposer, GetGameListMessageComposer, GetGameStatusMessageComposer, GetGiftMessageComposer, GetGiftWrappingConfigurationComposer, GetGuestRoomMessageComposer, GetGuestRoomResultEvent, GetGuideReportingStatusMessageComposer, GetHabboBasicMembershipExtendOfferComposer, GetHabboClubExtendOfferMessageComposer, GetHabboGroupBadgesMessageComposer, GetIgnoredUsersComposer, GetInterstitialMessageComposer, GetIsBadgeRequestFulfilledComposer, GetIsOfferGiftableComposer, GetIsUserPartOfCompetitionMessageComposer, GetItemDataComposer, GetJukeboxPlayListMessageComposer, GetLimitedOfferAppearingNextComposer, GetMarketplaceCanMakeOfferComposer, GetMarketplaceConfigurationMessageComposer, GetMarketplaceItemStatsComposer, GetMarketplaceOffersMessageComposer, GetMarketplaceOwnOffersMessageComposer, GetMessagesMessageComposer, GetModeratorRoomInfoMessageComposer, GetModeratorUserInfoMessageComposer, GetNextTargetedOfferComposer, GetNowPlayingMessageComposer, GetOccupiedTilesMessageComposer, GetOfficialRoomsMessageComposer, GetOfficialSongIdMessageComposer, GetPendingCallsForHelpMessageComposer, GetPetCommandsComposer, GetPopularRoomTagsMessageComposer, GetProductOfferComposer, GetPromoArticlesComposer, GetQuestsMessageComposer, GetQuizQuestionsComposer, GetRecyclerStatusMessageComposer, GetRentOrBuyoutOfferMessageComposer, GetResolutionAchievementsMessageComposer, GetRoomAdPurchaseInfoComposer, GetRoomChatlogMessageComposer, GetRoomEntryDataMessageComposer, GetRoomEntryTileMessageComposer, GetRoomVisitsMessageComposer, GetSeasonalCalendarDailyOfferComposer, GetSeasonalQuestsOnlyMessageComposer, GetSecondsUntilMessageComposer, GetSellablePetPalettesComposer, GetSongInfoMessageComposer, GetSoundMachinePlayListMessageComposer, GetSoundSettingsComposer, GetTalentTrackLevelMessageComposer, GetTargetedOfferComposer, GetThreadMessageComposer, GetThreadsMessageComposer, GetUnreadForumsCountMessageComposer, GetUserChatlogMessageComposer, GetUserEventCatsMessageComposer, GetUserFlatCatsMessageComposer, GetUserGameAchievementsMessageComposer, GetUserSongDisksMessageComposer, GetUserTagsComposer, GetWardrobeMessageComposer, GetWeeklyGameRewardComposer, GetWeeklyGameRewardWinnersComposer, GetYoutubeDisplayStatusMessageComposer, GiftReceiverNotFoundEvent, GiftWrappingConfigurationEvent, GotMysteryBoxPrizeMessageEvent, GoToFlatMessageComposer, GroupAdminGiveComposer, GroupAdminTakeComposer, GroupBadgePartsComposer, GroupBadgePartsEvent, GroupBuyComposer, GroupBuyDataComposer, GroupBuyDataEvent, GroupConfirmMemberRemoveEvent, GroupConfirmRemoveMemberComposer, GroupDeleteComposer, GroupDetailsChangedMessageEvent, GroupFavoriteComposer, GroupFurniContextMenuInfoMessageEvent, GroupInformationComposer, GroupInformationEvent, GroupJoinComposer, GroupMembersComposer, GroupMembersEvent, GroupMembershipAcceptComposer, GroupMembershipDeclineComposer, GroupMembershipRequestedMessageEvent, GroupPurchasedEvent, GroupRemoveMemberComposer, GroupSaveBadgeComposer, GroupSaveColorsComposer, GroupSaveInformationComposer, GroupSavePreferencesComposer, GroupSettingsComposer, GroupSettingsEvent, GroupUnfavoriteComposer, GuestRoomSearchResultEvent, GuideOnDutyStatusMessageEvent, GuideReportingStatusMessageEvent, GuideSessionAttachedMessageEvent, GuideSessionCreateMessageComposer, GuideSessionDetachedMessageEvent, GuideSessionEndedMessageEvent, GuideSessionErrorMessageEvent, GuideSessionFeedbackMessageComposer, GuideSessionGetRequesterRoomMessageComposer, GuideSessionGuideDecidesMessageComposer, GuideSessionInvitedToGuideRoomMessageEvent, GuideSessionInviteRequesterMessageComposer, GuideSessionIsTypingMessageComposer, GuideSessionMessageMessageComposer, GuideSessionMessageMessageEvent, GuideSessionOnDutyUpdateMessageComposer, GuideSessionPartnerIsTypingMessageEvent, GuideSessionReportMessageComposer, GuideSessionRequesterCancelsMessageComposer, GuideSessionRequesterRoomMessageEvent, GuideSessionResolvedMessageComposer, GuideSessionStartedMessageEvent, GuideTicketCreationResultMessageEvent, GuideTicketResolutionMessageEvent, GuildBaseSearchMessageComposer, GuildEditFailedMessageEvent, GuildForumThreadsEvent, GuildMemberMgmtFailedMessageEvent, GuildMembershipsMessageEvent, HabboBroadcastMessageEvent, HabboClubExtendOfferMessageEvent, HabboClubOffersMessageEvent, HabboGroupBadgesMessageEvent, HabboGroupDeactivatedMessageEvent, HabboGroupJoinFailedMessageEvent, HabboSearchComposer, HabboSearchResultEvent, HarvestPetMessageComposer, HotelClosedAndOpensEvent, HotelClosesAndWillOpenAtEvent, HotelMergeNameChangeEvent, HotelWillCloseInMinutesEvent, IdentityAccountsEvent, IgnoredUsersEvent, IgnoreResultEvent, IgnoreUserComposer, IgnoreUserIdComposer, InClientLinkEvent, IncomingHeader, InfoFeedEnableMessageEvent, InfoRetrieveMessageComposer, InitCameraMessageEvent, InitDiffieHandshakeEvent, InitDiffieHandshakeMessageComposer, InstantMessageErrorEvent, InterstitialMessageEvent, InterstitialShownMessageComposer, IsBadgeRequestFulfilledEvent, IsOfferGiftableMessageEvent, IssueCloseNotificationMessageEvent, IssueDeletedMessageEvent, IssueInfoMessageEvent, IssuePickFailedMessageEvent, IsUserPartOfCompetitionMessageEvent, ItemDataUpdateMessageEvent, JoinedQueueMessageEvent, JoiningQueueFailedMessageEvent, JoinQueueMessageComposer, JukeboxPlayListFullMessageEvent, JukeboxSongDisksMessageEvent, LagWarningReportMessageComposer, LeaveQueueMessageComposer, LeftQueueMessageEvent, LimitedEditionSoldOutEvent, LimitedOfferAppearingNextMessageEvent, LoadGameMessageEvent, LoadGameUrlEvent, LoveLockFurniFinishedEvent, LoveLockFurniFriendConfirmedEvent, LoveLockFurniStartEvent, MaintenanceStatusMessageEvent, MakeOfferMessageComposer, MarkCatalogNewAdditionsPageOpenedComposer, MarketplaceBuyOfferResultEvent, MarketplaceCancelOfferResultEvent, MarketplaceCanMakeOfferResult, MarketplaceConfigurationEvent, MarketplaceItemStatsEvent, MarketplaceMakeOfferResult, MarketPlaceOffersEvent, MarketplaceOwnOffersEvent, MessageErrorEvent, MessengerInitComposer, MessengerInitEvent, MiniMailNewMessageEvent, MiniMailUnreadCountEvent, ModAlertMessageComposer, ModBanMessageComposer, ModerateMessageMessageComposer, ModerateRoomMessageComposer, ModerateThreadMessageComposer, ModeratorActionMessageComposer, ModeratorActionResultMessageEvent, ModeratorCautionEvent, ModeratorInitMessageEvent, ModeratorMessageEvent, ModeratorRoomInfoEvent, ModeratorToolPreferencesEvent, ModeratorUserInfoEvent, ModKickMessageComposer, ModMessageMessageComposer, ModMuteMessageComposer, ModToolPreferencesComposer, ModToolSanctionComposer, ModTradingLockMessageComposer, MoodlightSettingsComposer, MoodlightSettingsSaveComposer, MoodlightTogggleStateComposer, MOTDNotificationEvent, MuteAllInRoomEvent, MyFavouriteRoomsSearchMessageComposer, MyFrequentRoomHistorySearchMessageComposer, MyFriendsRoomsSearchMessageComposer, MyGuildBasesSearchMessageComposer, MyRecommendedRoomsMessageComposer, MyRoomHistorySearchMessageComposer, MyRoomRightsSearchMessageComposer, MyRoomsSearchMessageComposer, MysteryBoxKeysEvent, MysteryBoxWaitingCanceledMessageComposer, NavigatorCategoryListModeComposer, NavigatorCollapsedEvent, NavigatorDeleteSavedSearchComposer, NavigatorHomeRoomEvent, NavigatorInitComposer, NavigatorLiftedEvent, NavigatorMetadataEvent, NavigatorOpenRoomCreatorEvent, NavigatorSearchCloseComposer, NavigatorSearchComposer, NavigatorSearchesEvent, NavigatorSearchEvent, NavigatorSearchOpenComposer, NavigatorSearchSaveComposer, NavigatorSettingsEvent, NavigatorSettingsSaveComposer, NewConsoleMessageEvent, NewFriendRequestEvent, NewUserExperienceGetGiftsComposer, NewUserExperienceGiftOfferMessageEvent, NewUserExperienceNotCompleteEvent, NewUserExperienceScriptProceedComposer, NoobnessLevelMessageEvent, NoOwnedRoomsAlertMessageEvent, NoSuchFlatEvent, NotEnoughBalanceMessageEvent, NotificationDialogMessageEvent, NowPlayingMessageEvent, ObjectsDataUpdateEvent, ObjectsRollingEvent, OfferRewardDeliveredMessageEvent, OfficialSongIdMessageEvent, OneWayDoorStatusMessageEvent, OpenCampaignCalendarDoorAsStaffComposer, OpenCampaignCalendarDoorComposer, OpenMessageComposer, OpenMysteryTrophyMessageComposer, OpenPetPackageMessageComposer, OpenPetPackageRequestedMessageEvent, OpenPetPackageResultMessageEvent, OpenPresentComposer, OpenQuestTrackerMessageComposer, OpenWelcomeGiftComposer, OutgoingHeader, PeerUsersClassificationMessageComposer, PerformanceLogMessageComposer, PerkAllowancesMessageEvent, PetAddedToInventoryEvent, PetBreedingResultEvent, PetExperienceEvent, PetFigureUpdateEvent, PetInfoEvent, PetInventoryEvent, PetLevelNotificationEvent, PetLevelUpdateMessageEvent, PetMountComposer, PetMoveComposer, PetPlaceComposer, PetPlacingErrorEvent, PetReceivedMessageEvent, PetRemoveComposer, PetRemovedFromInventory, PetRespectComposer, PetRespectNoficationEvent, PetScratchFailedMessageEvent, PetSelectedMessageComposer, PetStatusUpdateEvent, PetSupplementComposer, PetSupplementedNotificationEvent, PetTrainingPanelMessageEvent, PhoneCollectionStateMessageEvent, PhotoCompetitionMessageComposer, PickIssuesMessageComposer, PlayListMessageEvent, PlayListSongAddedMessageEvent, PollAnswerComposer, PollContentsEvent, RoomPollResultEvent, PollErrorEvent, PollOfferEvent, PollRejectComposer, PollStartComposer, PongMessageComposer, PopularRoomsSearchMessageComposer, PopularRoomTagsResultEvent, PostMessageMessageComposer, PostMessageMessageEvent, PostQuizAnswersComposer, PostThreadMessageEvent, PresentOpenedMessageEvent, ProductOfferEvent, PromoArticlesMessageEvent, PublishPhotoMessageComposer, PurchaseBasicMembershipExtensionComposer, PurchaseErrorMessageEvent, PurchaseFromCatalogAsGiftComposer, PurchaseFromCatalogComposer, PurchaseNotAllowedMessageEvent, PurchaseOKMessageEvent, PurchasePhotoMessageComposer, PurchaseRoomAdMessageComposer, PurchaseTargetedOfferComposer, PurchaseVipMembershipExtensionComposer, QuestCancelledMessageEvent, QuestCompletedMessageEvent, QuestDailyMessageEvent, QuestionAnsweredEvent, QuestionEvent, QuestionFinishedEvent, QuestMessageEvent, QuestsMessageEvent, QuizDataMessageEvent, QuizResultsMessageEvent, RateFlatMessageComposer, RecycleItemsMessageComposer, RecyclerFinishedMessageEvent, RecyclerStatusMessageEvent, RedeemCommunityGoalPrizeMessageComposer, RedeemItemClothingComposer, RedeemMarketplaceOfferCreditsMessageComposer, RedeemVoucherMessageComposer, RejectQuestMessageComposer, RelationshipStatusInfoEvent, ReleaseIssuesMessageComposer, RemainingMuteEvent, RemoveAllRightsMessageComposer, RemoveFriendComposer, RemoveJukeboxDiskComposer, RemoveOwnRoomRightsRoomMessageComposer, RemovePetSaddleComposer, RemoveWallItemComposer, RenderRoomMessageComposer, RenderRoomThumbnailMessageComposer, RentableSpaceCancelRentMessageComposer, RentableSpaceRentFailedMessageEvent, RentableSpaceRentMessageComposer, RentableSpaceRentOkMessageEvent, RentableSpaceStatusMessageComposer, RentableSpaceStatusMessageEvent, RequestABadgeComposer, RequestAchievementsMessageComposer, RequestBadgesComposer, RequestBotCommandConfigurationComposer, RequestCameraConfigurationComposer, RequestFriendComposer, RequestFurniInventoryWhenNotInRoomComposer, RequestPetInfoComposer, RequestPetsComposer, RequestSpamWallPostItMessageEvent, ResetPhoneNumberStateMessageComposer, ResetResolutionAchievementMessageComposer, RespectReceivedEvent, RestoreClientMessageEvent, RoomAdErrorEvent, RoomAdEventTabAdClickedComposer, RoomAdEventTabViewedComposer, RoomAdPurchaseInfoEvent, RoomAdPurchaseInitiatedComposer, RoomAdSearchMessageComposer, RoomAmbassadorAlertComposer, RoomBannedUsersComposer, RoomBanUserComposer, RoomChatlogEvent, RoomChatSettingsEvent, RoomCompetitionInitMessageComposer, RoomDeleteComposer, RoomDimmerPresetsEvent, RoomDoorbellAcceptedEvent, RoomDoorbellAccessComposer, RoomEnterComposer, RoomEnterErrorEvent, RoomEnterEvent, RoomEntryInfoMessageEvent, RoomEntryTileMessageEvent, RoomEventCancelEvent, RoomEventEvent, RoomFilterSettingsMessageEvent, RoomForwardEvent, RoomGiveRightsComposer, RoomHeightMapEvent, RoomHeightMapUpdateEvent, RoomInviteErrorEvent, RoomInviteEvent, RoomKickUserComposer, RoomMessageNotificationMessageEvent, RoomMuteComposer, RoomMuteUserComposer, RoomNetworkOpenConnectionMessageComposer, RoomOccupiedTilesMessageEvent, RoomPaintEvent, RoomReadyMessageEvent, RoomRightsClearEvent, RoomRightsEvent, RoomRightsOwnerEvent, RoomScoreEvent, RoomSettingsComposer, RoomSettingsDataEvent, RoomSettingsErrorEvent, RoomSettingsSavedEvent, RoomSettingsSaveErrorEvent, RoomSettingsUpdatedEvent, RoomsWhereMyFriendsAreSearchMessageComposer, RoomsWithHighestScoreSearchMessageComposer, RoomTakeRightsComposer, RoomTextSearchMessageComposer, RoomThumbnailUpdateResultEvent, RoomUnbanUserComposer, RoomUnitActionComposer, RoomUnitChatComposer, RoomUnitChatEvent, RoomUnitChatShoutComposer, RoomUnitChatShoutEvent, RoomUnitChatStyleComposer, RoomUnitChatWhisperComposer, RoomUnitChatWhisperEvent, RoomUnitDanceComposer, RoomUnitDanceEvent, RoomUnitDropHandItemComposer, RoomUnitEffectEvent, RoomUnitEvent, RoomUnitExpressionEvent, RoomUnitGiveHandItemComposer, RoomUnitGiveHandItemPetComposer, RoomUnitHandItemEvent, RoomUnitHandItemReceivedEvent, RoomUnitIdleEvent, RoomUnitInfoEvent, RoomUnitLookComposer, RoomUnitNumberEvent, RoomUnitPostureComposer, RoomUnitRemoveEvent, RoomUnitSignComposer, RoomUnitStatusEvent, RoomUnitTypingEvent, RoomUnitTypingStartComposer, RoomUnitTypingStopComposer, RoomUnitWalkComposer, RoomUsersClassificationMessageComposer, RoomUsersWithRightsComposer, RoomVisitsEvent, RoomVisualizationSettingsEvent, SanctionStatusEvent, SaveRoomSettingsComposer, SaveWardrobeOutfitMessageComposer, ScrGetKickbackInfoMessageComposer, ScrSendKickbackInfoMessageEvent, SearchFaqsMessageComposer, SeasonalCalendarDailyOfferMessageEvent, SeasonalQuestsMessageEvent, SecondsUntilMessageEvent, SelectClubGiftComposer, SellablePetPalettesMessageEvent, SendMessageComposer, SendRoomInviteComposer, SetActivatedBadgesComposer, SetClothingChangeDataMessageComposer, SetItemDataMessageComposer, SetObjectDataMessageComposer, SetPhoneNumberVerificationStatusMessageComposer, SetRelationshipStatusComposer, SetRoomSessionTagsMessageComposer, SetTargetedOfferStateComposer, SetYoutubeDisplayPlaylistMessageComposer, ShopTargetedOfferViewedComposer, ShowEnforceRoomCategoryDialogEvent, ShowMysteryBoxWaitMessageEvent, SimpleAlertMessageEvent, SSOTicketMessageComposer, StartCampaignMessageComposer, StartRoomPollEvent, SubmitRoomToCompetitionMessageComposer, TalentLevelUpEvent, TalentTrackComposer, TalentTrackLevelMessageEvent, TalentTrackMessageEvent, TargetedOfferEvent, TargetedOfferNotFoundEvent, ThreadMessagesMessageEvent, ThumbnailStatusMessageEvent, TogglePetBreedingComposer, TogglePetRidingComposer, ToggleStaffPickMessageComposer, TradingAcceptComposer, TradingAcceptEvent, TradingCancelComposer, TradingCloseComposer, TradingCloseEvent, TradingCompletedEvent, TradingConfirmationComposer, TradingConfirmationEvent, TradingListAddItemComposer, TradingListAddItemsComposer, TradingListItemEvent, TradingListItemRemoveComposer, TradingNoSuchItemEvent, TradingNotOpenEvent, TradingOpenComposer, TradingOpenEvent, TradingOpenFailedEvent, TradingOtherNotAllowedEvent, TradingUnacceptComposer, TradingYouAreNotAllowedEvent, TraxSongInfoMessageEvent, TryPhoneNumberMessageComposer, TryPhoneNumberResultMessageEvent, TryVerificationCodeResultMessageEvent, UnblockGroupMemberMessageComposer, UnignoreUserComposer, UniqueIDMessageComposer, UnloadGameMessageEvent, UnreadForumsCountMessageEvent, UnseenItemsEvent, UnseenResetCategoryComposer, UnseenResetItemsComposer, UpdateActionMessageComposer, UpdateConditionMessageComposer, UpdateFloorPropertiesMessageComposer, UpdateForumReadMarkerMessageComposer, UpdateForumSettingsMessageComposer, UpdateHomeRoomMessageComposer, UpdateMessageMessageEvent, UpdateRoomCategoryAndTradeSettingsComposer, UpdateRoomFilterMessageComposer, UpdateRoomThumbnailMessageComposer, UpdateThreadMessageComposer, UpdateThreadMessageEvent, UpdateTriggerMessageComposer, UsePetProductComposer, UserBannedMessageEvent, UserChatlogEvent, UserClassificationMessageEvent, UserCreditsEvent, UserCurrencyComposer, UserCurrencyEvent, UserCurrentBadgesComposer, UserCurrentBadgesEvent, UserEventCatsEvent, UserFigureComposer, UserFlatCatsEvent, UserGameAchievementsMessageEvent, UserInfoEvent, UserMottoComposer, UserNameChangeMessageEvent, UserPermissionsEvent, UserProfileComposer, UserProfileEvent, UserRelationshipsComposer, UserRespectComposer, UserSettingsCameraFollowComposer, UserSettingsEvent, UserSettingsOldChatComposer, UserSettingsRoomInvitesComposer, UserSettingsSoundComposer, UserSongDisksInventoryMessageEvent, UserSubscriptionComposer, UserSubscriptionEvent, UserTagsMessageEvent, UserUnbannedFromRoomEvent, UserWardrobePageEvent, VerifyCodeMessageComposer, VersionCheckMessageComposer, VisitUserComposer, VoteForRoomMessageComposer, VoucherRedeemErrorMessageEvent, VoucherRedeemOkMessageEvent, WardrobeMessageEvent, WeeklyCompetitiveFriendsLeaderboardEvent, WeeklyCompetitiveLeaderboardEvent, WeeklyGameRewardEvent, WeeklyGameRewardWinnersEvent, WelcomeGiftChangeEmailComposer, WelcomeGiftChangeEmailResultEvent, WelcomeGiftStatusEvent, WiredFurniActionEvent, WiredFurniConditionEvent, WiredFurniTriggerEvent, WiredOpenEvent, WiredRewardResultMessageEvent, WiredSaveSuccessEvent, WiredValidationErrorEvent, YouArePlayingGameEvent, YouAreSpectatorMessageEvent, YoutubeControlVideoMessageEvent, YoutubeDisplayPlaylistsEvent, YoutubeDisplayVideoMessageEvent, VotePollCounterMessageComposer } from './messages'; + +export class NitroMessages implements IMessageConfiguration +{ + private _events: Map; + private _composers: Map; + + constructor() + { + this._events = new Map(); + this._composers = new Map(); + + this.registerEvents(); + this.registerComposers(); + } + + private registerEvents(): void + { + // ADVERTISEMENT + this._events.set(IncomingHeader.INTERSTITIAL_MESSAGE, InterstitialMessageEvent); + this._events.set(IncomingHeader.ROOM_AD_ERROR, RoomAdErrorEvent); + + // AVAILABILITY + this._events.set(IncomingHeader.AVAILABILITY_STATUS, AvailabilityStatusMessageEvent); + this._events.set(IncomingHeader.AVAILABILITY_TIME, AvailabilityTimeMessageEvent); + this._events.set(IncomingHeader.HOTEL_CLOSED_AND_OPENS, HotelClosedAndOpensEvent); + this._events.set(IncomingHeader.HOTEL_CLOSES_AND_OPENS_AT, HotelClosesAndWillOpenAtEvent); + this._events.set(IncomingHeader.HOTEL_WILL_CLOSE_MINUTES, HotelWillCloseInMinutesEvent); + this._events.set(IncomingHeader.HOTEL_MAINTENANCE, MaintenanceStatusMessageEvent); + + // AVATAR + this._events.set(IncomingHeader.USER_CHANGE_NAME, ChangeUserNameResultMessageEvent); + this._events.set(IncomingHeader.CHECK_USER_NAME, CheckUserNameResultMessageEvent); + this._events.set(IncomingHeader.USER_FIGURE, FigureUpdateEvent); + this._events.set(IncomingHeader.USER_OUTFITS, WardrobeMessageEvent); + + // BOTS + this._events.set(IncomingHeader.ADD_BOT_TO_INVENTORY, BotAddedToInventoryEvent); + this._events.set(IncomingHeader.USER_BOTS, BotInventoryMessageEvent); + this._events.set(IncomingHeader.BOT_RECEIVED, BotReceivedMessageEvent); + this._events.set(IncomingHeader.REMOVE_BOT_FROM_INVENTORY, BotRemovedFromInventoryEvent); + + // CALL FOR HELP + this._events.set(IncomingHeader.CFH_SANCTION, CfhSanctionMessageEvent); + this._events.set(IncomingHeader.CFH_TOPICS, CfhTopicsInitEvent); + this._events.set(IncomingHeader.CFH_SANCTION_STATUS, SanctionStatusEvent); + + // CAMERA + this._events.set(IncomingHeader.CAMERA_PUBLISH_STATUS, CameraPublishStatusMessageEvent); + this._events.set(IncomingHeader.CAMERA_PURCHASE_OK, CameraPurchaseOKMessageEvent); + this._events.set(IncomingHeader.CAMERA_STORAGE_URL, CameraStorageUrlMessageEvent); + this._events.set(IncomingHeader.COMPETITION_STATUS, CompetitionStatusMessageEvent); + this._events.set(IncomingHeader.INIT_CAMERA, InitCameraMessageEvent); + this._events.set(IncomingHeader.THUMBNAIL_STATUS, ThumbnailStatusMessageEvent); + this._events.set(IncomingHeader.CAMERA_SNAPSHOT, CameraSnapshotMessageEvent); + + // CAMPAIGN + this._events.set(IncomingHeader.CAMPAIGN_CALENDAR_DATA, CampaignCalendarDataMessageEvent); + this._events.set(IncomingHeader.CAMPAIGN_CALENDAR_DOOR_OPENED, CampaignCalendarDoorOpenedMessageEvent); + + // CATALOG + this._events.set(IncomingHeader.BONUS_RARE_INFO, BonusRareInfoMessageEvent); + this._events.set(IncomingHeader.BUILDERS_CLUB_FURNI_COUNT, BuildersClubFurniCountMessageEvent); + this._events.set(IncomingHeader.BUILDERS_CLUB_SUBSCRIPTION, BuildersClubSubscriptionStatusMessageEvent); + this._events.set(IncomingHeader.BUNDLE_DISCOUNT_RULESET, BundleDiscountRulesetMessageEvent); + this._events.set(IncomingHeader.CATALOG_PAGE_EXPIRATION, CatalogPageExpirationEvent); + this._events.set(IncomingHeader.CATALOG_PAGE, CatalogPageMessageEvent); + this._events.set(IncomingHeader.CATALOG_PAGE_LIST, CatalogPagesListEvent); + this._events.set(IncomingHeader.CATALOG_EARLIEST_EXPIRY, CatalogPageWithEarliestExpiryMessageEvent); + this._events.set(IncomingHeader.CATALOG_PUBLISHED, CatalogPublishedMessageEvent); + this._events.set(IncomingHeader.CLUB_GIFT_INFO, ClubGiftInfoEvent); + this._events.set(IncomingHeader.CLUB_GIFT_SELECTED, ClubGiftSelectedEvent); + this._events.set(IncomingHeader.DIRECT_SMS_CLUB_BUY, DirectSMSClubBuyAvailableMessageEvent); + this._events.set(IncomingHeader.GIFT_RECEIVER_NOT_FOUND, GiftReceiverNotFoundEvent); + this._events.set(IncomingHeader.GIFT_WRAPPER_CONFIG, GiftWrappingConfigurationEvent); + this._events.set(IncomingHeader.CLUB_EXTENDED_OFFER, HabboClubExtendOfferMessageEvent); + this._events.set(IncomingHeader.CLUB_OFFERS, HabboClubOffersMessageEvent); + this._events.set(IncomingHeader.IS_OFFER_GIFTABLE, IsOfferGiftableMessageEvent); + this._events.set(IncomingHeader.LIMITED_SOLD_OUT, LimitedEditionSoldOutEvent); + this._events.set(IncomingHeader.LIMITED_OFFER_APPEARING_NEXT, LimitedOfferAppearingNextMessageEvent); + this._events.set(IncomingHeader.NOT_ENOUGH_BALANCE, NotEnoughBalanceMessageEvent); + this._events.set(IncomingHeader.PRODUCT_OFFER, ProductOfferEvent); + this._events.set(IncomingHeader.CATALOG_PURCHASE_ERROR, PurchaseErrorMessageEvent); + this._events.set(IncomingHeader.CATALOG_PURCHASE_NOT_ALLOWED, PurchaseNotAllowedMessageEvent); + this._events.set(IncomingHeader.CATALOG_PURCHASE_OK, PurchaseOKMessageEvent); + this._events.set(IncomingHeader.ROOM_AD_PURCHASE, RoomAdPurchaseInfoEvent); + this._events.set(IncomingHeader.SEASONAL_CALENDAR_OFFER, SeasonalCalendarDailyOfferMessageEvent); + this._events.set(IncomingHeader.CATALOG_RECEIVE_PET_BREEDS, SellablePetPalettesMessageEvent); + this._events.set(IncomingHeader.TARGET_OFFER, TargetedOfferEvent); + this._events.set(IncomingHeader.TARGET_OFFER_NOT_FOUND, TargetedOfferNotFoundEvent); + this._events.set(IncomingHeader.REDEEM_VOUCHER_ERROR, VoucherRedeemErrorMessageEvent); + this._events.set(IncomingHeader.REDEEM_VOUCHER_OK, VoucherRedeemOkMessageEvent); + + // CLIENT + this._events.set(IncomingHeader.CLIENT_PING, ClientPingEvent); + + // COMPETITION + this._events.set(IncomingHeader.COMPETITION_ENTRY_SUBMIT, CompetitionEntrySubmitResultEvent); + this._events.set(IncomingHeader.COMPETITION_VOTING_INFO, CompetitionVotingInfoMessageEvent); + this._events.set(IncomingHeader.COMPETITION_TIMING_CODE, CurrentTimingCodeMessageEvent); + this._events.set(IncomingHeader.COMPETITION_USER_PART_OF, IsUserPartOfCompetitionMessageEvent); + this._events.set(IncomingHeader.COMPETITION_NO_OWNED_ROOMS, NoOwnedRoomsAlertMessageEvent); + this._events.set(IncomingHeader.COMPETITION_SECONDS_UNTIL, SecondsUntilMessageEvent); + + // CRAFTING + this._events.set(IncomingHeader.CRAFTABLE_PRODUCTS, CraftableProductsEvent); + this._events.set(IncomingHeader.CRAFTING_RECIPE, CraftingRecipeEvent); + this._events.set(IncomingHeader.CRAFTING_RECIPES_AVAILABLE, CraftingRecipesAvailableEvent); + this._events.set(IncomingHeader.CRAFTING_RESULT, CraftingResultEvent); + + // DESKTOP + this._events.set(IncomingHeader.DESKTOP_VIEW, DesktopViewEvent); + + // FRIENDLIST + this._events.set(IncomingHeader.MESSENGER_ACCEPT_FRIENDS, AcceptFriendResultEvent); + this._events.set(IncomingHeader.MESSENGER_FIND_FRIENDS, FindFriendsProcessResultEvent); + this._events.set(IncomingHeader.MESSENGER_FOLLOW_FAILED, FollowFriendFailedEvent); + this._events.set(IncomingHeader.MESSENGER_FRIENDS, FriendListFragmentEvent); + this._events.set(IncomingHeader.MESSENGER_UPDATE, FriendListUpdateEvent); + this._events.set(IncomingHeader.MESSENGER_FRIEND_NOTIFICATION, FriendNotificationEvent); + this._events.set(IncomingHeader.MESSENGER_REQUESTS, FriendRequestsEvent); + this._events.set(IncomingHeader.MESSENGER_SEARCH, HabboSearchResultEvent); + this._events.set(IncomingHeader.MESSENGER_INSTANCE_MESSAGE_ERROR, InstantMessageErrorEvent); + this._events.set(IncomingHeader.MESSENGER_MESSAGE_ERROR, MessageErrorEvent); + this._events.set(IncomingHeader.MESSENGER_INIT, MessengerInitEvent); + this._events.set(IncomingHeader.MESSENGER_MINIMAIL_NEW, MiniMailNewMessageEvent); + this._events.set(IncomingHeader.MESSENGER_MINIMAIL_COUNT, MiniMailUnreadCountEvent); + this._events.set(IncomingHeader.MESSENGER_CHAT, NewConsoleMessageEvent); + this._events.set(IncomingHeader.MESSENGER_REQUEST, NewFriendRequestEvent); + this._events.set(IncomingHeader.MESSENGER_INVITE_ERROR, RoomInviteErrorEvent); + this._events.set(IncomingHeader.MESSENGER_INVITE, RoomInviteEvent); + + // GAMES + this._events.set(IncomingHeader.ACHIEVEMENTRESOLUTIONCOMPLETED, AchievementResolutionCompletedMessageEvent); + this._events.set(IncomingHeader.ACHIEVEMENTRESOLUTIONPROGRESS, AchievementResolutionProgressMessageEvent); + this._events.set(IncomingHeader.ACHIEVEMENTRESOLUTIONS, AchievementResolutionsMessageEvent); + this._events.set(IncomingHeader.LOAD_GAME_URL, LoadGameUrlEvent); + this._events.set(IncomingHeader.LOADGAME, LoadGameMessageEvent); + this._events.set(IncomingHeader.UNLOADGAME, UnloadGameMessageEvent); + this._events.set(IncomingHeader.GAME_CENTER_GAME_LIST, GameListMessageEvent); + this._events.set(IncomingHeader.GAMESTATUSMESSAGE, GameStatusMessageEvent); + this._events.set(IncomingHeader.GAME_CENTER_ACHIEVEMENTS, UserGameAchievementsMessageEvent); + this._events.set(IncomingHeader.GAME_CENTER_STATUS, Game2AccountGameStatusMessageEvent); + this._events.set(IncomingHeader.GAME_CENTER_IN_ARENA_QUEUE, Game2InArenaQueueMessageEvent); + this._events.set(IncomingHeader.GAME_CENTER_STOP_COUNTER, Game2StopCounterMessageEvent); + this._events.set(IncomingHeader.GAME_CENTER_USER_LEFT_GAME, Game2UserLeftGameMessageEvent); + this._events.set(IncomingHeader.GAME_CENTER_DIRECTORY_STATUS, Game2GameDirectoryStatusMessageEvent); + this._events.set(IncomingHeader.GAME_CENTER_STARTING_GAME_FAILED, Game2StartingGameFailedMessageEvent); + this._events.set(IncomingHeader.GAME_CENTER_JOINING_FAILED, Game2JoiningGameFailedMessageEvent); + this._events.set(IncomingHeader.GAMEACHIEVEMENTS, GameAchievementsMessageEvent); + this._events.set(IncomingHeader.GAMEINVITE, GameInviteMessageEvent); + this._events.set(IncomingHeader.JOINEDQUEUEMESSAGE, JoinedQueueMessageEvent); + this._events.set(IncomingHeader.JOININGQUEUEFAILED, JoiningQueueFailedMessageEvent); + this._events.set(IncomingHeader.LEFTQUEUE, LeftQueueMessageEvent); + this._events.set(IncomingHeader.WEEKLY_GAME_REWARD, WeeklyGameRewardEvent); + this._events.set(IncomingHeader.WEEKLY_GAME_REWARD_WINNERS, WeeklyGameRewardWinnersEvent); + this._events.set(IncomingHeader.WEEKLY_COMPETITIVE_LEADERBOARD, WeeklyCompetitiveLeaderboardEvent); + this._events.set(IncomingHeader.WEEKLY_COMPETITIVE_FRIENDS_LEADERBOARD, WeeklyCompetitiveFriendsLeaderboardEvent); + this._events.set(IncomingHeader.WEEKLY_GAME2_FRIENDS_LEADERBOARD, Game2WeeklyFriendsLeaderboardEvent); + this._events.set(IncomingHeader.WEEKLY_GAME2_LEADERBOARD, Game2WeeklyLeaderboardEvent); + + // GROUP + this._events.set(IncomingHeader.GROUP_INFO, GroupInformationEvent); + this._events.set(IncomingHeader.GROUP_MEMBER_REMOVE_CONFIRM, GroupConfirmMemberRemoveEvent); + this._events.set(IncomingHeader.GROUP_MEMBERS, GroupMembersEvent); + this._events.set(IncomingHeader.GROUP_CREATE_OPTIONS, GroupBuyDataEvent); + this._events.set(IncomingHeader.GROUP_BADGE_PARTS, GroupBadgePartsEvent); + this._events.set(IncomingHeader.GROUP_SETTINGS, GroupSettingsEvent); + this._events.set(IncomingHeader.GROUP_PURCHASED, GroupPurchasedEvent); + this._events.set(IncomingHeader.GROUP_BADGES, HabboGroupBadgesMessageEvent); + this._events.set(IncomingHeader.GROUP_DEACTIVATE, HabboGroupDeactivatedMessageEvent); + this._events.set(IncomingHeader.GROUP_MEMBERSHIP_REQUESTED, GroupMembershipRequestedMessageEvent); + this._events.set(IncomingHeader.GROUP_DETAILS_CHANGED, GroupDetailsChangedMessageEvent); + this._events.set(IncomingHeader.GROUP_HABBO_JOIN_FAILED, HabboGroupJoinFailedMessageEvent); + + // GROUP FORUMS + this._events.set(IncomingHeader.GROUP_FORUM_DATA, ForumDataMessageEvent); + this._events.set(IncomingHeader.GROUP_FORUM_LIST, ForumsListMessageEvent); + this._events.set(IncomingHeader.GROUP_FORUM_THREADS, GuildForumThreadsEvent); + this._events.set(IncomingHeader.GROUP_FORUM_POST, PostMessageMessageEvent); + this._events.set(IncomingHeader.GROUP_FORUM_POST_THREAD, PostThreadMessageEvent); + this._events.set(IncomingHeader.GROUP_FORUM_THREAD_MESSAGES, ThreadMessagesMessageEvent); + this._events.set(IncomingHeader.GROUP_FORUM_UNREAD_COUNT, UnreadForumsCountMessageEvent); + this._events.set(IncomingHeader.GROUP_FORUM_UPDATE_MESSAGE, UpdateMessageMessageEvent); + this._events.set(IncomingHeader.GROUP_FORUM_UPDATE_THREAD, UpdateThreadMessageEvent); + + // HELP + this._events.set(IncomingHeader.CFH_DISABLED_NOTIFY, CallForHelpDisabledNotifyMessageEvent); + this._events.set(IncomingHeader.CFH_PENDING_CALLS_DELETED, CallForHelpPendingCallsDeletedMessageEvent); + this._events.set(IncomingHeader.CFH_PENDING_CALLS, CallForHelpPendingCallsMessageEvent); + this._events.set(IncomingHeader.CFH_REPLY, CallForHelpReplyMessageEvent); + this._events.set(IncomingHeader.CFH_RESULT_MESSAGE, CallForHelpResultMessageEvent); + this._events.set(IncomingHeader.GUIDE_ON_DUTY_STATUS, GuideOnDutyStatusMessageEvent); + this._events.set(IncomingHeader.GUIDE_SESSION_ATTACHED, GuideSessionAttachedMessageEvent); + this._events.set(IncomingHeader.GUIDE_SESSION_DETACHED, GuideSessionDetachedMessageEvent); + this._events.set(IncomingHeader.GUIDE_SESSION_ENDED, GuideSessionEndedMessageEvent); + this._events.set(IncomingHeader.GUIDE_SESSION_ERROR, GuideSessionErrorMessageEvent); + this._events.set(IncomingHeader.GUIDE_SESSION_INVITED_TO_GUIDE_ROOM, GuideSessionInvitedToGuideRoomMessageEvent); + this._events.set(IncomingHeader.GUIDE_SESSION_MESSAGE, GuideSessionMessageMessageEvent); + this._events.set(IncomingHeader.GUIDE_SESSION_PARTNER_IS_TYPING, GuideSessionPartnerIsTypingMessageEvent); + this._events.set(IncomingHeader.GUIDE_SESSION_REQUESTER_ROOM, GuideSessionRequesterRoomMessageEvent); + this._events.set(IncomingHeader.GUIDE_SESSION_STARTED, GuideSessionStartedMessageEvent); + this._events.set(IncomingHeader.GUIDE_TICKET_CREATION_RESULT, GuideTicketCreationResultMessageEvent); + this._events.set(IncomingHeader.GUIDE_TICKET_RESOLUTION, GuideTicketResolutionMessageEvent); + this._events.set(IncomingHeader.GUIDE_REPORTING_STATUS, GuideReportingStatusMessageEvent); + this._events.set(IncomingHeader.HOTEL_MERGE_NAME_CHANGE, HotelMergeNameChangeEvent); + this._events.set(IncomingHeader.ISSUE_CLOSE_NOTIFICATION, IssueCloseNotificationMessageEvent); + this._events.set(IncomingHeader.QUIZ_DATA, QuizDataMessageEvent); + this._events.set(IncomingHeader.QUIZ_RESULTS, QuizResultsMessageEvent); + this._events.set(IncomingHeader.CHAT_REVIEW_SESSION_DETACHED, ChatReviewSessionDetachedMessageEvent); + this._events.set(IncomingHeader.CHAT_REVIEW_SESSION_OFFERED_TO_GUIDE, ChatReviewSessionOfferedToGuideMessageEvent); + this._events.set(IncomingHeader.CHAT_REVIEW_SESSION_RESULTS, ChatReviewSessionResultsMessageEvent); + this._events.set(IncomingHeader.CHAT_REVIEW_SESSION_STARTED, ChatReviewSessionStartedMessageEvent); + this._events.set(IncomingHeader.CHAT_REVIEW_SESSION_VOTING_STATUS, ChatReviewSessionVotingStatusMessageEvent); + + // INVENTORY + this._events.set(IncomingHeader.ACHIEVEMENT_PROGRESSED, AchievementEvent); + this._events.set(IncomingHeader.ACHIEVEMENT_LIST, AchievementsEvent); + this._events.set(IncomingHeader.USER_ACHIEVEMENT_SCORE, AchievementsScoreEvent); + this._events.set(IncomingHeader.USER_EFFECT_ACTIVATE, AvatarEffectActivatedEvent); + this._events.set(IncomingHeader.USER_EFFECT_LIST_ADD, AvatarEffectAddedEvent); + this._events.set(IncomingHeader.USER_EFFECT_LIST_REMOVE, AvatarEffectExpiredEvent); + this._events.set(IncomingHeader.USER_EFFECT_LIST, AvatarEffectsEvent); + this._events.set(IncomingHeader.AVATAR_EFFECT_SELECTED, AvatarEffectSelectedEvent); + this._events.set(IncomingHeader.USER_BADGES, BadgesEvent); + this._events.set(IncomingHeader.USER_BADGES_ADD, BadgeReceivedEvent); + this._events.set(IncomingHeader.BADGE_POINT_LIMITS, BadgePointLimitsEvent); + this._events.set(IncomingHeader.BADGE_REQUEST_FULFILLED, IsBadgeRequestFulfilledEvent); + this._events.set(IncomingHeader.USER_CLOTHING, FigureSetIdsMessageEvent); + this._events.set(IncomingHeader.USER_FURNITURE_ADD, FurnitureListAddOrUpdateEvent); + this._events.set(IncomingHeader.USER_FURNITURE, FurnitureListEvent); + this._events.set(IncomingHeader.USER_FURNITURE_REFRESH, FurnitureListInvalidateEvent); + this._events.set(IncomingHeader.USER_FURNITURE_REMOVE, FurnitureListRemovedEvent); + this._events.set(IncomingHeader.USER_FURNITURE_POSTIT_PLACED, FurniturePostItPlacedEvent); + this._events.set(IncomingHeader.USER_PETS, PetInventoryEvent); + this._events.set(IncomingHeader.USER_PET_REMOVE, PetRemovedFromInventory); + this._events.set(IncomingHeader.USER_PET_ADD, PetAddedToInventoryEvent); + this._events.set(IncomingHeader.PET_RECEIVED, PetReceivedMessageEvent); + this._events.set(IncomingHeader.PET_PLACING_ERROR, PetPlacingErrorEvent); + this._events.set(IncomingHeader.YOUTUBE_CONTROL_VIDEO, YoutubeControlVideoMessageEvent); + this._events.set(IncomingHeader.YOUTUBE_DISPLAY_PLAYLISTS, YoutubeDisplayPlaylistsEvent); + this._events.set(IncomingHeader.YOUTUBE_DISPLAY_VIDEO, YoutubeDisplayVideoMessageEvent); + + // TRADING + this._events.set(IncomingHeader.TRADE_ACCEPTED, TradingAcceptEvent); + this._events.set(IncomingHeader.TRADE_CLOSED, TradingCloseEvent); + this._events.set(IncomingHeader.TRADE_COMPLETED, TradingCompletedEvent); + this._events.set(IncomingHeader.TRADE_CONFIRMATION, TradingConfirmationEvent); + this._events.set(IncomingHeader.TRADE_LIST_ITEM, TradingListItemEvent); + this._events.set(IncomingHeader.TRADE_NOT_OPEN, TradingNotOpenEvent); + this._events.set(IncomingHeader.TRADE_OPEN_FAILED, TradingOpenFailedEvent); + this._events.set(IncomingHeader.TRADE_OPEN, TradingOpenEvent); + this._events.set(IncomingHeader.TRADE_OTHER_NOT_ALLOWED, TradingOtherNotAllowedEvent); + this._events.set(IncomingHeader.TRADE_YOU_NOT_ALLOWED, TradingYouAreNotAllowedEvent); + this._events.set(IncomingHeader.TRADE_NO_SUCH_ITEM, TradingNoSuchItemEvent); + + // LANDING VIEW + this._events.set(IncomingHeader.COMMUNITY_GOAL_VOTE_EVENT, CommunityGoalVoteMessageEvent); + this._events.set(IncomingHeader.PROMO_ARTICLES, PromoArticlesMessageEvent); + + // MARKETPLACE + this._events.set(IncomingHeader.MARKETPLACE_AFTER_ORDER_STATUS, MarketplaceBuyOfferResultEvent); + this._events.set(IncomingHeader.MARKETPLACE_CANCEL_SALE, MarketplaceCancelOfferResultEvent); + this._events.set(IncomingHeader.MARKETPLACE_SELL_ITEM, MarketplaceCanMakeOfferResult); + this._events.set(IncomingHeader.MARKETPLACE_CONFIG, MarketplaceConfigurationEvent); + this._events.set(IncomingHeader.MARKETPLACE_ITEM_STATS, MarketplaceItemStatsEvent); + this._events.set(IncomingHeader.MARKETPLACE_ITEM_POSTED, MarketplaceMakeOfferResult); + this._events.set(IncomingHeader.MARKETPLACE_ITEMS_SEARCHED, MarketPlaceOffersEvent); + this._events.set(IncomingHeader.MARKETPLACE_OWN_ITEMS, MarketplaceOwnOffersEvent); + + // MODERATION + this._events.set(IncomingHeader.USER_BANNED, UserBannedMessageEvent); + this._events.set(IncomingHeader.MODERATION_CAUTION, ModeratorCautionEvent); + this._events.set(IncomingHeader.MODTOOL_ROOM_INFO, ModeratorRoomInfoEvent); + this._events.set(IncomingHeader.MODTOOL_USER_CHATLOG, UserChatlogEvent); + this._events.set(IncomingHeader.MODTOOL_ROOM_CHATLOG, RoomChatlogEvent); + this._events.set(IncomingHeader.MODERATION_USER_INFO, ModeratorUserInfoEvent); + this._events.set(IncomingHeader.MODERATION_TOOL, ModeratorInitMessageEvent); + this._events.set(IncomingHeader.MODTOOL_VISITED_ROOMS_USER, RoomVisitsEvent); + this._events.set(IncomingHeader.CFH_CHATLOG, CfhChatlogEvent); + this._events.set(IncomingHeader.ISSUE_DELETED, IssueDeletedMessageEvent); + this._events.set(IncomingHeader.ISSUE_INFO, IssueInfoMessageEvent); + this._events.set(IncomingHeader.ISSUE_PICK_FAILED, IssuePickFailedMessageEvent); + this._events.set(IncomingHeader.MODERATOR_ACTION_RESULT, ModeratorActionResultMessageEvent); + this._events.set(IncomingHeader.MODERATOR_MESSAGE, ModeratorMessageEvent); + this._events.set(IncomingHeader.MODERATOR_TOOL_PREFERENCES, ModeratorToolPreferencesEvent); + + // MYSTERY BOX + this._events.set(IncomingHeader.MYSTERY_BOX_KEYS, MysteryBoxKeysEvent); + this._events.set(IncomingHeader.GOTMYSTERYBOXPRIZEMESSAGE, GotMysteryBoxPrizeMessageEvent); + this._events.set(IncomingHeader.CANCELMYSTERYBOXWAITMESSAGE, CancelMysteryBoxWaitMessageEvent); + this._events.set(IncomingHeader.SHOWMYSTERYBOXWAITMESSAGE, ShowMysteryBoxWaitMessageEvent); + + // NAVIGATOR + this._events.set(IncomingHeader.CAN_CREATE_ROOM, CanCreateRoomEvent); + this._events.set(IncomingHeader.CAN_CREATE_ROOM_EVENT, CanCreateRoomEventEvent); + this._events.set(IncomingHeader.CATEGORIES_WITH_VISITOR_COUNT, CategoriesWithVisitorCountEvent); + this._events.set(IncomingHeader.COMPETITION_ROOMS_DATA, CompetitionRoomsDataMessageEvent); + this._events.set(IncomingHeader.CONVERTED_ROOM_ID, ConvertedRoomIdEvent); + this._events.set(IncomingHeader.ROOM_DOORBELL, DoorbellMessageEvent); + this._events.set(IncomingHeader.USER_FAVORITE_ROOM, FavouriteChangedEvent); + this._events.set(IncomingHeader.USER_FAVORITE_ROOM_COUNT, FavouritesEvent); + this._events.set(IncomingHeader.ROOM_DOORBELL_REJECTED, FlatAccessDeniedMessageEvent); + this._events.set(IncomingHeader.ROOM_CREATED, FlatCreatedEvent); + this._events.set(IncomingHeader.ROOM_INFO, GetGuestRoomResultEvent); + this._events.set(IncomingHeader.GUEST_ROOM_SEARCH_RESULT, GuestRoomSearchResultEvent); + this._events.set(IncomingHeader.USER_HOME_ROOM, NavigatorHomeRoomEvent); + this._events.set(IncomingHeader.ROOM_EVENT_CANCEL, RoomEventCancelEvent); + this._events.set(IncomingHeader.ROOM_EVENT, RoomEventEvent); + this._events.set(IncomingHeader.ROOM_INFO_UPDATED, RoomSettingsUpdatedEvent); + this._events.set(IncomingHeader.THUMBNAIL_UPDATE_RESULT, RoomThumbnailUpdateResultEvent); + this._events.set(IncomingHeader.NAVIGATOR_EVENT_CATEGORIES, UserEventCatsEvent); + this._events.set(IncomingHeader.NAVIGATOR_CATEGORIES, UserFlatCatsEvent); + + this._events.set(IncomingHeader.NAVIGATOR_COLLAPSED, NavigatorCollapsedEvent); + this._events.set(IncomingHeader.NAVIGATOR_LIFTED, NavigatorLiftedEvent); + this._events.set(IncomingHeader.NAVIGATOR_METADATA, NavigatorMetadataEvent); + this._events.set(IncomingHeader.NAVIGATOR_OPEN_ROOM_CREATOR, NavigatorOpenRoomCreatorEvent); + this._events.set(IncomingHeader.NAVIGATOR_SEARCHES, NavigatorSearchesEvent); + this._events.set(IncomingHeader.NAVIGATOR_SEARCH, NavigatorSearchEvent); + this._events.set(IncomingHeader.NAVIGATOR_SETTINGS, NavigatorSettingsEvent); + + // NOTIFICATIONS + this._events.set(IncomingHeader.GENERIC_ALERT, HabboBroadcastMessageEvent); + this._events.set(IncomingHeader.MOTD_MESSAGES, MOTDNotificationEvent); + this._events.set(IncomingHeader.NOTIFICATION_LIST, NotificationDialogMessageEvent); + this._events.set(IncomingHeader.UNSEEN_ITEMS, UnseenItemsEvent); + this._events.set(IncomingHeader.ACHIEVEMENT_NOTIFICATION, AchievementNotificationMessageEvent); + this._events.set(IncomingHeader.INFO_FEED_ENABLE, InfoFeedEnableMessageEvent); + this._events.set(IncomingHeader.CLUB_GIFT_NOTIFICATION, ClubGiftNotificationEvent); + this._events.set(IncomingHeader.ACTIVITY_POINT_NOTIFICATION, ActivityPointNotificationMessageEvent); + this._events.set(IncomingHeader.BOT_ERROR, BotErrorEvent); + this._events.set(IncomingHeader.PET_LEVEL_NOTIFICATION, PetLevelNotificationEvent); + this._events.set(IncomingHeader.NOTIFICATION_OFFER_REWARD_DELIVERED, OfferRewardDeliveredMessageEvent); + this._events.set(IncomingHeader.NOTIFICATION_SIMPLE_ALERT, SimpleAlertMessageEvent); + this._events.set(IncomingHeader.NOTIFICATION_ELEMENT_POINTER, ElementPointerMessageEvent); + + // PERK + this._events.set(IncomingHeader.USER_PERKS, PerkAllowancesMessageEvent); + + // PETS + this._events.set(IncomingHeader.PET_TRAINING_PANEL, PetTrainingPanelMessageEvent); + this._events.set(IncomingHeader.PET_LEVEL_UPDATE, PetLevelUpdateMessageEvent); + this._events.set(IncomingHeader.PET_SCRATCH_FAILED, PetScratchFailedMessageEvent); + this._events.set(IncomingHeader.PET_OPEN_PACKAGE_REQUESTED, OpenPetPackageRequestedMessageEvent); + this._events.set(IncomingHeader.PET_OPEN_PACKAGE_RESULT, OpenPetPackageResultMessageEvent); + this._events.set(IncomingHeader.PET_BREEDING_RESULT, PetBreedingResultEvent); + + // POLL + this._events.set(IncomingHeader.QUESTION, QuestionEvent); + this._events.set(IncomingHeader.POLL_CONTENTS, PollContentsEvent); + this._events.set(IncomingHeader.POLL_ERROR, PollErrorEvent); + this._events.set(IncomingHeader.POLL_OFFER, PollOfferEvent); + this._events.set(IncomingHeader.POLL_START_ROOM, StartRoomPollEvent); + this._events.set(IncomingHeader.QUESTION_ANSWERED, QuestionAnsweredEvent); + this._events.set(IncomingHeader.QUESTION_FINISHED, QuestionFinishedEvent); + this._events.set(IncomingHeader.POLL_ROOM_RESULT, RoomPollResultEvent); + + // QUEST + this._events.set(IncomingHeader.COMMUNITY_GOAL_EARNED_PRIZES, CommunityGoalEarnedPrizesMessageEvent); + this._events.set(IncomingHeader.COMMUNITY_GOAL_PROGRESS, CommunityGoalProgressMessageEvent); + this._events.set(IncomingHeader.CONCURRENT_USERS_GOAL_PROGRESS, ConcurrentUsersGoalProgressMessageEvent); + this._events.set(IncomingHeader.QUEST_DAILY, QuestDailyMessageEvent); + this._events.set(IncomingHeader.QUEST_CANCELLED, QuestCancelledMessageEvent); + this._events.set(IncomingHeader.QUEST_COMPLETED, QuestCompletedMessageEvent); + this._events.set(IncomingHeader.COMMUNITY_GOAL_HALL_OF_FAME, CommunityGoalHallOfFameMessageEvent); + this._events.set(IncomingHeader.EPIC_POPUP, EpicPopupMessageEvent); + this._events.set(IncomingHeader.SEASONAL_QUESTS, SeasonalQuestsMessageEvent); + this._events.set(IncomingHeader.QUESTS, QuestsMessageEvent); + this._events.set(IncomingHeader.QUEST, QuestMessageEvent); + + // ROOM + this._events.set(IncomingHeader.ROOM_ENTER_ERROR, RoomEnterErrorEvent); + this._events.set(IncomingHeader.ROOM_ENTER, RoomEnterEvent); + this._events.set(IncomingHeader.ROOM_FORWARD, RoomForwardEvent); + this._events.set(IncomingHeader.ROOM_DOORBELL_ACCEPTED, RoomDoorbellAcceptedEvent); + this._events.set(IncomingHeader.ROOM_RIGHTS_CLEAR, RoomRightsClearEvent); + this._events.set(IncomingHeader.ROOM_RIGHTS_OWNER, RoomRightsOwnerEvent); + this._events.set(IncomingHeader.ROOM_RIGHTS, RoomRightsEvent); + this._events.set(IncomingHeader.BOT_COMMAND_CONFIGURATION, BotCommandConfigurationEvent); + this._events.set(IncomingHeader.BOT_SKILL_LIST_UPDATE, BotSkillListUpdateEvent); + this._events.set(IncomingHeader.BOT_FORCE_OPEN_CONTEXT_MENU, BotForceOpenContextMenuEvent); + this._events.set(IncomingHeader.ROOM_SETTINGS_CHAT, RoomChatSettingsEvent); + this._events.set(IncomingHeader.ROOM_INFO_OWNER, RoomEntryInfoMessageEvent); + this._events.set(IncomingHeader.ROOM_SCORE, RoomScoreEvent); + this._events.set(IncomingHeader.ROOM_ROLLING, ObjectsRollingEvent); + this._events.set(IncomingHeader.FURNITURE_FLOOR_ADD, FurnitureFloorAddEvent); + this._events.set(IncomingHeader.FURNITURE_FLOOR, FurnitureFloorEvent); + this._events.set(IncomingHeader.FURNITURE_FLOOR_REMOVE, FurnitureFloorRemoveEvent); + this._events.set(IncomingHeader.FURNITURE_FLOOR_UPDATE, FurnitureFloorUpdateEvent); + this._events.set(IncomingHeader.ITEM_WALL_ADD, FurnitureWallAddEvent); + this._events.set(IncomingHeader.ITEM_WALL, FurnitureWallEvent); + this._events.set(IncomingHeader.ITEM_WALL_REMOVE, FurnitureWallRemoveEvent); + this._events.set(IncomingHeader.ITEM_WALL_UPDATE, FurnitureWallUpdateEvent); + this._events.set(IncomingHeader.FURNITURE_ALIASES, FurnitureAliasesEvent); + this._events.set(IncomingHeader.FURNITURE_DATA, FurnitureDataEvent); + this._events.set(IncomingHeader.FURNITURE_ITEMDATA, ItemDataUpdateMessageEvent); + this._events.set(IncomingHeader.ITEM_STACK_HELPER, FurnitureStackHeightEvent); + this._events.set(IncomingHeader.FURNITURE_STATE, OneWayDoorStatusMessageEvent); + this._events.set(IncomingHeader.ITEM_DIMMER_SETTINGS, RoomDimmerPresetsEvent); + this._events.set(IncomingHeader.FURNITURE_STATE_2, DiceValueMessageEvent); + this._events.set(IncomingHeader.LOVELOCK_FURNI_FINISHED, LoveLockFurniFinishedEvent); + this._events.set(IncomingHeader.LOVELOCK_FURNI_FRIEND_COMFIRMED, LoveLockFurniFriendConfirmedEvent); + this._events.set(IncomingHeader.LOVELOCK_FURNI_START, LoveLockFurniStartEvent); + this._events.set(IncomingHeader.OBJECTS_DATA_UPDATE, ObjectsDataUpdateEvent); + this._events.set(IncomingHeader.FURNITURE_GROUP_CONTEXT_MENU_INFO, GroupFurniContextMenuInfoMessageEvent); + this._events.set(IncomingHeader.FURNITURE_POSTIT_STICKY_POLE_OPEN, RequestSpamWallPostItMessageEvent); + this._events.set(IncomingHeader.ROOM_SPECTATOR, YouAreSpectatorMessageEvent); + this._events.set(IncomingHeader.CUSTOM_USER_NOTIFICATION, CustomUserNotificationMessageEvent); + this._events.set(IncomingHeader.ROOM_MESSAGE_NOTIFICATION, RoomMessageNotificationMessageEvent); + this._events.set(IncomingHeader.ROOM_POPULAR_TAGS_RESULT, PopularRoomTagsResultEvent); + + // ROOM SETTINGS + this._events.set(IncomingHeader.ROOM_RIGHTS_LIST, FlatControllersEvent); + this._events.set(IncomingHeader.ROOM_RIGHTS_LIST_ADD, FlatControllerAddedEvent); + this._events.set(IncomingHeader.ROOM_RIGHTS_LIST_REMOVE, FlatControllerRemovedEvent); + this._events.set(IncomingHeader.ROOM_BAN_LIST, BannedUsersFromRoomEvent); + + this._events.set(IncomingHeader.ROOM_SETTINGS_SAVE_ERROR, RoomSettingsSaveErrorEvent); + this._events.set(IncomingHeader.ROOM_SETTINGS, RoomSettingsDataEvent); + this._events.set(IncomingHeader.ROOM_SETTINGS_SAVE, RoomSettingsSavedEvent); + this._events.set(IncomingHeader.ROOM_SETTINGS_ERROR, RoomSettingsErrorEvent); + this._events.set(IncomingHeader.SHOW_ENFORCE_ROOM_CATEGORY, ShowEnforceRoomCategoryDialogEvent); + this._events.set(IncomingHeader.ROOM_BAN_REMOVE, UserUnbannedFromRoomEvent); + + this._events.set(IncomingHeader.ROOM_MUTED, MuteAllInRoomEvent); + this._events.set(IncomingHeader.NO_SUCH_FLAT, NoSuchFlatEvent); + + this._events.set(IncomingHeader.FAVORITE_GROUP_UDPATE, FavoriteMembershipUpdateMessageEvent); + + // MAPPING + this._events.set(IncomingHeader.ROOM_MODEL_DOOR, RoomEntryTileMessageEvent); + this._events.set(IncomingHeader.ROOM_HEIGHT_MAP, RoomHeightMapEvent); + this._events.set(IncomingHeader.ROOM_HEIGHT_MAP_UPDATE, RoomHeightMapUpdateEvent); + this._events.set(IncomingHeader.ROOM_MODEL, FloorHeightMapEvent); + this._events.set(IncomingHeader.ROOM_MODEL_NAME, RoomReadyMessageEvent); + this._events.set(IncomingHeader.ROOM_PAINT, RoomPaintEvent); + this._events.set(IncomingHeader.ROOM_THICKNESS, RoomVisualizationSettingsEvent); + this._events.set(IncomingHeader.ROOM_GET_FILTER_WORDS, RoomFilterSettingsMessageEvent); + this._events.set(IncomingHeader.ROOM_MODEL_BLOCKED_TILES, RoomOccupiedTilesMessageEvent); + this._events.set(IncomingHeader.PET_FIGURE_UPDATE, PetFigureUpdateEvent); + this._events.set(IncomingHeader.PET_INFO, PetInfoEvent); + this._events.set(IncomingHeader.PET_STATUS, PetStatusUpdateEvent); + this._events.set(IncomingHeader.PET_EXPERIENCE, PetExperienceEvent); + this._events.set(IncomingHeader.PLAYING_GAME, YouArePlayingGameEvent); + this._events.set(IncomingHeader.UNIT_DANCE, RoomUnitDanceEvent); + this._events.set(IncomingHeader.UNIT_EFFECT, RoomUnitEffectEvent); + this._events.set(IncomingHeader.UNIT, RoomUnitEvent); + this._events.set(IncomingHeader.UNIT_EXPRESSION, RoomUnitExpressionEvent); + this._events.set(IncomingHeader.UNIT_HAND_ITEM, RoomUnitHandItemEvent); + this._events.set(IncomingHeader.UNIT_IDLE, RoomUnitIdleEvent); + this._events.set(IncomingHeader.UNIT_INFO, RoomUnitInfoEvent); + this._events.set(IncomingHeader.UNIT_NUMBER, RoomUnitNumberEvent); + this._events.set(IncomingHeader.UNIT_REMOVE, RoomUnitRemoveEvent); + this._events.set(IncomingHeader.UNIT_STATUS, RoomUnitStatusEvent); + this._events.set(IncomingHeader.HAND_ITEM_RECEIVED, RoomUnitHandItemReceivedEvent); + this._events.set(IncomingHeader.FLOOD_CONTROL, FloodControlEvent); + this._events.set(IncomingHeader.REMAINING_MUTE, RemainingMuteEvent); + this._events.set(IncomingHeader.UNIT_CHAT, RoomUnitChatEvent); + this._events.set(IncomingHeader.UNIT_CHAT_SHOUT, RoomUnitChatShoutEvent); + this._events.set(IncomingHeader.UNIT_CHAT_WHISPER, RoomUnitChatWhisperEvent); + this._events.set(IncomingHeader.UNIT_TYPING, RoomUnitTypingEvent); + + // ROOM EVENTS + this._events.set(IncomingHeader.WIRED_ACTION, WiredFurniActionEvent); + this._events.set(IncomingHeader.WIRED_CONDITION, WiredFurniConditionEvent); + this._events.set(IncomingHeader.WIRED_TRIGGER, WiredFurniTriggerEvent); + this._events.set(IncomingHeader.WIRED_OPEN, WiredOpenEvent); + this._events.set(IncomingHeader.WIRED_REWARD, WiredRewardResultMessageEvent); + this._events.set(IncomingHeader.WIRED_SAVE, WiredSaveSuccessEvent); + this._events.set(IncomingHeader.WIRED_ERROR, WiredValidationErrorEvent); + + // SECURITY + this._events.set(IncomingHeader.AUTHENTICATED, AuthenticatedEvent); + + // SOUNDS + this._events.set(IncomingHeader.JUKEBOX_PLAYLIST_FULL, JukeboxPlayListFullMessageEvent); + this._events.set(IncomingHeader.JUKEBOX_SONG_DISKS, JukeboxSongDisksMessageEvent); + this._events.set(IncomingHeader.NOW_PLAYING, NowPlayingMessageEvent); + this._events.set(IncomingHeader.OFFICIAL_SONG_ID, OfficialSongIdMessageEvent); + this._events.set(IncomingHeader.PLAYLIST, PlayListMessageEvent); + this._events.set(IncomingHeader.PLAYLIST_SONG_ADDED, PlayListSongAddedMessageEvent); + this._events.set(IncomingHeader.TRAX_SONG_INFO, TraxSongInfoMessageEvent); + this._events.set(IncomingHeader.USER_SONG_DISKS_INVENTORY, UserSongDisksInventoryMessageEvent); + + // TALENT + this._events.set(IncomingHeader.HELPER_TALENT_TRACK, TalentTrackMessageEvent); + this._events.set(IncomingHeader.TALENT_TRACK_LEVEL, TalentTrackLevelMessageEvent); + this._events.set(IncomingHeader.TALENT_TRACK_LEVEL_UP, TalentLevelUpEvent); + + // USER + this._events.set(IncomingHeader.IN_CLIENT_LINK, InClientLinkEvent); + this._events.set(IncomingHeader.USER_IGNORED, IgnoredUsersEvent); + this._events.set(IncomingHeader.USER_IGNORED_RESULT, IgnoreResultEvent); + this._events.set(IncomingHeader.USER_RESPECT, RespectReceivedEvent); + this._events.set(IncomingHeader.USER_PERMISSIONS, UserPermissionsEvent); + this._events.set(IncomingHeader.USER_BADGES_CURRENT, UserCurrentBadgesEvent); + this._events.set(IncomingHeader.USER_INFO, UserInfoEvent); + this._events.set(IncomingHeader.UNIT_CHANGE_NAME, UserNameChangeMessageEvent); + this._events.set(IncomingHeader.USER_SETTINGS, UserSettingsEvent); + this._events.set(IncomingHeader.USER_PROFILE, UserProfileEvent); + this._events.set(IncomingHeader.MESSENGER_RELATIONSHIPS, RelationshipStatusInfoEvent); + this._events.set(IncomingHeader.GIFT_OPENED, PresentOpenedMessageEvent); + this._events.set(IncomingHeader.USER_CREDITS, UserCreditsEvent); + this._events.set(IncomingHeader.USER_CURRENCY, UserCurrencyEvent); + this._events.set(IncomingHeader.USER_SUBSCRIPTION, UserSubscriptionEvent); + this._events.set(IncomingHeader.USER_WARDROBE_PAGE, UserWardrobePageEvent); + this._events.set(IncomingHeader.USER_CLASSIFICATION, UserClassificationMessageEvent); + this._events.set(IncomingHeader.GET_USER_TAGS, UserTagsMessageEvent); + this._events.set(IncomingHeader.SCR_SEND_KICKBACK_INFO, ScrSendKickbackInfoMessageEvent); + this._events.set(IncomingHeader.PET_RESPECTED, PetRespectNoficationEvent); + this._events.set(IncomingHeader.PET_SUPPLEMENT, PetSupplementedNotificationEvent); + this._events.set(IncomingHeader.ACCOUNT_SAFETY_LOCK_STATUS_CHANGE, AccountSafetyLockStatusChangeMessageEvent); + + this._events.set(IncomingHeader.GENERIC_ERROR, GenericErrorEvent); + this._events.set(IncomingHeader.GROUP_LIST, GuildMembershipsMessageEvent); + this._events.set(IncomingHeader.CATALOG_APPROVE_NAME_RESULT, ApproveNameMessageEvent); + this._events.set(IncomingHeader.CONNECTION_ERROR, ConnectionErrorEvent); + + // GUILD + this._events.set(IncomingHeader.GUILD_EDIT_FAILED, GuildEditFailedMessageEvent); + this._events.set(IncomingHeader.GUILD_MEMBER_MGMT_FAILED, GuildMemberMgmtFailedMessageEvent); + this._events.set(IncomingHeader.EXTENDED_PROFILE_CHANGED, ExtendedProfileChangedMessageEvent); + + // HANDSHAKE + this._events.set(IncomingHeader.NOOBNESS_LEVEL, NoobnessLevelMessageEvent); + this._events.set(IncomingHeader.DISCONNECT_REASON, DisconnectReasonEvent); + this._events.set(IncomingHeader.HANDSHAKE_INIT_DIFFIE, InitDiffieHandshakeEvent); + this._events.set(IncomingHeader.HANDSHAKE_COMPLETE_DIFFIE, CompleteDiffieHandshakeEvent); + this._events.set(IncomingHeader.HANDSHAKE_IDENTITY_ACCOUNT, IdentityAccountsEvent); + + // NUX + this._events.set(IncomingHeader.NEW_USER_EXPERIENCE_GIFT_OFFER, NewUserExperienceGiftOfferMessageEvent); + this._events.set(IncomingHeader.NEW_USER_EXPERIENCE_NOT_COMPLETE, NewUserExperienceNotCompleteEvent); + + // RESTORE CLIENT + this._events.set(IncomingHeader.RESTORE_CLIENT, RestoreClientMessageEvent); + + // FIREWORK + this._events.set(IncomingHeader.FIREWORK_CHARGE_DATA, FireworkChargeDataEvent); + + // PHONE + this._events.set(IncomingHeader.PHONE_COLLECTION_STATE, PhoneCollectionStateMessageEvent); + this._events.set(IncomingHeader.PHONE_TRY_NUMBER_RESULT, TryPhoneNumberResultMessageEvent); + this._events.set(IncomingHeader.PHONE_TRY_VERIFICATION_CODE_RESULT, TryVerificationCodeResultMessageEvent); + + // WELCOME + this._events.set(IncomingHeader.WELCOME_GIFT_CHANGE_EMAIL_RESULT, WelcomeGiftChangeEmailResultEvent); + this._events.set(IncomingHeader.WELCOME_GIFT_STATUS, WelcomeGiftStatusEvent); + // RENTABLE SPACE + this._events.set(IncomingHeader.RENTABLE_SPACE_RENT_OK, RentableSpaceRentOkMessageEvent); + this._events.set(IncomingHeader.RENTABLE_SPACE_STATUS, RentableSpaceStatusMessageEvent); + this._events.set(IncomingHeader.RENTABLE_SPACE_RENT_FAILED, RentableSpaceRentFailedMessageEvent); + // RECYCLER + this._events.set(IncomingHeader.RECYCLER_STATUS, RecyclerStatusMessageEvent); + this._events.set(IncomingHeader.RECYCLER_FINISHED, RecyclerFinishedMessageEvent); + // EMAIL + this._events.set(IncomingHeader.EMAIL_STATUS, EmailStatusResultEvent); + this._events.set(IncomingHeader.CHANGE_EMAIL_RESULT, ChangeEmailResultEvent); + + // RENTABLE FURNI + this._events.set(IncomingHeader.RENTABLE_FURNI_RENT_OR_BUYOUT_OFFER, FurniRentOrBuyoutOfferMessageEvent); + } + + private registerComposers(): void + { + // AUTHENTICATION + this._composers.set(OutgoingHeader.AUTHENTICATION, AuthenticationMessageComposer); + + // ADVERTISEMENT + this._composers.set(OutgoingHeader.INTERSTITIAL_SHOWN, InterstitialShownMessageComposer); + this._composers.set(OutgoingHeader.GET_INTERSTITIAL, GetInterstitialMessageComposer); + + // AVATAR + this._composers.set(OutgoingHeader.GET_WARDROBE, GetWardrobeMessageComposer); + this._composers.set(OutgoingHeader.SAVE_WARDROBE_OUTFIT, SaveWardrobeOutfitMessageComposer); + this._composers.set(OutgoingHeader.CHANGE_USERNAME, ChangeUserNameMessageComposer); + this._composers.set(OutgoingHeader.CHECK_USERNAME, CheckUserNameMessageComposer); + + // CAMERA + this._composers.set(OutgoingHeader.REQUEST_CAMERA_CONFIGURATION, RequestCameraConfigurationComposer); + this._composers.set(OutgoingHeader.RENDER_ROOM, RenderRoomMessageComposer); + this._composers.set(OutgoingHeader.RENDER_ROOM_THUMBNAIL, RenderRoomThumbnailMessageComposer); + this._composers.set(OutgoingHeader.PURCHASE_PHOTO, PurchasePhotoMessageComposer); + this._composers.set(OutgoingHeader.PUBLISH_PHOTO, PublishPhotoMessageComposer); + this._composers.set(OutgoingHeader.PHOTO_COMPETITION, PhotoCompetitionMessageComposer); + + // CAMPAIGN + this._composers.set(OutgoingHeader.OPEN_CAMPAIGN_CALENDAR_DOOR, OpenCampaignCalendarDoorComposer); + this._composers.set(OutgoingHeader.OPEN_CAMPAIGN_CALENDAR_DOOR_STAFF, OpenCampaignCalendarDoorAsStaffComposer); + + // CATALOG + this._composers.set(OutgoingHeader.BUILDERS_CLUB_PLACE_ROOM_ITEM, BuildersClubPlaceRoomItemMessageComposer); + this._composers.set(OutgoingHeader.BUILDERS_CLUB_PLACE_WALL_ITEM, BuildersClubPlaceWallItemMessageComposer); + this._composers.set(OutgoingHeader.BUILDERS_CLUB_QUERY_FURNI_COUNT, BuildersClubQueryFurniCountMessageComposer); + this._composers.set(OutgoingHeader.GET_CATALOG_INDEX, GetCatalogIndexComposer); + this._composers.set(OutgoingHeader.GET_CATALOG_PAGE, GetCatalogPageComposer); + this._composers.set(OutgoingHeader.CATALOG_PURCHASE, PurchaseFromCatalogComposer); + this._composers.set(OutgoingHeader.CATALOG_PURCHASE_GIFT, PurchaseFromCatalogAsGiftComposer); + this._composers.set(OutgoingHeader.GET_PRODUCT_OFFER, GetProductOfferComposer); + this._composers.set(OutgoingHeader.GET_CLUB_OFFERS, GetClubOffersMessageComposer); + this._composers.set(OutgoingHeader.GET_CLUB_GIFT_INFO, GetClubGiftInfo); + this._composers.set(OutgoingHeader.CATALOG_REDEEM_VOUCHER, RedeemVoucherMessageComposer); + this._composers.set(OutgoingHeader.GROUP_MEMBERSHIPS, CatalogGroupsComposer); + this._composers.set(OutgoingHeader.GET_GIFT_WRAPPING_CONFIG, GetGiftWrappingConfigurationComposer); + this._composers.set(OutgoingHeader.CATALOG_SELECT_VIP_GIFT, SelectClubGiftComposer); + this._composers.set(OutgoingHeader.CATALOG_REQUESET_PET_BREEDS, GetSellablePetPalettesComposer); + this._composers.set(OutgoingHeader.GET_BONUS_RARE_INFO, GetBonusRareInfoMessageComposer); + this._composers.set(OutgoingHeader.GET_BUNDLE_DISCOUNT_RULESET, GetBundleDiscountRulesetComposer); + this._composers.set(OutgoingHeader.GET_CATALOG_PAGE_EXPIRATION, GetCatalogPageExpirationComposer); + this._composers.set(OutgoingHeader.GET_CATALOG_PAGE_WITH_EARLIEST_EXP, GetCatalogPageWithEarliestExpiryComposer); + this._composers.set(OutgoingHeader.GET_DIRECT_CLUB_BUY_AVAILABLE, GetDirectClubBuyAvailableComposer); + this._composers.set(OutgoingHeader.GET_HABBO_BASIC_MEMBERSHIP_EXTEND_OFFER, GetHabboBasicMembershipExtendOfferComposer); + this._composers.set(OutgoingHeader.GET_HABBO_CLUB_EXTEND_OFFER, GetHabboClubExtendOfferMessageComposer); + this._composers.set(OutgoingHeader.GET_IS_OFFER_GIFTABLE, GetIsOfferGiftableComposer); + this._composers.set(OutgoingHeader.GET_LIMITED_OFFER_APPEARING_NEXT, GetLimitedOfferAppearingNextComposer); + this._composers.set(OutgoingHeader.GET_NEXT_TARGETED_OFFER, GetNextTargetedOfferComposer); + this._composers.set(OutgoingHeader.GET_ROOM_AD_PURCHASE_INFO, GetRoomAdPurchaseInfoComposer); + this._composers.set(OutgoingHeader.GET_SEASONAL_CALENDAR_DAILY_OFFER, GetSeasonalCalendarDailyOfferComposer); + this._composers.set(OutgoingHeader.GET_TARGETED_OFFER, GetTargetedOfferComposer); + this._composers.set(OutgoingHeader.MARK_CATALOG_NEW_ADDITIONS_PAGE_OPENED, MarkCatalogNewAdditionsPageOpenedComposer); + this._composers.set(OutgoingHeader.PURCHASE_BASIC_MEMBERSHIP_EXTENSION, PurchaseBasicMembershipExtensionComposer); + this._composers.set(OutgoingHeader.PURCHASE_ROOM_AD, PurchaseRoomAdMessageComposer); + this._composers.set(OutgoingHeader.PURCHASE_TARGETED_OFFER, PurchaseTargetedOfferComposer); + this._composers.set(OutgoingHeader.PURCHASE_VIP_MEMBERSHIP_EXTENSION, PurchaseVipMembershipExtensionComposer); + this._composers.set(OutgoingHeader.ROOM_AD_PURCHASE_INITIATED, RoomAdPurchaseInitiatedComposer); + this._composers.set(OutgoingHeader.SET_TARGETTED_OFFER_STATE, SetTargetedOfferStateComposer); + this._composers.set(OutgoingHeader.SHOP_TARGETED_OFFER_VIEWED, ShopTargetedOfferViewedComposer); + + // COMPETITION + this._composers.set(OutgoingHeader.FORWARD_TO_A_COMPETITION_ROOM, ForwardToACompetitionRoomMessageComposer); + this._composers.set(OutgoingHeader.FORWARD_TO_A_SUBMITTABLE_ROOM, ForwardToASubmittableRoomMessageComposer); + this._composers.set(OutgoingHeader.FORWARD_TO_RANDOM_COMPETITION_ROOM, ForwardToRandomCompetitionRoomMessageComposer); + this._composers.set(OutgoingHeader.GET_CURRENT_TIMING_CODE, GetCurrentTimingCodeMessageComposer); + this._composers.set(OutgoingHeader.GET_IS_USER_PART_OF_COMPETITION, GetIsUserPartOfCompetitionMessageComposer); + this._composers.set(OutgoingHeader.GET_SECONDS_UNTIL, GetSecondsUntilMessageComposer); + this._composers.set(OutgoingHeader.ROOM_COMPETITION_INIT, RoomCompetitionInitMessageComposer); + this._composers.set(OutgoingHeader.SUBMIT_ROOM_TO_COMPETITION, SubmitRoomToCompetitionMessageComposer); + this._composers.set(OutgoingHeader.VOTE_FOR_ROOM, VoteForRoomMessageComposer); + + // CRAFTING + this._composers.set(OutgoingHeader.CRAFT, CraftComposer); + this._composers.set(OutgoingHeader.CRAFT_SECRET, CraftSecretComposer); + this._composers.set(OutgoingHeader.GET_CRAFTABLE_PRODUCTS, GetCraftingRecipeComposer); + this._composers.set(OutgoingHeader.GET_CRAFTING_RECIPE, GetCraftableProductsComposer); + this._composers.set(OutgoingHeader.GET_CRAFTING_RECIPES_AVAILABLE, GetCraftingRecipesAvailableComposer); + + // FRIENDFURNI + this._composers.set(OutgoingHeader.FRIEND_FURNI_CONFIRM_LOCK, FriendFurniConfirmLockMessageComposer); + + // FRIENDLIST + this._composers.set(OutgoingHeader.ACCEPT_FRIEND, AcceptFriendMessageComposer); + this._composers.set(OutgoingHeader.DECLINE_FRIEND, DeclineFriendMessageComposer); + this._composers.set(OutgoingHeader.FIND_NEW_FRIENDS, FindNewFriendsMessageComposer); + this._composers.set(OutgoingHeader.FOLLOW_FRIEND, FollowFriendMessageComposer); + this._composers.set(OutgoingHeader.FRIEND_LIST_UPDATE, FriendListUpdateComposer); + this._composers.set(OutgoingHeader.GET_FRIEND_REQUESTS, GetFriendRequestsComposer); + this._composers.set(OutgoingHeader.HABBO_SEARCH, HabboSearchComposer); + this._composers.set(OutgoingHeader.MESSENGER_INIT, MessengerInitComposer); + this._composers.set(OutgoingHeader.REMOVE_FRIEND, RemoveFriendComposer); + this._composers.set(OutgoingHeader.REQUEST_FRIEND, RequestFriendComposer); + this._composers.set(OutgoingHeader.MESSENGER_CHAT, SendMessageComposer); + this._composers.set(OutgoingHeader.SEND_ROOM_INVITE, SendRoomInviteComposer); + this._composers.set(OutgoingHeader.SET_RELATIONSHIP_STATUS, SetRelationshipStatusComposer); + this._composers.set(OutgoingHeader.VISIT_USER, VisitUserComposer); + + // GAME + this._composers.set(OutgoingHeader.ACHIEVEMENT_RESOLUTION_OPEN, GetResolutionAchievementsMessageComposer); + this._composers.set(OutgoingHeader.ACCEPTGAMEINVITE, AcceptGameInviteMessageComposer); + this._composers.set(OutgoingHeader.GAMEUNLOADEDMESSAGE, GameUnloadedMessageComposer); + this._composers.set(OutgoingHeader.GETGAMEACHIEVEMENTSMESSAGE, GetGameAchievementsMessageComposer); + this._composers.set(OutgoingHeader.GAMES_LIST, GetGameListMessageComposer); + this._composers.set(OutgoingHeader.GETGAMESTATUSMESSAGE, GetGameStatusMessageComposer); + this._composers.set(OutgoingHeader.GETUSERGAMEACHIEVEMENTSMESSAGE, GetUserGameAchievementsMessageComposer); + this._composers.set(OutgoingHeader.JOINQUEUEMESSAGE, JoinQueueMessageComposer); + this._composers.set(OutgoingHeader.LEAVEQUEUEMESSAGE, LeaveQueueMessageComposer); + this._composers.set(OutgoingHeader.RESETRESOLUTIONACHIEVEMENTMESSAGE, ResetResolutionAchievementMessageComposer); + this._composers.set(OutgoingHeader.GAMES_INIT, GetWeeklyGameRewardComposer); + this._composers.set(OutgoingHeader.GETWEEKLYGAMEREWARDWINNERS, GetWeeklyGameRewardWinnersComposer); + this._composers.set(OutgoingHeader.GAME2GETACCOUNTGAMESTATUSMESSAGE, Game2GetAccountGameStatusMessageComposer); + this._composers.set(OutgoingHeader.GAME2CHECKGAMEDIRECTORYSTATUSMESSAGE, Game2CheckGameDirectoryStatusMessageComposer); + this._composers.set(OutgoingHeader.GAME2EXITGAMEMESSAGE, Game2ExitGameMessageComposer); + this._composers.set(OutgoingHeader.GAME2GAMECHATMESSAGE, Game2GameChatMessageComposer); + this._composers.set(OutgoingHeader.GAME2LOADSTAGEREADYMESSAGE, Game2LoadStageReadyMessageComposer); + this._composers.set(OutgoingHeader.GAME2PLAYAGAINMESSAGE, Game2PlayAgainMessageComposer); + this._composers.set(OutgoingHeader.GAME2REQUESTFULLSTATUSUPDATEMESSAGE, Game2RequestFullStatusUpdateMessageComposer); + this._composers.set(OutgoingHeader.GAME2GETWEEKLYFRIENDSLEADERBOARD, Game2GetWeeklyFriendsLeaderboardComposer); + this._composers.set(OutgoingHeader.GAME2GETWEEKLYLEADERBOARD, Game2GetWeeklyLeaderboardComposer); + + // GIFTS + this._composers.set(OutgoingHeader.GET_GIFT, GetGiftMessageComposer); + this._composers.set(OutgoingHeader.RESET_PHONE_NUMBER_STATE, ResetPhoneNumberStateMessageComposer); + this._composers.set(OutgoingHeader.SET_PHONE_NUMBER_VERIFICATION_STATUS, SetPhoneNumberVerificationStatusMessageComposer); + this._composers.set(OutgoingHeader.TRY_PHONE_NUMBER, TryPhoneNumberMessageComposer); + this._composers.set(OutgoingHeader.VERIFY_CODE, VerifyCodeMessageComposer); + + // GROUPFORUMS + this._composers.set(OutgoingHeader.GET_FORUM_STATS, GetForumStatsMessageComposer); + this._composers.set(OutgoingHeader.GET_FORUMS_LIST, GetForumsListMessageComposer); + this._composers.set(OutgoingHeader.GET_FORUM_MESSAGES, GetMessagesMessageComposer); + this._composers.set(OutgoingHeader.GET_FORUM_THREAD, GetThreadMessageComposer); + this._composers.set(OutgoingHeader.GET_FORUM_THREADS, GetThreadsMessageComposer); + this._composers.set(OutgoingHeader.GET_UNREAD_FORUMS_COUNT, GetUnreadForumsCountMessageComposer); + this._composers.set(OutgoingHeader.FORUM_MODERATE_MESSAGE, ModerateMessageMessageComposer); + this._composers.set(OutgoingHeader.FORUM_MODERATE_THREAD, ModerateThreadMessageComposer); + this._composers.set(OutgoingHeader.FORUM_POST_MESSAGE, PostMessageMessageComposer); + this._composers.set(OutgoingHeader.UPDATE_FORUM_READ_MARKER, UpdateForumReadMarkerMessageComposer); + this._composers.set(OutgoingHeader.UPDATE_FORUM_SETTINGS, UpdateForumSettingsMessageComposer); + this._composers.set(OutgoingHeader.FORUM_UPDATE_THREAD, UpdateThreadMessageComposer); + + // HANDSHAKE + this._composers.set(OutgoingHeader.CLIENT_PONG, PongMessageComposer); + this._composers.set(OutgoingHeader.RELEASE_VERSION, ClientHelloMessageComposer); + this._composers.set(OutgoingHeader.SECURITY_TICKET, SSOTicketMessageComposer); + this._composers.set(OutgoingHeader.USER_INFO, InfoRetrieveMessageComposer); + this._composers.set(OutgoingHeader.DISCONNECT, DisconnectMessageComposer); + this._composers.set(OutgoingHeader.SECURITY_MACHINE, UniqueIDMessageComposer); + this._composers.set(OutgoingHeader.CLIENT_VARIABLES, VersionCheckMessageComposer); + this._composers.set(OutgoingHeader.HANDSHAKE_INIT_DIFFIE, InitDiffieHandshakeMessageComposer); + this._composers.set(OutgoingHeader.HANDSHAKE_COMPLETE_DIFFIE, CompleteDiffieHandshakeMessageComposer); + + // HELP + this._composers.set(OutgoingHeader.CALL_FOR_HELP_FROM_FORUM_MESSAGE, CallForHelpFromForumMessageMessageComposer); + this._composers.set(OutgoingHeader.CALL_FOR_HELP_FROM_FORUM_THREAD, CallForHelpFromForumThreadMessageComposer); + this._composers.set(OutgoingHeader.CALL_FOR_HELP_FROM_IM, CallForHelpFromIMMessageComposer); + this._composers.set(OutgoingHeader.CALL_FOR_HELP_FROM_PHOTO, CallForHelpFromPhotoMessageComposer); + this._composers.set(OutgoingHeader.CALL_FOR_HELP_FROM_SELFIE, CallForHelpFromSelfieMessageComposer); + this._composers.set(OutgoingHeader.CALL_FOR_HELP, CallForHelpMessageComposer); + this._composers.set(OutgoingHeader.CHAT_REVIEW_GUIDE_DECIDES, ChatReviewGuideDecidesOnOfferMessageComposer); + this._composers.set(OutgoingHeader.CHAT_REVIEW_GUIDE_DETACHED, ChatReviewGuideDetachedMessageComposer); + this._composers.set(OutgoingHeader.CHAT_REVIEW_GUIDE_VOTE, ChatReviewGuideVoteMessageComposer); + this._composers.set(OutgoingHeader.CHAT_REVIEW_SESSION_CREATE, ChatReviewSessionCreateMessageComposer); + this._composers.set(OutgoingHeader.DELETE_PENDING_CALLS_FOR_HELP, DeletePendingCallsForHelpMessageComposer); + this._composers.set(OutgoingHeader.GET_CFH_STATUS, GetCfhStatusMessageComposer); + this._composers.set(OutgoingHeader.GET_FAQ_CATEGORY, GetFaqCategoryMessageComposer); + this._composers.set(OutgoingHeader.GET_FAQ_TEXT, GetFaqTextMessageComposer); + this._composers.set(OutgoingHeader.GET_GUIDE_REPORTING_STATUS, GetGuideReportingStatusMessageComposer); + this._composers.set(OutgoingHeader.GET_PENDING_CALLS_FOR_HELP, GetPendingCallsForHelpMessageComposer); + this._composers.set(OutgoingHeader.GET_QUIZ_QUESTIONS, GetQuizQuestionsComposer); + this._composers.set(OutgoingHeader.GUIDE_SESSION_CREATE, GuideSessionCreateMessageComposer); + this._composers.set(OutgoingHeader.GUIDE_SESSION_FEEDBACK, GuideSessionFeedbackMessageComposer); + this._composers.set(OutgoingHeader.GUIDE_SESSION_GET_REQUESTER_ROOM, GuideSessionGetRequesterRoomMessageComposer); + this._composers.set(OutgoingHeader.GUIDE_SESSION_GUIDE_DECIDES, GuideSessionGuideDecidesMessageComposer); + this._composers.set(OutgoingHeader.GUIDE_SESSION_INVITE_REQUESTER, GuideSessionInviteRequesterMessageComposer); + this._composers.set(OutgoingHeader.GUIDE_SESSION_IS_TYPING, GuideSessionIsTypingMessageComposer); + this._composers.set(OutgoingHeader.GUIDE_SESSION_MESSAGE, GuideSessionMessageMessageComposer); + this._composers.set(OutgoingHeader.GUIDE_SESSION_ON_DUTY_UPDATE, GuideSessionOnDutyUpdateMessageComposer); + this._composers.set(OutgoingHeader.GUIDE_SESSION_REPORT, GuideSessionReportMessageComposer); + this._composers.set(OutgoingHeader.GUIDE_SESSION_REQUESTER_CANCELS, GuideSessionRequesterCancelsMessageComposer); + this._composers.set(OutgoingHeader.GUIDE_SESSION_RESOLVED, GuideSessionResolvedMessageComposer); + this._composers.set(OutgoingHeader.POST_QUIZ_ANSWERS, PostQuizAnswersComposer); + this._composers.set(OutgoingHeader.SEARCH_FAQS, SearchFaqsMessageComposer); + + // DESKTOP + this._composers.set(OutgoingHeader.DESKTOP_VIEW, DesktopViewComposer); + + // GROUP + this._composers.set(OutgoingHeader.GROUP_INFO, GroupInformationComposer); + this._composers.set(OutgoingHeader.GROUP_REQUEST, GroupJoinComposer); + this._composers.set(OutgoingHeader.GROUP_MEMBER_REMOVE_CONFIRM, GroupConfirmRemoveMemberComposer); + this._composers.set(OutgoingHeader.GROUP_MEMBER_REMOVE, GroupRemoveMemberComposer); + this._composers.set(OutgoingHeader.GROUP_MEMBERS, GroupMembersComposer); + this._composers.set(OutgoingHeader.GROUP_ADMIN_ADD, GroupAdminGiveComposer); + this._composers.set(OutgoingHeader.GROUP_ADMIN_REMOVE, GroupAdminTakeComposer); + this._composers.set(OutgoingHeader.GROUP_REQUEST_ACCEPT, GroupMembershipAcceptComposer); + this._composers.set(OutgoingHeader.GROUP_REQUEST_DECLINE, GroupMembershipDeclineComposer); + this._composers.set(OutgoingHeader.GROUP_DELETE, GroupDeleteComposer); + this._composers.set(OutgoingHeader.GROUP_CREATE_OPTIONS, GroupBuyDataComposer); + this._composers.set(OutgoingHeader.GROUP_PARTS, GroupBadgePartsComposer); + this._composers.set(OutgoingHeader.GROUP_BUY, GroupBuyComposer); + this._composers.set(OutgoingHeader.GROUP_SETTINGS, GroupSettingsComposer); + this._composers.set(OutgoingHeader.GROUP_SAVE_BADGE, GroupSaveBadgeComposer); + this._composers.set(OutgoingHeader.GROUP_SAVE_COLORS, GroupSaveColorsComposer); + this._composers.set(OutgoingHeader.GROUP_SAVE_INFORMATION, GroupSaveInformationComposer); + this._composers.set(OutgoingHeader.GROUP_SAVE_PREFERENCES, GroupSavePreferencesComposer); + this._composers.set(OutgoingHeader.GROUP_FAVORITE, GroupFavoriteComposer); + this._composers.set(OutgoingHeader.GROUP_UNFAVORITE, GroupUnfavoriteComposer); + this._composers.set(OutgoingHeader.GROUP_BADGES, GetHabboGroupBadgesMessageComposer); + this._composers.set(OutgoingHeader.APPROVE_ALL_MEMBERSHIP_REQUESTS, ApproveAllMembershipRequestsMessageComposer); + this._composers.set(OutgoingHeader.GROUP_UNBLOCK_MEMBER, UnblockGroupMemberMessageComposer); + + // NAVIGATOR + this._composers.set(OutgoingHeader.ROOM_FAVORITE, AddFavouriteRoomMessageComposer); + this._composers.set(OutgoingHeader.CAN_CREATE_ROOM, CanCreateRoomMessageComposer); + this._composers.set(OutgoingHeader.CANCEL_ROOM_EVENT, CancelEventMessageComposer); + this._composers.set(OutgoingHeader.CONVERT_GLOBAL_ROOM_ID, ConvertGlobalRoomIdMessageComposer); + this._composers.set(OutgoingHeader.COMPETITION_ROOM_SEARCH, CompetitionRoomsSearchMessageComposer); + this._composers.set(OutgoingHeader.ROOM_CREATE, CreateFlatMessageComposer); + this._composers.set(OutgoingHeader.GET_USER_FLAT_CATS, GetUserFlatCatsMessageComposer); + this._composers.set(OutgoingHeader.GET_USER_EVENT_CATS, GetUserEventCatsMessageComposer); + this._composers.set(OutgoingHeader.ROOM_FAVORITE_REMOVE, DeleteFavouriteRoomMessageComposer); + this._composers.set(OutgoingHeader.EDIT_ROOM_EVENT, EditEventMessageComposer); + this._composers.set(OutgoingHeader.FORWARD_TO_RANDOM_PROMOTED_ROOM, ForwardToARandomPromotedRoomMessageComposer); + this._composers.set(OutgoingHeader.FORWARD_TO_SOME_ROOM, ForwardToSomeRoomMessageComposer); + this._composers.set(OutgoingHeader.GET_CATEGORIES_WITH_USER_COUNT, GetCategoriesWithUserCountMessageComposer); + this._composers.set(OutgoingHeader.GET_GUEST_ROOM, GetGuestRoomMessageComposer); + this._composers.set(OutgoingHeader.GET_OFFICIAL_ROOMS, GetOfficialRoomsMessageComposer); + this._composers.set(OutgoingHeader.GET_POPULAR_ROOM_TAGS, GetPopularRoomTagsMessageComposer); + this._composers.set(OutgoingHeader.GUILD_BASE_SEARCH, GuildBaseSearchMessageComposer); + this._composers.set(OutgoingHeader.MY_FAVOURITE_ROOMS_SEARCH, MyFavouriteRoomsSearchMessageComposer); + this._composers.set(OutgoingHeader.MY_FREQUENT_ROOM_HISTORY_SEARCH, MyFrequentRoomHistorySearchMessageComposer); + this._composers.set(OutgoingHeader.MY_FRIENDS_ROOM_SEARCH, MyFriendsRoomsSearchMessageComposer); + this._composers.set(OutgoingHeader.MY_GUILD_BASES_SEARCH, MyGuildBasesSearchMessageComposer); + this._composers.set(OutgoingHeader.MY_RECOMMENDED_ROOMS, MyRecommendedRoomsMessageComposer); + this._composers.set(OutgoingHeader.MY_ROOM_HISTORY_SEARCH, MyRoomHistorySearchMessageComposer); + this._composers.set(OutgoingHeader.MY_ROOM_RIGHTS_SEARCH, MyRoomRightsSearchMessageComposer); + this._composers.set(OutgoingHeader.MY_ROOMS_SEARCH, MyRoomsSearchMessageComposer); + this._composers.set(OutgoingHeader.POPULAR_ROOMS_SEARCH, PopularRoomsSearchMessageComposer); + this._composers.set(OutgoingHeader.ROOM_LIKE, RateFlatMessageComposer); + this._composers.set(OutgoingHeader.ROOM_RIGHTS_REMOVE_OWN, RemoveOwnRoomRightsRoomMessageComposer); + this._composers.set(OutgoingHeader.ROOM_AD_EVENT_TAB_CLICKED, RoomAdEventTabAdClickedComposer); + this._composers.set(OutgoingHeader.ROOM_AD_EVENT_TAB_VIEWED, RoomAdEventTabViewedComposer); + this._composers.set(OutgoingHeader.ROOM_AD_SEARCH, RoomAdSearchMessageComposer); + this._composers.set(OutgoingHeader.ROOM_TEXT_SEARCH, RoomTextSearchMessageComposer); + this._composers.set(OutgoingHeader.ROOMS_WHERE_MY_FRIENDS_ARE, RoomsWhereMyFriendsAreSearchMessageComposer); + this._composers.set(OutgoingHeader.ROOMS_WITH_HIGHEST_SCORE_SEARCH, RoomsWithHighestScoreSearchMessageComposer); + this._composers.set(OutgoingHeader.SET_ROOM_SESSION_TAGS, SetRoomSessionTagsMessageComposer); + this._composers.set(OutgoingHeader.ROOM_STAFF_PICK, ToggleStaffPickMessageComposer); + this._composers.set(OutgoingHeader.ROOM_FILTER_WORDS, GetCustomRoomFilterMessageComposer); + this._composers.set(OutgoingHeader.ROOM_FILTER_WORDS_MODIFY, UpdateRoomFilterMessageComposer); + this._composers.set(OutgoingHeader.USER_HOME_ROOM, UpdateHomeRoomMessageComposer); + this._composers.set(OutgoingHeader.UPDATE_ROOM_THUMBNAIL, UpdateRoomThumbnailMessageComposer); + // NEW NAVIGATOR + this._composers.set(OutgoingHeader.NAVIGATOR_INIT, NavigatorInitComposer); + this._composers.set(OutgoingHeader.NAVIGATOR_SEARCH_CLOSE, NavigatorSearchCloseComposer); + this._composers.set(OutgoingHeader.NAVIGATOR_SEARCH, NavigatorSearchComposer); + this._composers.set(OutgoingHeader.NAVIGATOR_SEARCH_OPEN, NavigatorSearchOpenComposer); + this._composers.set(OutgoingHeader.NAVIGATOR_SEARCH_SAVE, NavigatorSearchSaveComposer); + this._composers.set(OutgoingHeader.NAVIGATOR_SETTINGS_SAVE, NavigatorSettingsSaveComposer); + this._composers.set(OutgoingHeader.NAVIGATOR_CATEGORY_LIST_MODE, NavigatorCategoryListModeComposer); + this._composers.set(OutgoingHeader.NAVIGATOR_DELETE_SAVED_SEARCH, NavigatorDeleteSavedSearchComposer); + + // POLL + this._composers.set(OutgoingHeader.POLL_ANSWER, PollAnswerComposer); + this._composers.set(OutgoingHeader.POLL_REJECT, PollRejectComposer); + this._composers.set(OutgoingHeader.POLL_START, PollStartComposer); + this._composers.set(OutgoingHeader.POLL_VOTE_COUNTER, VotePollCounterMessageComposer); + + // INVENTORY + + // EFFECTS + this._composers.set(OutgoingHeader.USER_EFFECT_ACTIVATE, AvatarEffectActivatedComposer); + this._composers.set(OutgoingHeader.USER_EFFECT_ENABLE, AvatarEffectSelectedComposer); + + // BADGES + this._composers.set(OutgoingHeader.USER_BADGES, RequestBadgesComposer); + this._composers.set(OutgoingHeader.USER_BADGES_CURRENT_UPDATE, SetActivatedBadgesComposer); + this._composers.set(OutgoingHeader.GET_BADGE_POINTS_LIMITS, GetBadgePointLimitsComposer); + this._composers.set(OutgoingHeader.REQUESTABADGE, RequestABadgeComposer); + this._composers.set(OutgoingHeader.GETISBADGEREQUESTFULFILLED, GetIsBadgeRequestFulfilledComposer); + + // BOTS + this._composers.set(OutgoingHeader.USER_BOTS, GetBotInventoryComposer); + + // FURNI + this._composers.set(OutgoingHeader.USER_FURNITURE, FurnitureListComposer); + this._composers.set(OutgoingHeader.REQUESTFURNIINVENTORYWHENNOTINROOM, RequestFurniInventoryWhenNotInRoomComposer); + + // PETS + this._composers.set(OutgoingHeader.USER_PETS, RequestPetsComposer); + + // TRADING + this._composers.set(OutgoingHeader.TRADE_ACCEPT, TradingAcceptComposer); + this._composers.set(OutgoingHeader.TRADE_CANCEL, TradingCancelComposer); + this._composers.set(OutgoingHeader.TRADE_CLOSE, TradingCloseComposer); + this._composers.set(OutgoingHeader.TRADE_CONFIRM, TradingConfirmationComposer); + this._composers.set(OutgoingHeader.TRADE_ITEM, TradingListAddItemComposer); + this._composers.set(OutgoingHeader.TRADE_ITEMS, TradingListAddItemsComposer); + this._composers.set(OutgoingHeader.TRADE_ITEM_REMOVE, TradingListItemRemoveComposer); + this._composers.set(OutgoingHeader.TRADE, TradingOpenComposer); + this._composers.set(OutgoingHeader.TRADE_UNACCEPT, TradingUnacceptComposer); + + // UNSEEN + this._composers.set(OutgoingHeader.UNSEEN_RESET_CATEGORY, UnseenResetCategoryComposer); + this._composers.set(OutgoingHeader.UNSEEN_RESET_ITEMS, UnseenResetItemsComposer); + + // ACHIVEMENTS + this._composers.set(OutgoingHeader.ACHIEVEMENT_LIST, RequestAchievementsMessageComposer); + + // PET + this._composers.set(OutgoingHeader.PET_MOUNT, PetMountComposer); + this._composers.set(OutgoingHeader.PET_RESPECT, PetRespectComposer); + this._composers.set(OutgoingHeader.PET_SUPPLEMENT, PetSupplementComposer); + this._composers.set(OutgoingHeader.REMOVE_PET_SADDLE, RemovePetSaddleComposer); + this._composers.set(OutgoingHeader.PET_INFO, RequestPetInfoComposer); + this._composers.set(OutgoingHeader.TOGGLE_PET_BREEDING, TogglePetBreedingComposer); + this._composers.set(OutgoingHeader.TOGGLE_PET_RIDING, TogglePetRidingComposer); + this._composers.set(OutgoingHeader.USE_PET_PRODUCT, UsePetProductComposer); + this._composers.set(OutgoingHeader.GET_PET_TRAINING_PANEL, GetPetCommandsComposer); + this._composers.set(OutgoingHeader.PET_OPEN_PACKAGE, OpenPetPackageMessageComposer); + this._composers.set(OutgoingHeader.PET_SELECTED, PetSelectedMessageComposer); + this._composers.set(OutgoingHeader.PETS_BREED, BreedPetsMessageComposer); + this._composers.set(OutgoingHeader.PET_CANCEL_BREEDING, CancelPetBreedingComposer); + this._composers.set(OutgoingHeader.PET_CONFIRM_BREEDING, ConfirmPetBreedingComposer); + + // ROOM + + // ACCESS + this._composers.set(OutgoingHeader.ROOM_ENTER, RoomEnterComposer); + this._composers.set(OutgoingHeader.ROOM_DOORBELL, RoomDoorbellAccessComposer); + this._composers.set(OutgoingHeader.GO_TO_FLAT, GoToFlatMessageComposer); + this._composers.set(OutgoingHeader.CHANGE_QUEUE, ChangeQueueMessageComposer); + + // ACTION + this._composers.set(OutgoingHeader.ROOM_AMBASSADOR_ALERT, RoomAmbassadorAlertComposer); + this._composers.set(OutgoingHeader.ROOM_BAN_GIVE, RoomBanUserComposer); + this._composers.set(OutgoingHeader.ROOM_BAN_REMOVE, RoomUnbanUserComposer); + this._composers.set(OutgoingHeader.ROOM_RIGHTS_GIVE, RoomGiveRightsComposer); + this._composers.set(OutgoingHeader.ROOM_KICK, RoomKickUserComposer); + this._composers.set(OutgoingHeader.ROOM_MUTE_USER, RoomMuteUserComposer); + this._composers.set(OutgoingHeader.ROOM_RIGHTS_REMOVE, RoomTakeRightsComposer); + this._composers.set(OutgoingHeader.ROOM_RIGHTS_REMOVE_ALL, RemoveAllRightsMessageComposer); + + this._composers.set(OutgoingHeader.ROOM_DELETE, RoomDeleteComposer); + + // DATA + this._composers.set(OutgoingHeader.ROOM_SETTINGS, RoomSettingsComposer); + this._composers.set(OutgoingHeader.ROOM_SETTINGS_SAVE, SaveRoomSettingsComposer); + this._composers.set(OutgoingHeader.ROOM_RIGHTS_LIST, RoomUsersWithRightsComposer); + this._composers.set(OutgoingHeader.ROOM_BAN_LIST, RoomBannedUsersComposer); + this._composers.set(OutgoingHeader.ROOM_SETTINGS_UPDATE_ROOM_CATEGORY_AND_TRADE, UpdateRoomCategoryAndTradeSettingsComposer); + + // BOTS + this._composers.set(OutgoingHeader.BOT_CONFIGURATION, RequestBotCommandConfigurationComposer); + + // ENGINE + this._composers.set(OutgoingHeader.GET_ITEM_DATA, GetItemDataComposer); + this._composers.set(OutgoingHeader.REMOVE_WALL_ITEM, RemoveWallItemComposer); + this._composers.set(OutgoingHeader.BOT_PLACE, BotPlaceComposer); + this._composers.set(OutgoingHeader.BOT_PICKUP, BotRemoveComposer); + this._composers.set(OutgoingHeader.BOT_SKILL_SAVE, BotSkillSaveComposer); + this._composers.set(OutgoingHeader.PET_PLACE, PetPlaceComposer); + this._composers.set(OutgoingHeader.PET_MOVE, PetMoveComposer); + this._composers.set(OutgoingHeader.PET_PICKUP, PetRemoveComposer); + this._composers.set(OutgoingHeader.SET_ITEM_DATA, SetItemDataMessageComposer); + this._composers.set(OutgoingHeader.SET_OBJECT_DATA, SetObjectDataMessageComposer); + this._composers.set(OutgoingHeader.COMPOST_PLANT, CompostPlantMessageComposer); + this._composers.set(OutgoingHeader.HARVEST_PET, HarvestPetMessageComposer); + this._composers.set(OutgoingHeader.SET_CLOTHING_CHANGE_DATA, SetClothingChangeDataMessageComposer); + + // FURNITURE + this._composers.set(OutgoingHeader.FURNITURE_ALIASES, FurnitureAliasesComposer); + this._composers.set(OutgoingHeader.FURNITURE_GROUP_INFO, FurnitureGroupInfoComposer); + this._composers.set(OutgoingHeader.FURNITURE_PICKUP, FurniturePickupComposer); + this._composers.set(OutgoingHeader.FURNITURE_PLACE, FurniturePlaceComposer); + this._composers.set(OutgoingHeader.ITEM_PAINT, FurniturePlacePaintComposer); + this._composers.set(OutgoingHeader.FURNITURE_POSTIT_PLACE, FurniturePostItPlaceComposer); + this._composers.set(OutgoingHeader.FURNITURE_POSTIT_SAVE_STICKY_POLE, AddSpamWallPostItMessageComposer); + this._composers.set(OutgoingHeader.CONTROL_YOUTUBE_DISPLAY_PLAYBACK, ControlYoutubeDisplayPlaybackMessageComposer); + this._composers.set(OutgoingHeader.GET_YOUTUBE_DISPLAY_STATUS, GetYoutubeDisplayStatusMessageComposer); + this._composers.set(OutgoingHeader.SET_YOUTUBE_DISPLAY_PLAYLIST, SetYoutubeDisplayPlaylistMessageComposer); + + // FLOOR + this._composers.set(OutgoingHeader.FURNITURE_FLOOR_UPDATE, FurnitureFloorUpdateComposer); + + // WALL + this._composers.set(OutgoingHeader.FURNITURE_WALL_UPDATE, FurnitureWallUpdateComposer); + + // Dimmers + this._composers.set(OutgoingHeader.ITEM_DIMMER_SETTINGS, MoodlightSettingsComposer); + this._composers.set(OutgoingHeader.ITEM_DIMMER_SAVE, MoodlightSettingsSaveComposer); + this._composers.set(OutgoingHeader.ITEM_DIMMER_TOGGLE, MoodlightTogggleStateComposer); + + // Toners + this._composers.set(OutgoingHeader.ROOM_TONER_APPLY, ApplyTonerComposer); + + // LOGIC + this._composers.set(OutgoingHeader.ITEM_COLOR_WHEEL_CLICK, FurnitureColorWheelComposer); + this._composers.set(OutgoingHeader.ITEM_DICE_CLICK, FurnitureDiceActivateComposer); + this._composers.set(OutgoingHeader.ITEM_DICE_CLOSE, FurnitureDiceDeactivateComposer); + this._composers.set(OutgoingHeader.FURNITURE_MULTISTATE, FurnitureMultiStateComposer); + this._composers.set(OutgoingHeader.FURNITURE_RANDOMSTATE, FurnitureRandomStateComposer); + this._composers.set(OutgoingHeader.ITEM_STACK_HELPER, FurnitureStackHeightComposer); + this._composers.set(OutgoingHeader.FURNITURE_WALL_MULTISTATE, FurnitureWallMultiStateComposer); + this._composers.set(OutgoingHeader.ONE_WAY_DOOR_CLICK, FurnitureOneWayDoorComposer); + this._composers.set(OutgoingHeader.ITEM_EXCHANGE_REDEEM, FurnitureExchangeComposer); + this._composers.set(OutgoingHeader.ITEM_CLOTHING_REDEEM, RedeemItemClothingComposer); + + // LAYOUT + this._composers.set(OutgoingHeader.ROOM_MODEL, GetRoomEntryDataMessageComposer); + this._composers.set(OutgoingHeader.GET_OCCUPIED_TILES, GetOccupiedTilesMessageComposer); + this._composers.set(OutgoingHeader.GET_ROOM_ENTRY_TILE, GetRoomEntryTileMessageComposer); + this._composers.set(OutgoingHeader.ROOM_MODEL_SAVE, UpdateFloorPropertiesMessageComposer); + + // UNIT + this._composers.set(OutgoingHeader.UNIT_ACTION, RoomUnitActionComposer); + this._composers.set(OutgoingHeader.UNIT_DANCE, RoomUnitDanceComposer); + this._composers.set(OutgoingHeader.UNIT_DROP_HAND_ITEM, RoomUnitDropHandItemComposer); + this._composers.set(OutgoingHeader.UNIT_GIVE_HANDITEM, RoomUnitGiveHandItemComposer); + this._composers.set(OutgoingHeader.UNIT_GIVE_HANDITEM_PET, RoomUnitGiveHandItemPetComposer); + this._composers.set(OutgoingHeader.UNIT_LOOK, RoomUnitLookComposer); + this._composers.set(OutgoingHeader.UNIT_SIGN, RoomUnitSignComposer); + this._composers.set(OutgoingHeader.UNIT_POSTURE, RoomUnitPostureComposer); + this._composers.set(OutgoingHeader.UNIT_WALK, RoomUnitWalkComposer); + + // CHAT + this._composers.set(OutgoingHeader.UNIT_CHAT, RoomUnitChatComposer); + this._composers.set(OutgoingHeader.UNIT_CHAT_SHOUT, RoomUnitChatShoutComposer); + this._composers.set(OutgoingHeader.USER_SETTINGS_CHAT_STYLE, RoomUnitChatStyleComposer); + this._composers.set(OutgoingHeader.UNIT_CHAT_WHISPER, RoomUnitChatWhisperComposer); + this._composers.set(OutgoingHeader.UNIT_TYPING, RoomUnitTypingStartComposer); + this._composers.set(OutgoingHeader.UNIT_TYPING_STOP, RoomUnitTypingStopComposer); + + // ROOM EVENTS + this._composers.set(OutgoingHeader.WIRED_APPLY_SNAPSHOT, ApplySnapshotMessageComposer); + this._composers.set(OutgoingHeader.WIRED_OPEN, OpenMessageComposer); + this._composers.set(OutgoingHeader.WIRED_ACTION_SAVE, UpdateActionMessageComposer); + this._composers.set(OutgoingHeader.WIRED_CONDITION_SAVE, UpdateConditionMessageComposer); + this._composers.set(OutgoingHeader.WIRED_TRIGGER_SAVE, UpdateTriggerMessageComposer); + this._composers.set(OutgoingHeader.ROOM_MUTE, RoomMuteComposer); + + // USER + this._composers.set(OutgoingHeader.APPROVE_NAME, ApproveNameMessageComposer); + this._composers.set(OutgoingHeader.USER_RESPECT, UserRespectComposer); + this._composers.set(OutgoingHeader.SCR_GET_KICKBACK_INFO, ScrGetKickbackInfoMessageComposer); + + // USER CLASSIFICATION + this._composers.set(OutgoingHeader.PEER_USERS_CLASSIFICATION, PeerUsersClassificationMessageComposer); + this._composers.set(OutgoingHeader.USER_CLASSIFICATION, RoomUsersClassificationMessageComposer); + + // DATA + this._composers.set(OutgoingHeader.USER_IGNORED, GetIgnoredUsersComposer); + this._composers.set(OutgoingHeader.USER_IGNORE, IgnoreUserComposer); + this._composers.set(OutgoingHeader.USER_IGNORE_ID, IgnoreUserIdComposer); + this._composers.set(OutgoingHeader.USER_UNIGNORE, UnignoreUserComposer); + this._composers.set(OutgoingHeader.USER_BADGES_CURRENT, UserCurrentBadgesComposer); + this._composers.set(OutgoingHeader.USER_FIGURE, UserFigureComposer); + this._composers.set(OutgoingHeader.USER_MOTTO, UserMottoComposer); + this._composers.set(OutgoingHeader.USER_PROFILE, UserProfileComposer); + this._composers.set(OutgoingHeader.USER_PROFILE_BY_NAME, GetExtendedProfileByNameMessageComposer); + this._composers.set(OutgoingHeader.USER_TAGS, GetUserTagsComposer); + this._composers.set(OutgoingHeader.MESSENGER_RELATIONSHIPS, UserRelationshipsComposer); + + // MANNEQUIN + this._composers.set(OutgoingHeader.MANNEQUIN_SAVE_NAME, FurnitureMannequinSaveNameComposer); + this._composers.set(OutgoingHeader.MANNEQUIN_SAVE_LOOK, FurnitureMannequinSaveLookComposer); + + // GIFTS + this._composers.set(OutgoingHeader.PRESENT_OPEN_PRESENT, OpenPresentComposer); + + // INVENTORY + + // MARKETPLACE + this._composers.set(OutgoingHeader.MARKETPLACE_CONFIG, GetMarketplaceConfigurationMessageComposer); + this._composers.set(OutgoingHeader.MARKETPLACE_SELL_ITEM, MakeOfferMessageComposer); + this._composers.set(OutgoingHeader.MARKETPLACE_REQUEST_OWN_ITEMS, GetMarketplaceOwnOffersMessageComposer); + this._composers.set(OutgoingHeader.MARKETPLACE_TAKE_BACK_ITEM, CancelMarketplaceOfferMessageComposer); + this._composers.set(OutgoingHeader.MARKETPLACE_REQUEST_OFFERS, GetMarketplaceOffersMessageComposer); + this._composers.set(OutgoingHeader.MARKETPLACE_BUY_OFFER, BuyMarketplaceOfferMessageComposer); + this._composers.set(OutgoingHeader.MARKETPLACE_REDEEM_CREDITS, RedeemMarketplaceOfferCreditsMessageComposer); + this._composers.set(OutgoingHeader.MARKETPLACE_BUY_TOKENS, BuyMarketplaceTokensMessageComposer); + this._composers.set(OutgoingHeader.REQUEST_SELL_ITEM, GetMarketplaceCanMakeOfferComposer); + this._composers.set(OutgoingHeader.REQUEST_MARKETPLACE_ITEM_STATS, GetMarketplaceItemStatsComposer); + + // BOTS + this._composers.set(OutgoingHeader.USER_BOTS, GetBotInventoryComposer); + + // PETS + this._composers.set(OutgoingHeader.USER_PETS, RequestPetsComposer); + + // CURRENCY + this._composers.set(OutgoingHeader.USER_CURRENCY, UserCurrencyComposer); + + // SUBSCRIPTION + this._composers.set(OutgoingHeader.USER_SUBSCRIPTION, UserSubscriptionComposer); + + // MODERATION + this._composers.set(OutgoingHeader.MODTOOL_REQUEST_ROOM_INFO, GetModeratorRoomInfoMessageComposer); + this._composers.set(OutgoingHeader.MODTOOL_CHANGE_ROOM_SETTINGS, ModerateRoomMessageComposer); + this._composers.set(OutgoingHeader.MODTOOL_REQUEST_USER_CHATLOG, GetUserChatlogMessageComposer); + this._composers.set(OutgoingHeader.MODTOOL_REQUEST_ROOM_CHATLOG, GetRoomChatlogMessageComposer); + this._composers.set(OutgoingHeader.MOD_TOOL_USER_INFO, GetModeratorUserInfoMessageComposer); + this._composers.set(OutgoingHeader.MODTOOL_SANCTION_ALERT, ModAlertMessageComposer); + this._composers.set(OutgoingHeader.MODTOOL_SANCTION_BAN, ModBanMessageComposer); + this._composers.set(OutgoingHeader.MODTOOL_SANCTION_KICK, ModKickMessageComposer); + this._composers.set(OutgoingHeader.MODTOOL_SANCTION_TRADELOCK, ModTradingLockMessageComposer); + this._composers.set(OutgoingHeader.MODTOOL_ALERTEVENT, ModMessageMessageComposer); + this._composers.set(OutgoingHeader.MODTOOL_SANCTION_MUTE, ModMuteMessageComposer); + this._composers.set(OutgoingHeader.MODTOOL_REQUEST_USER_ROOMS, GetRoomVisitsMessageComposer); + this._composers.set(OutgoingHeader.MODTOOL_ROOM_ALERT, ModeratorActionMessageComposer); + this._composers.set(OutgoingHeader.CLOSE_ISSUE_DEFAULT_ACTION, CloseIssueDefaultActionMessageComposer); + this._composers.set(OutgoingHeader.CLOSE_ISSUES, CloseIssuesMessageComposer); + this._composers.set(OutgoingHeader.DEFAULT_SANCTION, DefaultSanctionMessageComposer); + this._composers.set(OutgoingHeader.GET_CFH_CHATLOG, GetCfhChatlogMessageComposer); + this._composers.set(OutgoingHeader.MODTOOL_PREFERENCES, ModToolPreferencesComposer); + this._composers.set(OutgoingHeader.MODTOOL_SANCTION, ModToolSanctionComposer); + this._composers.set(OutgoingHeader.PICK_ISSUES, PickIssuesMessageComposer); + this._composers.set(OutgoingHeader.RELEASE_ISSUES, ReleaseIssuesMessageComposer); + + // MYSTERYBOX + this._composers.set(OutgoingHeader.MYSTERYBOXWAITINGCANCELEDMESSAGE, MysteryBoxWaitingCanceledMessageComposer); + this._composers.set(OutgoingHeader.MYSTERYBOX_OPEN_TROPHY, OpenMysteryTrophyMessageComposer); + + // SETTINGS + this._composers.set(OutgoingHeader.USER_SETTINGS_CAMERA, UserSettingsCameraFollowComposer); + this._composers.set(OutgoingHeader.USER_SETTINGS_OLD_CHAT, UserSettingsOldChatComposer); + this._composers.set(OutgoingHeader.USER_SETTINGS_INVITES, UserSettingsRoomInvitesComposer); + this._composers.set(OutgoingHeader.USER_SETTINGS_VOLUME, UserSettingsSoundComposer); + + // LANDING VIEW + this._composers.set(OutgoingHeader.COMMUNITY_GOAL_VOTE_COMPOSER, CommunityGoalVoteMessageComposer); + this._composers.set(OutgoingHeader.GET_PROMO_ARTICLES, GetPromoArticlesComposer); + + // QUEST + this._composers.set(OutgoingHeader.ACCEPT_QUEST, AcceptQuestMessageComposer); + this._composers.set(OutgoingHeader.ACTIVATE_QUEST, ActivateQuestMessageComposer); + this._composers.set(OutgoingHeader.CANCEL_QUEST, CancelQuestMessageComposer); + this._composers.set(OutgoingHeader.FRIEND_REQUEST_QUEST_COMPLETE, FriendRequestQuestCompleteMessageComposer); + this._composers.set(OutgoingHeader.GET_COMMUNITY_GOAL_EARNED_PRIZES, GetCommunityGoalEarnedPrizesMessageComposer); + this._composers.set(OutgoingHeader.GET_COMMUNITY_GOAL_HALL_OF_FAME, GetCommunityGoalHallOfFameMessageComposer); + this._composers.set(OutgoingHeader.GET_COMMUNITY_GOAL_PROGRESS, GetCommunityGoalProgressMessageComposer); + this._composers.set(OutgoingHeader.GET_CONCURRENT_USERS_GOAL_PROGRESS, GetConcurrentUsersGoalProgressMessageComposer); + this._composers.set(OutgoingHeader.GET_CONCURRENT_USERS_REWARD, GetConcurrentUsersRewardMessageComposer); + this._composers.set(OutgoingHeader.GET_DAILY_QUEST, GetDailyQuestMessageComposer); + this._composers.set(OutgoingHeader.GET_QUESTS, GetQuestsMessageComposer); + this._composers.set(OutgoingHeader.GET_SEASONAL_QUESTS_ONLY, GetSeasonalQuestsOnlyMessageComposer); + this._composers.set(OutgoingHeader.OPEN_QUEST_TRACKER, OpenQuestTrackerMessageComposer); + this._composers.set(OutgoingHeader.REDEEM_COMMUNITY_GOAL_PRIZE, RedeemCommunityGoalPrizeMessageComposer); + this._composers.set(OutgoingHeader.REJECT_QUEST, RejectQuestMessageComposer); + this._composers.set(OutgoingHeader.START_CAMPAIGN, StartCampaignMessageComposer); + + // SOUNDS + this._composers.set(OutgoingHeader.GET_SOUND_SETTINGS, GetSoundSettingsComposer); + this._composers.set(OutgoingHeader.ADD_JUKEBOX_DISK, AddJukeboxDiskComposer); + this._composers.set(OutgoingHeader.GET_JUKEBOX_PLAYLIST, GetJukeboxPlayListMessageComposer); + this._composers.set(OutgoingHeader.GET_NOW_PLAYING, GetNowPlayingMessageComposer); + this._composers.set(OutgoingHeader.GET_OFFICIAL_SONG_ID, GetOfficialSongIdMessageComposer); + this._composers.set(OutgoingHeader.GET_SONG_INFO, GetSongInfoMessageComposer); + this._composers.set(OutgoingHeader.GET_SOUND_MACHINE_PLAYLIST, GetSoundMachinePlayListMessageComposer); + this._composers.set(OutgoingHeader.GET_USER_SONG_DISKS, GetUserSongDisksMessageComposer); + this._composers.set(OutgoingHeader.REMOVE_JUKEBOX_DISK, RemoveJukeboxDiskComposer); + + // TALENT + this._composers.set(OutgoingHeader.HELPER_TALENT_TRACK, TalentTrackComposer); + this._composers.set(OutgoingHeader.TALENT_TRACK_GET_LEVEL, GetTalentTrackLevelMessageComposer); + + //NUX + this._composers.set(OutgoingHeader.NEW_USER_EXPERIENCE_GET_GIFTS, NewUserExperienceGetGiftsComposer); + this._composers.set(OutgoingHeader.NEW_USER_EXPERIENCE_SCRIPT_PROCEED, NewUserExperienceScriptProceedComposer); + + // WELCOME + this._composers.set(OutgoingHeader.WELCOME_OPEN_GIFT, OpenWelcomeGiftComposer); + this._composers.set(OutgoingHeader.WELCOME_GIFT_CHANGE_EMAIL, WelcomeGiftChangeEmailComposer); + + // EMAIL + this._composers.set(OutgoingHeader.EMAIL_GET_STATUS, GetEmailStatusComposer); + this._composers.set(OutgoingHeader.EMAIL_CHANGE, ChangeEmailComposer); + // RENTABLE + this._composers.set(OutgoingHeader.RENTABLE_SPACE_CANCEL_RENT, RentableSpaceCancelRentMessageComposer); + this._composers.set(OutgoingHeader.RENTABLE_SPACE_RENT, RentableSpaceRentMessageComposer); + this._composers.set(OutgoingHeader.RENTABLE_SPACE_STATUS, RentableSpaceStatusMessageComposer); + // RECYCLER + this._composers.set(OutgoingHeader.RECYCLER_STATUS, GetRecyclerStatusMessageComposer); + this._composers.set(OutgoingHeader.RECYCLER_ITEMS, RecycleItemsMessageComposer); + + // TRACKING + this._composers.set(OutgoingHeader.TRACKING_PERFORMANCE_LOG, PerformanceLogMessageComposer); + this._composers.set(OutgoingHeader.TRACKING_LAG_WARNING_REPORT, LagWarningReportMessageComposer); + + // ROOM DIRECTORY + this._composers.set(OutgoingHeader.ROOM_DIRECTORY_ROOM_NETWORK_OPEN_CONNECTION, RoomNetworkOpenConnectionMessageComposer); + + // RENTABLE + this._composers.set(OutgoingHeader.RENTABLE_EXTEND_RENT_OR_BUYOUT_STRIP_ITEM, ExtendRentOrBuyoutStripItemMessageComposer); + this._composers.set(OutgoingHeader.RENTABLE_EXTEND_RENT_OR_BUYOUT_FURNI, ExtendRentOrBuyoutFurniMessageComposer); + this._composers.set(OutgoingHeader.RENTABLE_GET_RENT_OR_BUYOUT_OFFER, GetRentOrBuyoutOfferMessageComposer); + } + + public get events(): Map + { + return this._events; + } + + public get composers(): Map + { + return this._composers; + } +} diff --git a/submodules/renderer/src/nitro/communication/index.ts b/submodules/renderer/src/nitro/communication/index.ts new file mode 100644 index 0000000..b5f456f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/index.ts @@ -0,0 +1,4 @@ +export * from './messages'; +export * from './NitroCommunicationDemo'; +export * from './NitroCommunicationManager'; +export * from './NitroMessages'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/IncomingHeader.ts b/submodules/renderer/src/nitro/communication/messages/incoming/IncomingHeader.ts new file mode 100644 index 0000000..f7ae0fd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/IncomingHeader.ts @@ -0,0 +1,473 @@ +export class IncomingHeader +{ + public static ACHIEVEMENT_LIST = 305; + public static AUTHENTICATED = 2491; + public static AUTHENTICATION = -1; + public static AVAILABILITY_STATUS = 2033; + public static BUILDERS_CLUB_EXPIRED = 1452; + public static CLUB_OFFERS = 2405; + public static CATALOG_PAGE = 804; + public static CATALOG_PAGE_LIST = 1032; + public static CATALOG_PURCHASE_OK = 869; + public static CATALOG_PURCHASE_ERROR = 1404; + public static CATALOG_PURCHASE_NOT_ALLOWED = 3770; + public static PRODUCT_OFFER = 3388; + public static LIMITED_SOLD_OUT = 377; + public static CATALOG_PUBLISHED = 1866; + public static CFH_RESULT_MESSAGE = 3635; + public static CLIENT_LATENCY = 10; + public static CLIENT_PING = 3928; + public static DESKTOP_CAMPAIGN = 1745; + public static DESKTOP_NEWS = 286; + public static DESKTOP_VIEW = 122; + public static BUNDLE_DISCOUNT_RULESET = 2347; + public static FIRST_LOGIN_OF_DAY = 793; + public static FURNITURE_ALIASES = 1723; + public static FURNITURE_DATA = 2547; + public static FURNITURE_FLOOR = 1778; + public static FURNITURE_FLOOR_ADD = 1534; + public static FURNITURE_FLOOR_REMOVE = 2703; + public static FURNITURE_FLOOR_UPDATE = 3776; + public static FURNITURE_ITEMDATA = 2202; + public static FURNITURE_STATE = 2376; + public static FURNITURE_GROUP_CONTEXT_MENU_INFO = 3293; + public static FURNITURE_POSTIT_STICKY_POLE_OPEN = 2366; + public static GAME_CENTER_ACHIEVEMENTS = 2265; + public static GAME_CENTER_GAME_LIST = 222; + public static GAME_CENTER_STATUS = 2893; + public static GAME_CENTER_IN_ARENA_QUEUE = 872; + public static GAME_CENTER_STOP_COUNTER = 3191; + public static GAME_CENTER_USER_LEFT_GAME = 3138; + public static GAME_CENTER_DIRECTORY_STATUS = 2246; + public static GAME_CENTER_STARTING_GAME_FAILED = 2142; + public static GAME_CENTER_JOINING_FAILED = 1730; + public static GAMESTATUSMESSAGE = 3805; + public static GAMEACHIEVEMENTS = 1689; + public static GAMEINVITE = 904; + public static JOININGQUEUEFAILED = 3035; + public static JOINEDQUEUEMESSAGE = 2260; + public static LEFTQUEUE = 1477; + public static LOAD_GAME_URL = 2624; + public static LOADGAME = 3654; + public static UNLOADGAME = 1715; + public static ACHIEVEMENTRESOLUTIONCOMPLETED = 740; + public static ACHIEVEMENTRESOLUTIONPROGRESS = 3370; + public static ACHIEVEMENTRESOLUTIONS = 66; + public static GENERIC_ALERT = 3801; + public static MODERATOR_MESSAGE = 2030; + public static GENERIC_ERROR = 1600; + public static GIFT_WRAPPER_CONFIG = 2234; + public static GROUP_BADGES = 2402; + public static GROUP_CREATE_OPTIONS = 2159; + public static GROUP_FORUM_DATA = 3011; + public static GROUP_FORUM_LIST = 3001; + public static GROUP_FORUM_THREADS = 1073; + public static GROUP_FORUM_POST = 2049; + public static GROUP_FORUM_POST_THREAD = 1862; + public static GROUP_FORUM_THREAD_MESSAGES = 509; + public static GROUP_FORUM_UNREAD_COUNT = 2379; + public static GROUP_FORUM_UPDATE_MESSAGE = 324; + public static GROUP_FORUM_UPDATE_THREAD = 2528; + public static GROUP_INFO = 1702; + public static GROUP_LIST = 420; + public static GROUP_MEMBER = 265; + public static GROUP_MEMBERS = 1200; + public static GROUP_MEMBERS_REFRESH = 2445; + public static GROUP_MEMBER_REMOVE_CONFIRM = 1876; + public static GROUP_PURCHASED = 2808; + public static GROUP_SETTINGS = 3965; + public static GROUP_BADGE_PARTS = 2238; + public static GROUP_MEMBERSHIP_REQUESTED = 1180; + public static GROUP_DETAILS_CHANGED = 1459; + public static GROUP_HABBO_JOIN_FAILED = 762; + public static GUILD_EDIT_FAILED = 3988; + public static GUILD_MEMBER_MGMT_FAILED = 818; + public static ITEM_DIMMER_SETTINGS = 2710; + public static ITEM_STACK_HELPER = 2816; + public static ITEM_WALL = 1369; + public static ITEM_WALL_ADD = 2187; + public static ITEM_WALL_REMOVE = 3208; + public static ITEM_WALL_UPDATE = 2009; + public static MARKETPLACE_CONFIG = 1823; + public static MESSENGER_ACCEPT_FRIENDS = 896; + public static MESSENGER_CHAT = 1587; + public static MESSENGER_FIND_FRIENDS = 1210; + public static MESSENGER_FOLLOW_FAILED = 3048; + public static MESSENGER_FRIEND_NOTIFICATION = 3082; + public static MESSENGER_FRIENDS = 3130; + public static MESSENGER_INIT = 1605; + public static MESSENGER_INSTANCE_MESSAGE_ERROR = 3359; + public static MESSENGER_INVITE = 3870; + public static MESSENGER_INVITE_ERROR = 462; + public static MESSENGER_MESSAGE_ERROR = 892; + public static MESSENGER_MINIMAIL_COUNT = 2803; + public static MESSENGER_MINIMAIL_NEW = 1911; + public static MESSENGER_RELATIONSHIPS = 2016; + public static MESSENGER_REQUEST = 2219; + public static MESSENGER_REQUEST_ERROR = 892; + public static MESSENGER_REQUESTS = 280; + public static MESSENGER_SEARCH = 973; + public static MESSENGER_UPDATE = 2800; + public static MODERATION_REPORT_DISABLED = 1651; + public static MODERATION_TOOL = 2696; + public static MODERATION_USER_INFO = 2866; + public static MOTD_MESSAGES = 2035; + public static NAVIGATOR_CATEGORIES = 1562; + public static NAVIGATOR_COLLAPSED = 1543; + public static NAVIGATOR_EVENT_CATEGORIES = 3244; + public static NAVIGATOR_LIFTED = 3104; + public static NAVIGATOR_METADATA = 3052; + public static NAVIGATOR_OPEN_ROOM_CREATOR = 2064; + public static NAVIGATOR_SEARCH = 2690; + public static NAVIGATOR_SEARCHES = 3984; + public static NAVIGATOR_SETTINGS = 518; + public static THUMBNAIL_UPDATE_RESULT = 1927; + public static CAN_CREATE_ROOM = 378; + public static CATEGORIES_WITH_VISITOR_COUNT = 1455; + public static COMPETITION_ROOMS_DATA = 3954; + public static CONVERTED_ROOM_ID = 1331; + public static GUEST_ROOM_SEARCH_RESULT = 52; + public static NOTIFICATION_LIST = 1992; + public static NOTIFICATION_OFFER_REWARD_DELIVERED = 2125; + public static NOTIFICATION_SIMPLE_ALERT = 5100; + public static NOTIFICATION_ELEMENT_POINTER = 1787; + public static PET_FIGURE_UPDATE = 1924; + public static PET_INFO = 2901; + public static PET_TRAINING_PANEL = 1164; + public static PET_LEVEL_UPDATE = 2824; + public static PET_SCRATCH_FAILED = 1130; + public static PET_OPEN_PACKAGE_REQUESTED = 2380; + public static PET_OPEN_PACKAGE_RESULT = 546; + public static PET_BREEDING = 1746; + public static PET_CONFIRM_BREEDING_RESULT = 1625; + public static PET_GO_TO_BREEDING_NEST_FAILURE = 2621; + public static PET_NEST_BREEDING_SUCCESS = 2527; + public static PET_CONFIRM_BREEDING_REQUEST = 634; + public static PET_BREEDING_RESULT = 1553; + public static RECYCLER_PRIZES = 3164; + public static RECYCLER_STATUS = 3433; + public static RECYCLER_FINISHED = 468; + public static ROOM_BAN_LIST = 1869; + public static ROOM_BAN_REMOVE = 3429; + public static ROOM_CREATED = 1304; + public static ROOM_DOORBELL = 2309; + public static ROOM_DOORBELL_ACCEPTED = 3783; + public static ROOM_DOORBELL_REJECTED = 878; + public static ROOM_ENTER = 758; + public static ROOM_ENTER_ERROR = 899; + public static ROOM_FORWARD = 160; + public static ROOM_HEIGHT_MAP = 2753; + public static ROOM_HEIGHT_MAP_UPDATE = 558; + public static ROOM_INFO = 687; + public static ROOM_INFO_OWNER = 749; + public static ROOM_MODEL = 1301; + public static ROOM_MODEL_BLOCKED_TILES = 3990; + public static ROOM_MODEL_DOOR = 1664; + public static ROOM_MODEL_NAME = 2031; + public static ROOM_MUTED = 2533; + public static ROOM_MUTE_USER = 826; + public static ROOM_PAINT = 2454; + public static ROOM_PROMOTION = 2274; + public static ROOM_QUEUE_STATUS = 2208; + public static ROOM_RIGHTS = 780; + public static ROOM_RIGHTS_CLEAR = 2392; + public static ROOM_RIGHTS_LIST = 1284; + public static ROOM_RIGHTS_LIST_ADD = 2088; + public static ROOM_RIGHTS_LIST_REMOVE = 1327; + public static ROOM_RIGHTS_OWNER = 339; + public static ROOM_ROLLING = 3207; + public static ROOM_SCORE = 482; + public static ROOM_SETTINGS = 1498; + public static ROOM_SETTINGS_CHAT = 1191; + public static ROOM_SETTINGS_SAVE = 948; + public static ROOM_SETTINGS_SAVE_ERROR = 1555; + public static ROOM_INFO_UPDATED = 3297; + public static ROOM_SPECTATOR = 1033; + public static ROOM_THICKNESS = 3547; + public static ROOM_GET_FILTER_WORDS = 2937; + public static ROOM_MESSAGE_NOTIFICATION = 1634; + public static ROOM_POPULAR_TAGS_RESULT = 2012; + public static INFO_FEED_ENABLE = 3284; + public static SECURITY_MACHINE = 1488; + public static MYSTERY_BOX_KEYS = 2833; + public static GOTMYSTERYBOXPRIZEMESSAGE = 3712; + public static CANCELMYSTERYBOXWAITMESSAGE = 596; + public static SHOWMYSTERYBOXWAITMESSAGE = 3201; + public static TRADE_ACCEPTED = 2568; + public static TRADE_CLOSED = 1373; + public static TRADE_COMPLETED = 1001; + public static TRADE_CONFIRMATION = 2720; + public static TRADE_LIST_ITEM = 2024; + public static TRADE_NOT_OPEN = 3128; + public static TRADE_OPEN = 2505; + public static TRADE_OPEN_FAILED = 217; + public static TRADE_OTHER_NOT_ALLOWED = 1254; + public static TRADE_YOU_NOT_ALLOWED = 3058; + public static TRADE_NO_SUCH_ITEM = 2873; + public static UNIT = 374; + public static UNIT_CHANGE_NAME = 2182; + public static UNIT_CHAT = 1446; + public static UNIT_CHAT_SHOUT = 1036; + public static UNIT_CHAT_WHISPER = 2704; + public static UNIT_DANCE = 2233; + public static UNIT_EFFECT = 1167; + public static UNIT_EXPRESSION = 1631; + public static UNIT_HAND_ITEM = 1474; + public static UNIT_IDLE = 1797; + public static UNIT_INFO = 3920; + public static UNIT_NUMBER = 2324; + public static UNIT_REMOVE = 2661; + public static UNIT_STATUS = 1640; + public static UNIT_TYPING = 1717; + public static UNSEEN_ITEMS = 2103; + public static USER_ACHIEVEMENT_SCORE = 1968; + public static USER_BADGES = 717; + public static USER_BADGES_ADD = 2493; + public static USER_BADGES_CURRENT = 1087; + public static USER_BOT_REMOVE = 233; + public static USER_BOTS = 3086; + public static USER_CHANGE_NAME = 118; + public static USER_CLOTHING = 1450; + public static USER_CREDITS = 3475; + public static USER_CURRENCY = 2018; + public static ACTIVITY_POINT_NOTIFICATION = 2275; + public static USER_EFFECTS = 340; + public static USER_FAVORITE_ROOM = 2524; + public static USER_FAVORITE_ROOM_COUNT = 151; + public static USER_FIGURE = 2429; + public static USER_FURNITURE = 994; + public static USER_FURNITURE_ADD = 104; + public static USER_FURNITURE_POSTIT_PLACED = 1501; + public static USER_FURNITURE_REFRESH = 3151; + public static USER_FURNITURE_REMOVE = 159; + public static USER_HOME_ROOM = 2875; + public static ROOM_EVENT_CANCEL = 3479; + public static ROOM_EVENT = 1840; + public static USER_IGNORED = 126; + public static USER_IGNORED_RESULT = 207; + public static USER_INFO = 2725; + public static USER_OUTFITS = 3315; + public static USER_PERKS = 2586; + public static USER_PERMISSIONS = 411; + public static USER_PET_ADD = 2101; + public static USER_PET_REMOVE = 3253; + public static USER_PETS = 3522; + public static USER_PROFILE = 3898; + public static USER_RESPECT = 2815; + public static USER_SANCTION_STATUS = 3679; + public static USER_SETTINGS = 513; + public static USER_SUBSCRIPTION = 954; + public static USER_WARDROBE_PAGE = 3315; + public static USER_CLASSIFICATION = 966; + public static GET_USER_TAGS = 1255; + public static WIRED_ACTION = 1434; + public static WIRED_CONDITION = 1108; + public static WIRED_ERROR = 156; + public static WIRED_OPEN = 1830; + public static WIRED_REWARD = 178; + public static WIRED_SAVE = 1155; + public static WIRED_TRIGGER = 383; + public static PLAYING_GAME = 448; + public static FURNITURE_STATE_2 = 3431; + public static REMOVE_BOT_FROM_INVENTORY = 233; + public static ADD_BOT_TO_INVENTORY = 1352; + public static ACHIEVEMENT_PROGRESSED = 2107; + public static MODTOOL_ROOM_INFO = 1333; + public static MODTOOL_USER_CHATLOG = 3377; + public static MODTOOL_ROOM_CHATLOG = 3434; + public static MODTOOL_VISITED_ROOMS_USER = 1752; + public static MODERATOR_ACTION_RESULT = 2335; + public static ISSUE_DELETED = 3192; + public static ISSUE_INFO = 3609; + public static ISSUE_PICK_FAILED = 3150; + public static CFH_CHATLOG = 607; + public static MODERATOR_TOOL_PREFERENCES = 1576; + public static LOVELOCK_FURNI_START = 3753; + public static LOVELOCK_FURNI_FRIEND_COMFIRMED = 382; + public static LOVELOCK_FURNI_FINISHED = 770; + public static GIFT_RECEIVER_NOT_FOUND = 1517; + public static GIFT_OPENED = 56; + public static FLOOD_CONTROL = 566; + public static REMAINING_MUTE = 826; + public static USER_EFFECT_LIST = 340; + public static USER_EFFECT_LIST_ADD = 2867; + public static USER_EFFECT_LIST_REMOVE = 2228; + public static USER_EFFECT_ACTIVATE = 1959; + public static AVATAR_EFFECT_SELECTED = 3473; + public static CLUB_GIFT_INFO = 619; + public static REDEEM_VOUCHER_ERROR = 714; + public static REDEEM_VOUCHER_OK = 3336; + public static IN_CLIENT_LINK = 2023; + public static BOT_COMMAND_CONFIGURATION = 1618; + public static BOT_SKILL_LIST_UPDATE = 69; + public static BOT_FORCE_OPEN_CONTEXT_MENU = 296; + public static HAND_ITEM_RECEIVED = 354; + public static PET_PLACING_ERROR = 2913; + public static BOT_ERROR = 639; + public static MARKETPLACE_SELL_ITEM = 54; + public static MARKETPLACE_ITEM_STATS = 725; + public static MARKETPLACE_OWN_ITEMS = 3884; + public static MARKETPLACE_CANCEL_SALE = 3264; + public static MARKETPLACE_ITEM_POSTED = 1359; + public static MARKETPLACE_ITEMS_SEARCHED = 680; + public static MARKETPLACE_AFTER_ORDER_STATUS = 2032; + public static CATALOG_RECEIVE_PET_BREEDS = 3331; + public static CATALOG_APPROVE_NAME_RESULT = 1503; + public static OBJECTS_DATA_UPDATE = 1453; + public static PET_EXPERIENCE = 2156; + public static COMMUNITY_GOAL_VOTE_EVENT = 1435; + public static PROMO_ARTICLES = 286; + public static COMMUNITY_GOAL_EARNED_PRIZES = 3319; + public static COMMUNITY_GOAL_PROGRESS = 2525; + public static CONCURRENT_USERS_GOAL_PROGRESS = 2737; + public static QUEST_DAILY = 1878; + public static QUEST_CANCELLED = 3027; + public static QUEST_COMPLETED = 949; + public static COMMUNITY_GOAL_HALL_OF_FAME = 3005; + public static EPIC_POPUP = 3945; + public static SEASONAL_QUESTS = 1122; + public static QUESTS = 3625; + public static QUEST = 230; + public static BONUS_RARE_INFO = 1533; + public static CRAFTABLE_PRODUCTS = 1000; + public static CRAFTING_RECIPE = 2774; + public static CRAFTING_RECIPES_AVAILABLE = 2124; + public static CRAFTING_RESULT = 618; + public static CAMERA_PUBLISH_STATUS = 2057; + public static CAMERA_PURCHASE_OK = 2783; + public static CAMERA_STORAGE_URL = 3696; + public static CAMERA_SNAPSHOT = 463; + public static COMPETITION_STATUS = 133; + public static INIT_CAMERA = 3878; + public static THUMBNAIL_STATUS = 3595; + public static ACHIEVEMENT_NOTIFICATION = 806; + public static CLUB_GIFT_NOTIFICATION = 2188; + public static INTERSTITIAL_MESSAGE = 1808; + public static ROOM_AD_ERROR = 1759; + public static AVAILABILITY_TIME = 600; + public static HOTEL_CLOSED_AND_OPENS = 3728; + public static HOTEL_CLOSES_AND_OPENS_AT = 2771; + public static HOTEL_WILL_CLOSE_MINUTES = 1050; + public static HOTEL_MAINTENANCE = 1350; + public static JUKEBOX_PLAYLIST_FULL = 105; + public static JUKEBOX_SONG_DISKS = 34; + public static NOW_PLAYING = 469; + public static OFFICIAL_SONG_ID = 1381; + public static PLAYLIST = 1748; + public static PLAYLIST_SONG_ADDED = 1140; + public static TRAX_SONG_INFO = 3365; + public static USER_SONG_DISKS_INVENTORY = 2602; + public static CHECK_USER_NAME = 563; + public static CFH_SANCTION = 2782; + public static CFH_TOPICS = 325; + public static CFH_SANCTION_STATUS = 2221; + public static CAMPAIGN_CALENDAR_DATA = 2531; + public static CAMPAIGN_CALENDAR_DOOR_OPENED = 2551; + public static BUILDERS_CLUB_FURNI_COUNT = 3828; + public static BUILDERS_CLUB_SUBSCRIPTION = 1452; + public static CATALOG_PAGE_EXPIRATION = 2668; + public static CATALOG_EARLIEST_EXPIRY = 2515; + public static CLUB_GIFT_SELECTED = 659; + public static TARGET_OFFER_NOT_FOUND = 1237; + public static TARGET_OFFER = 119; + public static DIRECT_SMS_CLUB_BUY = 195; + public static ROOM_AD_PURCHASE = 2468; + public static NOT_ENOUGH_BALANCE = 3914; + public static LIMITED_OFFER_APPEARING_NEXT = 44; + public static IS_OFFER_GIFTABLE = 761; + public static CLUB_EXTENDED_OFFER = 3964; + public static SEASONAL_CALENDAR_OFFER = 1889; + public static COMPETITION_ENTRY_SUBMIT = 1177; + public static COMPETITION_VOTING_INFO = 3506; + public static COMPETITION_TIMING_CODE = 1745; + public static COMPETITION_USER_PART_OF = 3841; + public static COMPETITION_NO_OWNED_ROOMS = 2064; + public static COMPETITION_SECONDS_UNTIL = 3926; + public static BADGE_POINT_LIMITS = 2501; + public static BADGE_REQUEST_FULFILLED = 2998; + public static HELPER_TALENT_TRACK = 3406; + public static TALENT_TRACK_LEVEL = 1203; + public static TALENT_TRACK_LEVEL_UP = 638; + public static USER_BANNED = 1683; + public static BOT_RECEIVED = 3684; + public static PET_LEVEL_NOTIFICATION = 859; + public static PET_RECEIVED = 1111; + public static MODERATION_CAUTION = 1890; + public static YOUTUBE_CONTROL_VIDEO = 1554; + public static YOUTUBE_DISPLAY_PLAYLISTS = 1112; + public static YOUTUBE_DISPLAY_VIDEO = 1411; + public static CFH_DISABLED_NOTIFY = 1651; + public static QUESTION = 2665; + public static POLL_CONTENTS = 2997; + public static POLL_ERROR = 662; + public static POLL_OFFER = 3785; + public static POLL_ROOM_RESULT = 5201; + public static POLL_START_ROOM = 5200; + public static QUESTION_ANSWERED = 2589; + public static QUESTION_FINISHED = 1066; + public static CFH_PENDING_CALLS = 1121; + public static GUIDE_ON_DUTY_STATUS = 1548; + public static GUIDE_SESSION_ATTACHED = 1591; + public static GUIDE_SESSION_DETACHED = 138; + public static GUIDE_SESSION_ENDED = 1456; + public static GUIDE_SESSION_ERROR = 673; + public static GUIDE_SESSION_INVITED_TO_GUIDE_ROOM = 219; + public static GUIDE_SESSION_MESSAGE = 841; + public static GUIDE_SESSION_PARTNER_IS_TYPING = 1016; + public static GUIDE_SESSION_REQUESTER_ROOM = 1847; + public static GUIDE_SESSION_STARTED = 3209; + public static GUIDE_TICKET_CREATION_RESULT = 3285; + public static GUIDE_TICKET_RESOLUTION = 2674; + public static GUIDE_REPORTING_STATUS = 3463; + public static HOTEL_MERGE_NAME_CHANGE = 1663; + public static ISSUE_CLOSE_NOTIFICATION = 934; + public static QUIZ_DATA = 2927; + public static QUIZ_RESULTS = 2772; + public static CFH_PENDING_CALLS_DELETED = 77; + public static CFH_REPLY = 3796; + public static CHAT_REVIEW_SESSION_DETACHED = 30; + public static CHAT_REVIEW_SESSION_OFFERED_TO_GUIDE = 735; + public static CHAT_REVIEW_SESSION_RESULTS = 3276; + public static CHAT_REVIEW_SESSION_STARTED = 143; + public static CHAT_REVIEW_SESSION_VOTING_STATUS = 1829; + public static SCR_SEND_KICKBACK_INFO = 3277; + public static PET_STATUS = 1907; + public static GROUP_DEACTIVATE = 3129; + public static PET_RESPECTED = 2788; + public static PET_SUPPLEMENT = 3441; + public static NOOBNESS_LEVEL = 3738; + public static DISCONNECT_REASON = 4000; + public static CAN_CREATE_ROOM_EVENT = 2599; + public static FAVORITE_GROUP_UDPATE = 3403; + public static NO_SUCH_FLAT = 84; + public static ROOM_SETTINGS_ERROR = 2897; + public static SHOW_ENFORCE_ROOM_CATEGORY = 3896; + public static CUSTOM_USER_NOTIFICATION = 909; + public static NEW_USER_EXPERIENCE_GIFT_OFFER = 3575; + public static RESTORE_CLIENT = 426; + public static FIREWORK_CHARGE_DATA = 5210; + public static NEW_USER_EXPERIENCE_NOT_COMPLETE = 3639; + public static CONNECTION_ERROR = 1004; + public static ACCOUNT_SAFETY_LOCK_STATUS_CHANGE = 1243; + public static PHONE_COLLECTION_STATE = 2890; + public static PHONE_TRY_NUMBER_RESULT = 800; + public static PHONE_TRY_VERIFICATION_CODE_RESULT = 91; + public static EXTENDED_PROFILE_CHANGED = 876; + public static WELCOME_GIFT_CHANGE_EMAIL_RESULT = 2293; + public static WELCOME_GIFT_STATUS = 2707; + public static HANDSHAKE_INIT_DIFFIE = 1347; + public static HANDSHAKE_COMPLETE_DIFFIE = 3885; + public static RENTABLE_SPACE_RENT_OK = 2046; + public static RENTABLE_SPACE_STATUS = 3559; + public static RENTABLE_SPACE_RENT_FAILED = 1868; + public static EMAIL_STATUS = 612; + public static CHANGE_EMAIL_RESULT = 1815; + public static WEEKLY_GAME_REWARD = 2641; + public static WEEKLY_GAME_REWARD_WINNERS = 3097; + public static WEEKLY_COMPETITIVE_LEADERBOARD = 3512; + public static WEEKLY_COMPETITIVE_FRIENDS_LEADERBOARD = 3560; + public static WEEKLY_GAME2_FRIENDS_LEADERBOARD = 2270; + public static WEEKLY_GAME2_LEADERBOARD = 2196; + public static RENTABLE_FURNI_RENT_OR_BUYOUT_OFFER = 35; + public static HANDSHAKE_IDENTITY_ACCOUNT = 3523; +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/advertisement/InterstitialMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/advertisement/InterstitialMessageEvent.ts new file mode 100644 index 0000000..bad2f83 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/advertisement/InterstitialMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { InterstitialMessageParser } from '../../parser'; + +export class InterstitialMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, InterstitialMessageParser); + } + + public getParser(): InterstitialMessageParser + { + return this.parser as InterstitialMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/advertisement/RoomAdErrorEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/advertisement/RoomAdErrorEvent.ts new file mode 100644 index 0000000..a355941 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/advertisement/RoomAdErrorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomAdErrorMessageParser } from '../../parser'; + +export class RoomAdErrorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomAdErrorMessageParser); + } + + public getParser(): RoomAdErrorMessageParser + { + return this.parser as RoomAdErrorMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/advertisement/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/advertisement/index.ts new file mode 100644 index 0000000..7727ffc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/advertisement/index.ts @@ -0,0 +1,2 @@ +export * from './InterstitialMessageEvent'; +export * from './RoomAdErrorEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/availability/AvailabilityStatusMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/availability/AvailabilityStatusMessageEvent.ts new file mode 100644 index 0000000..0e5bc26 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/availability/AvailabilityStatusMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { AvailabilityStatusMessageParser } from '../../parser'; + +export class AvailabilityStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AvailabilityStatusMessageParser); + } + + public getParser(): AvailabilityStatusMessageParser + { + return this.parser as AvailabilityStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/availability/AvailabilityTimeMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/availability/AvailabilityTimeMessageEvent.ts new file mode 100644 index 0000000..e1aa43e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/availability/AvailabilityTimeMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { AvailabilityTimeMessageParser } from '../../parser'; + +export class AvailabilityTimeMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AvailabilityTimeMessageParser); + } + + public getParser(): AvailabilityTimeMessageParser + { + return this.parser as AvailabilityTimeMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/availability/HotelClosedAndOpensEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/availability/HotelClosedAndOpensEvent.ts new file mode 100644 index 0000000..e048a64 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/availability/HotelClosedAndOpensEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { HotelClosedAndOpensMessageParser } from '../../parser'; + +export class HotelClosedAndOpensEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, HotelClosedAndOpensMessageParser); + } + + public getParser(): HotelClosedAndOpensMessageParser + { + return this.parser as HotelClosedAndOpensMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/availability/HotelClosesAndWillOpenAtEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/availability/HotelClosesAndWillOpenAtEvent.ts new file mode 100644 index 0000000..cae55a2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/availability/HotelClosesAndWillOpenAtEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { HotelClosesAndWillOpenAtMessageParser } from '../../parser'; + +export class HotelClosesAndWillOpenAtEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, HotelClosesAndWillOpenAtMessageParser); + } + + public getParser(): HotelClosesAndWillOpenAtMessageParser + { + return this.parser as HotelClosesAndWillOpenAtMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/availability/HotelWillCloseInMinutesEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/availability/HotelWillCloseInMinutesEvent.ts new file mode 100644 index 0000000..74eda44 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/availability/HotelWillCloseInMinutesEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { HotelWillCloseInMinutesMessageParser } from '../../parser'; + +export class HotelWillCloseInMinutesEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, HotelWillCloseInMinutesMessageParser); + } + + public getParser(): HotelWillCloseInMinutesMessageParser + { + return this.parser as HotelWillCloseInMinutesMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/availability/MaintenanceStatusMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/availability/MaintenanceStatusMessageEvent.ts new file mode 100644 index 0000000..3da15a8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/availability/MaintenanceStatusMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MaintenanceStatusMessageParser } from '../../parser'; + +export class MaintenanceStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MaintenanceStatusMessageParser); + } + + public getParser(): MaintenanceStatusMessageParser + { + return this.parser as MaintenanceStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/availability/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/availability/index.ts new file mode 100644 index 0000000..8d657b5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/availability/index.ts @@ -0,0 +1,6 @@ +export * from './AvailabilityStatusMessageEvent'; +export * from './AvailabilityTimeMessageEvent'; +export * from './HotelClosedAndOpensEvent'; +export * from './HotelClosesAndWillOpenAtEvent'; +export * from './HotelWillCloseInMinutesEvent'; +export * from './MaintenanceStatusMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/avatar/ChangeUserNameResultMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/avatar/ChangeUserNameResultMessageEvent.ts new file mode 100644 index 0000000..886005c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/avatar/ChangeUserNameResultMessageEvent.ts @@ -0,0 +1,25 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ChangeUserNameResultMessageParser } from '../../parser'; + +export class ChangeUserNameResultMessageEvent extends MessageEvent implements IMessageEvent +{ + public static NAME_OK: number = 0; + public static ERROR_NAME_REQUIRED: number = 1; + public static ERROR_NAME_TOO_SHORT: number = 2; + public static ERROR_NAME_TOO_LONG: number = 3; + public static ERROR_NAME_NOT_VALID: number = 4; + public static ERROR_NAME_IN_USE: number = 5; + public static ERROR_NAME_CHANGE_NOT_ALLOWED: number = 6; + public static ERROR_MERGE_HOTEL_DOWN: number = 7; + + constructor(callBack: Function) + { + super(callBack, ChangeUserNameResultMessageParser); + } + + public getParser(): ChangeUserNameResultMessageParser + { + return this.parser as ChangeUserNameResultMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/avatar/CheckUserNameResultMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/avatar/CheckUserNameResultMessageEvent.ts new file mode 100644 index 0000000..93d0d49 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/avatar/CheckUserNameResultMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CheckUserNameResultMessageParser } from '../../parser'; + +export class CheckUserNameResultMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CheckUserNameResultMessageParser); + } + + public getParser(): CheckUserNameResultMessageParser + { + return this.parser as CheckUserNameResultMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/avatar/FigureUpdateEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/avatar/FigureUpdateEvent.ts new file mode 100644 index 0000000..dacf15f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/avatar/FigureUpdateEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { FigureUpdateParser } from '../../parser'; + +export class FigureUpdateEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FigureUpdateParser); + } + + public getParser(): FigureUpdateParser + { + return this.parser as FigureUpdateParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/avatar/WardrobeMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/avatar/WardrobeMessageEvent.ts new file mode 100644 index 0000000..b138c32 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/avatar/WardrobeMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { WardrobeMessageParser } from '../../parser'; + +export class WardrobeMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, WardrobeMessageParser); + } + + public getParser(): WardrobeMessageParser + { + return this.parser as WardrobeMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/avatar/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/avatar/index.ts new file mode 100644 index 0000000..45a727e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/avatar/index.ts @@ -0,0 +1,4 @@ +export * from './ChangeUserNameResultMessageEvent'; +export * from './CheckUserNameResultMessageEvent'; +export * from './FigureUpdateEvent'; +export * from './WardrobeMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/bots/BotAddedToInventoryEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/bots/BotAddedToInventoryEvent.ts new file mode 100644 index 0000000..0036a0f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/bots/BotAddedToInventoryEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { BotAddedToInventoryParser } from '../../parser'; + +export class BotAddedToInventoryEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BotAddedToInventoryParser); + } + + public getParser(): BotAddedToInventoryParser + { + return this.parser as BotAddedToInventoryParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/bots/BotInventoryMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/bots/BotInventoryMessageEvent.ts new file mode 100644 index 0000000..f1c2a99 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/bots/BotInventoryMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { BotInventoryMessageParser } from '../../parser'; + +export class BotInventoryMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BotInventoryMessageParser); + } + + public getParser(): BotInventoryMessageParser + { + return this.parser as BotInventoryMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/bots/BotReceivedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/bots/BotReceivedMessageEvent.ts new file mode 100644 index 0000000..aab273d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/bots/BotReceivedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { BotReceivedMessageParser } from '../../parser'; + +export class BotReceivedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BotReceivedMessageParser); + } + + public getParser(): BotReceivedMessageParser + { + return this.parser as BotReceivedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/bots/BotRemovedFromInventoryEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/bots/BotRemovedFromInventoryEvent.ts new file mode 100644 index 0000000..30982df --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/bots/BotRemovedFromInventoryEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { BotRemovedFromInventoryParser } from '../../parser'; + +export class BotRemovedFromInventoryEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BotRemovedFromInventoryParser); + } + + public getParser(): BotRemovedFromInventoryParser + { + return this.parser as BotRemovedFromInventoryParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/bots/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/bots/index.ts new file mode 100644 index 0000000..dde10bf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/bots/index.ts @@ -0,0 +1,4 @@ +export * from './BotAddedToInventoryEvent'; +export * from './BotInventoryMessageEvent'; +export * from './BotReceivedMessageEvent'; +export * from './BotRemovedFromInventoryEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/callforhelp/CfhSanctionMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/callforhelp/CfhSanctionMessageEvent.ts new file mode 100644 index 0000000..3e058ff --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/callforhelp/CfhSanctionMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CfhSanctionMessageParser } from '../../parser'; + +export class CfhSanctionMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CfhSanctionMessageParser); + } + + public getParser(): CfhSanctionMessageParser + { + return this.parser as CfhSanctionMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/callforhelp/CfhTopicsInitEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/callforhelp/CfhTopicsInitEvent.ts new file mode 100644 index 0000000..1109b5c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/callforhelp/CfhTopicsInitEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CfhTopicsInitMessageParser } from '../../parser'; + +export class CfhTopicsInitEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CfhTopicsInitMessageParser); + } + + public getParser(): CfhTopicsInitMessageParser + { + return this.parser as CfhTopicsInitMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/callforhelp/SanctionStatusEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/callforhelp/SanctionStatusEvent.ts new file mode 100644 index 0000000..0710df1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/callforhelp/SanctionStatusEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { SanctionStatusMessageParser } from '../../parser'; + +export class SanctionStatusEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, SanctionStatusMessageParser); + } + + public getParser(): SanctionStatusMessageParser + { + return this.parser as SanctionStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/callforhelp/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/callforhelp/index.ts new file mode 100644 index 0000000..9b60cfb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/callforhelp/index.ts @@ -0,0 +1,3 @@ +export * from './CfhSanctionMessageEvent'; +export * from './CfhTopicsInitEvent'; +export * from './SanctionStatusEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/camera/CameraPublishStatusMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/camera/CameraPublishStatusMessageEvent.ts new file mode 100644 index 0000000..f70e3d2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/camera/CameraPublishStatusMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CameraPublishStatusMessageParser } from '../../parser'; + +export class CameraPublishStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CameraPublishStatusMessageParser); + } + + public getParser(): CameraPublishStatusMessageParser + { + return this.parser as CameraPublishStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/camera/CameraPurchaseOKMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/camera/CameraPurchaseOKMessageEvent.ts new file mode 100644 index 0000000..7c0a8c6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/camera/CameraPurchaseOKMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CameraPurchaseOKMessageParser } from '../../parser'; + +export class CameraPurchaseOKMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CameraPurchaseOKMessageParser); + } + + public getParser(): CameraPurchaseOKMessageParser + { + return this.parser as CameraPurchaseOKMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/camera/CameraSnapshotMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/camera/CameraSnapshotMessageEvent.ts new file mode 100644 index 0000000..d9a8f3d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/camera/CameraSnapshotMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CameraSnapshotMessageParser } from '../../parser'; + +export class CameraSnapshotMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CameraSnapshotMessageParser); + } + + public getParser(): CameraSnapshotMessageParser + { + return this.parser as CameraSnapshotMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/camera/CameraStorageUrlMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/camera/CameraStorageUrlMessageEvent.ts new file mode 100644 index 0000000..7e7d1df --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/camera/CameraStorageUrlMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CameraStorageUrlMessageParser } from '../../parser'; + +export class CameraStorageUrlMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CameraStorageUrlMessageParser); + } + + public getParser(): CameraStorageUrlMessageParser + { + return this.parser as CameraStorageUrlMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/camera/CompetitionStatusMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/camera/CompetitionStatusMessageEvent.ts new file mode 100644 index 0000000..b2e1e10 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/camera/CompetitionStatusMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CompetitionStatusMessageParser } from '../../parser'; + +export class CompetitionStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CompetitionStatusMessageParser); + } + + public getParser(): CompetitionStatusMessageParser + { + return this.parser as CompetitionStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/camera/InitCameraMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/camera/InitCameraMessageEvent.ts new file mode 100644 index 0000000..28d734f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/camera/InitCameraMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { InitCameraMessageParser } from '../../parser'; + +export class InitCameraMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, InitCameraMessageParser); + } + + public getParser(): InitCameraMessageParser + { + return this.parser as InitCameraMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/camera/ThumbnailStatusMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/camera/ThumbnailStatusMessageEvent.ts new file mode 100644 index 0000000..ec6e073 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/camera/ThumbnailStatusMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ThumbnailStatusMessageParser } from '../../parser'; + +export class ThumbnailStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ThumbnailStatusMessageParser); + } + + public getParser(): ThumbnailStatusMessageParser + { + return this.parser as ThumbnailStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/camera/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/camera/index.ts new file mode 100644 index 0000000..03df06b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/camera/index.ts @@ -0,0 +1,7 @@ +export * from './CameraPublishStatusMessageEvent'; +export * from './CameraPurchaseOKMessageEvent'; +export * from './CameraSnapshotMessageEvent'; +export * from './CameraStorageUrlMessageEvent'; +export * from './CompetitionStatusMessageEvent'; +export * from './InitCameraMessageEvent'; +export * from './ThumbnailStatusMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/campaign/CampaignCalendarDataMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/campaign/CampaignCalendarDataMessageEvent.ts new file mode 100644 index 0000000..6e239a5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/campaign/CampaignCalendarDataMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CampaignCalendarDataMessageParser } from '../../parser'; + +export class CampaignCalendarDataMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CampaignCalendarDataMessageParser); + } + + public getParser(): CampaignCalendarDataMessageParser + { + return this.parser as CampaignCalendarDataMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/campaign/CampaignCalendarDoorOpenedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/campaign/CampaignCalendarDoorOpenedMessageEvent.ts new file mode 100644 index 0000000..8341682 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/campaign/CampaignCalendarDoorOpenedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CampaignCalendarDoorOpenedMessageParser } from '../../parser'; + +export class CampaignCalendarDoorOpenedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CampaignCalendarDoorOpenedMessageParser); + } + + public getParser(): CampaignCalendarDoorOpenedMessageParser + { + return this.parser as CampaignCalendarDoorOpenedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/campaign/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/campaign/index.ts new file mode 100644 index 0000000..a6263ae --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/campaign/index.ts @@ -0,0 +1,2 @@ +export * from './CampaignCalendarDataMessageEvent'; +export * from './CampaignCalendarDoorOpenedMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/BonusRareInfoMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/BonusRareInfoMessageEvent.ts new file mode 100644 index 0000000..2e6169a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/BonusRareInfoMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { BonusRareInfoMessageParser } from '../../parser'; + +export class BonusRareInfoMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BonusRareInfoMessageParser); + } + + public getParser(): BonusRareInfoMessageParser + { + return this.parser as BonusRareInfoMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/BuildersClubFurniCountMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/BuildersClubFurniCountMessageEvent.ts new file mode 100644 index 0000000..159bc88 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/BuildersClubFurniCountMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { BuildersClubFurniCountMessageParser } from '../../parser'; + +export class BuildersClubFurniCountMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BuildersClubFurniCountMessageParser); + } + + public getParser(): BuildersClubFurniCountMessageParser + { + return this.parser as BuildersClubFurniCountMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/BuildersClubSubscriptionStatusMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/BuildersClubSubscriptionStatusMessageEvent.ts new file mode 100644 index 0000000..e4385dc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/BuildersClubSubscriptionStatusMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { BuildersClubSubscriptionStatusMessageParser } from '../../parser'; + +export class BuildersClubSubscriptionStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BuildersClubSubscriptionStatusMessageParser); + } + + public getParser(): BuildersClubSubscriptionStatusMessageParser + { + return this.parser as BuildersClubSubscriptionStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/BundleDiscountRulesetMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/BundleDiscountRulesetMessageEvent.ts new file mode 100644 index 0000000..6cd294e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/BundleDiscountRulesetMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { BundleDiscountRulesetMessageParser } from '../../parser'; + +export class BundleDiscountRulesetMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BundleDiscountRulesetMessageParser); + } + + public getParser(): BundleDiscountRulesetMessageParser + { + return this.parser as BundleDiscountRulesetMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/CatalogPageExpirationEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/CatalogPageExpirationEvent.ts new file mode 100644 index 0000000..cd75eab --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/CatalogPageExpirationEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CatalogPageExpirationParser } from '../../parser'; + +export class CatalogPageExpirationEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CatalogPageExpirationParser); + } + + public getParser(): CatalogPageExpirationParser + { + return this.parser as CatalogPageExpirationParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/CatalogPageMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/CatalogPageMessageEvent.ts new file mode 100644 index 0000000..a9a6712 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/CatalogPageMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CatalogPageMessageParser } from '../../parser'; + +export class CatalogPageMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CatalogPageMessageParser); + } + + public getParser(): CatalogPageMessageParser + { + return this.parser as CatalogPageMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/CatalogPageWithEarliestExpiryMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/CatalogPageWithEarliestExpiryMessageEvent.ts new file mode 100644 index 0000000..50e8f9a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/CatalogPageWithEarliestExpiryMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CatalogPageWithEarliestExpiryMessageParser } from '../../parser'; + +export class CatalogPageWithEarliestExpiryMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CatalogPageWithEarliestExpiryMessageParser); + } + + public getParser(): CatalogPageWithEarliestExpiryMessageParser + { + return this.parser as CatalogPageWithEarliestExpiryMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/CatalogPagesListEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/CatalogPagesListEvent.ts new file mode 100644 index 0000000..ae255bf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/CatalogPagesListEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CatalogIndexMessageParser } from '../../parser'; + +export class CatalogPagesListEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CatalogIndexMessageParser); + } + + public getParser(): CatalogIndexMessageParser + { + return this.parser as CatalogIndexMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/CatalogPublishedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/CatalogPublishedMessageEvent.ts new file mode 100644 index 0000000..8364f2e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/CatalogPublishedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CatalogPublishedMessageParser } from '../../parser'; + +export class CatalogPublishedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CatalogPublishedMessageParser); + } + + public getParser(): CatalogPublishedMessageParser + { + return this.parser as CatalogPublishedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/ClubGiftInfoEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/ClubGiftInfoEvent.ts new file mode 100644 index 0000000..cbae8d4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/ClubGiftInfoEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ClubGiftInfoParser } from '../../parser'; + +export class ClubGiftInfoEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ClubGiftInfoParser); + } + + public getParser(): ClubGiftInfoParser + { + return this.parser as ClubGiftInfoParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/ClubGiftSelectedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/ClubGiftSelectedEvent.ts new file mode 100644 index 0000000..289b22c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/ClubGiftSelectedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ClubGiftSelectedParser } from '../../parser'; + +export class ClubGiftSelectedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ClubGiftSelectedParser); + } + + public getParser(): ClubGiftSelectedParser + { + return this.parser as ClubGiftSelectedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/DirectSMSClubBuyAvailableMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/DirectSMSClubBuyAvailableMessageEvent.ts new file mode 100644 index 0000000..0b0fe3b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/DirectSMSClubBuyAvailableMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { DirectSMSClubBuyAvailableMessageParser } from '../../parser'; + +export class DirectSMSClubBuyAvailableMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, DirectSMSClubBuyAvailableMessageParser); + } + + public getParser(): DirectSMSClubBuyAvailableMessageParser + { + return this.parser as DirectSMSClubBuyAvailableMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/FireworkChargeDataEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/FireworkChargeDataEvent.ts new file mode 100644 index 0000000..6617313 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/FireworkChargeDataEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { FireworkChargeDataParser } from '../../parser'; + +export class FireworkChargeDataEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FireworkChargeDataParser); + } + + public getParser(): FireworkChargeDataParser + { + return this.parser as FireworkChargeDataParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/GiftReceiverNotFoundEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/GiftReceiverNotFoundEvent.ts new file mode 100644 index 0000000..39ff2e5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/GiftReceiverNotFoundEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GiftReceiverNotFoundParser } from '../../parser'; + +export class GiftReceiverNotFoundEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GiftReceiverNotFoundParser); + } + + public getParser(): GiftReceiverNotFoundParser + { + return this.parser as GiftReceiverNotFoundParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/GiftWrappingConfigurationEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/GiftWrappingConfigurationEvent.ts new file mode 100644 index 0000000..fe9077d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/GiftWrappingConfigurationEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GiftWrappingConfigurationParser } from '../../parser'; + +export class GiftWrappingConfigurationEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GiftWrappingConfigurationParser); + } + + public getParser(): GiftWrappingConfigurationParser + { + return this.parser as GiftWrappingConfigurationParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/HabboClubExtendOfferMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/HabboClubExtendOfferMessageEvent.ts new file mode 100644 index 0000000..6347b0c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/HabboClubExtendOfferMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { HabboClubExtendOfferMessageParser } from '../../parser'; + +export class HabboClubExtendOfferMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, HabboClubExtendOfferMessageParser); + } + + public getParser(): HabboClubExtendOfferMessageParser + { + return this.parser as HabboClubExtendOfferMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/HabboClubOffersMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/HabboClubOffersMessageEvent.ts new file mode 100644 index 0000000..4a03436 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/HabboClubOffersMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { HabboClubOffersMessageParser } from '../../parser'; + +export class HabboClubOffersMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, HabboClubOffersMessageParser); + } + + public getParser(): HabboClubOffersMessageParser + { + return this.parser as HabboClubOffersMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/IsOfferGiftableMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/IsOfferGiftableMessageEvent.ts new file mode 100644 index 0000000..e0aa9f7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/IsOfferGiftableMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { IsOfferGiftableMessageParser } from '../../parser'; + +export class IsOfferGiftableMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, IsOfferGiftableMessageParser); + } + + public getParser(): IsOfferGiftableMessageParser + { + return this.parser as IsOfferGiftableMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/LimitedEditionSoldOutEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/LimitedEditionSoldOutEvent.ts new file mode 100644 index 0000000..665c882 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/LimitedEditionSoldOutEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { LimitedEditionSoldOutParser } from '../../parser'; + +export class LimitedEditionSoldOutEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, LimitedEditionSoldOutParser); + } + + public getParser(): LimitedEditionSoldOutParser + { + return this.parser as LimitedEditionSoldOutParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/LimitedOfferAppearingNextMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/LimitedOfferAppearingNextMessageEvent.ts new file mode 100644 index 0000000..eb571d0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/LimitedOfferAppearingNextMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { LimitedOfferAppearingNextMessageParser } from '../../parser'; + +export class LimitedOfferAppearingNextMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, LimitedOfferAppearingNextMessageParser); + } + + public getParser(): LimitedOfferAppearingNextMessageParser + { + return this.parser as LimitedOfferAppearingNextMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/NotEnoughBalanceMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/NotEnoughBalanceMessageEvent.ts new file mode 100644 index 0000000..1ec3dfe --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/NotEnoughBalanceMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NotEnoughBalanceMessageParser } from '../../parser'; + +export class NotEnoughBalanceMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NotEnoughBalanceMessageParser); + } + + public getParser(): NotEnoughBalanceMessageParser + { + return this.parser as NotEnoughBalanceMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/ProductOfferEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/ProductOfferEvent.ts new file mode 100644 index 0000000..f4c5126 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/ProductOfferEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ProductOfferMessageParser } from '../../parser'; + +export class ProductOfferEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ProductOfferMessageParser); + } + + public getParser(): ProductOfferMessageParser + { + return this.parser as ProductOfferMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/PurchaseErrorMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/PurchaseErrorMessageEvent.ts new file mode 100644 index 0000000..f2fd9da --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/PurchaseErrorMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PurchaseErrorMessageParser } from '../../parser'; + +export class PurchaseErrorMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PurchaseErrorMessageParser); + } + + public getParser(): PurchaseErrorMessageParser + { + return this.parser as PurchaseErrorMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/PurchaseNotAllowedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/PurchaseNotAllowedMessageEvent.ts new file mode 100644 index 0000000..9c98db0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/PurchaseNotAllowedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PurchaseNotAllowedMessageParser } from '../../parser'; + +export class PurchaseNotAllowedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PurchaseNotAllowedMessageParser); + } + + public getParser(): PurchaseNotAllowedMessageParser + { + return this.parser as PurchaseNotAllowedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/PurchaseOKMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/PurchaseOKMessageEvent.ts new file mode 100644 index 0000000..2a3eae5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/PurchaseOKMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PurchaseOKMessageParser } from '../../parser'; + +export class PurchaseOKMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PurchaseOKMessageParser); + } + + public getParser(): PurchaseOKMessageParser + { + return this.parser as PurchaseOKMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/RoomAdPurchaseInfoEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/RoomAdPurchaseInfoEvent.ts new file mode 100644 index 0000000..c7b365e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/RoomAdPurchaseInfoEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomAdPurchaseInfoEventParser } from '../../parser'; + +export class RoomAdPurchaseInfoEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomAdPurchaseInfoEventParser); + } + + public getParser(): RoomAdPurchaseInfoEventParser + { + return this.parser as RoomAdPurchaseInfoEventParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/SeasonalCalendarDailyOfferMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/SeasonalCalendarDailyOfferMessageEvent.ts new file mode 100644 index 0000000..b119e45 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/SeasonalCalendarDailyOfferMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { SeasonalCalendarDailyOfferMessageParser } from '../../parser'; + +export class SeasonalCalendarDailyOfferMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, SeasonalCalendarDailyOfferMessageParser); + } + + public getParser(): SeasonalCalendarDailyOfferMessageParser + { + return this.parser as SeasonalCalendarDailyOfferMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/SellablePetPalettesMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/SellablePetPalettesMessageEvent.ts new file mode 100644 index 0000000..f77c4ee --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/SellablePetPalettesMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { SellablePetPalettesParser } from '../../parser'; + +export class SellablePetPalettesMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, SellablePetPalettesParser); + } + + public getParser(): SellablePetPalettesParser + { + return this.parser as SellablePetPalettesParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/TargetedOfferEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/TargetedOfferEvent.ts new file mode 100644 index 0000000..6de23a9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/TargetedOfferEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { TargetedOfferParser } from '../../parser'; + +export class TargetedOfferEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TargetedOfferParser); + } + + public getParser(): TargetedOfferParser + { + return this.parser as TargetedOfferParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/TargetedOfferNotFoundEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/TargetedOfferNotFoundEvent.ts new file mode 100644 index 0000000..71a0883 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/TargetedOfferNotFoundEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { TargetedOfferNotFoundParser } from '../../parser'; + +export class TargetedOfferNotFoundEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TargetedOfferNotFoundParser); + } + + public getParser(): TargetedOfferNotFoundParser + { + return this.parser as TargetedOfferNotFoundParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/VoucherRedeemErrorMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/VoucherRedeemErrorMessageEvent.ts new file mode 100644 index 0000000..ceb9664 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/VoucherRedeemErrorMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { VoucherRedeemErrorMessageParser } from '../../parser'; + +export class VoucherRedeemErrorMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, VoucherRedeemErrorMessageParser); + } + + public getParser(): VoucherRedeemErrorMessageParser + { + return this.parser as VoucherRedeemErrorMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/VoucherRedeemOkMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/VoucherRedeemOkMessageEvent.ts new file mode 100644 index 0000000..5209e34 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/VoucherRedeemOkMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { VoucherRedeemOkMessageParser } from '../../parser'; + +export class VoucherRedeemOkMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, VoucherRedeemOkMessageParser); + } + + public getParser(): VoucherRedeemOkMessageParser + { + return this.parser as VoucherRedeemOkMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/catalog/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/index.ts new file mode 100644 index 0000000..c7a281c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/catalog/index.ts @@ -0,0 +1,32 @@ +export * from './BonusRareInfoMessageEvent'; +export * from './BuildersClubFurniCountMessageEvent'; +export * from './BuildersClubSubscriptionStatusMessageEvent'; +export * from './BundleDiscountRulesetMessageEvent'; +export * from './CatalogPageExpirationEvent'; +export * from './CatalogPageMessageEvent'; +export * from './CatalogPagesListEvent'; +export * from './CatalogPageWithEarliestExpiryMessageEvent'; +export * from './CatalogPublishedMessageEvent'; +export * from './ClubGiftInfoEvent'; +export * from './ClubGiftSelectedEvent'; +export * from './DirectSMSClubBuyAvailableMessageEvent'; +export * from './FireworkChargeDataEvent'; +export * from './GiftReceiverNotFoundEvent'; +export * from './GiftWrappingConfigurationEvent'; +export * from './HabboClubExtendOfferMessageEvent'; +export * from './HabboClubOffersMessageEvent'; +export * from './IsOfferGiftableMessageEvent'; +export * from './LimitedEditionSoldOutEvent'; +export * from './LimitedOfferAppearingNextMessageEvent'; +export * from './NotEnoughBalanceMessageEvent'; +export * from './ProductOfferEvent'; +export * from './PurchaseErrorMessageEvent'; +export * from './PurchaseNotAllowedMessageEvent'; +export * from './PurchaseOKMessageEvent'; +export * from './RoomAdPurchaseInfoEvent'; +export * from './SeasonalCalendarDailyOfferMessageEvent'; +export * from './SellablePetPalettesMessageEvent'; +export * from './TargetedOfferEvent'; +export * from './TargetedOfferNotFoundEvent'; +export * from './VoucherRedeemErrorMessageEvent'; +export * from './VoucherRedeemOkMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/client/ClientPingEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/client/ClientPingEvent.ts new file mode 100644 index 0000000..05f4932 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/client/ClientPingEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ClientPingParser } from '../../parser'; + +export class ClientPingEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ClientPingParser); + } + + public getParser(): ClientPingParser + { + return this.parser as ClientPingParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/client/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/client/index.ts new file mode 100644 index 0000000..deaf34e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/client/index.ts @@ -0,0 +1 @@ +export * from './ClientPingEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/competition/CompetitionEntrySubmitResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/competition/CompetitionEntrySubmitResultEvent.ts new file mode 100644 index 0000000..d947558 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/competition/CompetitionEntrySubmitResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CompetitionEntrySubmitResultMessageParser } from '../../parser'; + +export class CompetitionEntrySubmitResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CompetitionEntrySubmitResultMessageParser); + } + + public getParser(): CompetitionEntrySubmitResultMessageParser + { + return this.parser as CompetitionEntrySubmitResultMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/competition/CompetitionVotingInfoMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/competition/CompetitionVotingInfoMessageEvent.ts new file mode 100644 index 0000000..e291b35 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/competition/CompetitionVotingInfoMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CompetitionVotingInfoMessageParser } from '../../parser'; + +export class CompetitionVotingInfoMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CompetitionVotingInfoMessageParser); + } + + public getParser(): CompetitionVotingInfoMessageParser + { + return this.parser as CompetitionVotingInfoMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/competition/CurrentTimingCodeMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/competition/CurrentTimingCodeMessageEvent.ts new file mode 100644 index 0000000..7c9fab3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/competition/CurrentTimingCodeMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CurrentTimingCodeMessageParser } from '../../parser'; + +export class CurrentTimingCodeMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CurrentTimingCodeMessageParser); + } + + public getParser(): CurrentTimingCodeMessageParser + { + return this.parser as CurrentTimingCodeMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/competition/IsUserPartOfCompetitionMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/competition/IsUserPartOfCompetitionMessageEvent.ts new file mode 100644 index 0000000..bf40c90 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/competition/IsUserPartOfCompetitionMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { IsUserPartOfCompetitionMessageParser } from '../../parser'; + +export class IsUserPartOfCompetitionMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, IsUserPartOfCompetitionMessageParser); + } + + public getParser(): IsUserPartOfCompetitionMessageParser + { + return this.parser as IsUserPartOfCompetitionMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/competition/NoOwnedRoomsAlertMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/competition/NoOwnedRoomsAlertMessageEvent.ts new file mode 100644 index 0000000..d8e1fda --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/competition/NoOwnedRoomsAlertMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NoOwnedRoomsAlertMessageParser } from '../../parser'; + +export class NoOwnedRoomsAlertMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NoOwnedRoomsAlertMessageParser); + } + + public getParser(): NoOwnedRoomsAlertMessageParser + { + return this.parser as NoOwnedRoomsAlertMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/competition/SecondsUntilMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/competition/SecondsUntilMessageEvent.ts new file mode 100644 index 0000000..89432fa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/competition/SecondsUntilMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { SecondsUntilMessageParser } from '../../parser'; + +export class SecondsUntilMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, SecondsUntilMessageParser); + } + + public getParser(): SecondsUntilMessageParser + { + return this.parser as SecondsUntilMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/competition/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/competition/index.ts new file mode 100644 index 0000000..7c2b70a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/competition/index.ts @@ -0,0 +1,6 @@ +export * from './CompetitionEntrySubmitResultEvent'; +export * from './CompetitionVotingInfoMessageEvent'; +export * from './CurrentTimingCodeMessageEvent'; +export * from './IsUserPartOfCompetitionMessageEvent'; +export * from './NoOwnedRoomsAlertMessageEvent'; +export * from './SecondsUntilMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/crafting/CraftableProductsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/crafting/CraftableProductsEvent.ts new file mode 100644 index 0000000..268b907 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/crafting/CraftableProductsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CraftableProductsMessageParser } from '../../parser'; + +export class CraftableProductsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CraftableProductsMessageParser); + } + + public getParser(): CraftableProductsMessageParser + { + return this.parser as CraftableProductsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/crafting/CraftingRecipeEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/crafting/CraftingRecipeEvent.ts new file mode 100644 index 0000000..dbfc86e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/crafting/CraftingRecipeEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CraftingRecipeMessageParser } from '../../parser'; + +export class CraftingRecipeEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CraftingRecipeMessageParser); + } + + public getParser(): CraftingRecipeMessageParser + { + return this.parser as CraftingRecipeMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/crafting/CraftingRecipesAvailableEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/crafting/CraftingRecipesAvailableEvent.ts new file mode 100644 index 0000000..0e6ed08 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/crafting/CraftingRecipesAvailableEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CraftingRecipesAvailableMessageParser } from '../../parser'; + +export class CraftingRecipesAvailableEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CraftingRecipesAvailableMessageParser); + } + + public getParser(): CraftingRecipesAvailableMessageParser + { + return this.parser as CraftingRecipesAvailableMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/crafting/CraftingResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/crafting/CraftingResultEvent.ts new file mode 100644 index 0000000..15175c5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/crafting/CraftingResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CraftingResultMessageParser } from '../../parser'; + +export class CraftingResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CraftingResultMessageParser); + } + + public getParser(): CraftingResultMessageParser + { + return this.parser as CraftingResultMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/crafting/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/crafting/index.ts new file mode 100644 index 0000000..cf26449 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/crafting/index.ts @@ -0,0 +1,4 @@ +export * from './CraftableProductsEvent'; +export * from './CraftingRecipeEvent'; +export * from './CraftingRecipesAvailableEvent'; +export * from './CraftingResultEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/desktop/DesktopViewEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/desktop/DesktopViewEvent.ts new file mode 100644 index 0000000..0afb2c7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/desktop/DesktopViewEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { DesktopViewParser } from '../../parser'; + +export class DesktopViewEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, DesktopViewParser); + } + + public getParser(): DesktopViewParser + { + return this.parser as DesktopViewParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/desktop/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/desktop/index.ts new file mode 100644 index 0000000..2c0758c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/desktop/index.ts @@ -0,0 +1 @@ +export * from './DesktopViewEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/AcceptFriendResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/AcceptFriendResultEvent.ts new file mode 100644 index 0000000..c1fd8db --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/AcceptFriendResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { AcceptFriendResultParser } from '../../parser'; + +export class AcceptFriendResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AcceptFriendResultParser); + } + + public getParser(): AcceptFriendResultParser + { + return this.parser as AcceptFriendResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FindFriendsProcessResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FindFriendsProcessResultEvent.ts new file mode 100644 index 0000000..37dedf3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FindFriendsProcessResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { FindFriendsProcessResultParser } from '../../parser'; + +export class FindFriendsProcessResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FindFriendsProcessResultParser); + } + + public getParser(): FindFriendsProcessResultParser + { + return this.parser as FindFriendsProcessResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FollowFriendFailedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FollowFriendFailedEvent.ts new file mode 100644 index 0000000..98f6061 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FollowFriendFailedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { FollowFriendFailedParser } from '../../parser'; + +export class FollowFriendFailedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FollowFriendFailedParser); + } + + public getParser(): FollowFriendFailedParser + { + return this.parser as FollowFriendFailedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FriendListFragmentEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FriendListFragmentEvent.ts new file mode 100644 index 0000000..a4cacdc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FriendListFragmentEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { FriendListFragmentParser } from '../../parser'; + +export class FriendListFragmentEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FriendListFragmentParser); + } + + public getParser(): FriendListFragmentParser + { + return this.parser as FriendListFragmentParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FriendListUpdateEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FriendListUpdateEvent.ts new file mode 100644 index 0000000..64da572 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FriendListUpdateEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { FriendListUpdateParser } from '../../parser'; + +export class FriendListUpdateEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FriendListUpdateParser); + } + + public getParser(): FriendListUpdateParser + { + return this.parser as FriendListUpdateParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FriendNotificationEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FriendNotificationEvent.ts new file mode 100644 index 0000000..ccf0c87 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FriendNotificationEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { FriendNotificationParser } from '../../parser'; + +export class FriendNotificationEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FriendNotificationParser); + } + + public getParser(): FriendNotificationParser + { + return this.parser as FriendNotificationParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FriendRequestsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FriendRequestsEvent.ts new file mode 100644 index 0000000..c490325 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/FriendRequestsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { FriendRequestsParser } from '../../parser'; + +export class FriendRequestsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FriendRequestsParser); + } + + public getParser(): FriendRequestsParser + { + return this.parser as FriendRequestsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/HabboSearchResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/HabboSearchResultEvent.ts new file mode 100644 index 0000000..3dbabf8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/HabboSearchResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { HabboSearchResultParser } from '../../parser'; + +export class HabboSearchResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, HabboSearchResultParser); + } + + public getParser(): HabboSearchResultParser + { + return this.parser as HabboSearchResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/InstantMessageErrorEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/InstantMessageErrorEvent.ts new file mode 100644 index 0000000..3a3ab08 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/InstantMessageErrorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { InstantMessageErrorParser } from '../../parser'; + +export class InstantMessageErrorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, InstantMessageErrorParser); + } + + public getParser(): InstantMessageErrorParser + { + return this.parser as InstantMessageErrorParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/MessageErrorEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/MessageErrorEvent.ts new file mode 100644 index 0000000..1510f56 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/MessageErrorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MessageErrorParser } from '../../parser'; + +export class MessageErrorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MessageErrorParser); + } + + public getParser(): MessageErrorParser + { + return this.parser as MessageErrorParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/MessengerInitEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/MessengerInitEvent.ts new file mode 100644 index 0000000..ade1a64 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/MessengerInitEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MessengerInitParser } from '../../parser'; + +export class MessengerInitEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MessengerInitParser); + } + + public getParser(): MessengerInitParser + { + return this.parser as MessengerInitParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/MiniMailNewMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/MiniMailNewMessageEvent.ts new file mode 100644 index 0000000..5c452f1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/MiniMailNewMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MiniMailNewMessageParser } from '../../parser'; + +export class MiniMailNewMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MiniMailNewMessageParser); + } + + public getParser(): MiniMailNewMessageParser + { + return this.parser as MiniMailNewMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/MiniMailUnreadCountEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/MiniMailUnreadCountEvent.ts new file mode 100644 index 0000000..33dea73 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/MiniMailUnreadCountEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MiniMailUnreadCountParser } from '../../parser'; + +export class MiniMailUnreadCountEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MiniMailUnreadCountParser); + } + + public getParser(): MiniMailUnreadCountParser + { + return this.parser as MiniMailUnreadCountParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/NewConsoleMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/NewConsoleMessageEvent.ts new file mode 100644 index 0000000..255d314 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/NewConsoleMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NewConsoleMessageParser } from '../../parser'; + +export class NewConsoleMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NewConsoleMessageParser); + } + + public getParser(): NewConsoleMessageParser + { + return this.parser as NewConsoleMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/NewFriendRequestEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/NewFriendRequestEvent.ts new file mode 100644 index 0000000..a3b0bc5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/NewFriendRequestEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NewFriendRequestParser } from '../../parser'; + +export class NewFriendRequestEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NewFriendRequestParser); + } + + public getParser(): NewFriendRequestParser + { + return this.parser as NewFriendRequestParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/RoomInviteErrorEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/RoomInviteErrorEvent.ts new file mode 100644 index 0000000..c54b070 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/RoomInviteErrorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomInviteErrorParser } from '../../parser'; + +export class RoomInviteErrorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomInviteErrorParser); + } + + public getParser(): RoomInviteErrorParser + { + return this.parser as RoomInviteErrorParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/RoomInviteEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/RoomInviteEvent.ts new file mode 100644 index 0000000..2e0ea00 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/RoomInviteEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomInviteParser } from '../../parser'; + +export class RoomInviteEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomInviteParser); + } + + public getParser(): RoomInviteParser + { + return this.parser as RoomInviteParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/index.ts new file mode 100644 index 0000000..47c991c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/friendlist/index.ts @@ -0,0 +1,17 @@ +export * from './AcceptFriendResultEvent'; +export * from './FindFriendsProcessResultEvent'; +export * from './FollowFriendFailedEvent'; +export * from './FriendListFragmentEvent'; +export * from './FriendListUpdateEvent'; +export * from './FriendNotificationEvent'; +export * from './FriendRequestsEvent'; +export * from './HabboSearchResultEvent'; +export * from './InstantMessageErrorEvent'; +export * from './MessageErrorEvent'; +export * from './MessengerInitEvent'; +export * from './MiniMailNewMessageEvent'; +export * from './MiniMailUnreadCountEvent'; +export * from './NewConsoleMessageEvent'; +export * from './NewFriendRequestEvent'; +export * from './RoomInviteErrorEvent'; +export * from './RoomInviteEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2AccountGameStatusMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2AccountGameStatusMessageEvent.ts new file mode 100644 index 0000000..1c680c8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2AccountGameStatusMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { Game2AccountGameStatusMessageParser } from '../../../parser'; + +export class Game2AccountGameStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, Game2AccountGameStatusMessageParser); + } + + public getParser(): Game2AccountGameStatusMessageParser + { + return this.parser as Game2AccountGameStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2GameDirectoryStatusMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2GameDirectoryStatusMessageEvent.ts new file mode 100644 index 0000000..fd07a8e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2GameDirectoryStatusMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { Game2GameDirectoryStatusMessageParser } from '../../../parser'; + +export class Game2GameDirectoryStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, Game2GameDirectoryStatusMessageParser); + } + + public getParser(): Game2GameDirectoryStatusMessageParser + { + return this.parser as Game2GameDirectoryStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2InArenaQueueMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2InArenaQueueMessageEvent.ts new file mode 100644 index 0000000..099bbe1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2InArenaQueueMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { Game2InArenaQueueMessageParser } from '../../../parser'; + +export class Game2InArenaQueueMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, Game2InArenaQueueMessageParser); + } + + public getParser(): Game2InArenaQueueMessageParser + { + return this.parser as Game2InArenaQueueMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2JoiningGameFailedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2JoiningGameFailedMessageEvent.ts new file mode 100644 index 0000000..cf72ef7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2JoiningGameFailedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { Game2JoiningGameFailedMessageParser } from '../../../parser'; + +export class Game2JoiningGameFailedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, Game2JoiningGameFailedMessageParser); + } + + public getParser(): Game2JoiningGameFailedMessageParser + { + return this.parser as Game2JoiningGameFailedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2StartingGameFailedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2StartingGameFailedMessageEvent.ts new file mode 100644 index 0000000..65414fb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2StartingGameFailedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { Game2StartingGameFailedMessageParser } from '../../../parser'; + +export class Game2StartingGameFailedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, Game2StartingGameFailedMessageParser); + } + + public getParser(): Game2StartingGameFailedMessageParser + { + return this.parser as Game2StartingGameFailedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2StopCounterMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2StopCounterMessageEvent.ts new file mode 100644 index 0000000..90a5ef6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2StopCounterMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { Game2InArenaQueueMessageParser, Game2StopCounterMessageParser } from '../../../parser'; + +export class Game2StopCounterMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, Game2StopCounterMessageParser); + } + + public getParser(): Game2InArenaQueueMessageParser + { + return this.parser as Game2InArenaQueueMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2UserLeftGameMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2UserLeftGameMessageEvent.ts new file mode 100644 index 0000000..f6b7592 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/Game2UserLeftGameMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { Game2UserLeftGameMessageParser } from '../../../parser'; + +export class Game2UserLeftGameMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, Game2UserLeftGameMessageParser); + } + + public getParser(): Game2UserLeftGameMessageParser + { + return this.parser as Game2UserLeftGameMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/index.ts new file mode 100644 index 0000000..8724315 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/directory/index.ts @@ -0,0 +1,7 @@ +export * from './Game2AccountGameStatusMessageEvent'; +export * from './Game2GameDirectoryStatusMessageEvent'; +export * from './Game2InArenaQueueMessageEvent'; +export * from './Game2JoiningGameFailedMessageEvent'; +export * from './Game2StartingGameFailedMessageEvent'; +export * from './Game2StopCounterMessageEvent'; +export * from './Game2UserLeftGameMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/index.ts new file mode 100644 index 0000000..779f388 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/index.ts @@ -0,0 +1,3 @@ +export * from './directory'; +export * from './lobby'; +export * from './score'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/AchievementResolutionCompletedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/AchievementResolutionCompletedMessageEvent.ts new file mode 100644 index 0000000..9f7702f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/AchievementResolutionCompletedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { AchievementResolutionCompletedMessageParser } from '../../../parser'; + +export class AchievementResolutionCompletedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AchievementResolutionCompletedMessageParser); + } + + public getParser(): AchievementResolutionCompletedMessageParser + { + return this.parser as AchievementResolutionCompletedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/AchievementResolutionProgressMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/AchievementResolutionProgressMessageEvent.ts new file mode 100644 index 0000000..c503c07 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/AchievementResolutionProgressMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { AchievementResolutionProgressMessageParser } from '../../../parser'; + +export class AchievementResolutionProgressMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AchievementResolutionProgressMessageParser); + } + + public getParser(): AchievementResolutionProgressMessageParser + { + return this.parser as AchievementResolutionProgressMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/AchievementResolutionsMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/AchievementResolutionsMessageEvent.ts new file mode 100644 index 0000000..2eaea11 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/AchievementResolutionsMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { AchievementResolutionsMessageParser } from '../../../parser'; + +export class AchievementResolutionsMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AchievementResolutionsMessageParser); + } + + public getParser(): AchievementResolutionsMessageParser + { + return this.parser as AchievementResolutionsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/GameAchievementsMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/GameAchievementsMessageEvent.ts new file mode 100644 index 0000000..3190043 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/GameAchievementsMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { GameAchievementsMessageParser } from '../../../parser'; + +export class GameAchievementsMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GameAchievementsMessageParser); + } + + public getParser(): GameAchievementsMessageParser + { + return this.parser as GameAchievementsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/GameInviteMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/GameInviteMessageEvent.ts new file mode 100644 index 0000000..36f21c0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/GameInviteMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { GameInviteMessageParser } from '../../../parser'; + +export class GameInviteMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GameInviteMessageParser); + } + + public getParser(): GameInviteMessageParser + { + return this.parser as GameInviteMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/GameListMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/GameListMessageEvent.ts new file mode 100644 index 0000000..8ce4aed --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/GameListMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { GameListMessageParser } from '../../../parser'; + +export class GameListMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GameListMessageParser); + } + + public getParser(): GameListMessageParser + { + return this.parser as GameListMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/GameStatusMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/GameStatusMessageEvent.ts new file mode 100644 index 0000000..401e8bc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/GameStatusMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { GameStatusMessageParser } from '../../../parser'; + +export class GameStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GameStatusMessageParser); + } + + public getParser(): GameStatusMessageParser + { + return this.parser as GameStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/JoinedQueueMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/JoinedQueueMessageEvent.ts new file mode 100644 index 0000000..4c56240 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/JoinedQueueMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { JoinedQueueMessageParser } from '../../../parser'; + +export class JoinedQueueMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, JoinedQueueMessageParser); + } + + public getParser(): JoinedQueueMessageParser + { + return this.parser as JoinedQueueMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/JoiningQueueFailedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/JoiningQueueFailedMessageEvent.ts new file mode 100644 index 0000000..6d4e646 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/JoiningQueueFailedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { JoiningQueueFailedMessageParser } from '../../../parser'; + +export class JoiningQueueFailedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, JoiningQueueFailedMessageParser); + } + + public getParser(): JoiningQueueFailedMessageParser + { + return this.parser as JoiningQueueFailedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/LeftQueueMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/LeftQueueMessageEvent.ts new file mode 100644 index 0000000..b502954 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/LeftQueueMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { LeftQueueMessageParser } from '../../../parser'; + +export class LeftQueueMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, LeftQueueMessageParser); + } + + public getParser(): LeftQueueMessageParser + { + return this.parser as LeftQueueMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/LoadGameMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/LoadGameMessageEvent.ts new file mode 100644 index 0000000..67f2ec4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/LoadGameMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { LoadGameMessageParser } from '../../../parser'; + +export class LoadGameMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, LoadGameMessageParser); + } + + public getParser(): LoadGameMessageParser + { + return this.parser as LoadGameMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/LoadGameUrlEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/LoadGameUrlEvent.ts new file mode 100644 index 0000000..829127e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/LoadGameUrlEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { LoadGameUrlParser } from '../../../parser'; + +export class LoadGameUrlEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, LoadGameUrlParser); + } + + public getParser(): LoadGameUrlParser + { + return this.parser as LoadGameUrlParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/UnloadGameMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/UnloadGameMessageEvent.ts new file mode 100644 index 0000000..05be298 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/UnloadGameMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { UnloadGameMessageParser } from '../../../parser'; + +export class UnloadGameMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UnloadGameMessageParser); + } + + public getParser(): UnloadGameMessageParser + { + return this.parser as UnloadGameMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/UserGameAchievementsMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/UserGameAchievementsMessageEvent.ts new file mode 100644 index 0000000..e228590 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/UserGameAchievementsMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { UserGameAchievementsMessageParser } from '../../../parser'; + +export class UserGameAchievementsMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserGameAchievementsMessageParser); + } + + public getParser(): UserGameAchievementsMessageParser + { + return this.parser as UserGameAchievementsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/index.ts new file mode 100644 index 0000000..13421db --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/lobby/index.ts @@ -0,0 +1,14 @@ +export * from './AchievementResolutionCompletedMessageEvent'; +export * from './AchievementResolutionProgressMessageEvent'; +export * from './AchievementResolutionsMessageEvent'; +export * from './GameAchievementsMessageEvent'; +export * from './GameInviteMessageEvent'; +export * from './GameListMessageEvent'; +export * from './GameStatusMessageEvent'; +export * from './JoinedQueueMessageEvent'; +export * from './JoiningQueueFailedMessageEvent'; +export * from './LeftQueueMessageEvent'; +export * from './LoadGameMessageEvent'; +export * from './LoadGameUrlEvent'; +export * from './UnloadGameMessageEvent'; +export * from './UserGameAchievementsMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/score/Game2WeeklyFriendsLeaderboardEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/score/Game2WeeklyFriendsLeaderboardEvent.ts new file mode 100644 index 0000000..98381f4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/score/Game2WeeklyFriendsLeaderboardEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { Game2WeeklyLeaderboardParser } from '../../../parser'; + +export class Game2WeeklyFriendsLeaderboardEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, Game2WeeklyLeaderboardParser); + } + + public getParser(): Game2WeeklyLeaderboardParser + { + return this.parser as Game2WeeklyLeaderboardParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/score/Game2WeeklyLeaderboardEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/score/Game2WeeklyLeaderboardEvent.ts new file mode 100644 index 0000000..4e99e2e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/score/Game2WeeklyLeaderboardEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { Game2WeeklyLeaderboardParser } from '../../../parser'; + +export class Game2WeeklyLeaderboardEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, Game2WeeklyLeaderboardParser); + } + + public getParser(): Game2WeeklyLeaderboardParser + { + return this.parser as Game2WeeklyLeaderboardParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/score/WeeklyCompetitiveFriendsLeaderboardEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/score/WeeklyCompetitiveFriendsLeaderboardEvent.ts new file mode 100644 index 0000000..76a64c9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/score/WeeklyCompetitiveFriendsLeaderboardEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { Game2WeeklyLeaderboardParser } from '../../../parser'; + +export class WeeklyCompetitiveFriendsLeaderboardEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, Game2WeeklyLeaderboardParser); + } + + public getParser(): Game2WeeklyLeaderboardParser + { + return this.parser as Game2WeeklyLeaderboardParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/score/WeeklyCompetitiveLeaderboardEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/score/WeeklyCompetitiveLeaderboardEvent.ts new file mode 100644 index 0000000..f9faf88 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/score/WeeklyCompetitiveLeaderboardEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { Game2WeeklyLeaderboardParser } from '../../../parser'; + +export class WeeklyCompetitiveLeaderboardEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, Game2WeeklyLeaderboardParser); + } + + public getParser(): Game2WeeklyLeaderboardParser + { + return this.parser as Game2WeeklyLeaderboardParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/score/WeeklyGameRewardEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/score/WeeklyGameRewardEvent.ts new file mode 100644 index 0000000..d8464fd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/score/WeeklyGameRewardEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { WeeklyGameRewardParser } from '../../../parser'; + +export class WeeklyGameRewardEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, WeeklyGameRewardParser); + } + + public getParser(): WeeklyGameRewardParser + { + return this.parser as WeeklyGameRewardParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/score/WeeklyGameRewardWinnersEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/score/WeeklyGameRewardWinnersEvent.ts new file mode 100644 index 0000000..c55fd0d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/score/WeeklyGameRewardWinnersEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { WeeklyGameRewardWinnersParser } from '../../../parser'; + +export class WeeklyGameRewardWinnersEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, WeeklyGameRewardWinnersParser); + } + + public getParser(): WeeklyGameRewardWinnersParser + { + return this.parser as WeeklyGameRewardWinnersParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/game/score/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/game/score/index.ts new file mode 100644 index 0000000..546b5a3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/game/score/index.ts @@ -0,0 +1,6 @@ +export * from './Game2WeeklyFriendsLeaderboardEvent'; +export * from './Game2WeeklyLeaderboardEvent'; +export * from './WeeklyCompetitiveFriendsLeaderboardEvent'; +export * from './WeeklyCompetitiveLeaderboardEvent'; +export * from './WeeklyGameRewardEvent'; +export * from './WeeklyGameRewardWinnersEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/generic/GenericErrorEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/generic/GenericErrorEvent.ts new file mode 100644 index 0000000..43b3a88 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/generic/GenericErrorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GenericErrorParser } from '../../parser'; + +export class GenericErrorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GenericErrorParser); + } + + public getParser(): GenericErrorParser + { + return this.parser as GenericErrorParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/generic/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/generic/index.ts new file mode 100644 index 0000000..08ed38e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/generic/index.ts @@ -0,0 +1 @@ +export * from './GenericErrorEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/gifts/PhoneCollectionStateMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/gifts/PhoneCollectionStateMessageEvent.ts new file mode 100644 index 0000000..7e97ab2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/gifts/PhoneCollectionStateMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PhoneCollectionStateParser } from '../../parser'; + +export class PhoneCollectionStateMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PhoneCollectionStateParser); + } + + public getParser(): PhoneCollectionStateParser + { + return this.parser as PhoneCollectionStateParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/gifts/TryPhoneNumberResultMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/gifts/TryPhoneNumberResultMessageEvent.ts new file mode 100644 index 0000000..c95a557 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/gifts/TryPhoneNumberResultMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { TryPhoneNumberResultParser } from '../../parser'; + +export class TryPhoneNumberResultMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TryPhoneNumberResultParser); + } + + public getParser(): TryPhoneNumberResultParser + { + return this.parser as TryPhoneNumberResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/gifts/TryVerificationCodeResultMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/gifts/TryVerificationCodeResultMessageEvent.ts new file mode 100644 index 0000000..016972f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/gifts/TryVerificationCodeResultMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { TryVerificationCodeResultParser } from '../../parser'; + +export class TryVerificationCodeResultMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TryVerificationCodeResultParser); + } + + public getParser(): TryVerificationCodeResultParser + { + return this.parser as TryVerificationCodeResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/gifts/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/gifts/index.ts new file mode 100644 index 0000000..ee498b9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/gifts/index.ts @@ -0,0 +1,3 @@ +export * from './PhoneCollectionStateMessageEvent'; +export * from './TryPhoneNumberResultMessageEvent'; +export * from './TryVerificationCodeResultMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupBadgePartsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupBadgePartsEvent.ts new file mode 100644 index 0000000..3cdfa97 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupBadgePartsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GroupBadgePartsParser } from '../../parser'; + +export class GroupBadgePartsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GroupBadgePartsParser); + } + + public getParser(): GroupBadgePartsParser + { + return this.parser as GroupBadgePartsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupBuyDataEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupBuyDataEvent.ts new file mode 100644 index 0000000..9447add --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupBuyDataEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GroupBuyDataParser } from '../../parser'; + +export class GroupBuyDataEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GroupBuyDataParser); + } + + public getParser(): GroupBuyDataParser + { + return this.parser as GroupBuyDataParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupConfirmMemberRemoveEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupConfirmMemberRemoveEvent.ts new file mode 100644 index 0000000..007a78c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupConfirmMemberRemoveEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GroupConfirmMemberRemoveParser } from '../../parser'; + +export class GroupConfirmMemberRemoveEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GroupConfirmMemberRemoveParser); + } + + public getParser(): GroupConfirmMemberRemoveParser + { + return this.parser as GroupConfirmMemberRemoveParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupInformationEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupInformationEvent.ts new file mode 100644 index 0000000..c75dae8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupInformationEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GroupInformationParser } from '../../parser'; + +export class GroupInformationEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GroupInformationParser); + } + + public getParser(): GroupInformationParser + { + return this.parser as GroupInformationParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupMembersEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupMembersEvent.ts new file mode 100644 index 0000000..90636b1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupMembersEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GroupMembersParser } from '../../parser'; + +export class GroupMembersEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GroupMembersParser); + } + + public getParser(): GroupMembersParser + { + return this.parser as GroupMembersParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupPurchasedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupPurchasedEvent.ts new file mode 100644 index 0000000..2917115 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupPurchasedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GroupPurchasedParser } from '../../parser'; + +export class GroupPurchasedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GroupPurchasedParser); + } + + public getParser(): GroupPurchasedParser + { + return this.parser as GroupPurchasedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupSettingsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupSettingsEvent.ts new file mode 100644 index 0000000..efb9db1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/group/GroupSettingsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GroupSettingsParser } from '../../parser'; + +export class GroupSettingsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GroupSettingsParser); + } + + public getParser(): GroupSettingsParser + { + return this.parser as GroupSettingsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/group/HabboGroupDeactivatedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/group/HabboGroupDeactivatedMessageEvent.ts new file mode 100644 index 0000000..ff97a5d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/group/HabboGroupDeactivatedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { HabboGroupDeactivatedMessageParser } from '../../parser'; + +export class HabboGroupDeactivatedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, HabboGroupDeactivatedMessageParser); + } + + public getParser(): HabboGroupDeactivatedMessageParser + { + return this.parser as HabboGroupDeactivatedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/group/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/group/index.ts new file mode 100644 index 0000000..5fc4853 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/group/index.ts @@ -0,0 +1,8 @@ +export * from './GroupBadgePartsEvent'; +export * from './GroupBuyDataEvent'; +export * from './GroupConfirmMemberRemoveEvent'; +export * from './GroupInformationEvent'; +export * from './GroupMembersEvent'; +export * from './GroupPurchasedEvent'; +export * from './GroupSettingsEvent'; +export * from './HabboGroupDeactivatedMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/ForumDataMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/ForumDataMessageEvent.ts new file mode 100644 index 0000000..a7de339 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/ForumDataMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ForumDataMessageParser } from '../../parser'; + +export class ForumDataMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ForumDataMessageParser); + } + + public getParser(): ForumDataMessageParser + { + return this.parser as ForumDataMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/ForumsListMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/ForumsListMessageEvent.ts new file mode 100644 index 0000000..f4ea021 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/ForumsListMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GetForumsListMessageParser } from '../../parser'; + +export class ForumsListMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GetForumsListMessageParser); + } + + public getParser(): GetForumsListMessageParser + { + return this.parser as GetForumsListMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/GuildForumThreadsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/GuildForumThreadsEvent.ts new file mode 100644 index 0000000..94bb408 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/GuildForumThreadsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuildForumThreadsParser } from '../../parser'; + +export class GuildForumThreadsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuildForumThreadsParser); + } + + public getParser(): GuildForumThreadsParser + { + return this.parser as GuildForumThreadsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/PostMessageMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/PostMessageMessageEvent.ts new file mode 100644 index 0000000..147785c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/PostMessageMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PostMessageMessageParser } from '../../parser'; + +export class PostMessageMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PostMessageMessageParser); + } + + public getParser(): PostMessageMessageParser + { + return this.parser as PostMessageMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/PostThreadMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/PostThreadMessageEvent.ts new file mode 100644 index 0000000..077a6d6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/PostThreadMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PostThreadMessageParser } from '../../parser'; + +export class PostThreadMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PostThreadMessageParser); + } + + public getParser(): PostThreadMessageParser + { + return this.parser as PostThreadMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/ThreadMessagesMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/ThreadMessagesMessageEvent.ts new file mode 100644 index 0000000..30f5832 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/ThreadMessagesMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ThreadMessagesMessageParser } from '../../parser'; + +export class ThreadMessagesMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ThreadMessagesMessageParser); + } + + public getParser(): ThreadMessagesMessageParser + { + return this.parser as ThreadMessagesMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/UnreadForumsCountMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/UnreadForumsCountMessageEvent.ts new file mode 100644 index 0000000..922e757 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/UnreadForumsCountMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { UnreadForumsCountMessageParser } from '../../parser'; + +export class UnreadForumsCountMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UnreadForumsCountMessageParser); + } + + public getParser(): UnreadForumsCountMessageParser + { + return this.parser as UnreadForumsCountMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/UpdateMessageMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/UpdateMessageMessageEvent.ts new file mode 100644 index 0000000..24a109b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/UpdateMessageMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { UpdateMessageMessageParser } from '../../parser'; + +export class UpdateMessageMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UpdateMessageMessageParser); + } + + public getParser(): UpdateMessageMessageParser + { + return this.parser as UpdateMessageMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/UpdateThreadMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/UpdateThreadMessageEvent.ts new file mode 100644 index 0000000..9ff2789 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/UpdateThreadMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { UpdateThreadMessageParser } from '../../parser'; + +export class UpdateThreadMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UpdateThreadMessageParser); + } + + public getParser(): UpdateThreadMessageParser + { + return this.parser as UpdateThreadMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/index.ts new file mode 100644 index 0000000..53566b9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/groupforums/index.ts @@ -0,0 +1,9 @@ +export * from './ForumDataMessageEvent'; +export * from './ForumsListMessageEvent'; +export * from './GuildForumThreadsEvent'; +export * from './PostMessageMessageEvent'; +export * from './PostThreadMessageEvent'; +export * from './ThreadMessagesMessageEvent'; +export * from './UnreadForumsCountMessageEvent'; +export * from './UpdateMessageMessageEvent'; +export * from './UpdateThreadMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/handshake/CompleteDiffieHandshakeEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/handshake/CompleteDiffieHandshakeEvent.ts new file mode 100644 index 0000000..c5b633e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/handshake/CompleteDiffieHandshakeEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CompleteDiffieHandshakeParser } from '../../parser'; + +export class CompleteDiffieHandshakeEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CompleteDiffieHandshakeParser); + } + + public getParser(): CompleteDiffieHandshakeParser + { + return this.parser as CompleteDiffieHandshakeParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/handshake/DisconnectReasonEnum.ts b/submodules/renderer/src/nitro/communication/messages/incoming/handshake/DisconnectReasonEnum.ts new file mode 100644 index 0000000..dcd50df --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/handshake/DisconnectReasonEnum.ts @@ -0,0 +1,46 @@ +export class DisconnectReasonEnum +{ + public static readonly LOGOUT: number = 0; + public static readonly JUST_BANNED: number = 1; + public static readonly CONCURRENT_LOGIN: number = 2; + public static readonly CONNECTION_LOST_TO_PEER: number = 3; + public static readonly AVATAR_IDENTITY_CHANGE: number = 4; + public static readonly REMOVE_FURNITURE_TOOL: number = 5; + public static readonly STILL_BANNED: number = 10; + public static readonly DUAL_LOGIN_BY_USERID: number = 11; + public static readonly HOTEL_CLOSED: number = 12; + public static readonly DUAL_LOGIN_BY_IP: number = 13; + public static readonly PEER_CONNECTION_MISSING: number = 16; + public static readonly NO_LOGIN_PERMISSION: number = 17; + public static readonly DUPLICATE_CONNECTION: number = 18; + public static readonly HOTEL_CLOSING: number = 19; + public static readonly INCORRECT_PASSWORD: number = 20; + public static readonly INVALID_LOGIN_TICKET: number = 22; + public static readonly VERSION_CHECK_URL: number = 23; + public static readonly VERSION_CHECK_PROPERTY: number = 24; + public static readonly VERSION_CHECK_MACHINE_ID: number = 25; + public static readonly NO_MESSENGER_SESSION: number = 26; + public static readonly USER_NOT_FOUND: number = 27; + public static readonly CRYPTO_NOT_INITIALIZED: number = 28; + public static readonly DEV_CRYPTO_NOT_ALLOWED: number = 29; + public static readonly DUPLICATE_UUID_DETECTED: number = 100; + public static readonly OLD_SESSION_IN_PROXY: number = 101; + public static readonly PUBLIC_KEY_NOT_NUMERIC: number = 102; + public static readonly PUBLIC_KEY_TOO_SHORT: number = 103; + public static readonly SOCKET_READ_GENERIC: number = 104; + public static readonly SOCKET_READ_FIRST_BYTE: number = 105; + public static readonly SOCKET_READ_LENGTH: number = 106; + public static readonly SOCKET_READ_BODY: number = 107; + public static readonly SOCKET_READ_POLICY: number = 108; + public static readonly SOCKET_IO_EXCEPTION: number = 109; + public static readonly SOCKET_WRONG_CRYPTO: number = 110; + public static readonly PROXY_RUNTIME_EXCEPTION: number = 111; + public static readonly IDLE_CONNECTION: number = 112; + public static readonly PONG_TIMEOUT: number = 113; + public static readonly IDLE_CONNECTION_NOT_AUTH: number = 114; + public static readonly IDLE_CONNECTION_NO_USER_ID: number = 115; + public static readonly WRITE_CLOSED_CHANNEL: number = 116; + public static readonly SOCKET_WRITE_EXCEPTION_1: number = 117; + public static readonly SOCKET_WRITE_EXCEPTION_2: number = 118; + public static readonly SOCKET_WRITE_EXCEPTION_3: number = 119; +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/handshake/DisconnectReasonEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/handshake/DisconnectReasonEvent.ts new file mode 100644 index 0000000..627fb1e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/handshake/DisconnectReasonEvent.ts @@ -0,0 +1,33 @@ +import { DisconnectReasonEnum } from '.'; +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { DisconnectReasonParser } from '../../parser'; + +export class DisconnectReasonEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, DisconnectReasonParser); + } + + public getParser(): DisconnectReasonParser + { + return this.parser as DisconnectReasonParser; + } + + public get reasonString(): string + { + switch(this.getParser().reason) + { + case DisconnectReasonEnum.JUST_BANNED: + case DisconnectReasonEnum.STILL_BANNED: + return 'banned'; + case DisconnectReasonEnum.CONCURRENT_LOGIN: + return 'concurrentlogin'; + case DisconnectReasonEnum.INCORRECT_PASSWORD: + return 'incorrectpassword'; + default: + return 'logout'; + } + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/handshake/IdentityAccountsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/handshake/IdentityAccountsEvent.ts new file mode 100644 index 0000000..74a1550 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/handshake/IdentityAccountsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { IdentityAccountsParser } from '../../parser'; + +export class IdentityAccountsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, IdentityAccountsParser); + } + + public getParser(): IdentityAccountsParser + { + return this.parser as IdentityAccountsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/handshake/InitDiffieHandshakeEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/handshake/InitDiffieHandshakeEvent.ts new file mode 100644 index 0000000..d080543 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/handshake/InitDiffieHandshakeEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { InitDiffieHandshakeParser } from '../../parser'; + +export class InitDiffieHandshakeEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, InitDiffieHandshakeParser); + } + + public getParser(): InitDiffieHandshakeParser + { + return this.parser as InitDiffieHandshakeParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/handshake/NoobnessLevelMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/handshake/NoobnessLevelMessageEvent.ts new file mode 100644 index 0000000..113818b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/handshake/NoobnessLevelMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NoobnessLevelMessageParser } from '../../parser'; + +export class NoobnessLevelMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NoobnessLevelMessageParser); + } + + public getParser(): NoobnessLevelMessageParser + { + return this.parser as NoobnessLevelMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/handshake/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/handshake/index.ts new file mode 100644 index 0000000..81bb67a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/handshake/index.ts @@ -0,0 +1,6 @@ +export * from './CompleteDiffieHandshakeEvent'; +export * from './DisconnectReasonEnum'; +export * from './DisconnectReasonEvent'; +export * from './IdentityAccountsEvent'; +export * from './InitDiffieHandshakeEvent'; +export * from './NoobnessLevelMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/CallForHelpDisabledNotifyMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/CallForHelpDisabledNotifyMessageEvent.ts new file mode 100644 index 0000000..d98a3e6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/CallForHelpDisabledNotifyMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CallForHelpDisabledNotifyMessageParser } from '../../parser'; + +export class CallForHelpDisabledNotifyMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CallForHelpDisabledNotifyMessageParser); + } + + public getParser(): CallForHelpDisabledNotifyMessageParser + { + return this.parser as CallForHelpDisabledNotifyMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/CallForHelpPendingCallsDeletedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/CallForHelpPendingCallsDeletedMessageEvent.ts new file mode 100644 index 0000000..05d2695 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/CallForHelpPendingCallsDeletedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CallForHelpPendingCallsDeletedMessageParser } from '../../parser'; + +export class CallForHelpPendingCallsDeletedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CallForHelpPendingCallsDeletedMessageParser); + } + + public getParser(): CallForHelpPendingCallsDeletedMessageParser + { + return this.parser as CallForHelpPendingCallsDeletedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/CallForHelpPendingCallsMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/CallForHelpPendingCallsMessageEvent.ts new file mode 100644 index 0000000..34e1332 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/CallForHelpPendingCallsMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CallForHelpPendingCallsMessageParser } from '../../parser'; + +export class CallForHelpPendingCallsMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CallForHelpPendingCallsMessageParser); + } + + public getParser(): CallForHelpPendingCallsMessageParser + { + return this.parser as CallForHelpPendingCallsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/CallForHelpReplyMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/CallForHelpReplyMessageEvent.ts new file mode 100644 index 0000000..dd95950 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/CallForHelpReplyMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CallForHelpReplyMessageParser } from '../../parser'; + +export class CallForHelpReplyMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CallForHelpReplyMessageParser); + } + + public getParser(): CallForHelpReplyMessageParser + { + return this.parser as CallForHelpReplyMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/CallForHelpResultMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/CallForHelpResultMessageEvent.ts new file mode 100644 index 0000000..1e71ecc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/CallForHelpResultMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CallForHelpResultMessageParser } from '../../parser'; + +export class CallForHelpResultMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CallForHelpResultMessageParser); + } + + public getParser(): CallForHelpResultMessageParser + { + return this.parser as CallForHelpResultMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/ChatReviewSessionDetachedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/ChatReviewSessionDetachedMessageEvent.ts new file mode 100644 index 0000000..c07cb7a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/ChatReviewSessionDetachedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ChatReviewSessionDetachedMessageParser } from '../../parser'; + +export class ChatReviewSessionDetachedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ChatReviewSessionDetachedMessageParser); + } + + public getParser(): ChatReviewSessionDetachedMessageParser + { + return this.parser as ChatReviewSessionDetachedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/ChatReviewSessionOfferedToGuideMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/ChatReviewSessionOfferedToGuideMessageEvent.ts new file mode 100644 index 0000000..da307ba --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/ChatReviewSessionOfferedToGuideMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ChatReviewSessionOfferedToGuideMessageParser } from '../../parser'; + +export class ChatReviewSessionOfferedToGuideMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ChatReviewSessionOfferedToGuideMessageParser); + } + + public getParser(): ChatReviewSessionOfferedToGuideMessageParser + { + return this.parser as ChatReviewSessionOfferedToGuideMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/ChatReviewSessionResultsMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/ChatReviewSessionResultsMessageEvent.ts new file mode 100644 index 0000000..009012e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/ChatReviewSessionResultsMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ChatReviewSessionResultsMessageParser } from '../../parser'; + +export class ChatReviewSessionResultsMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ChatReviewSessionResultsMessageParser); + } + + public getParser(): ChatReviewSessionResultsMessageParser + { + return this.parser as ChatReviewSessionResultsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/ChatReviewSessionStartedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/ChatReviewSessionStartedMessageEvent.ts new file mode 100644 index 0000000..9cc7caa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/ChatReviewSessionStartedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ChatReviewSessionStartedMessageParser } from '../../parser'; + +export class ChatReviewSessionStartedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ChatReviewSessionStartedMessageParser); + } + + public getParser(): ChatReviewSessionStartedMessageParser + { + return this.parser as ChatReviewSessionStartedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/ChatReviewSessionVotingStatusMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/ChatReviewSessionVotingStatusMessageEvent.ts new file mode 100644 index 0000000..693f206 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/ChatReviewSessionVotingStatusMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ChatReviewSessionVotingStatusMessageParser } from '../../parser'; + +export class ChatReviewSessionVotingStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ChatReviewSessionVotingStatusMessageParser); + } + + public getParser(): ChatReviewSessionVotingStatusMessageParser + { + return this.parser as ChatReviewSessionVotingStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideOnDutyStatusMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideOnDutyStatusMessageEvent.ts new file mode 100644 index 0000000..c989e4d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideOnDutyStatusMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuideOnDutyStatusMessageParser } from '../../parser'; + +export class GuideOnDutyStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuideOnDutyStatusMessageParser); + } + + public getParser(): GuideOnDutyStatusMessageParser + { + return this.parser as GuideOnDutyStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideReportingStatusMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideReportingStatusMessageEvent.ts new file mode 100644 index 0000000..ea4a56d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideReportingStatusMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuideReportingStatusMessageParser } from './../../parser'; + +export class GuideReportingStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuideReportingStatusMessageParser); + } + + public getParser(): GuideReportingStatusMessageParser + { + return this.parser as GuideReportingStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionAttachedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionAttachedMessageEvent.ts new file mode 100644 index 0000000..539c041 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionAttachedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuideSessionAttachedMessageParser } from '../../parser'; + +export class GuideSessionAttachedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuideSessionAttachedMessageParser); + } + + public getParser(): GuideSessionAttachedMessageParser + { + return this.parser as GuideSessionAttachedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionDetachedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionDetachedMessageEvent.ts new file mode 100644 index 0000000..0eda406 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionDetachedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuideSessionDetachedMessageParser } from '../../parser'; + +export class GuideSessionDetachedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuideSessionDetachedMessageParser); + } + + public getParser(): GuideSessionDetachedMessageParser + { + return this.parser as GuideSessionDetachedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionEndedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionEndedMessageEvent.ts new file mode 100644 index 0000000..58f7dd1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionEndedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuideSessionEndedMessageParser } from '../../parser'; + +export class GuideSessionEndedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuideSessionEndedMessageParser); + } + + public getParser(): GuideSessionEndedMessageParser + { + return this.parser as GuideSessionEndedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionErrorMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionErrorMessageEvent.ts new file mode 100644 index 0000000..16bbda3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionErrorMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuideSessionErrorMessageParser } from '../../parser'; + +export class GuideSessionErrorMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuideSessionErrorMessageParser); + } + + public getParser(): GuideSessionErrorMessageParser + { + return this.parser as GuideSessionErrorMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionInvitedToGuideRoomMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionInvitedToGuideRoomMessageEvent.ts new file mode 100644 index 0000000..c259c55 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionInvitedToGuideRoomMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuideSessionInvitedToGuideRoomMessageParser } from '../../parser'; + +export class GuideSessionInvitedToGuideRoomMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuideSessionInvitedToGuideRoomMessageParser); + } + + public getParser(): GuideSessionInvitedToGuideRoomMessageParser + { + return this.parser as GuideSessionInvitedToGuideRoomMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionMessageMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionMessageMessageEvent.ts new file mode 100644 index 0000000..5d1ecb2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionMessageMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuideSessionMessageMessageParser } from '../../parser'; + +export class GuideSessionMessageMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuideSessionMessageMessageParser); + } + + public getParser(): GuideSessionMessageMessageParser + { + return this.parser as GuideSessionMessageMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionPartnerIsTypingMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionPartnerIsTypingMessageEvent.ts new file mode 100644 index 0000000..978862f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionPartnerIsTypingMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuideSessionPartnerIsTypingMessageParser } from '../../parser'; + +export class GuideSessionPartnerIsTypingMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuideSessionPartnerIsTypingMessageParser); + } + + public getParser(): GuideSessionPartnerIsTypingMessageParser + { + return this.parser as GuideSessionPartnerIsTypingMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionRequesterRoomMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionRequesterRoomMessageEvent.ts new file mode 100644 index 0000000..ae2464c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionRequesterRoomMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuideSessionRequesterRoomMessageParser } from '../../parser'; + +export class GuideSessionRequesterRoomMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuideSessionRequesterRoomMessageParser); + } + + public getParser(): GuideSessionRequesterRoomMessageParser + { + return this.parser as GuideSessionRequesterRoomMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionStartedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionStartedMessageEvent.ts new file mode 100644 index 0000000..27939e1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideSessionStartedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuideSessionStartedMessageParser } from '../../parser'; + +export class GuideSessionStartedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuideSessionStartedMessageParser); + } + + public getParser(): GuideSessionStartedMessageParser + { + return this.parser as GuideSessionStartedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideTicketCreationResultMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideTicketCreationResultMessageEvent.ts new file mode 100644 index 0000000..cca728d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideTicketCreationResultMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuideTicketCreationResultMessageParser } from '../../parser'; + +export class GuideTicketCreationResultMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuideTicketCreationResultMessageParser); + } + + public getParser(): GuideTicketCreationResultMessageParser + { + return this.parser as GuideTicketCreationResultMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideTicketResolutionMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideTicketResolutionMessageEvent.ts new file mode 100644 index 0000000..861035d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/GuideTicketResolutionMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuideTicketResolutionMessageParser } from '../../parser'; + +export class GuideTicketResolutionMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuideTicketResolutionMessageParser); + } + + public getParser(): GuideTicketResolutionMessageParser + { + return this.parser as GuideTicketResolutionMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/HotelMergeNameChangeEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/HotelMergeNameChangeEvent.ts new file mode 100644 index 0000000..929a7b8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/HotelMergeNameChangeEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { HotelMergeNameChangeParser } from '../../parser'; + +export class HotelMergeNameChangeEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, HotelMergeNameChangeParser); + } + + public getParser(): HotelMergeNameChangeParser + { + return this.parser as HotelMergeNameChangeParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/IssueCloseNotificationMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/IssueCloseNotificationMessageEvent.ts new file mode 100644 index 0000000..b8b3642 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/IssueCloseNotificationMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { IssueCloseNotificationMessageParser } from '../../parser'; + +export class IssueCloseNotificationMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, IssueCloseNotificationMessageParser); + } + + public getParser(): IssueCloseNotificationMessageParser + { + return this.parser as IssueCloseNotificationMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/QuizDataMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/QuizDataMessageEvent.ts new file mode 100644 index 0000000..bf2b6ba --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/QuizDataMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { QuizDataMessageParser } from '../../parser'; + +export class QuizDataMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, QuizDataMessageParser); + } + + public getParser(): QuizDataMessageParser + { + return this.parser as QuizDataMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/QuizResultsMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/QuizResultsMessageEvent.ts new file mode 100644 index 0000000..d1d8806 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/QuizResultsMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { QuizResultsMessageParser } from '../../parser'; + +export class QuizResultsMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, QuizResultsMessageParser); + } + + public getParser(): QuizResultsMessageParser + { + return this.parser as QuizResultsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/help/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/help/index.ts new file mode 100644 index 0000000..029319e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/help/index.ts @@ -0,0 +1,27 @@ +export * from './CallForHelpDisabledNotifyMessageEvent'; +export * from './CallForHelpPendingCallsDeletedMessageEvent'; +export * from './CallForHelpPendingCallsMessageEvent'; +export * from './CallForHelpReplyMessageEvent'; +export * from './CallForHelpResultMessageEvent'; +export * from './ChatReviewSessionDetachedMessageEvent'; +export * from './ChatReviewSessionOfferedToGuideMessageEvent'; +export * from './ChatReviewSessionResultsMessageEvent'; +export * from './ChatReviewSessionStartedMessageEvent'; +export * from './ChatReviewSessionVotingStatusMessageEvent'; +export * from './GuideOnDutyStatusMessageEvent'; +export * from './GuideReportingStatusMessageEvent'; +export * from './GuideSessionAttachedMessageEvent'; +export * from './GuideSessionDetachedMessageEvent'; +export * from './GuideSessionEndedMessageEvent'; +export * from './GuideSessionErrorMessageEvent'; +export * from './GuideSessionInvitedToGuideRoomMessageEvent'; +export * from './GuideSessionMessageMessageEvent'; +export * from './GuideSessionPartnerIsTypingMessageEvent'; +export * from './GuideSessionRequesterRoomMessageEvent'; +export * from './GuideSessionStartedMessageEvent'; +export * from './GuideTicketCreationResultMessageEvent'; +export * from './GuideTicketResolutionMessageEvent'; +export * from './HotelMergeNameChangeEvent'; +export * from './IssueCloseNotificationMessageEvent'; +export * from './QuizDataMessageEvent'; +export * from './QuizResultsMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/index.ts new file mode 100644 index 0000000..d9e905c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/index.ts @@ -0,0 +1,75 @@ +export * from './advertisement'; +export * from './availability'; +export * from './avatar'; +export * from './bots'; +export * from './callforhelp'; +export * from './camera'; +export * from './campaign'; +export * from './catalog'; +export * from './client'; +export * from './competition'; +export * from './crafting'; +export * from './desktop'; +export * from './friendlist'; +export * from './game'; +export * from './game/directory'; +export * from './game/lobby'; +export * from './game/score'; +export * from './generic'; +export * from './gifts'; +export * from './group'; +export * from './groupforums'; +export * from './handshake'; +export * from './help'; +export * from './IncomingHeader'; +export * from './inventory'; +export * from './inventory/achievements'; +export * from './inventory/avatareffect'; +export * from './inventory/badges'; +export * from './inventory/clothes'; +export * from './inventory/furni'; +export * from './inventory/furni/gifts'; +export * from './inventory/pets'; +export * from './inventory/trading'; +export * from './landingview'; +export * from './landingview/votes'; +export * from './marketplace'; +export * from './moderation'; +export * from './mysterybox'; +export * from './navigator'; +export * from './notifications'; +export * from './nux'; +export * from './perk'; +export * from './pet'; +export * from './poll'; +export * from './quest'; +export * from './recycler'; +export * from './room'; +export * from './room/access'; +export * from './room/access/doorbell'; +export * from './room/access/rights'; +export * from './room/bots'; +export * from './room/data'; +export * from './room/engine'; +export * from './room/furniture'; +export * from './room/furniture/floor'; +export * from './room/furniture/wall'; +export * from './room/furniture/youtube'; +export * from './room/mapping'; +export * from './room/pet'; +export * from './room/session'; +export * from './room/unit'; +export * from './room/unit/chat'; +export * from './roomevents'; +export * from './roomsettings'; +export * from './security'; +export * from './sound'; +export * from './talent'; +export * from './user'; +export * from './user/access'; +export * from './user/data'; +export * from './user/inventory'; +export * from './user/inventory/currency'; +export * from './user/inventory/subscription'; +export * from './user/wardrobe'; +export * from './userclassification'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/achievements/AchievementEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/achievements/AchievementEvent.ts new file mode 100644 index 0000000..9946dec --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/achievements/AchievementEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { AchievementParser } from '../../../parser'; + +export class AchievementEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AchievementParser); + } + + public getParser(): AchievementParser + { + return this.parser as AchievementParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/achievements/AchievementsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/achievements/AchievementsEvent.ts new file mode 100644 index 0000000..cd167bd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/achievements/AchievementsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { AchievementsParser } from '../../../parser'; + +export class AchievementsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AchievementsParser); + } + + public getParser(): AchievementsParser + { + return this.parser as AchievementsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/achievements/AchievementsScoreEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/achievements/AchievementsScoreEvent.ts new file mode 100644 index 0000000..4e33970 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/achievements/AchievementsScoreEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { AchievementsScoreParser } from '../../../parser'; + +export class AchievementsScoreEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AchievementsScoreParser); + } + + public getParser(): AchievementsScoreParser + { + return this.parser as AchievementsScoreParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/achievements/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/achievements/index.ts new file mode 100644 index 0000000..1344aec --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/achievements/index.ts @@ -0,0 +1,3 @@ +export * from './AchievementEvent'; +export * from './AchievementsEvent'; +export * from './AchievementsScoreEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/AvatarEffectActivatedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/AvatarEffectActivatedEvent.ts new file mode 100644 index 0000000..89570a2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/AvatarEffectActivatedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { AvatarEffectActivatedParser } from '../../../parser'; + +export class AvatarEffectActivatedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AvatarEffectActivatedParser); + } + + public getParser(): AvatarEffectActivatedParser + { + return this.parser as AvatarEffectActivatedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/AvatarEffectAddedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/AvatarEffectAddedEvent.ts new file mode 100644 index 0000000..7f63c95 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/AvatarEffectAddedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { AvatarEffectAddedParser } from '../../../parser'; + +export class AvatarEffectAddedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AvatarEffectAddedParser); + } + + public getParser(): AvatarEffectAddedParser + { + return this.parser as AvatarEffectAddedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/AvatarEffectExpiredEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/AvatarEffectExpiredEvent.ts new file mode 100644 index 0000000..2e67098 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/AvatarEffectExpiredEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { AvatarEffectExpiredParser } from '../../../parser'; + +export class AvatarEffectExpiredEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AvatarEffectExpiredParser); + } + + public getParser(): AvatarEffectExpiredParser + { + return this.parser as AvatarEffectExpiredParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/AvatarEffectSelectedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/AvatarEffectSelectedEvent.ts new file mode 100644 index 0000000..451186c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/AvatarEffectSelectedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { AvatarEffectSelectedParser } from '../../../parser'; + +export class AvatarEffectSelectedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AvatarEffectSelectedParser); + } + + public getParser(): AvatarEffectSelectedParser + { + return this.parser as AvatarEffectSelectedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/AvatarEffectsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/AvatarEffectsEvent.ts new file mode 100644 index 0000000..40d0a22 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/AvatarEffectsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { AvatarEffectsParser } from '../../../parser'; + +export class AvatarEffectsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AvatarEffectsParser); + } + + public getParser(): AvatarEffectsParser + { + return this.parser as AvatarEffectsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/index.ts new file mode 100644 index 0000000..4a407ad --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/avatareffect/index.ts @@ -0,0 +1,5 @@ +export * from './AvatarEffectActivatedEvent'; +export * from './AvatarEffectAddedEvent'; +export * from './AvatarEffectExpiredEvent'; +export * from './AvatarEffectSelectedEvent'; +export * from './AvatarEffectsEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/badges/BadgePointLimitsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/badges/BadgePointLimitsEvent.ts new file mode 100644 index 0000000..bc6d58e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/badges/BadgePointLimitsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { BadgePointLimitsParser } from '../../../parser'; + +export class BadgePointLimitsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BadgePointLimitsParser); + } + + public getParser(): BadgePointLimitsParser + { + return this.parser as BadgePointLimitsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/badges/BadgeReceivedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/badges/BadgeReceivedEvent.ts new file mode 100644 index 0000000..60d2b98 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/badges/BadgeReceivedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { BadgeReceivedParser } from '../../../parser'; + +export class BadgeReceivedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BadgeReceivedParser); + } + + public getParser(): BadgeReceivedParser + { + return this.parser as BadgeReceivedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/badges/BadgesEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/badges/BadgesEvent.ts new file mode 100644 index 0000000..1b446e0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/badges/BadgesEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { BadgesParser } from '../../../parser'; + +export class BadgesEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BadgesParser); + } + + public getParser(): BadgesParser + { + return this.parser as BadgesParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/badges/IsBadgeRequestFulfilledEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/badges/IsBadgeRequestFulfilledEvent.ts new file mode 100644 index 0000000..ca820dd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/badges/IsBadgeRequestFulfilledEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { IsBadgeRequestFulfilledParser } from '../../../parser'; + +export class IsBadgeRequestFulfilledEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, IsBadgeRequestFulfilledParser); + } + + public getParser(): IsBadgeRequestFulfilledParser + { + return this.parser as IsBadgeRequestFulfilledParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/badges/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/badges/index.ts new file mode 100644 index 0000000..fe4c995 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/badges/index.ts @@ -0,0 +1,4 @@ +export * from './BadgePointLimitsEvent'; +export * from './BadgeReceivedEvent'; +export * from './BadgesEvent'; +export * from './IsBadgeRequestFulfilledEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/clothes/FigureSetIdsMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/clothes/FigureSetIdsMessageEvent.ts new file mode 100644 index 0000000..153d74f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/clothes/FigureSetIdsMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { FigureSetIdsMessageParser } from '../../../parser'; + +export class FigureSetIdsMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FigureSetIdsMessageParser); + } + + public getParser(): FigureSetIdsMessageParser + { + return this.parser as FigureSetIdsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/clothes/_Str_16135.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/clothes/_Str_16135.ts new file mode 100644 index 0000000..d1f356f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/clothes/_Str_16135.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { _Str_8728 } from '../../../parser'; + +export class _Str_16135 extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, _Str_8728); + } + + public getParser(): _Str_8728 + { + return this.parser as _Str_8728; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/clothes/_Str_17532.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/clothes/_Str_17532.ts new file mode 100644 index 0000000..f41a9c2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/clothes/_Str_17532.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { _Str_9021 } from '../../../parser'; + +export class _Str_17532 extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, _Str_9021); + } + + public getParser(): _Str_9021 + { + return this.parser as _Str_9021; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/clothes/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/clothes/index.ts new file mode 100644 index 0000000..477fbf3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/clothes/index.ts @@ -0,0 +1,3 @@ +export * from './FigureSetIdsMessageEvent'; +export * from './_Str_16135'; +export * from './_Str_17532'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/FurnitureListAddOrUpdateEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/FurnitureListAddOrUpdateEvent.ts new file mode 100644 index 0000000..3baee65 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/FurnitureListAddOrUpdateEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { FurnitureListAddOrUpdateParser } from '../../../parser'; + +export class FurnitureListAddOrUpdateEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurnitureListAddOrUpdateParser); + } + + public getParser(): FurnitureListAddOrUpdateParser + { + return this.parser as FurnitureListAddOrUpdateParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/FurnitureListEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/FurnitureListEvent.ts new file mode 100644 index 0000000..abf9e71 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/FurnitureListEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { FurnitureListParser } from '../../../parser'; + +export class FurnitureListEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurnitureListParser); + } + + public getParser(): FurnitureListParser + { + return this.parser as FurnitureListParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/FurnitureListInvalidateEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/FurnitureListInvalidateEvent.ts new file mode 100644 index 0000000..5b3b404 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/FurnitureListInvalidateEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { FurnitureListInvalidateParser } from '../../../parser'; + +export class FurnitureListInvalidateEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurnitureListInvalidateParser); + } + + public getParser(): FurnitureListInvalidateParser + { + return this.parser as FurnitureListInvalidateParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/FurnitureListRemovedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/FurnitureListRemovedEvent.ts new file mode 100644 index 0000000..b7b1aaf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/FurnitureListRemovedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { FurnitureListRemovedParser } from '../../../parser'; + +export class FurnitureListRemovedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurnitureListRemovedParser); + } + + public getParser(): FurnitureListRemovedParser + { + return this.parser as FurnitureListRemovedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/FurniturePostItPlacedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/FurniturePostItPlacedEvent.ts new file mode 100644 index 0000000..50296e0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/FurniturePostItPlacedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { FurniturePostItPlacedParser } from '../../../parser'; + +export class FurniturePostItPlacedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurniturePostItPlacedParser); + } + + public getParser(): FurniturePostItPlacedParser + { + return this.parser as FurniturePostItPlacedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/gifts/PresentOpenedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/gifts/PresentOpenedMessageEvent.ts new file mode 100644 index 0000000..d818781 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/gifts/PresentOpenedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { PresentOpenedMessageParser } from '../../../../parser'; + +export class PresentOpenedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PresentOpenedMessageParser); + } + + public getParser(): PresentOpenedMessageParser + { + return this.parser as PresentOpenedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/gifts/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/gifts/index.ts new file mode 100644 index 0000000..349aca7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/gifts/index.ts @@ -0,0 +1 @@ +export * from './PresentOpenedMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/index.ts new file mode 100644 index 0000000..79c3096 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/furni/index.ts @@ -0,0 +1,6 @@ +export * from './FurnitureListAddOrUpdateEvent'; +export * from './FurnitureListEvent'; +export * from './FurnitureListInvalidateEvent'; +export * from './FurnitureListRemovedEvent'; +export * from './FurniturePostItPlacedEvent'; +export * from './gifts'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/index.ts new file mode 100644 index 0000000..4f6ae27 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/index.ts @@ -0,0 +1,8 @@ +export * from './achievements'; +export * from './avatareffect'; +export * from './badges'; +export * from './clothes'; +export * from './furni'; +export * from './furni/gifts'; +export * from './pets'; +export * from './trading'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/ConfirmBreedingRequestEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/ConfirmBreedingRequestEvent.ts new file mode 100644 index 0000000..f7f5b9a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/ConfirmBreedingRequestEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { ConfirmBreedingRequestParser } from '../../../parser'; + +export class ConfirmBreedingRequestEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ConfirmBreedingRequestParser); + } + + public getParser(): ConfirmBreedingRequestParser + { + return this.parser as ConfirmBreedingRequestParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/ConfirmBreedingResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/ConfirmBreedingResultEvent.ts new file mode 100644 index 0000000..62efea7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/ConfirmBreedingResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { ConfirmBreedingResultParser } from '../../../parser'; + +export class ConfirmBreedingResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ConfirmBreedingResultParser); + } + + public getParser(): ConfirmBreedingResultParser + { + return this.parser as ConfirmBreedingResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/GoToBreedingNestFailureEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/GoToBreedingNestFailureEvent.ts new file mode 100644 index 0000000..b22de5b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/GoToBreedingNestFailureEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { GoToBreedingNestFailureParser } from '../../../parser'; + +export class GoToBreedingNestFailureEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GoToBreedingNestFailureParser); + } + + public getParser(): GoToBreedingNestFailureParser + { + return this.parser as GoToBreedingNestFailureParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/NestBreedingSuccessEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/NestBreedingSuccessEvent.ts new file mode 100644 index 0000000..2f82165 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/NestBreedingSuccessEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { NestBreedingSuccessParser } from '../../../parser'; + +export class NestBreedingSuccessEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NestBreedingSuccessParser); + } + + public getParser(): NestBreedingSuccessParser + { + return this.parser as NestBreedingSuccessParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/PetAddedToInventoryEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/PetAddedToInventoryEvent.ts new file mode 100644 index 0000000..ccfafbd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/PetAddedToInventoryEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { PetAddedToInventoryParser } from '../../../parser'; + +export class PetAddedToInventoryEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetAddedToInventoryParser); + } + + public getParser(): PetAddedToInventoryParser + { + return this.parser as PetAddedToInventoryParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/PetInventoryEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/PetInventoryEvent.ts new file mode 100644 index 0000000..e6d02c3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/PetInventoryEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { PetInventoryParser } from '../../../parser'; + +export class PetInventoryEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetInventoryParser); + } + + public getParser(): PetInventoryParser + { + return this.parser as PetInventoryParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/PetReceivedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/PetReceivedMessageEvent.ts new file mode 100644 index 0000000..b1414c3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/PetReceivedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { PetReceivedMessageParser } from '../../../parser'; + +export class PetReceivedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetReceivedMessageParser); + } + + public getParser(): PetReceivedMessageParser + { + return this.parser as PetReceivedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/PetRemovedFromInventoryEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/PetRemovedFromInventoryEvent.ts new file mode 100644 index 0000000..0a4fda8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/PetRemovedFromInventoryEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { PetRemovedFromInventoryParser } from '../../../parser'; + +export class PetRemovedFromInventory extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetRemovedFromInventoryParser); + } + + public getParser(): PetRemovedFromInventoryParser + { + return this.parser as PetRemovedFromInventoryParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/index.ts new file mode 100644 index 0000000..f7c5d97 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/pets/index.ts @@ -0,0 +1,8 @@ +export * from './ConfirmBreedingRequestEvent'; +export * from './ConfirmBreedingResultEvent'; +export * from './GoToBreedingNestFailureEvent'; +export * from './NestBreedingSuccessEvent'; +export * from './PetAddedToInventoryEvent'; +export * from './PetInventoryEvent'; +export * from './PetReceivedMessageEvent'; +export * from './PetRemovedFromInventoryEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingAcceptEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingAcceptEvent.ts new file mode 100644 index 0000000..bf71c7f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingAcceptEvent.ts @@ -0,0 +1,26 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { TradingAcceptParser } from '../../../parser'; + +export class TradingAcceptEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TradingAcceptParser); + } + + public get userID(): number + { + return this.getParser().userID; + } + + public get userAccepts(): boolean + { + return this.getParser().userAccepts; + } + + public getParser(): TradingAcceptParser + { + return this.parser as TradingAcceptParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingCloseEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingCloseEvent.ts new file mode 100644 index 0000000..bb333e8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingCloseEvent.ts @@ -0,0 +1,21 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { TradingCloseParser } from '../../../parser'; + +export class TradingCloseEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TradingCloseParser); + } + + public get userID(): number + { + return this.getParser().userID; + } + + public getParser(): TradingCloseParser + { + return this.parser as TradingCloseParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingCompletedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingCompletedEvent.ts new file mode 100644 index 0000000..d840bba --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingCompletedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { TradingCompletedParser } from '../../../parser'; + +export class TradingCompletedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TradingCompletedParser); + } + + public getParser(): TradingCompletedParser + { + return this.parser as TradingCompletedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingConfirmationEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingConfirmationEvent.ts new file mode 100644 index 0000000..c6d33af --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingConfirmationEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { TradingConfirmationParser } from '../../../parser'; + +export class TradingConfirmationEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TradingConfirmationParser); + } + + public getParser(): TradingConfirmationParser + { + return this.parser as TradingConfirmationParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingListItemEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingListItemEvent.ts new file mode 100644 index 0000000..34e1c6e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingListItemEvent.ts @@ -0,0 +1,56 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { ItemDataStructure, TradingListItemParser } from '../../../parser'; + +export class TradingListItemEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TradingListItemParser); + } + + public get firstUserID(): number + { + return this.getParser().firstUserID; + } + + public get secondUserID(): number + { + return this.getParser().secondUserID; + } + + public get firstUserNumItems(): number + { + return this.getParser().firstUserNumItems; + } + + public get secondUserNumItems(): number + { + return this.getParser().secondUserNumItems; + } + + public get firstUserNumCredits(): number + { + return this.getParser().firstUserNumCredits; + } + + public get secondUserNumCredits(): number + { + return this.getParser().secondUserNumCredits; + } + + public get firstUserItemArray(): ItemDataStructure[] + { + return this.getParser().firstUserItemArray; + } + + public get secondUserItemArray(): ItemDataStructure[] + { + return this.getParser().secondUserItemArray; + } + + public getParser(): TradingListItemParser + { + return this.parser as TradingListItemParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingNoSuchItemEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingNoSuchItemEvent.ts new file mode 100644 index 0000000..be35e34 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingNoSuchItemEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { TradingNoSuchItemParser } from '../../../parser'; + +export class TradingNoSuchItemEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TradingNoSuchItemParser); + } + + public getParser(): TradingNoSuchItemParser + { + return this.parser as TradingNoSuchItemParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingNotOpenEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingNotOpenEvent.ts new file mode 100644 index 0000000..2833163 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingNotOpenEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { TradingNotOpenParser } from '../../../parser'; + +export class TradingNotOpenEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TradingNotOpenParser); + } + + public getParser(): TradingNotOpenParser + { + return this.parser as TradingNotOpenParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingOpenEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingOpenEvent.ts new file mode 100644 index 0000000..7c8fdfa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingOpenEvent.ts @@ -0,0 +1,36 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { TradingOpenParser } from '../../../parser'; + +export class TradingOpenEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TradingOpenParser); + } + + public get userID(): number + { + return this.getParser().userID; + } + + public get userCanTrade(): boolean + { + return this.getParser().userCanTrade; + } + + public get otherUserID(): number + { + return this.getParser().otherUserID; + } + + public get otherUserCanTrade(): boolean + { + return this.getParser().otherUserCanTrade; + } + + public getParser(): TradingOpenParser + { + return this.parser as TradingOpenParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingOpenFailedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingOpenFailedEvent.ts new file mode 100644 index 0000000..ba2f73c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingOpenFailedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { TradingOpenFailedParser } from '../../../parser'; + +export class TradingOpenFailedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TradingOpenFailedParser); + } + + public getParser(): TradingOpenFailedParser + { + return this.parser as TradingOpenFailedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingOtherNotAllowedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingOtherNotAllowedEvent.ts new file mode 100644 index 0000000..c082348 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingOtherNotAllowedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { TradingOtherNotAllowedParser } from '../../../parser'; + +export class TradingOtherNotAllowedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TradingOtherNotAllowedParser); + } + + public getParser(): TradingOtherNotAllowedParser + { + return this.parser as TradingOtherNotAllowedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingYouAreNotAllowedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingYouAreNotAllowedEvent.ts new file mode 100644 index 0000000..4f1b24f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/TradingYouAreNotAllowedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { TradingYouAreNotAllowedParser } from '../../../parser'; + +export class TradingYouAreNotAllowedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TradingYouAreNotAllowedParser); + } + + public getParser(): TradingYouAreNotAllowedParser + { + return this.parser as TradingYouAreNotAllowedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/index.ts new file mode 100644 index 0000000..cddd363 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/inventory/trading/index.ts @@ -0,0 +1,11 @@ +export * from './TradingAcceptEvent'; +export * from './TradingCloseEvent'; +export * from './TradingCompletedEvent'; +export * from './TradingConfirmationEvent'; +export * from './TradingListItemEvent'; +export * from './TradingNoSuchItemEvent'; +export * from './TradingNotOpenEvent'; +export * from './TradingOpenEvent'; +export * from './TradingOpenFailedEvent'; +export * from './TradingOtherNotAllowedEvent'; +export * from './TradingYouAreNotAllowedEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/landingview/PromoArticlesMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/landingview/PromoArticlesMessageEvent.ts new file mode 100644 index 0000000..b74cb48 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/landingview/PromoArticlesMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PromoArticlesMessageParser } from '../../parser'; + +export class PromoArticlesMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PromoArticlesMessageParser); + } + + public getParser(): PromoArticlesMessageParser + { + return this.parser as PromoArticlesMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/landingview/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/landingview/index.ts new file mode 100644 index 0000000..d566aeb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/landingview/index.ts @@ -0,0 +1,2 @@ +export * from './PromoArticlesMessageEvent'; +export * from './votes'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/landingview/votes/CommunityGoalVoteMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/landingview/votes/CommunityGoalVoteMessageEvent.ts new file mode 100644 index 0000000..a4d2631 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/landingview/votes/CommunityGoalVoteMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { CommunityVoteReceivedParser } from '../../../parser'; + +export class CommunityGoalVoteMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CommunityVoteReceivedParser); + } + + public getParser(): CommunityVoteReceivedParser + { + return this.parser as CommunityVoteReceivedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/landingview/votes/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/landingview/votes/index.ts new file mode 100644 index 0000000..adcbb0e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/landingview/votes/index.ts @@ -0,0 +1 @@ +export * from './CommunityGoalVoteMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceBuyOfferResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceBuyOfferResultEvent.ts new file mode 100644 index 0000000..8ee9e26 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceBuyOfferResultEvent.ts @@ -0,0 +1,17 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MarketplaceBuyOfferResultParser } from '../../parser'; + + +export class MarketplaceBuyOfferResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceBuyOfferResultParser); + } + + public getParser(): MarketplaceBuyOfferResultParser + { + return this.parser as MarketplaceBuyOfferResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceCanMakeOfferResult.ts b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceCanMakeOfferResult.ts new file mode 100644 index 0000000..926d674 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceCanMakeOfferResult.ts @@ -0,0 +1,17 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MarketplaceCanMakeOfferResultParser } from '../../parser'; + + +export class MarketplaceCanMakeOfferResult extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceCanMakeOfferResultParser); + } + + public getParser(): MarketplaceCanMakeOfferResultParser + { + return this.parser as MarketplaceCanMakeOfferResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceCancelOfferResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceCancelOfferResultEvent.ts new file mode 100644 index 0000000..b667147 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceCancelOfferResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MarketplaceCancelOfferResultParser } from '../../parser'; + +export class MarketplaceCancelOfferResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceCancelOfferResultParser); + } + + public getParser(): MarketplaceCancelOfferResultParser + { + return this.parser as MarketplaceCancelOfferResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceConfigurationEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceConfigurationEvent.ts new file mode 100644 index 0000000..c8f9713 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceConfigurationEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MarketplaceConfigurationMessageParser } from '../../parser'; + +export class MarketplaceConfigurationEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceConfigurationMessageParser); + } + + public getParser(): MarketplaceConfigurationMessageParser + { + return this.parser as MarketplaceConfigurationMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceItemStatsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceItemStatsEvent.ts new file mode 100644 index 0000000..b42ad6b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceItemStatsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MarketplaceItemStatsParser } from '../../parser'; + +export class MarketplaceItemStatsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceItemStatsParser); + } + + public getParser(): MarketplaceItemStatsParser + { + return this.parser as MarketplaceItemStatsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceMakeOfferResult.ts b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceMakeOfferResult.ts new file mode 100644 index 0000000..67f2f7c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceMakeOfferResult.ts @@ -0,0 +1,17 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MarketplaceMakeOfferResultParser } from '../../parser'; + + +export class MarketplaceMakeOfferResult extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceMakeOfferResultParser); + } + + public getParser(): MarketplaceMakeOfferResultParser + { + return this.parser as MarketplaceMakeOfferResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceOffersEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceOffersEvent.ts new file mode 100644 index 0000000..f0430c8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceOffersEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MarketplaceOffersParser } from '../../parser'; + +export class MarketPlaceOffersEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceOffersParser); + } + + public getParser(): MarketplaceOffersParser + { + return this.parser as MarketplaceOffersParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceOwnOffersEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceOwnOffersEvent.ts new file mode 100644 index 0000000..07f829a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/MarketplaceOwnOffersEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MarketplaceOwnOffersParser } from '../../parser'; + +export class MarketplaceOwnOffersEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MarketplaceOwnOffersParser); + } + + public getParser(): MarketplaceOwnOffersParser + { + return this.parser as MarketplaceOwnOffersParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/index.ts new file mode 100644 index 0000000..7f4c2d5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/marketplace/index.ts @@ -0,0 +1,8 @@ +export * from './MarketplaceBuyOfferResultEvent'; +export * from './MarketplaceCancelOfferResultEvent'; +export * from './MarketplaceCanMakeOfferResult'; +export * from './MarketplaceConfigurationEvent'; +export * from './MarketplaceItemStatsEvent'; +export * from './MarketplaceMakeOfferResult'; +export * from './MarketplaceOffersEvent'; +export * from './MarketplaceOwnOffersEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/CfhChatlogEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/CfhChatlogEvent.ts new file mode 100644 index 0000000..15f7070 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/CfhChatlogEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CfhChatlogMessageParser } from '../../parser'; + +export class CfhChatlogEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CfhChatlogMessageParser); + } + + public getParser(): CfhChatlogMessageParser + { + return this.parser as CfhChatlogMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/IssueDeletedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/IssueDeletedMessageEvent.ts new file mode 100644 index 0000000..fdc774b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/IssueDeletedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { IssueDeletedMessageParser } from '../../parser'; + +export class IssueDeletedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, IssueDeletedMessageParser); + } + + public getParser(): IssueDeletedMessageParser + { + return this.parser as IssueDeletedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/IssueInfoMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/IssueInfoMessageEvent.ts new file mode 100644 index 0000000..1cccb4d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/IssueInfoMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { IssueInfoMessageParser } from '../../parser'; + +export class IssueInfoMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, IssueInfoMessageParser); + } + + public getParser(): IssueInfoMessageParser + { + return this.parser as IssueInfoMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/IssuePickFailedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/IssuePickFailedMessageEvent.ts new file mode 100644 index 0000000..f57994e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/IssuePickFailedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { IssuePickFailedMessageParser } from '../../parser'; + +export class IssuePickFailedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, IssuePickFailedMessageParser); + } + + public getParser(): IssuePickFailedMessageParser + { + return this.parser as IssuePickFailedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorActionResultMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorActionResultMessageEvent.ts new file mode 100644 index 0000000..3f92dca --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorActionResultMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ModeratorActionResultMessageParser } from '../../parser'; + +export class ModeratorActionResultMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ModeratorActionResultMessageParser); + } + + public getParser(): ModeratorActionResultMessageParser + { + return this.parser as ModeratorActionResultMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorCautionEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorCautionEvent.ts new file mode 100644 index 0000000..5208f43 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorCautionEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ModerationCautionParser } from '../../parser'; + +export class ModeratorCautionEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ModerationCautionParser); + } + + public getParser(): ModerationCautionParser + { + return this.parser as ModerationCautionParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorInitMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorInitMessageEvent.ts new file mode 100644 index 0000000..a4c027d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorInitMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ModeratorInitMessageParser } from '../../parser'; + +export class ModeratorInitMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ModeratorInitMessageParser); + } + + public getParser(): ModeratorInitMessageParser + { + return this.parser as ModeratorInitMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorMessageEvent.ts new file mode 100644 index 0000000..f7c5a3b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ModeratorMessageParser } from '../../parser'; + +export class ModeratorMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ModeratorMessageParser); + } + + public getParser(): ModeratorMessageParser + { + return this.parser as ModeratorMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorRoomInfoEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorRoomInfoEvent.ts new file mode 100644 index 0000000..37490d7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorRoomInfoEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ModeratorRoomInfoMessageParser } from '../../parser'; + +export class ModeratorRoomInfoEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ModeratorRoomInfoMessageParser); + } + + public getParser(): ModeratorRoomInfoMessageParser + { + return this.parser as ModeratorRoomInfoMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorToolPreferencesEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorToolPreferencesEvent.ts new file mode 100644 index 0000000..09d1bf8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorToolPreferencesEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ModeratorToolPreferencesMessageParser } from '../../parser'; + +export class ModeratorToolPreferencesEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ModeratorToolPreferencesMessageParser); + } + + public getParser(): ModeratorToolPreferencesMessageParser + { + return this.parser as ModeratorToolPreferencesMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorUserInfoEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorUserInfoEvent.ts new file mode 100644 index 0000000..44961d5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/ModeratorUserInfoEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ModeratorUserInfoMessageParser } from '../../parser'; + +export class ModeratorUserInfoEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ModeratorUserInfoMessageParser); + } + + public getParser(): ModeratorUserInfoMessageParser + { + return this.parser as ModeratorUserInfoMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/RoomChatlogEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/RoomChatlogEvent.ts new file mode 100644 index 0000000..a41ada4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/RoomChatlogEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomChatlogMessageParser } from '../../parser'; + +export class RoomChatlogEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomChatlogMessageParser); + } + + public getParser(): RoomChatlogMessageParser + { + return this.parser as RoomChatlogMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/RoomVisitsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/RoomVisitsEvent.ts new file mode 100644 index 0000000..16a0339 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/RoomVisitsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomVisitsMessageParser } from '../../parser'; + +export class RoomVisitsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomVisitsMessageParser); + } + + public getParser(): RoomVisitsMessageParser + { + return this.parser as RoomVisitsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/UserBannedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/UserBannedMessageEvent.ts new file mode 100644 index 0000000..2c684e1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/UserBannedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { UserBannedMessageParser } from '../../parser'; + +export class UserBannedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserBannedMessageParser); + } + + public getParser(): UserBannedMessageParser + { + return this.parser as UserBannedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/UserChatlogEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/UserChatlogEvent.ts new file mode 100644 index 0000000..7134e28 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/UserChatlogEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { UserChatlogMessageParser } from '../../parser'; + +export class UserChatlogEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserChatlogMessageParser); + } + + public getParser(): UserChatlogMessageParser + { + return this.parser as UserChatlogMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/moderation/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/index.ts new file mode 100644 index 0000000..2bbc0c0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/moderation/index.ts @@ -0,0 +1,15 @@ +export * from './CfhChatlogEvent'; +export * from './IssueDeletedMessageEvent'; +export * from './IssueInfoMessageEvent'; +export * from './IssuePickFailedMessageEvent'; +export * from './ModeratorActionResultMessageEvent'; +export * from './ModeratorCautionEvent'; +export * from './ModeratorInitMessageEvent'; +export * from './ModeratorMessageEvent'; +export * from './ModeratorRoomInfoEvent'; +export * from './ModeratorToolPreferencesEvent'; +export * from './ModeratorUserInfoEvent'; +export * from './RoomChatlogEvent'; +export * from './RoomVisitsEvent'; +export * from './UserBannedMessageEvent'; +export * from './UserChatlogEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/mysterybox/CancelMysteryBoxWaitMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/mysterybox/CancelMysteryBoxWaitMessageEvent.ts new file mode 100644 index 0000000..4d1ecb0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/mysterybox/CancelMysteryBoxWaitMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CancelMysteryBoxWaitMessageParser } from '../../parser/mysterybox'; + +export class CancelMysteryBoxWaitMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CancelMysteryBoxWaitMessageParser); + } + + public getParser(): CancelMysteryBoxWaitMessageParser + { + return this.parser as CancelMysteryBoxWaitMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/mysterybox/GotMysteryBoxPrizeMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/mysterybox/GotMysteryBoxPrizeMessageEvent.ts new file mode 100644 index 0000000..a085d05 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/mysterybox/GotMysteryBoxPrizeMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GotMysteryBoxPrizeMessageParser } from '../../parser/mysterybox'; + +export class GotMysteryBoxPrizeMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GotMysteryBoxPrizeMessageParser); + } + + public getParser(): GotMysteryBoxPrizeMessageParser + { + return this.parser as GotMysteryBoxPrizeMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/mysterybox/MysteryBoxKeysEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/mysterybox/MysteryBoxKeysEvent.ts new file mode 100644 index 0000000..2f71462 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/mysterybox/MysteryBoxKeysEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MysteryBoxKeysParser } from '../../parser'; + +export class MysteryBoxKeysEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MysteryBoxKeysParser); + } + + public getParser(): MysteryBoxKeysParser + { + return this.parser as MysteryBoxKeysParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/mysterybox/ShowMysteryBoxWaitMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/mysterybox/ShowMysteryBoxWaitMessageEvent.ts new file mode 100644 index 0000000..945d362 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/mysterybox/ShowMysteryBoxWaitMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ShowMysteryBoxWaitMessageParser } from '../../parser/mysterybox'; + +export class ShowMysteryBoxWaitMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ShowMysteryBoxWaitMessageParser); + } + + public getParser(): ShowMysteryBoxWaitMessageParser + { + return this.parser as ShowMysteryBoxWaitMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/mysterybox/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/mysterybox/index.ts new file mode 100644 index 0000000..0d41333 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/mysterybox/index.ts @@ -0,0 +1,4 @@ +export * from './CancelMysteryBoxWaitMessageEvent'; +export * from './GotMysteryBoxPrizeMessageEvent'; +export * from './MysteryBoxKeysEvent'; +export * from './ShowMysteryBoxWaitMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/CanCreateRoomEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/CanCreateRoomEvent.ts new file mode 100644 index 0000000..ba811b9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/CanCreateRoomEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CanCreateRoomMessageParser } from '../../parser'; + +export class CanCreateRoomEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CanCreateRoomMessageParser); + } + + public getParser(): CanCreateRoomMessageParser + { + return this.parser as CanCreateRoomMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/CanCreateRoomEventEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/CanCreateRoomEventEvent.ts new file mode 100644 index 0000000..06641da --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/CanCreateRoomEventEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CanCreateRoomEventParser } from '../../parser'; + +export class CanCreateRoomEventEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CanCreateRoomEventParser); + } + + public getParser(): CanCreateRoomEventParser + { + return this.parser as CanCreateRoomEventParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/CategoriesWithVisitorCountEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/CategoriesWithVisitorCountEvent.ts new file mode 100644 index 0000000..eda6d8f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/CategoriesWithVisitorCountEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CategoriesWithVisitorCountParser } from '../../parser'; + +export class CategoriesWithVisitorCountEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CategoriesWithVisitorCountParser); + } + + public getParser(): CategoriesWithVisitorCountParser + { + return this.parser as CategoriesWithVisitorCountParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/CompetitionRoomsDataMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/CompetitionRoomsDataMessageEvent.ts new file mode 100644 index 0000000..71ea806 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/CompetitionRoomsDataMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CompetitionRoomsDataMessageParser } from '../../parser'; + +export class CompetitionRoomsDataMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CompetitionRoomsDataMessageParser); + } + + public getParser(): CompetitionRoomsDataMessageParser + { + return this.parser as CompetitionRoomsDataMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/ConvertedRoomIdEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/ConvertedRoomIdEvent.ts new file mode 100644 index 0000000..f0c39ce --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/ConvertedRoomIdEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ConvertedRoomIdMessageParser } from '../../parser'; + +export class ConvertedRoomIdEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ConvertedRoomIdMessageParser); + } + + public getParser(): ConvertedRoomIdMessageParser + { + return this.parser as ConvertedRoomIdMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/DoorbellMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/DoorbellMessageEvent.ts new file mode 100644 index 0000000..f4c14d7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/DoorbellMessageEvent.ts @@ -0,0 +1,21 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { DoorbellMessageParser } from '../../parser'; + +export class DoorbellMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, DoorbellMessageParser); + } + + public getParser(): DoorbellMessageParser + { + return this.parser as DoorbellMessageParser; + } + + public get userName(): string + { + return this.getParser().userName; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/FavouriteChangedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/FavouriteChangedEvent.ts new file mode 100644 index 0000000..62f1c3a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/FavouriteChangedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { FavouriteChangedMessageParser } from '../../parser'; + +export class FavouriteChangedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FavouriteChangedMessageParser); + } + + public getParser(): FavouriteChangedMessageParser + { + return this.parser as FavouriteChangedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/FavouritesEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/FavouritesEvent.ts new file mode 100644 index 0000000..13aecb2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/FavouritesEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { FavouritesMessageParser } from '../../parser'; + +export class FavouritesEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FavouritesMessageParser); + } + + public getParser(): FavouritesMessageParser + { + return this.parser as FavouritesMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/FlatAccessDeniedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/FlatAccessDeniedMessageEvent.ts new file mode 100644 index 0000000..5ab87ba --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/FlatAccessDeniedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { FlatAccessDeniedMessageParser } from '../../parser'; + +export class FlatAccessDeniedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FlatAccessDeniedMessageParser); + } + + public getParser(): FlatAccessDeniedMessageParser + { + return this.parser as FlatAccessDeniedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/FlatCreatedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/FlatCreatedEvent.ts new file mode 100644 index 0000000..3702d19 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/FlatCreatedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { FlatCreatedMessageParser } from '../../parser'; + +export class FlatCreatedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FlatCreatedMessageParser); + } + + public getParser(): FlatCreatedMessageParser + { + return this.parser as FlatCreatedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/GetGuestRoomResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/GetGuestRoomResultEvent.ts new file mode 100644 index 0000000..190585c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/GetGuestRoomResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GetGuestRoomResultMessageParser } from '../../parser'; + +export class GetGuestRoomResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GetGuestRoomResultMessageParser); + } + + public getParser(): GetGuestRoomResultMessageParser + { + return this.parser as GetGuestRoomResultMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/GuestRoomSearchResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/GuestRoomSearchResultEvent.ts new file mode 100644 index 0000000..a7a65f8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/GuestRoomSearchResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuestRoomSearchResultMessageParser } from '../../parser'; + +export class GuestRoomSearchResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuestRoomSearchResultMessageParser); + } + + public getParser(): GuestRoomSearchResultMessageParser + { + return this.parser as GuestRoomSearchResultMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorCollapsedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorCollapsedEvent.ts new file mode 100644 index 0000000..344f474 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorCollapsedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NavigatorCollapsedParser } from '../../parser'; + +export class NavigatorCollapsedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NavigatorCollapsedParser); + } + + public getParser(): NavigatorCollapsedParser + { + return this.parser as NavigatorCollapsedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorHomeRoomEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorHomeRoomEvent.ts new file mode 100644 index 0000000..c8e80aa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorHomeRoomEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NavigatorHomeRoomParser } from '../../parser'; + +export class NavigatorHomeRoomEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NavigatorHomeRoomParser); + } + + public getParser(): NavigatorHomeRoomParser + { + return this.parser as NavigatorHomeRoomParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorLiftedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorLiftedEvent.ts new file mode 100644 index 0000000..8f95e10 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorLiftedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NavigatorLiftedParser } from '../../parser'; + +export class NavigatorLiftedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NavigatorLiftedParser); + } + + public getParser(): NavigatorLiftedParser + { + return this.parser as NavigatorLiftedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorMetadataEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorMetadataEvent.ts new file mode 100644 index 0000000..f6c2dda --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorMetadataEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NavigatorMetadataParser } from '../../parser'; + +export class NavigatorMetadataEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NavigatorMetadataParser); + } + + public getParser(): NavigatorMetadataParser + { + return this.parser as NavigatorMetadataParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorOpenRoomCreatorEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorOpenRoomCreatorEvent.ts new file mode 100644 index 0000000..a403734 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorOpenRoomCreatorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NavigatorOpenRoomCreatorParser } from '../../parser'; + +export class NavigatorOpenRoomCreatorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NavigatorOpenRoomCreatorParser); + } + + public getParser(): NavigatorOpenRoomCreatorParser + { + return this.parser as NavigatorOpenRoomCreatorParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorSearchEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorSearchEvent.ts new file mode 100644 index 0000000..2ee5fa9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorSearchEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NavigatorSearchParser } from '../../parser'; + +export class NavigatorSearchEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NavigatorSearchParser); + } + + public getParser(): NavigatorSearchParser + { + return this.parser as NavigatorSearchParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorSearchesEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorSearchesEvent.ts new file mode 100644 index 0000000..32a72c4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorSearchesEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NavigatorSearchesParser } from '../../parser'; + +export class NavigatorSearchesEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NavigatorSearchesParser); + } + + public getParser(): NavigatorSearchesParser + { + return this.parser as NavigatorSearchesParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorSettingsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorSettingsEvent.ts new file mode 100644 index 0000000..eed6578 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/NavigatorSettingsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NavigatorSettingsParser } from '../../parser'; + +export class NavigatorSettingsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NavigatorSettingsParser); + } + + public getParser(): NavigatorSettingsParser + { + return this.parser as NavigatorSettingsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/PopularRoomTagsResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/PopularRoomTagsResultEvent.ts new file mode 100644 index 0000000..49b4948 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/PopularRoomTagsResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PopularRoomTagsResultMessageParser } from '../../parser'; + +export class PopularRoomTagsResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PopularRoomTagsResultMessageParser); + } + + public getParser(): PopularRoomTagsResultMessageParser + { + return this.parser as PopularRoomTagsResultMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/RoomEventCancelEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/RoomEventCancelEvent.ts new file mode 100644 index 0000000..4846e93 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/RoomEventCancelEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomEventCancelMessageParser } from '../../parser'; + +export class RoomEventCancelEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomEventCancelMessageParser); + } + + public getParser(): RoomEventCancelMessageParser + { + return this.parser as RoomEventCancelMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/RoomEventEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/RoomEventEvent.ts new file mode 100644 index 0000000..6e8a5de --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/RoomEventEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomEventMessageParser } from '../../parser'; + +export class RoomEventEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomEventMessageParser); + } + + public getParser(): RoomEventMessageParser + { + return this.parser as RoomEventMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/RoomFilterSettingsMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/RoomFilterSettingsMessageEvent.ts new file mode 100644 index 0000000..30b57da --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/RoomFilterSettingsMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomFilterSettingsMessageParser } from '../../parser'; + +export class RoomFilterSettingsMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomFilterSettingsMessageParser); + } + + public getParser(): RoomFilterSettingsMessageParser + { + return this.parser as RoomFilterSettingsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/RoomSettingsUpdatedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/RoomSettingsUpdatedEvent.ts new file mode 100644 index 0000000..a7c04d3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/RoomSettingsUpdatedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomSettingsUpdatedParser } from '../../parser'; + +export class RoomSettingsUpdatedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomSettingsUpdatedParser); + } + + public getParser(): RoomSettingsUpdatedParser + { + return this.parser as RoomSettingsUpdatedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/RoomThumbnailUpdateResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/RoomThumbnailUpdateResultEvent.ts new file mode 100644 index 0000000..7824096 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/RoomThumbnailUpdateResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomThumbnailUpdateResultMessageParser } from '../../parser'; + +export class RoomThumbnailUpdateResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomThumbnailUpdateResultMessageParser); + } + + public getParser(): RoomThumbnailUpdateResultMessageParser + { + return this.parser as RoomThumbnailUpdateResultMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/UserEventCatsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/UserEventCatsEvent.ts new file mode 100644 index 0000000..693ee3f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/UserEventCatsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { UserEventCatsMessageParser } from '../../parser'; + +export class UserEventCatsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserEventCatsMessageParser); + } + + public getParser(): UserEventCatsMessageParser + { + return this.parser as UserEventCatsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/UserFlatCatsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/UserFlatCatsEvent.ts new file mode 100644 index 0000000..9d53f37 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/UserFlatCatsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { UserFlatCatsMessageParser } from '../../parser'; + +export class UserFlatCatsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserFlatCatsMessageParser); + } + + public getParser(): UserFlatCatsMessageParser + { + return this.parser as UserFlatCatsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/navigator/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/index.ts new file mode 100644 index 0000000..deac832 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/navigator/index.ts @@ -0,0 +1,28 @@ +export * from './CanCreateRoomEvent'; +export * from './CanCreateRoomEventEvent'; +export * from './CategoriesWithVisitorCountEvent'; +export * from './CompetitionRoomsDataMessageEvent'; +export * from './ConvertedRoomIdEvent'; +export * from './DoorbellMessageEvent'; +export * from './FavouriteChangedEvent'; +export * from './FavouritesEvent'; +export * from './FlatAccessDeniedMessageEvent'; +export * from './FlatCreatedEvent'; +export * from './GetGuestRoomResultEvent'; +export * from './GuestRoomSearchResultEvent'; +export * from './NavigatorCollapsedEvent'; +export * from './NavigatorHomeRoomEvent'; +export * from './NavigatorLiftedEvent'; +export * from './NavigatorMetadataEvent'; +export * from './NavigatorOpenRoomCreatorEvent'; +export * from './NavigatorSearchesEvent'; +export * from './NavigatorSearchEvent'; +export * from './NavigatorSettingsEvent'; +export * from './PopularRoomTagsResultEvent'; +export * from './RoomEventCancelEvent'; +export * from './RoomEventEvent'; +export * from './RoomFilterSettingsMessageEvent'; +export * from './RoomSettingsUpdatedEvent'; +export * from './RoomThumbnailUpdateResultEvent'; +export * from './UserEventCatsEvent'; +export * from './UserFlatCatsEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/AchievementNotificationMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/AchievementNotificationMessageEvent.ts new file mode 100644 index 0000000..81af079 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/AchievementNotificationMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { AchievementNotificationMessageParser } from '../../parser'; + +export class AchievementNotificationMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AchievementNotificationMessageParser); + } + + public getParser(): AchievementNotificationMessageParser + { + return this.parser as AchievementNotificationMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/ActivityPointNotificationMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/ActivityPointNotificationMessageEvent.ts new file mode 100644 index 0000000..c35b6cc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/ActivityPointNotificationMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ActivityPointNotificationParser } from '../../parser'; + +export class ActivityPointNotificationMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ActivityPointNotificationParser); + } + + public getParser(): ActivityPointNotificationParser + { + return this.parser as ActivityPointNotificationParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/BotErrorEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/BotErrorEvent.ts new file mode 100644 index 0000000..8770bfe --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/BotErrorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { BotErrorEventParser } from '../../parser'; + +export class BotErrorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BotErrorEventParser); + } + + public getParser(): BotErrorEventParser + { + return this.parser as BotErrorEventParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/ClubGiftNotificationEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/ClubGiftNotificationEvent.ts new file mode 100644 index 0000000..a322be9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/ClubGiftNotificationEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ClubGiftNotificationParser } from '../../parser'; + +export class ClubGiftNotificationEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ClubGiftNotificationParser); + } + + public getParser(): ClubGiftNotificationParser + { + return this.parser as ClubGiftNotificationParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/ConnectionErrorEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/ConnectionErrorEvent.ts new file mode 100644 index 0000000..ef2a223 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/ConnectionErrorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ConnectionErrorMessageParser } from '../../parser/notifications/ConnectionErrorMessageParser'; + +export class ConnectionErrorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ConnectionErrorMessageParser); + } + + public getParser(): ConnectionErrorMessageParser + { + return this.parser as ConnectionErrorMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/ElementPointerMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/ElementPointerMessageEvent.ts new file mode 100644 index 0000000..9abc353 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/ElementPointerMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ElementPointerMessageParser } from '../../parser'; + +export class ElementPointerMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ElementPointerMessageParser); + } + + public getParser(): ElementPointerMessageParser + { + return this.parser as ElementPointerMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/HabboBroadcastMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/HabboBroadcastMessageEvent.ts new file mode 100644 index 0000000..574423d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/HabboBroadcastMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { HabboBroadcastMessageParser } from '../../parser'; + +export class HabboBroadcastMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, HabboBroadcastMessageParser); + } + + public getParser(): HabboBroadcastMessageParser + { + return this.parser as HabboBroadcastMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/HotelWillShutdownEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/HotelWillShutdownEvent.ts new file mode 100644 index 0000000..481c158 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/HotelWillShutdownEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { HotelWillShutdownParser } from '../../parser'; + +export class HotelWillShutdownEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, HotelWillShutdownParser); + } + + public getParser(): HotelWillShutdownParser + { + return this.parser as HotelWillShutdownParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/InfoFeedEnableMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/InfoFeedEnableMessageEvent.ts new file mode 100644 index 0000000..aa4a1f0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/InfoFeedEnableMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { InfoFeedEnableMessageParser } from '../../parser'; + +export class InfoFeedEnableMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, InfoFeedEnableMessageParser); + } + + public getParser(): InfoFeedEnableMessageParser + { + return this.parser as InfoFeedEnableMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/MOTDNotificationEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/MOTDNotificationEvent.ts new file mode 100644 index 0000000..1ef2d8c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/MOTDNotificationEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MOTDNotificationParser } from '../../parser'; + +export class MOTDNotificationEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MOTDNotificationParser); + } + + public getParser(): MOTDNotificationParser + { + return this.parser as MOTDNotificationParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/NotificationDialogMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/NotificationDialogMessageEvent.ts new file mode 100644 index 0000000..102d35e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/NotificationDialogMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NotificationDialogMessageParser } from '../../parser'; + +export class NotificationDialogMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NotificationDialogMessageParser); + } + + public getParser(): NotificationDialogMessageParser + { + return this.parser as NotificationDialogMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/OfferRewardDeliveredMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/OfferRewardDeliveredMessageEvent.ts new file mode 100644 index 0000000..fe22151 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/OfferRewardDeliveredMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { OfferRewardDeliveredMessageParser } from '../../parser'; + +export class OfferRewardDeliveredMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, OfferRewardDeliveredMessageParser); + } + + public getParser(): OfferRewardDeliveredMessageParser + { + return this.parser as OfferRewardDeliveredMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/PetLevelNotificationEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/PetLevelNotificationEvent.ts new file mode 100644 index 0000000..300836c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/PetLevelNotificationEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PetLevelNotificationParser } from '../../parser'; + +export class PetLevelNotificationEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetLevelNotificationParser); + } + + public getParser(): PetLevelNotificationParser + { + return this.parser as PetLevelNotificationParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/PetPlacingErrorEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/PetPlacingErrorEvent.ts new file mode 100644 index 0000000..093b4c3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/PetPlacingErrorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PetPlacingErrorEventParser } from '../../parser'; + +export class PetPlacingErrorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetPlacingErrorEventParser); + } + + public getParser(): PetPlacingErrorEventParser + { + return this.parser as PetPlacingErrorEventParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/RestoreClientMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/RestoreClientMessageEvent.ts new file mode 100644 index 0000000..8537758 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/RestoreClientMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RestoreClientMessageParser } from '../../parser'; + +export class RestoreClientMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RestoreClientMessageParser); + } + + public getParser(): RestoreClientMessageParser + { + return this.parser as RestoreClientMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/SimpleAlertMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/SimpleAlertMessageEvent.ts new file mode 100644 index 0000000..c9192e2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/SimpleAlertMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { SimpleAlertMessageParser } from '../../parser'; + +export class SimpleAlertMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, SimpleAlertMessageParser); + } + + public getParser(): SimpleAlertMessageParser + { + return this.parser as SimpleAlertMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/UnseenItemsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/UnseenItemsEvent.ts new file mode 100644 index 0000000..51cbd65 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/UnseenItemsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { UnseenItemsParser } from '../../parser'; + +export class UnseenItemsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UnseenItemsParser); + } + + public getParser(): UnseenItemsParser + { + return this.parser as UnseenItemsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/notifications/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/index.ts new file mode 100644 index 0000000..943253e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/notifications/index.ts @@ -0,0 +1,17 @@ +export * from './AchievementNotificationMessageEvent'; +export * from './ActivityPointNotificationMessageEvent'; +export * from './BotErrorEvent'; +export * from './ClubGiftNotificationEvent'; +export * from './ConnectionErrorEvent'; +export * from './ElementPointerMessageEvent'; +export * from './HabboBroadcastMessageEvent'; +export * from './HotelWillShutdownEvent'; +export * from './InfoFeedEnableMessageEvent'; +export * from './MOTDNotificationEvent'; +export * from './NotificationDialogMessageEvent'; +export * from './OfferRewardDeliveredMessageEvent'; +export * from './PetLevelNotificationEvent'; +export * from './PetPlacingErrorEvent'; +export * from './RestoreClientMessageEvent'; +export * from './SimpleAlertMessageEvent'; +export * from './UnseenItemsEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/nux/NewUserExperienceGift.ts b/submodules/renderer/src/nitro/communication/messages/incoming/nux/NewUserExperienceGift.ts new file mode 100644 index 0000000..ecc4045 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/nux/NewUserExperienceGift.ts @@ -0,0 +1,37 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { ProductOffer } from './ProductOffer'; + +export class NewUserExperienceGift +{ + private _thumbnailUrl: string; + private _productOfferList: ProductOffer[]; + + constructor(wrapper: IMessageDataWrapper) + { + this._thumbnailUrl = wrapper.readString(); + if(this._thumbnailUrl == '') + { + this._thumbnailUrl = null; + } + + this._productOfferList = []; + const count:number = wrapper.readInt(); + let index = 0; + + while(index < count) + { + this._productOfferList.push(new ProductOffer(wrapper)); + index++; + } + } + + public get productOfferList(): ProductOffer[] + { + return this._productOfferList; + } + + public get thumbnailUrl(): string + { + return this._thumbnailUrl; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/nux/NewUserExperienceGiftOfferMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/nux/NewUserExperienceGiftOfferMessageEvent.ts new file mode 100644 index 0000000..3f8d4d0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/nux/NewUserExperienceGiftOfferMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NewUserExperienceGiftOfferMessageParser } from '../../parser/nux'; + +export class NewUserExperienceGiftOfferMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NewUserExperienceGiftOfferMessageParser); + } + + public getParser(): NewUserExperienceGiftOfferMessageParser + { + return this.parser as NewUserExperienceGiftOfferMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/nux/NewUserExperienceGiftOptions.ts b/submodules/renderer/src/nitro/communication/messages/incoming/nux/NewUserExperienceGiftOptions.ts new file mode 100644 index 0000000..ff2fd1b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/nux/NewUserExperienceGiftOptions.ts @@ -0,0 +1,40 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { NewUserExperienceGift } from './NewUserExperienceGift'; + +export class NewUserExperienceGiftOptions +{ + private _dayIndex: number; + private _stepIndex: number; + private _options: NewUserExperienceGift[]; + + constructor(wrapper: IMessageDataWrapper) + { + this._dayIndex = wrapper.readInt(); + this._stepIndex = wrapper.readInt(); + this._options = []; + + const count:number = wrapper.readInt(); + let index = 0; + + while(index < count) + { + this._options.push(new NewUserExperienceGift(wrapper)); + index++; + } + } + + public get dayIndex(): number + { + return this._dayIndex; + } + + public get stepIndex(): number + { + return this._stepIndex; + } + + public get options(): NewUserExperienceGift[] + { + return this._options; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/nux/NewUserExperienceNotCompleteEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/nux/NewUserExperienceNotCompleteEvent.ts new file mode 100644 index 0000000..89229d2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/nux/NewUserExperienceNotCompleteEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NewUserExperienceNotCompleteParser } from '../../parser/nux'; + +export class NewUserExperienceNotCompleteEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NewUserExperienceNotCompleteParser); + } + + public getParser(): NewUserExperienceNotCompleteParser + { + return this.parser as NewUserExperienceNotCompleteParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/nux/ProductOffer.ts b/submodules/renderer/src/nitro/communication/messages/incoming/nux/ProductOffer.ts new file mode 100644 index 0000000..9fc58b4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/nux/ProductOffer.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class ProductOffer +{ + private _itemName: string; + private _extraInfo: string; + + constructor(wrapper: IMessageDataWrapper) + { + this._itemName = wrapper.readString(); + this._extraInfo = wrapper.readString(); + + if(this._extraInfo == '') + { + this._extraInfo = null; + } + } + + public get itemName(): string + { + return this._itemName; + } + + public get extraInfo(): string + { + return this._extraInfo; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/nux/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/nux/index.ts new file mode 100644 index 0000000..731f00d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/nux/index.ts @@ -0,0 +1,5 @@ +export * from './NewUserExperienceGift'; +export * from './NewUserExperienceGiftOfferMessageEvent'; +export * from './NewUserExperienceGiftOptions'; +export * from './NewUserExperienceNotCompleteEvent'; +export * from './ProductOffer'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/perk/PerkAllowancesMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/perk/PerkAllowancesMessageEvent.ts new file mode 100644 index 0000000..7d7cf0c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/perk/PerkAllowancesMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PerkAllowancesMessageParser } from './../../parser'; + +export class PerkAllowancesMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PerkAllowancesMessageParser); + } + + public getParser(): PerkAllowancesMessageParser + { + return this.parser as PerkAllowancesMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/perk/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/perk/index.ts new file mode 100644 index 0000000..b19fe4b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/perk/index.ts @@ -0,0 +1 @@ +export * from './PerkAllowancesMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/pet/OpenPetPackageRequestedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/pet/OpenPetPackageRequestedMessageEvent.ts new file mode 100644 index 0000000..88d4482 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/pet/OpenPetPackageRequestedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { OpenPetPackageRequestedMessageParser } from './../../parser'; + +export class OpenPetPackageRequestedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, OpenPetPackageRequestedMessageParser); + } + + public getParser(): OpenPetPackageRequestedMessageParser + { + return this.parser as OpenPetPackageRequestedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/pet/OpenPetPackageResultMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/pet/OpenPetPackageResultMessageEvent.ts new file mode 100644 index 0000000..b1cd4f0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/pet/OpenPetPackageResultMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { OpenPetPackageResultMessageParser } from './../../parser'; + +export class OpenPetPackageResultMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, OpenPetPackageResultMessageParser); + } + + public getParser(): OpenPetPackageResultMessageParser + { + return this.parser as OpenPetPackageResultMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/pet/PetLevelUpdateMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/pet/PetLevelUpdateMessageEvent.ts new file mode 100644 index 0000000..e1c393c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/pet/PetLevelUpdateMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PetLevelUpdateMessageParser } from '../../parser'; + +export class PetLevelUpdateMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetLevelUpdateMessageParser); + } + + public getParser(): PetLevelUpdateMessageParser + { + return this.parser as PetLevelUpdateMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/pet/PetScratchFailedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/pet/PetScratchFailedMessageEvent.ts new file mode 100644 index 0000000..becaaac --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/pet/PetScratchFailedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PetScratchFailedMessageParser } from './../../parser'; + +export class PetScratchFailedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetScratchFailedMessageParser); + } + + public getParser(): PetScratchFailedMessageParser + { + return this.parser as PetScratchFailedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/pet/PetTrainingPanelMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/pet/PetTrainingPanelMessageEvent.ts new file mode 100644 index 0000000..66cf798 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/pet/PetTrainingPanelMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PetTrainingMessageParser } from './../../parser'; + +export class PetTrainingPanelMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetTrainingMessageParser); + } + + public getParser(): PetTrainingMessageParser + { + return this.parser as PetTrainingMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/pet/breeding/PetBreedingMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/pet/breeding/PetBreedingMessageEvent.ts new file mode 100644 index 0000000..21201a2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/pet/breeding/PetBreedingMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { PetBreedingMessageParser } from './../../../parser'; + +export class PetBreedingMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetBreedingMessageParser); + } + + public getParser(): PetBreedingMessageParser + { + return this.parser as PetBreedingMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/pet/breeding/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/pet/breeding/index.ts new file mode 100644 index 0000000..c18ef67 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/pet/breeding/index.ts @@ -0,0 +1 @@ +export * from './PetBreedingMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/pet/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/pet/index.ts new file mode 100644 index 0000000..d5fb00b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/pet/index.ts @@ -0,0 +1,6 @@ +export * from './breeding'; +export * from './OpenPetPackageRequestedMessageEvent'; +export * from './OpenPetPackageResultMessageEvent'; +export * from './PetLevelUpdateMessageEvent'; +export * from './PetScratchFailedMessageEvent'; +export * from './PetTrainingPanelMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/poll/PollContentsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/poll/PollContentsEvent.ts new file mode 100644 index 0000000..fa0674b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/poll/PollContentsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PollContentsParser } from '../../parser'; + +export class PollContentsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PollContentsParser); + } + + public getParser(): PollContentsParser + { + return this.parser as PollContentsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/poll/PollErrorEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/poll/PollErrorEvent.ts new file mode 100644 index 0000000..01bef84 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/poll/PollErrorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PollErrorParser } from '../../parser'; + +export class PollErrorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PollErrorParser); + } + + public getParser(): PollErrorParser + { + return this.parser as PollErrorParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/poll/PollOfferEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/poll/PollOfferEvent.ts new file mode 100644 index 0000000..6aecdd3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/poll/PollOfferEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PollOfferParser } from '../../parser'; + +export class PollOfferEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PollOfferParser); + } + + public getParser(): PollOfferParser + { + return this.parser as PollOfferParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/poll/QuestionAnsweredEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/poll/QuestionAnsweredEvent.ts new file mode 100644 index 0000000..7ea9203 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/poll/QuestionAnsweredEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { QuestionAnsweredParser } from '../../parser'; + +export class QuestionAnsweredEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, QuestionAnsweredParser); + } + + public getParser(): QuestionAnsweredParser + { + return this.parser as QuestionAnsweredParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/poll/QuestionEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/poll/QuestionEvent.ts new file mode 100644 index 0000000..4ec3196 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/poll/QuestionEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { QuestionParser } from '../../parser'; + +export class QuestionEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, QuestionParser); + } + + public getParser(): QuestionParser + { + return this.parser as QuestionParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/poll/QuestionFinishedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/poll/QuestionFinishedEvent.ts new file mode 100644 index 0000000..809e2b2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/poll/QuestionFinishedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { QuestionFinishedParser } from '../../parser'; + +export class QuestionFinishedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, QuestionFinishedParser); + } + + public getParser(): QuestionFinishedParser + { + return this.parser as QuestionFinishedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/poll/RoomPollResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/poll/RoomPollResultEvent.ts new file mode 100644 index 0000000..3af4f9d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/poll/RoomPollResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomPollResultParser } from '../../parser'; + +export class RoomPollResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomPollResultParser); + } + + public getParser(): RoomPollResultParser + { + return this.parser as RoomPollResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/poll/StartRoomPollEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/poll/StartRoomPollEvent.ts new file mode 100644 index 0000000..b89817c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/poll/StartRoomPollEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomPollDataParser } from '../../parser'; + +export class StartRoomPollEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomPollDataParser); + } + + public getParser(): RoomPollDataParser + { + return this.parser as RoomPollDataParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/poll/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/poll/index.ts new file mode 100644 index 0000000..a90c6f5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/poll/index.ts @@ -0,0 +1,8 @@ +export * from './PollContentsEvent'; +export * from './PollErrorEvent'; +export * from './PollOfferEvent'; +export * from './QuestionAnsweredEvent'; +export * from './QuestionEvent'; +export * from './QuestionFinishedEvent'; +export * from './RoomPollResultEvent'; +export * from './StartRoomPollEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/quest/CommunityGoalEarnedPrizesMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/quest/CommunityGoalEarnedPrizesMessageEvent.ts new file mode 100644 index 0000000..9087c13 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/quest/CommunityGoalEarnedPrizesMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CommunityGoalEarnedPrizesMessageParser } from '../../parser'; + +export class CommunityGoalEarnedPrizesMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CommunityGoalEarnedPrizesMessageParser); + } + + public getParser(): CommunityGoalEarnedPrizesMessageParser + { + return this.parser as CommunityGoalEarnedPrizesMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/quest/CommunityGoalHallOfFameMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/quest/CommunityGoalHallOfFameMessageEvent.ts new file mode 100644 index 0000000..0ad79a4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/quest/CommunityGoalHallOfFameMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CommunityGoalHallOfFameMessageParser } from '../../parser'; + +export class CommunityGoalHallOfFameMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CommunityGoalHallOfFameMessageParser); + } + + public getParser(): CommunityGoalHallOfFameMessageParser + { + return this.parser as CommunityGoalHallOfFameMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/quest/CommunityGoalProgressMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/quest/CommunityGoalProgressMessageEvent.ts new file mode 100644 index 0000000..3c0dc05 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/quest/CommunityGoalProgressMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { CommunityGoalProgressMessageParser } from '../../parser'; + +export class CommunityGoalProgressMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CommunityGoalProgressMessageParser); + } + + public getParser(): CommunityGoalProgressMessageParser + { + return this.parser as CommunityGoalProgressMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/quest/ConcurrentUsersGoalProgressMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/quest/ConcurrentUsersGoalProgressMessageEvent.ts new file mode 100644 index 0000000..2f9d4bc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/quest/ConcurrentUsersGoalProgressMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ConcurrentUsersGoalProgressMessageParser } from '../../parser'; + +export class ConcurrentUsersGoalProgressMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ConcurrentUsersGoalProgressMessageParser); + } + + public getParser(): ConcurrentUsersGoalProgressMessageParser + { + return this.parser as ConcurrentUsersGoalProgressMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/quest/EpicPopupMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/quest/EpicPopupMessageEvent.ts new file mode 100644 index 0000000..611bcda --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/quest/EpicPopupMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { EpicPopupMessageParser } from '../../parser'; + +export class EpicPopupMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, EpicPopupMessageParser); + } + + public getParser(): EpicPopupMessageParser + { + return this.parser as EpicPopupMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/quest/QuestCancelledMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/quest/QuestCancelledMessageEvent.ts new file mode 100644 index 0000000..c7f8b01 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/quest/QuestCancelledMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { QuestCancelledMessageParser } from '../../parser'; + +export class QuestCancelledMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, QuestCancelledMessageParser); + } + + public getParser(): QuestCancelledMessageParser + { + return this.parser as QuestCancelledMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/quest/QuestCompletedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/quest/QuestCompletedMessageEvent.ts new file mode 100644 index 0000000..1cd26f7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/quest/QuestCompletedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { QuestCompletedMessageParser } from '../../parser'; + +export class QuestCompletedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, QuestCompletedMessageParser); + } + + public getParser(): QuestCompletedMessageParser + { + return this.parser as QuestCompletedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/quest/QuestDailyMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/quest/QuestDailyMessageEvent.ts new file mode 100644 index 0000000..5ddb274 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/quest/QuestDailyMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { QuestDailyMessageParser } from '../../parser'; + +export class QuestDailyMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, QuestDailyMessageParser); + } + + public getParser(): QuestDailyMessageParser + { + return this.parser as QuestDailyMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/quest/QuestMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/quest/QuestMessageEvent.ts new file mode 100644 index 0000000..774c538 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/quest/QuestMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { QuestMessageParser } from '../../parser'; + +export class QuestMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, QuestMessageParser); + } + + public getParser(): QuestMessageParser + { + return this.parser as QuestMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/quest/QuestsMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/quest/QuestsMessageEvent.ts new file mode 100644 index 0000000..f4a14f3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/quest/QuestsMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { QuestsMessageParser } from '../../parser'; + +export class QuestsMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, QuestsMessageParser); + } + + public getParser(): QuestsMessageParser + { + return this.parser as QuestsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/quest/SeasonalQuestsMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/quest/SeasonalQuestsMessageEvent.ts new file mode 100644 index 0000000..0a5d07e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/quest/SeasonalQuestsMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { SeasonalQuestsParser } from '../../parser'; + +export class SeasonalQuestsMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, SeasonalQuestsParser); + } + + public getParser(): SeasonalQuestsParser + { + return this.parser as SeasonalQuestsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/quest/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/quest/index.ts new file mode 100644 index 0000000..f2b8707 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/quest/index.ts @@ -0,0 +1,11 @@ +export * from './CommunityGoalEarnedPrizesMessageEvent'; +export * from './CommunityGoalHallOfFameMessageEvent'; +export * from './CommunityGoalProgressMessageEvent'; +export * from './ConcurrentUsersGoalProgressMessageEvent'; +export * from './EpicPopupMessageEvent'; +export * from './QuestCancelledMessageEvent'; +export * from './QuestCompletedMessageEvent'; +export * from './QuestDailyMessageEvent'; +export * from './QuestMessageEvent'; +export * from './QuestsMessageEvent'; +export * from './SeasonalQuestsMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/recycler/RecyclerFinishedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/recycler/RecyclerFinishedMessageEvent.ts new file mode 100644 index 0000000..41cfa6f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/recycler/RecyclerFinishedMessageEvent.ts @@ -0,0 +1,19 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RecyclerFinishedMessageParser } from '../../parser'; + +export class RecyclerFinishedMessageEvent extends MessageEvent implements IMessageEvent +{ + public static readonly FINISHED_OK: number = 1; + public static readonly FINISHED_FAIL: number = 2; + + constructor(callBack: Function) + { + super(callBack, RecyclerFinishedMessageParser); + } + + public getParser(): RecyclerFinishedMessageParser + { + return this.parser as RecyclerFinishedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/recycler/RecyclerStatusMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/recycler/RecyclerStatusMessageEvent.ts new file mode 100644 index 0000000..b9a3c6f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/recycler/RecyclerStatusMessageEvent.ts @@ -0,0 +1,20 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RecyclerStatusMessageParser } from '../../parser'; + +export class RecyclerStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + public static readonly SYSTEM_STATUS_ENABLED: number = 1; + public static readonly SYSTEM_STATUS_DISABLED: number = 2; + public static readonly SYSTEM_STATUS_TIMEOUT: number = 3; + + constructor(callBack: Function) + { + super(callBack, RecyclerStatusMessageParser); + } + + public getParser(): RecyclerStatusMessageParser + { + return this.parser as RecyclerStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/recycler/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/recycler/index.ts new file mode 100644 index 0000000..b6f40ee --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/recycler/index.ts @@ -0,0 +1,2 @@ +export * from './RecyclerFinishedMessageEvent'; +export * from './RecyclerStatusMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/access/RoomEnterErrorEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/RoomEnterErrorEvent.ts new file mode 100644 index 0000000..84bf3f8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/RoomEnterErrorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { CantConnectMessageParser } from '../../../parser'; + +export class RoomEnterErrorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CantConnectMessageParser); + } + + public getParser(): CantConnectMessageParser + { + return this.parser as CantConnectMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/access/RoomEnterEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/RoomEnterEvent.ts new file mode 100644 index 0000000..11b9210 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/RoomEnterEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomEnterParser } from '../../../parser'; + +export class RoomEnterEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomEnterParser); + } + + public getParser(): RoomEnterParser + { + return this.parser as RoomEnterParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/access/RoomForwardEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/RoomForwardEvent.ts new file mode 100644 index 0000000..78ce833 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/RoomForwardEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomFowardParser as RoomForwardParser } from '../../../parser'; + +export class RoomForwardEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomForwardParser); + } + + public getParser(): RoomForwardParser + { + return this.parser as RoomForwardParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/access/doorbell/RoomDoorbellAcceptedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/doorbell/RoomDoorbellAcceptedEvent.ts new file mode 100644 index 0000000..5724323 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/doorbell/RoomDoorbellAcceptedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { RoomDoorbellAcceptedParser } from '../../../../parser'; + +export class RoomDoorbellAcceptedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomDoorbellAcceptedParser); + } + + public getParser(): RoomDoorbellAcceptedParser + { + return this.parser as RoomDoorbellAcceptedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/access/doorbell/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/doorbell/index.ts new file mode 100644 index 0000000..ce67bee --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/doorbell/index.ts @@ -0,0 +1 @@ +export * from './RoomDoorbellAcceptedEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/access/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/index.ts new file mode 100644 index 0000000..0e1f2d7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/index.ts @@ -0,0 +1,5 @@ +export * from './doorbell'; +export * from './rights'; +export * from './RoomEnterErrorEvent'; +export * from './RoomEnterEvent'; +export * from './RoomForwardEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/access/rights/RoomRightsClearEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/rights/RoomRightsClearEvent.ts new file mode 100644 index 0000000..b383680 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/rights/RoomRightsClearEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { RoomRightsClearParser } from '../../../../parser'; + +export class RoomRightsClearEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomRightsClearParser); + } + + public getParser(): RoomRightsClearParser + { + return this.parser as RoomRightsClearParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/access/rights/RoomRightsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/rights/RoomRightsEvent.ts new file mode 100644 index 0000000..8299daf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/rights/RoomRightsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { RoomRightsParser } from '../../../../parser'; + +export class RoomRightsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomRightsParser); + } + + public getParser(): RoomRightsParser + { + return this.parser as RoomRightsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/access/rights/RoomRightsOwnerEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/rights/RoomRightsOwnerEvent.ts new file mode 100644 index 0000000..5b59c12 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/rights/RoomRightsOwnerEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { RoomRightsOwnerParser } from '../../../../parser'; + +export class RoomRightsOwnerEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomRightsOwnerParser); + } + + public getParser(): RoomRightsOwnerParser + { + return this.parser as RoomRightsOwnerParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/access/rights/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/rights/index.ts new file mode 100644 index 0000000..9569969 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/access/rights/index.ts @@ -0,0 +1,3 @@ +export * from './RoomRightsClearEvent'; +export * from './RoomRightsEvent'; +export * from './RoomRightsOwnerEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/bots/BotCommandConfigurationEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/bots/BotCommandConfigurationEvent.ts new file mode 100644 index 0000000..2361f35 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/bots/BotCommandConfigurationEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { BotCommandConfigurationParser } from '../../../parser'; + +export class BotCommandConfigurationEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BotCommandConfigurationParser); + } + + public getParser(): BotCommandConfigurationParser + { + return this.parser as BotCommandConfigurationParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/bots/BotForceOpenContextMenuEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/bots/BotForceOpenContextMenuEvent.ts new file mode 100644 index 0000000..d9d9fde --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/bots/BotForceOpenContextMenuEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { BotForceOpenContextMenuParser } from '../../../parser'; + +export class BotForceOpenContextMenuEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BotForceOpenContextMenuParser); + } + + public getParser(): BotForceOpenContextMenuParser + { + return this.parser as BotForceOpenContextMenuParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/bots/BotSkillListUpdateEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/bots/BotSkillListUpdateEvent.ts new file mode 100644 index 0000000..19408ee --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/bots/BotSkillListUpdateEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { BotSkillListUpdateParser } from '../../../parser'; + +export class BotSkillListUpdateEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BotSkillListUpdateParser); + } + + public getParser(): BotSkillListUpdateParser + { + return this.parser as BotSkillListUpdateParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/bots/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/bots/index.ts new file mode 100644 index 0000000..cae047b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/bots/index.ts @@ -0,0 +1,3 @@ +export * from './BotCommandConfigurationEvent'; +export * from './BotForceOpenContextMenuEvent'; +export * from './BotSkillListUpdateEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/data/RoomChatSettingsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/data/RoomChatSettingsEvent.ts new file mode 100644 index 0000000..50b4828 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/data/RoomChatSettingsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomChatSettingsParser } from '../../../parser'; + +export class RoomChatSettingsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomChatSettingsParser); + } + + public getParser(): RoomChatSettingsParser + { + return this.parser as RoomChatSettingsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/data/RoomEntryInfoMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/data/RoomEntryInfoMessageEvent.ts new file mode 100644 index 0000000..535fe0d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/data/RoomEntryInfoMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomEntryInfoMessageParser } from '../../../parser'; + +export class RoomEntryInfoMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomEntryInfoMessageParser); + } + + public getParser(): RoomEntryInfoMessageParser + { + return this.parser as RoomEntryInfoMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/data/RoomScoreEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/data/RoomScoreEvent.ts new file mode 100644 index 0000000..70561d1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/data/RoomScoreEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomScoreParser } from '../../../parser'; + +export class RoomScoreEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomScoreParser); + } + + public getParser(): RoomScoreParser + { + return this.parser as RoomScoreParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/data/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/data/index.ts new file mode 100644 index 0000000..e0187f0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/data/index.ts @@ -0,0 +1,3 @@ +export * from './RoomChatSettingsEvent'; +export * from './RoomEntryInfoMessageEvent'; +export * from './RoomScoreEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/engine/FavoriteMembershipUpdateMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/engine/FavoriteMembershipUpdateMessageEvent.ts new file mode 100644 index 0000000..18c4639 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/engine/FavoriteMembershipUpdateMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { FavoriteMembershipUpdateMessageParser } from '../../../parser'; + +export class FavoriteMembershipUpdateMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FavoriteMembershipUpdateMessageParser); + } + + public getParser(): FavoriteMembershipUpdateMessageParser + { + return this.parser as FavoriteMembershipUpdateMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/engine/ObjectsDataUpdateEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/engine/ObjectsDataUpdateEvent.ts new file mode 100644 index 0000000..a040c57 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/engine/ObjectsDataUpdateEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { ObjectsDataUpdateParser } from '../../../parser'; + +export class ObjectsDataUpdateEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ObjectsDataUpdateParser); + } + + public getParser(): ObjectsDataUpdateParser + { + return this.parser as ObjectsDataUpdateParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/engine/ObjectsRollingEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/engine/ObjectsRollingEvent.ts new file mode 100644 index 0000000..6d96622 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/engine/ObjectsRollingEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { ObjectsRollingParser } from '../../../parser'; + +export class ObjectsRollingEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ObjectsRollingParser); + } + + public getParser(): ObjectsRollingParser + { + return this.parser as ObjectsRollingParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/engine/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/engine/index.ts new file mode 100644 index 0000000..24ceed5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/engine/index.ts @@ -0,0 +1,3 @@ +export * from './FavoriteMembershipUpdateMessageEvent'; +export * from './ObjectsDataUpdateEvent'; +export * from './ObjectsRollingEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/CustomUserNotificationMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/CustomUserNotificationMessageEvent.ts new file mode 100644 index 0000000..e61ec8d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/CustomUserNotificationMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { CustomUserNotificationMessageParser } from '../../../parser'; + +export class CustomUserNotificationMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, CustomUserNotificationMessageParser); + } + + public getParser(): CustomUserNotificationMessageParser + { + return this.parser as CustomUserNotificationMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/DiceValueMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/DiceValueMessageEvent.ts new file mode 100644 index 0000000..53a0593 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/DiceValueMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { DiceValueMessageParser } from '../../../parser'; + +export class DiceValueMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, DiceValueMessageParser); + } + + public getParser(): DiceValueMessageParser + { + return this.parser as DiceValueMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/FurniRentOrBuyoutOfferMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/FurniRentOrBuyoutOfferMessageEvent.ts new file mode 100644 index 0000000..c62d36d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/FurniRentOrBuyoutOfferMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { FurniRentOrBuyoutOfferMessageParser } from '../../../parser'; + +export class FurniRentOrBuyoutOfferMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurniRentOrBuyoutOfferMessageParser); + } + + public getParser(): FurniRentOrBuyoutOfferMessageParser + { + return this.parser as FurniRentOrBuyoutOfferMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/FurnitureAliasesEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/FurnitureAliasesEvent.ts new file mode 100644 index 0000000..a42fe46 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/FurnitureAliasesEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { FurnitureAliasesParser } from '../../../parser'; + +export class FurnitureAliasesEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurnitureAliasesParser); + } + + public getParser(): FurnitureAliasesParser + { + return this.parser as FurnitureAliasesParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/FurnitureDataEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/FurnitureDataEvent.ts new file mode 100644 index 0000000..4b3dc06 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/FurnitureDataEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { FurnitureDataParser } from '../../../parser'; + +export class FurnitureDataEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurnitureDataParser); + } + + public getParser(): FurnitureDataParser + { + return this.parser as FurnitureDataParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/FurnitureStackHeightEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/FurnitureStackHeightEvent.ts new file mode 100644 index 0000000..784e625 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/FurnitureStackHeightEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { FurnitureStackHeightParser } from '../../../parser'; + +export class FurnitureStackHeightEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurnitureStackHeightParser); + } + + public getParser(): FurnitureStackHeightParser + { + return this.parser as FurnitureStackHeightParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/GroupFurniContextMenuInfoMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/GroupFurniContextMenuInfoMessageEvent.ts new file mode 100644 index 0000000..761b30e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/GroupFurniContextMenuInfoMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { GroupFurniContextMenuInfoMessageParser } from '../../../parser'; + +export class GroupFurniContextMenuInfoMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GroupFurniContextMenuInfoMessageParser); + } + + public getParser(): GroupFurniContextMenuInfoMessageParser + { + return this.parser as GroupFurniContextMenuInfoMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/ItemDataUpdateMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/ItemDataUpdateMessageEvent.ts new file mode 100644 index 0000000..fd43849 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/ItemDataUpdateMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { ItemDataUpdateMessageParser } from '../../../parser'; + +export class ItemDataUpdateMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ItemDataUpdateMessageParser); + } + + public getParser(): ItemDataUpdateMessageParser + { + return this.parser as ItemDataUpdateMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/LoveLockFurniFinishedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/LoveLockFurniFinishedEvent.ts new file mode 100644 index 0000000..e7bf208 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/LoveLockFurniFinishedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { LoveLockFurniFinishedParser } from '../../../parser'; + +export class LoveLockFurniFinishedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, LoveLockFurniFinishedParser); + } + + public getParser(): LoveLockFurniFinishedParser + { + return this.parser as LoveLockFurniFinishedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/LoveLockFurniFriendConfirmedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/LoveLockFurniFriendConfirmedEvent.ts new file mode 100644 index 0000000..34316d6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/LoveLockFurniFriendConfirmedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { LoveLockFurniFriendConfirmedParser } from '../../../parser'; + +export class LoveLockFurniFriendConfirmedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, LoveLockFurniFriendConfirmedParser); + } + + public getParser(): LoveLockFurniFriendConfirmedParser + { + return this.parser as LoveLockFurniFriendConfirmedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/LoveLockFurniStartEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/LoveLockFurniStartEvent.ts new file mode 100644 index 0000000..f1b65c5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/LoveLockFurniStartEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { LoveLockFurniStartParser } from '../../../parser'; + +export class LoveLockFurniStartEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, LoveLockFurniStartParser); + } + + public getParser(): LoveLockFurniStartParser + { + return this.parser as LoveLockFurniStartParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/OneWayDoorStatusMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/OneWayDoorStatusMessageEvent.ts new file mode 100644 index 0000000..35ac593 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/OneWayDoorStatusMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { OneWayDoorStatusMessageParser } from '../../../parser'; + +export class OneWayDoorStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, OneWayDoorStatusMessageParser); + } + + public getParser(): OneWayDoorStatusMessageParser + { + return this.parser as OneWayDoorStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RentableSpaceRentFailedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RentableSpaceRentFailedMessageEvent.ts new file mode 100644 index 0000000..248f101 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RentableSpaceRentFailedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RentableSpaceRentFailedMessageParser } from '../../../parser'; + +export class RentableSpaceRentFailedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RentableSpaceRentFailedMessageParser); + } + + public getParser(): RentableSpaceRentFailedMessageParser + { + return this.parser as RentableSpaceRentFailedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RentableSpaceRentOkMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RentableSpaceRentOkMessageEvent.ts new file mode 100644 index 0000000..3a66e9d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RentableSpaceRentOkMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RentableSpaceRentOkMessageParser } from '../../../parser'; + +export class RentableSpaceRentOkMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RentableSpaceRentOkMessageParser); + } + + public getParser(): RentableSpaceRentOkMessageParser + { + return this.parser as RentableSpaceRentOkMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RentableSpaceStatusMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RentableSpaceStatusMessageEvent.ts new file mode 100644 index 0000000..02d3d0b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RentableSpaceStatusMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RentableSpaceStatusMessageParser } from '../../../parser'; + +export class RentableSpaceStatusMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RentableSpaceStatusMessageParser); + } + + public getParser(): RentableSpaceStatusMessageParser + { + return this.parser as RentableSpaceStatusMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RequestSpamWallPostItMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RequestSpamWallPostItMessageEvent.ts new file mode 100644 index 0000000..03d9e4b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RequestSpamWallPostItMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RequestSpamWallPostItMessageParser } from '../../../parser'; + +export class RequestSpamWallPostItMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RequestSpamWallPostItMessageParser); + } + + public getParser(): RequestSpamWallPostItMessageParser + { + return this.parser as RequestSpamWallPostItMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RoomDimmerPresetsMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RoomDimmerPresetsMessageEvent.ts new file mode 100644 index 0000000..dab41b9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RoomDimmerPresetsMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomDimmerPresetsMessageParser } from '../../../parser'; + +export class RoomDimmerPresetsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomDimmerPresetsMessageParser); + } + + public getParser(): RoomDimmerPresetsMessageParser + { + return this.parser as RoomDimmerPresetsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RoomMessageNotificationMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RoomMessageNotificationMessageEvent.ts new file mode 100644 index 0000000..64c303a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/RoomMessageNotificationMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomMessageNotificationMessageParser } from '../../../parser'; + +export class RoomMessageNotificationMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomMessageNotificationMessageParser); + } + + public getParser(): RoomMessageNotificationMessageParser + { + return this.parser as RoomMessageNotificationMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/WelcomeGiftStatusEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/WelcomeGiftStatusEvent.ts new file mode 100644 index 0000000..a4b946c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/WelcomeGiftStatusEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { WelcomeGiftStatusParser } from '../../../parser'; + +export class WelcomeGiftStatusEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, WelcomeGiftStatusParser); + } + + public getParser(): WelcomeGiftStatusParser + { + return this.parser as WelcomeGiftStatusParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/floor/FurnitureFloorAddEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/floor/FurnitureFloorAddEvent.ts new file mode 100644 index 0000000..c606f9f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/floor/FurnitureFloorAddEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { FurnitureFloorAddParser } from '../../../../parser'; + +export class FurnitureFloorAddEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurnitureFloorAddParser); + } + + public getParser(): FurnitureFloorAddParser + { + return this.parser as FurnitureFloorAddParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/floor/FurnitureFloorEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/floor/FurnitureFloorEvent.ts new file mode 100644 index 0000000..0aa41ba --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/floor/FurnitureFloorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { FurnitureFloorParser } from '../../../../parser'; + +export class FurnitureFloorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurnitureFloorParser); + } + + public getParser(): FurnitureFloorParser + { + return this.parser as FurnitureFloorParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/floor/FurnitureFloorRemoveEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/floor/FurnitureFloorRemoveEvent.ts new file mode 100644 index 0000000..0da0907 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/floor/FurnitureFloorRemoveEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { FurnitureFloorRemoveParser } from '../../../../parser'; + +export class FurnitureFloorRemoveEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurnitureFloorRemoveParser); + } + + public getParser(): FurnitureFloorRemoveParser + { + return this.parser as FurnitureFloorRemoveParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/floor/FurnitureFloorUpdateEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/floor/FurnitureFloorUpdateEvent.ts new file mode 100644 index 0000000..df99117 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/floor/FurnitureFloorUpdateEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { FurnitureFloorUpdateParser } from '../../../../parser'; + +export class FurnitureFloorUpdateEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurnitureFloorUpdateParser); + } + + public getParser(): FurnitureFloorUpdateParser + { + return this.parser as FurnitureFloorUpdateParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/floor/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/floor/index.ts new file mode 100644 index 0000000..4b0cb67 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/floor/index.ts @@ -0,0 +1,4 @@ +export * from './FurnitureFloorAddEvent'; +export * from './FurnitureFloorEvent'; +export * from './FurnitureFloorRemoveEvent'; +export * from './FurnitureFloorUpdateEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/index.ts new file mode 100644 index 0000000..3926d97 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/index.ts @@ -0,0 +1,22 @@ +export * from './CustomUserNotificationMessageEvent'; +export * from './DiceValueMessageEvent'; +export * from './floor'; +export * from './FurniRentOrBuyoutOfferMessageEvent'; +export * from './FurnitureAliasesEvent'; +export * from './FurnitureDataEvent'; +export * from './FurnitureStackHeightEvent'; +export * from './GroupFurniContextMenuInfoMessageEvent'; +export * from './ItemDataUpdateMessageEvent'; +export * from './LoveLockFurniFinishedEvent'; +export * from './LoveLockFurniFriendConfirmedEvent'; +export * from './LoveLockFurniStartEvent'; +export * from './OneWayDoorStatusMessageEvent'; +export * from './RentableSpaceRentFailedMessageEvent'; +export * from './RentableSpaceRentOkMessageEvent'; +export * from './RentableSpaceStatusMessageEvent'; +export * from './RequestSpamWallPostItMessageEvent'; +export * from './RoomDimmerPresetsMessageEvent'; +export * from './RoomMessageNotificationMessageEvent'; +export * from './wall'; +export * from './WelcomeGiftStatusEvent'; +export * from './youtube'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/wall/FurnitureWallAddEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/wall/FurnitureWallAddEvent.ts new file mode 100644 index 0000000..4e79e1a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/wall/FurnitureWallAddEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { FurnitureWallAddParser } from '../../../../parser'; + +export class FurnitureWallAddEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurnitureWallAddParser); + } + + public getParser(): FurnitureWallAddParser + { + return this.parser as FurnitureWallAddParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/wall/FurnitureWallEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/wall/FurnitureWallEvent.ts new file mode 100644 index 0000000..95345c5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/wall/FurnitureWallEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { FurnitureWallParser } from '../../../../parser'; + +export class FurnitureWallEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurnitureWallParser); + } + + public getParser(): FurnitureWallParser + { + return this.parser as FurnitureWallParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/wall/FurnitureWallRemoveEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/wall/FurnitureWallRemoveEvent.ts new file mode 100644 index 0000000..2435688 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/wall/FurnitureWallRemoveEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { FurnitureWallRemoveParser } from '../../../../parser'; + +export class FurnitureWallRemoveEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurnitureWallRemoveParser); + } + + public getParser(): FurnitureWallRemoveParser + { + return this.parser as FurnitureWallRemoveParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/wall/FurnitureWallUpdateEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/wall/FurnitureWallUpdateEvent.ts new file mode 100644 index 0000000..ca6412e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/wall/FurnitureWallUpdateEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { FurnitureWallUpdateParser } from '../../../../parser'; + +export class FurnitureWallUpdateEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FurnitureWallUpdateParser); + } + + public getParser(): FurnitureWallUpdateParser + { + return this.parser as FurnitureWallUpdateParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/wall/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/wall/index.ts new file mode 100644 index 0000000..3065491 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/wall/index.ts @@ -0,0 +1,4 @@ +export * from './FurnitureWallAddEvent'; +export * from './FurnitureWallEvent'; +export * from './FurnitureWallRemoveEvent'; +export * from './FurnitureWallUpdateEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/youtube/YoutubeControlVideoMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/youtube/YoutubeControlVideoMessageEvent.ts new file mode 100644 index 0000000..412f630 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/youtube/YoutubeControlVideoMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { YoutubeControlVideoMessageParser } from '../../../../parser'; + +export class YoutubeControlVideoMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, YoutubeControlVideoMessageParser); + } + + public getParser(): YoutubeControlVideoMessageParser + { + return this.parser as YoutubeControlVideoMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/youtube/YoutubeDisplayPlaylistsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/youtube/YoutubeDisplayPlaylistsEvent.ts new file mode 100644 index 0000000..73b715f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/youtube/YoutubeDisplayPlaylistsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { YoutubeDisplayPlaylistsMessageParser } from '../../../../parser'; + +export class YoutubeDisplayPlaylistsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, YoutubeDisplayPlaylistsMessageParser); + } + + public getParser(): YoutubeDisplayPlaylistsMessageParser + { + return this.parser as YoutubeDisplayPlaylistsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/youtube/YoutubeDisplayVideoMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/youtube/YoutubeDisplayVideoMessageEvent.ts new file mode 100644 index 0000000..88835e9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/youtube/YoutubeDisplayVideoMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { YoutubeDisplayVideoMessageParser } from '../../../../parser'; + +export class YoutubeDisplayVideoMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, YoutubeDisplayVideoMessageParser); + } + + public getParser(): YoutubeDisplayVideoMessageParser + { + return this.parser as YoutubeDisplayVideoMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/youtube/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/youtube/index.ts new file mode 100644 index 0000000..4bb22a3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/furniture/youtube/index.ts @@ -0,0 +1,3 @@ +export * from './YoutubeControlVideoMessageEvent'; +export * from './YoutubeDisplayPlaylistsEvent'; +export * from './YoutubeDisplayVideoMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/index.ts new file mode 100644 index 0000000..81b327b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/index.ts @@ -0,0 +1,15 @@ +export * from './access'; +export * from './access/doorbell'; +export * from './access/rights'; +export * from './bots'; +export * from './data'; +export * from './engine'; +export * from './furniture'; +export * from './furniture/floor'; +export * from './furniture/wall'; +export * from './furniture/youtube'; +export * from './mapping'; +export * from './pet'; +export * from './session'; +export * from './unit'; +export * from './unit/chat'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/FloorHeightMapEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/FloorHeightMapEvent.ts new file mode 100644 index 0000000..d175061 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/FloorHeightMapEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { FloorHeightMapMessageParser } from '../../../parser'; + +export class FloorHeightMapEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FloorHeightMapMessageParser); + } + + public getParser(): FloorHeightMapMessageParser + { + return this.parser as FloorHeightMapMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomEntryTileMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomEntryTileMessageEvent.ts new file mode 100644 index 0000000..445b0ae --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomEntryTileMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomEntryTileMessageParser } from '../../../parser'; + +export class RoomEntryTileMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomEntryTileMessageParser); + } + + public getParser(): RoomEntryTileMessageParser + { + return this.parser as RoomEntryTileMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomHeightMapEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomHeightMapEvent.ts new file mode 100644 index 0000000..f736a30 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomHeightMapEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomHeightMapParser } from '../../../parser'; + +export class RoomHeightMapEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomHeightMapParser); + } + + public getParser(): RoomHeightMapParser + { + return this.parser as RoomHeightMapParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomHeightMapUpdateEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomHeightMapUpdateEvent.ts new file mode 100644 index 0000000..0cb80e1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomHeightMapUpdateEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomHeightMapUpdateParser } from '../../../parser'; + +export class RoomHeightMapUpdateEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomHeightMapUpdateParser); + } + + public getParser(): RoomHeightMapUpdateParser + { + return this.parser as RoomHeightMapUpdateParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomOccupiedTilesMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomOccupiedTilesMessageEvent.ts new file mode 100644 index 0000000..6d288ed --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomOccupiedTilesMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomOccupiedTilesMessageParser } from '../../../parser'; + +export class RoomOccupiedTilesMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomOccupiedTilesMessageParser); + } + + public getParser(): RoomOccupiedTilesMessageParser + { + return this.parser as RoomOccupiedTilesMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomPaintEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomPaintEvent.ts new file mode 100644 index 0000000..62dc931 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomPaintEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomPaintParser } from '../../../parser'; + +export class RoomPaintEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomPaintParser); + } + + public getParser(): RoomPaintParser + { + return this.parser as RoomPaintParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomReadyMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomReadyMessageEvent.ts new file mode 100644 index 0000000..820b527 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomReadyMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomReadyMessageParser } from '../../../parser'; + +export class RoomReadyMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomReadyMessageParser); + } + + public getParser(): RoomReadyMessageParser + { + return this.parser as RoomReadyMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomVisualizationSettingsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomVisualizationSettingsEvent.ts new file mode 100644 index 0000000..2af794d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/RoomVisualizationSettingsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomVisualizationSettingsParser } from '../../../parser'; + +export class RoomVisualizationSettingsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomVisualizationSettingsParser); + } + + public getParser(): RoomVisualizationSettingsParser + { + return this.parser as RoomVisualizationSettingsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/index.ts new file mode 100644 index 0000000..1ada5b8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/mapping/index.ts @@ -0,0 +1,8 @@ +export * from './FloorHeightMapEvent'; +export * from './RoomEntryTileMessageEvent'; +export * from './RoomHeightMapEvent'; +export * from './RoomHeightMapUpdateEvent'; +export * from './RoomOccupiedTilesMessageEvent'; +export * from './RoomPaintEvent'; +export * from './RoomReadyMessageEvent'; +export * from './RoomVisualizationSettingsEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/PetBreedingResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/PetBreedingResultEvent.ts new file mode 100644 index 0000000..978082b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/PetBreedingResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { PetBreedingResultParser } from '../../../parser'; + +export class PetBreedingResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetBreedingResultParser); + } + + public getParser(): PetBreedingResultParser + { + return this.parser as PetBreedingResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/PetExperienceEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/PetExperienceEvent.ts new file mode 100644 index 0000000..afb2f43 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/PetExperienceEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { PetExperienceParser } from '../../../parser'; + +export class PetExperienceEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetExperienceParser); + } + + public getParser(): PetExperienceParser + { + return this.parser as PetExperienceParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/PetFigureUpdateEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/PetFigureUpdateEvent.ts new file mode 100644 index 0000000..a394202 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/PetFigureUpdateEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { PetFigureUpdateParser } from '../../../parser'; + +export class PetFigureUpdateEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetFigureUpdateParser); + } + + public getParser(): PetFigureUpdateParser + { + return this.parser as PetFigureUpdateParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/PetInfoEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/PetInfoEvent.ts new file mode 100644 index 0000000..83af268 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/PetInfoEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { PetInfoParser } from '../../../parser'; + +export class PetInfoEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetInfoParser); + } + + public getParser(): PetInfoParser + { + return this.parser as PetInfoParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/PetStatusUpdateEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/PetStatusUpdateEvent.ts new file mode 100644 index 0000000..063b6c0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/PetStatusUpdateEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { PetStatusUpdateParser } from '../../../parser'; + +export class PetStatusUpdateEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetStatusUpdateParser); + } + + public getParser(): PetStatusUpdateParser + { + return this.parser as PetStatusUpdateParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/index.ts new file mode 100644 index 0000000..e43bd92 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/pet/index.ts @@ -0,0 +1,5 @@ +export * from './PetBreedingResultEvent'; +export * from './PetExperienceEvent'; +export * from './PetFigureUpdateEvent'; +export * from './PetInfoEvent'; +export * from './PetStatusUpdateEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/session/YouArePlayingGameEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/session/YouArePlayingGameEvent.ts new file mode 100644 index 0000000..624fff2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/session/YouArePlayingGameEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { YouArePlayingGameParser } from '../../../parser'; + +export class YouArePlayingGameEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, YouArePlayingGameParser); + } + + public getParser(): YouArePlayingGameParser + { + return this.parser as YouArePlayingGameParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/session/YouAreSpectatorMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/session/YouAreSpectatorMessageEvent.ts new file mode 100644 index 0000000..510a74a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/session/YouAreSpectatorMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { YouAreSpectatorMessageParser } from '../../../parser'; + +export class YouAreSpectatorMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, YouAreSpectatorMessageParser); + } + + public getParser(): YouAreSpectatorMessageParser + { + return this.parser as YouAreSpectatorMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/session/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/session/index.ts new file mode 100644 index 0000000..0ac722b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/session/index.ts @@ -0,0 +1,2 @@ +export * from './YouArePlayingGameEvent'; +export * from './YouAreSpectatorMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitDanceEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitDanceEvent.ts new file mode 100644 index 0000000..a91c329 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitDanceEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomUnitDanceParser } from '../../../parser'; + +export class RoomUnitDanceEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomUnitDanceParser); + } + + public getParser(): RoomUnitDanceParser + { + return this.parser as RoomUnitDanceParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitEffectEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitEffectEvent.ts new file mode 100644 index 0000000..42033bc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitEffectEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomUnitEffectParser } from '../../../parser'; + +export class RoomUnitEffectEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomUnitEffectParser); + } + + public getParser(): RoomUnitEffectParser + { + return this.parser as RoomUnitEffectParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitEvent.ts new file mode 100644 index 0000000..0b2aa79 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomUnitParser } from '../../../parser'; + +export class RoomUnitEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomUnitParser); + } + + public getParser(): RoomUnitParser + { + return this.parser as RoomUnitParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitExpressionEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitExpressionEvent.ts new file mode 100644 index 0000000..3448627 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitExpressionEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomUnitExpressionParser } from '../../../parser'; + +export class RoomUnitExpressionEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomUnitExpressionParser); + } + + public getParser(): RoomUnitExpressionParser + { + return this.parser as RoomUnitExpressionParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitHandItemEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitHandItemEvent.ts new file mode 100644 index 0000000..32f0f0e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitHandItemEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomUnitHandItemParser } from '../../../parser'; + +export class RoomUnitHandItemEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomUnitHandItemParser); + } + + public getParser(): RoomUnitHandItemParser + { + return this.parser as RoomUnitHandItemParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitHandItemReceivedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitHandItemReceivedEvent.ts new file mode 100644 index 0000000..339c68f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitHandItemReceivedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomUnitHandItemReceivedParser } from '../../../parser'; + +export class RoomUnitHandItemReceivedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomUnitHandItemReceivedParser); + } + + public getParser(): RoomUnitHandItemReceivedParser + { + return this.parser as RoomUnitHandItemReceivedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitIdleEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitIdleEvent.ts new file mode 100644 index 0000000..a36d51d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitIdleEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomUnitIdleParser } from '../../../parser'; + +export class RoomUnitIdleEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomUnitIdleParser); + } + + public getParser(): RoomUnitIdleParser + { + return this.parser as RoomUnitIdleParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitInfoEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitInfoEvent.ts new file mode 100644 index 0000000..5220132 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitInfoEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomUnitInfoParser } from '../../../parser'; + +export class RoomUnitInfoEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomUnitInfoParser); + } + + public getParser(): RoomUnitInfoParser + { + return this.parser as RoomUnitInfoParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitNumberEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitNumberEvent.ts new file mode 100644 index 0000000..c5e4dcc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitNumberEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomUnitNumberParser } from '../../../parser'; + +export class RoomUnitNumberEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomUnitNumberParser); + } + + public getParser(): RoomUnitNumberParser + { + return this.parser as RoomUnitNumberParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitRemoveEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitRemoveEvent.ts new file mode 100644 index 0000000..fb4d91d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitRemoveEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomUnitRemoveParser } from '../../../parser'; + +export class RoomUnitRemoveEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomUnitRemoveParser); + } + + public getParser(): RoomUnitRemoveParser + { + return this.parser as RoomUnitRemoveParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitStatusEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitStatusEvent.ts new file mode 100644 index 0000000..d4c5b9f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/RoomUnitStatusEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RoomUnitStatusParser } from '../../../parser'; + +export class RoomUnitStatusEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomUnitStatusParser); + } + + public getParser(): RoomUnitStatusParser + { + return this.parser as RoomUnitStatusParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/FloodControlEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/FloodControlEvent.ts new file mode 100644 index 0000000..b1bcee5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/FloodControlEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { FloodControlParser } from '../../../../parser'; + +export class FloodControlEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FloodControlParser); + } + + public getParser(): FloodControlParser + { + return this.parser as FloodControlParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/RemainingMuteEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/RemainingMuteEvent.ts new file mode 100644 index 0000000..381d72b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/RemainingMuteEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { RemainingMuteParser } from '../../../../parser'; + +export class RemainingMuteEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RemainingMuteParser); + } + + public getParser(): RemainingMuteParser + { + return this.parser as RemainingMuteParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/RoomUnitChatEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/RoomUnitChatEvent.ts new file mode 100644 index 0000000..e13b98c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/RoomUnitChatEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { RoomUnitChatParser } from '../../../../parser'; + +export class RoomUnitChatEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomUnitChatParser); + } + + public getParser(): RoomUnitChatParser + { + return this.parser as RoomUnitChatParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/RoomUnitChatShoutEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/RoomUnitChatShoutEvent.ts new file mode 100644 index 0000000..fce5ce2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/RoomUnitChatShoutEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { RoomUnitChatParser } from '../../../../parser'; + +export class RoomUnitChatShoutEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomUnitChatParser); + } + + public getParser(): RoomUnitChatParser + { + return this.parser as RoomUnitChatParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/RoomUnitChatWhisperEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/RoomUnitChatWhisperEvent.ts new file mode 100644 index 0000000..48ddb25 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/RoomUnitChatWhisperEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { RoomUnitChatParser } from '../../../../parser'; + +export class RoomUnitChatWhisperEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomUnitChatParser); + } + + public getParser(): RoomUnitChatParser + { + return this.parser as RoomUnitChatParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/RoomUnitTypingEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/RoomUnitTypingEvent.ts new file mode 100644 index 0000000..0f3a373 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/RoomUnitTypingEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { RoomUnitTypingParser } from '../../../../parser'; + +export class RoomUnitTypingEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomUnitTypingParser); + } + + public getParser(): RoomUnitTypingParser + { + return this.parser as RoomUnitTypingParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/index.ts new file mode 100644 index 0000000..6ba41a2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/chat/index.ts @@ -0,0 +1,6 @@ +export * from './FloodControlEvent'; +export * from './RemainingMuteEvent'; +export * from './RoomUnitChatEvent'; +export * from './RoomUnitChatShoutEvent'; +export * from './RoomUnitChatWhisperEvent'; +export * from './RoomUnitTypingEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/index.ts new file mode 100644 index 0000000..2592685 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/room/unit/index.ts @@ -0,0 +1,12 @@ +export * from './chat'; +export * from './RoomUnitDanceEvent'; +export * from './RoomUnitEffectEvent'; +export * from './RoomUnitEvent'; +export * from './RoomUnitExpressionEvent'; +export * from './RoomUnitHandItemEvent'; +export * from './RoomUnitHandItemReceivedEvent'; +export * from './RoomUnitIdleEvent'; +export * from './RoomUnitInfoEvent'; +export * from './RoomUnitNumberEvent'; +export * from './RoomUnitRemoveEvent'; +export * from './RoomUnitStatusEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredFurniActionEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredFurniActionEvent.ts new file mode 100644 index 0000000..7c0c528 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredFurniActionEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { WiredFurniActionParser } from '../../parser'; + +export class WiredFurniActionEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, WiredFurniActionParser); + } + + public getParser(): WiredFurniActionParser + { + return this.parser as WiredFurniActionParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredFurniConditionEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredFurniConditionEvent.ts new file mode 100644 index 0000000..29a7f20 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredFurniConditionEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { WiredFurniConditionParser } from '../../parser'; + +export class WiredFurniConditionEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, WiredFurniConditionParser); + } + + public getParser(): WiredFurniConditionParser + { + return this.parser as WiredFurniConditionParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredFurniTriggerEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredFurniTriggerEvent.ts new file mode 100644 index 0000000..3c15db6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredFurniTriggerEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { WiredFurniTriggerParser } from '../../parser'; + +export class WiredFurniTriggerEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, WiredFurniTriggerParser); + } + + public getParser(): WiredFurniTriggerParser + { + return this.parser as WiredFurniTriggerParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredOpenEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredOpenEvent.ts new file mode 100644 index 0000000..ef5b564 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredOpenEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { WiredOpenParser } from '../../parser'; + +export class WiredOpenEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, WiredOpenParser); + } + + public getParser(): WiredOpenParser + { + return this.parser as WiredOpenParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredRewardResultMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredRewardResultMessageEvent.ts new file mode 100644 index 0000000..fe7f998 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredRewardResultMessageEvent.ts @@ -0,0 +1,19 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { WiredRewardResultMessageParser } from '../../parser'; + +export class WiredRewardResultMessageEvent extends MessageEvent implements IMessageEvent +{ + public static PRODUCT_DONATED_CODE: number = 6; + public static BADGE_DONATED_CODE: number = 7; + + constructor(callBack: Function) + { + super(callBack, WiredRewardResultMessageParser); + } + + public getParser(): WiredRewardResultMessageParser + { + return this.parser as WiredRewardResultMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredSaveSuccessEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredSaveSuccessEvent.ts new file mode 100644 index 0000000..e0a93a5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredSaveSuccessEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { WiredSaveSuccessParser } from '../../parser'; + +export class WiredSaveSuccessEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, WiredSaveSuccessParser); + } + + public getParser(): WiredSaveSuccessParser + { + return this.parser as WiredSaveSuccessParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredValidationErrorEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredValidationErrorEvent.ts new file mode 100644 index 0000000..4f94d15 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/WiredValidationErrorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { WiredValidationErrorParser } from '../../parser'; + +export class WiredValidationErrorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, WiredValidationErrorParser); + } + + public getParser(): WiredValidationErrorParser + { + return this.parser as WiredValidationErrorParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/index.ts new file mode 100644 index 0000000..0775d57 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomevents/index.ts @@ -0,0 +1,7 @@ +export * from './WiredFurniActionEvent'; +export * from './WiredFurniConditionEvent'; +export * from './WiredFurniTriggerEvent'; +export * from './WiredOpenEvent'; +export * from './WiredRewardResultMessageEvent'; +export * from './WiredSaveSuccessEvent'; +export * from './WiredValidationErrorEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/BannedUsersFromRoomEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/BannedUsersFromRoomEvent.ts new file mode 100644 index 0000000..672665a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/BannedUsersFromRoomEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { BannedUsersFromRoomParser } from '../../parser'; + +export class BannedUsersFromRoomEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, BannedUsersFromRoomParser); + } + + public getParser(): BannedUsersFromRoomParser + { + return this.parser as BannedUsersFromRoomParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/FlatControllerAddedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/FlatControllerAddedEvent.ts new file mode 100644 index 0000000..b94be07 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/FlatControllerAddedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { FlatControllerAddedParser } from '../../parser'; + +export class FlatControllerAddedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FlatControllerAddedParser); + } + + public getParser(): FlatControllerAddedParser + { + return this.parser as FlatControllerAddedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/FlatControllerRemovedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/FlatControllerRemovedEvent.ts new file mode 100644 index 0000000..d819b89 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/FlatControllerRemovedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { FlatControllerRemovedParser } from '../../parser'; + +export class FlatControllerRemovedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FlatControllerRemovedParser); + } + + public getParser(): FlatControllerRemovedParser + { + return this.parser as FlatControllerRemovedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/FlatControllersEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/FlatControllersEvent.ts new file mode 100644 index 0000000..23f5778 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/FlatControllersEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { FlatControllersParser } from '../../parser'; + +export class FlatControllersEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, FlatControllersParser); + } + + public getParser(): FlatControllersParser + { + return this.parser as FlatControllersParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/MuteAllInRoomEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/MuteAllInRoomEvent.ts new file mode 100644 index 0000000..e5b0a9d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/MuteAllInRoomEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { MuteAllInRoomParser } from '../../parser'; + +export class MuteAllInRoomEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, MuteAllInRoomParser); + } + + public getParser(): MuteAllInRoomParser + { + return this.parser as MuteAllInRoomParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/NoSuchFlatEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/NoSuchFlatEvent.ts new file mode 100644 index 0000000..7f98b55 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/NoSuchFlatEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NoSuchFlatParser } from '../../parser'; + +export class NoSuchFlatEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NoSuchFlatParser); + } + + public getParser(): NoSuchFlatParser + { + return this.parser as NoSuchFlatParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsDataEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsDataEvent.ts new file mode 100644 index 0000000..c3b0744 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsDataEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomSettingsDataParser } from '../../parser'; + +export class RoomSettingsDataEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomSettingsDataParser); + } + + public getParser(): RoomSettingsDataParser + { + return this.parser as RoomSettingsDataParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsErrorEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsErrorEvent.ts new file mode 100644 index 0000000..8a0717d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsErrorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomSettingsErrorParser } from '../../parser'; + +export class RoomSettingsErrorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomSettingsErrorParser); + } + + public getParser(): RoomSettingsErrorParser + { + return this.parser as RoomSettingsErrorParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsSaveErrorEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsSaveErrorEvent.ts new file mode 100644 index 0000000..65a1a0e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsSaveErrorEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomSettingsSaveErrorParser } from '../../parser'; + +export class RoomSettingsSaveErrorEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomSettingsSaveErrorParser); + } + + public getParser(): RoomSettingsSaveErrorParser + { + return this.parser as RoomSettingsSaveErrorParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsSavedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsSavedEvent.ts new file mode 100644 index 0000000..0623a85 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/RoomSettingsSavedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RoomSettingsSavedParser } from '../../parser'; + +export class RoomSettingsSavedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RoomSettingsSavedParser); + } + + public getParser(): RoomSettingsSavedParser + { + return this.parser as RoomSettingsSavedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/ShowEnforceRoomCategoryDialogEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/ShowEnforceRoomCategoryDialogEvent.ts new file mode 100644 index 0000000..77e6bea --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/ShowEnforceRoomCategoryDialogEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ShowEnforceRoomCategoryDialogParser } from '../../parser'; + +export class ShowEnforceRoomCategoryDialogEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ShowEnforceRoomCategoryDialogParser); + } + + public getParser(): ShowEnforceRoomCategoryDialogParser + { + return this.parser as ShowEnforceRoomCategoryDialogParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/UserUnbannedFromRoomEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/UserUnbannedFromRoomEvent.ts new file mode 100644 index 0000000..7f45344 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/UserUnbannedFromRoomEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { UserUnbannedFromRoomParser } from '../../parser'; + +export class UserUnbannedFromRoomEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserUnbannedFromRoomParser); + } + + public getParser(): UserUnbannedFromRoomParser + { + return this.parser as UserUnbannedFromRoomParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/index.ts new file mode 100644 index 0000000..63327aa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/roomsettings/index.ts @@ -0,0 +1,12 @@ +export * from './BannedUsersFromRoomEvent'; +export * from './FlatControllerAddedEvent'; +export * from './FlatControllerRemovedEvent'; +export * from './FlatControllersEvent'; +export * from './MuteAllInRoomEvent'; +export * from './NoSuchFlatEvent'; +export * from './RoomSettingsDataEvent'; +export * from './RoomSettingsErrorEvent'; +export * from './RoomSettingsSavedEvent'; +export * from './RoomSettingsSaveErrorEvent'; +export * from './ShowEnforceRoomCategoryDialogEvent'; +export * from './UserUnbannedFromRoomEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/security/AuthenticatedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/security/AuthenticatedEvent.ts new file mode 100644 index 0000000..2951c8e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/security/AuthenticatedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { AuthenticatedParser } from '../../parser'; + +export class AuthenticatedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AuthenticatedParser); + } + + public getParser(): AuthenticatedParser + { + return this.parser as AuthenticatedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/security/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/security/index.ts new file mode 100644 index 0000000..01a887c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/security/index.ts @@ -0,0 +1 @@ +export * from './AuthenticatedEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/sound/JukeboxPlayListFullMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/sound/JukeboxPlayListFullMessageEvent.ts new file mode 100644 index 0000000..c26ac25 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/sound/JukeboxPlayListFullMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { JukeboxPlayListFullMessageParser } from '../../parser'; + +export class JukeboxPlayListFullMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, JukeboxPlayListFullMessageParser); + } + + public getParser(): JukeboxPlayListFullMessageParser + { + return this.parser as JukeboxPlayListFullMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/sound/JukeboxSongDisksMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/sound/JukeboxSongDisksMessageEvent.ts new file mode 100644 index 0000000..d644867 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/sound/JukeboxSongDisksMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { JukeboxSongDisksMessageParser } from '../../parser'; + +export class JukeboxSongDisksMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, JukeboxSongDisksMessageParser); + } + + public getParser(): JukeboxSongDisksMessageParser + { + return this.parser as JukeboxSongDisksMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/sound/NowPlayingMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/sound/NowPlayingMessageEvent.ts new file mode 100644 index 0000000..610f392 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/sound/NowPlayingMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { NowPlayingMessageParser } from '../../parser'; + +export class NowPlayingMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, NowPlayingMessageParser); + } + + public getParser(): NowPlayingMessageParser + { + return this.parser as NowPlayingMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/sound/OfficialSongIdMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/sound/OfficialSongIdMessageEvent.ts new file mode 100644 index 0000000..aa9fbc1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/sound/OfficialSongIdMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { OfficialSongIdMessageParser } from '../../parser'; + +export class OfficialSongIdMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, OfficialSongIdMessageParser); + } + + public getParser(): OfficialSongIdMessageParser + { + return this.parser as OfficialSongIdMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/sound/PlayListMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/sound/PlayListMessageEvent.ts new file mode 100644 index 0000000..bae8e8a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/sound/PlayListMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PlayListMessageParser } from '../../parser'; + +export class PlayListMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PlayListMessageParser); + } + + public getParser(): PlayListMessageParser + { + return this.parser as PlayListMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/sound/PlayListSongAddedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/sound/PlayListSongAddedMessageEvent.ts new file mode 100644 index 0000000..84226f2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/sound/PlayListSongAddedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PlayListSongAddedMessageParser } from '../../parser'; + +export class PlayListSongAddedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PlayListSongAddedMessageParser); + } + + public getParser(): PlayListSongAddedMessageParser + { + return this.parser as PlayListSongAddedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/sound/TraxSongInfoMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/sound/TraxSongInfoMessageEvent.ts new file mode 100644 index 0000000..b6f69c2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/sound/TraxSongInfoMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { TraxSongInfoMessageParser } from '../../parser'; + +export class TraxSongInfoMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TraxSongInfoMessageParser); + } + + public getParser(): TraxSongInfoMessageParser + { + return this.parser as TraxSongInfoMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/sound/UserSongDisksInventoryMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/sound/UserSongDisksInventoryMessageEvent.ts new file mode 100644 index 0000000..4b4fcf6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/sound/UserSongDisksInventoryMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { UserSongDisksInventoryMessageParser } from '../../parser'; + +export class UserSongDisksInventoryMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserSongDisksInventoryMessageParser); + } + + public getParser(): UserSongDisksInventoryMessageParser + { + return this.parser as UserSongDisksInventoryMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/sound/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/sound/index.ts new file mode 100644 index 0000000..24744f7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/sound/index.ts @@ -0,0 +1,8 @@ +export * from './JukeboxPlayListFullMessageEvent'; +export * from './JukeboxSongDisksMessageEvent'; +export * from './NowPlayingMessageEvent'; +export * from './OfficialSongIdMessageEvent'; +export * from './PlayListMessageEvent'; +export * from './PlayListSongAddedMessageEvent'; +export * from './TraxSongInfoMessageEvent'; +export * from './UserSongDisksInventoryMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/talent/TalentLevelUpEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/talent/TalentLevelUpEvent.ts new file mode 100644 index 0000000..6f6fcb0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/talent/TalentLevelUpEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { TalentLevelUpMessageParser } from '../../parser'; + +export class TalentLevelUpEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TalentLevelUpMessageParser); + } + + public getParser(): TalentLevelUpMessageParser + { + return this.parser as TalentLevelUpMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/talent/TalentTrackLevelMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/talent/TalentTrackLevelMessageEvent.ts new file mode 100644 index 0000000..6fa90e1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/talent/TalentTrackLevelMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { TalentTrackLevelMessageParser } from '../../parser'; + +export class TalentTrackLevelMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TalentTrackLevelMessageParser); + } + + public getParser(): TalentTrackLevelMessageParser + { + return this.parser as TalentTrackLevelMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/talent/TalentTrackMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/talent/TalentTrackMessageEvent.ts new file mode 100644 index 0000000..5f23177 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/talent/TalentTrackMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { TalentTrackParser } from '../../parser'; + +export class TalentTrackMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, TalentTrackParser); + } + + public getParser(): TalentTrackParser + { + return this.parser as TalentTrackParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/talent/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/talent/index.ts new file mode 100644 index 0000000..a05161d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/talent/index.ts @@ -0,0 +1,3 @@ +export * from './TalentLevelUpEvent'; +export * from './TalentTrackLevelMessageEvent'; +export * from './TalentTrackMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/AccountSafetyLockStatusChangeMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/AccountSafetyLockStatusChangeMessageEvent.ts new file mode 100644 index 0000000..6ef3e0a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/AccountSafetyLockStatusChangeMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { AccountSafetyLockStatusChangeParser } from '../../parser/user/AccountSafetyLockStatusChangeParser'; + +export class AccountSafetyLockStatusChangeMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, AccountSafetyLockStatusChangeParser); + } + + public getParser(): AccountSafetyLockStatusChangeParser + { + return this.parser as AccountSafetyLockStatusChangeParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/ApproveNameMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/ApproveNameMessageEvent.ts new file mode 100644 index 0000000..e623d61 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/ApproveNameMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ApproveNameResultParser } from '../../parser'; + +export class ApproveNameMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ApproveNameResultParser); + } + + public getParser(): ApproveNameResultParser + { + return this.parser as ApproveNameResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/ChangeEmailResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/ChangeEmailResultEvent.ts new file mode 100644 index 0000000..2a2e5bb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/ChangeEmailResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ChangeEmailResultParser } from '../../parser'; + +export class ChangeEmailResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ChangeEmailResultParser); + } + + public getParser(): ChangeEmailResultParser + { + return this.parser as ChangeEmailResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/EmailStatusResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/EmailStatusResultEvent.ts new file mode 100644 index 0000000..2bdba56 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/EmailStatusResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { EmailStatusParser } from '../../parser'; + +export class EmailStatusResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, EmailStatusParser); + } + + public getParser(): EmailStatusParser + { + return this.parser as EmailStatusParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/ExtendedProfileChangedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/ExtendedProfileChangedMessageEvent.ts new file mode 100644 index 0000000..148c29d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/ExtendedProfileChangedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ExtendedProfileChangedMessageParser } from '../../parser'; + +export class ExtendedProfileChangedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ExtendedProfileChangedMessageParser); + } + + public getParser(): ExtendedProfileChangedMessageParser + { + return this.parser as ExtendedProfileChangedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/GroupDetailsChangedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/GroupDetailsChangedMessageEvent.ts new file mode 100644 index 0000000..7001d7f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/GroupDetailsChangedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GroupDetailsChangedMessageParser } from '../../parser'; + +export class GroupDetailsChangedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GroupDetailsChangedMessageParser); + } + + public getParser(): GroupDetailsChangedMessageParser + { + return this.parser as GroupDetailsChangedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/GroupMembershipRequestedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/GroupMembershipRequestedMessageEvent.ts new file mode 100644 index 0000000..4165aa1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/GroupMembershipRequestedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GroupMembershipRequestedMessageParser } from '../../parser'; + +export class GroupMembershipRequestedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GroupMembershipRequestedMessageParser); + } + + public getParser(): GroupMembershipRequestedMessageParser + { + return this.parser as GroupMembershipRequestedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/GuildEditFailedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/GuildEditFailedMessageEvent.ts new file mode 100644 index 0000000..6c25082 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/GuildEditFailedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuildEditFailedMessageParser } from '../../parser'; + +export class GuildEditFailedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuildEditFailedMessageParser); + } + + public getParser(): GuildEditFailedMessageParser + { + return this.parser as GuildEditFailedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/GuildMemberMgmtFailedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/GuildMemberMgmtFailedMessageEvent.ts new file mode 100644 index 0000000..d94b89f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/GuildMemberMgmtFailedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuildMemberMgmtFailedMessageParser } from '../../parser'; + +export class GuildMemberMgmtFailedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuildMemberMgmtFailedMessageParser); + } + + public getParser(): GuildMemberMgmtFailedMessageParser + { + return this.parser as GuildMemberMgmtFailedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/GuildMembershipsMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/GuildMembershipsMessageEvent.ts new file mode 100644 index 0000000..1638e10 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/GuildMembershipsMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { GuildMembershipsMessageParser } from '../../parser'; + +export class GuildMembershipsMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, GuildMembershipsMessageParser); + } + + public getParser(): GuildMembershipsMessageParser + { + return this.parser as GuildMembershipsMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/HabboGroupBadgesMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/HabboGroupBadgesMessageEvent.ts new file mode 100644 index 0000000..58f5d0d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/HabboGroupBadgesMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { HabboGroupBadgesMessageParser } from '../../parser'; + +export class HabboGroupBadgesMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, HabboGroupBadgesMessageParser); + } + + public getParser(): HabboGroupBadgesMessageParser + { + return this.parser as HabboGroupBadgesMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/HabboGroupJoinFailedMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/HabboGroupJoinFailedMessageEvent.ts new file mode 100644 index 0000000..f0823bd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/HabboGroupJoinFailedMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { HabboGroupJoinFailedMessageParser } from '../../parser'; + +export class HabboGroupJoinFailedMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, HabboGroupJoinFailedMessageParser); + } + + public getParser(): HabboGroupJoinFailedMessageParser + { + return this.parser as HabboGroupJoinFailedMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/IgnoreResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/IgnoreResultEvent.ts new file mode 100644 index 0000000..8b1fa48 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/IgnoreResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { IgnoreResultParser } from '../../parser'; + +export class IgnoreResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, IgnoreResultParser); + } + + public getParser(): IgnoreResultParser + { + return this.parser as IgnoreResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/IgnoredUsersEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/IgnoredUsersEvent.ts new file mode 100644 index 0000000..c796988 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/IgnoredUsersEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { IgnoredUsersParser } from '../../parser'; + +export class IgnoredUsersEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, IgnoredUsersParser); + } + + public getParser(): IgnoredUsersParser + { + return this.parser as IgnoredUsersParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/InClientLinkEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/InClientLinkEvent.ts new file mode 100644 index 0000000..8218641 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/InClientLinkEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { InClientLinkParser } from '../../parser'; + +export class InClientLinkEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, InClientLinkParser); + } + + public getParser(): InClientLinkParser + { + return this.parser as InClientLinkParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/MemberData.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/MemberData.ts new file mode 100644 index 0000000..0c7f176 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/MemberData.ts @@ -0,0 +1,70 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class MemberData +{ + private static readonly TYPE_OWNER: number = 0; + private static readonly TYPE_ADMIN: number = 1; + private static readonly TYPE_PENDING: number = 2; + private static readonly TYPE_MEMBER: number = 3; + private static readonly TYPE_BLOCKED: number = 4; + + private _type: number; + private _userId: number; + private _userName: string; + private _figure: string; + private _memberSince: string; + + constructor(wrapper: IMessageDataWrapper) + { + this._type = wrapper.readInt(); + this._userId = wrapper.readInt(); + this._userName = wrapper.readString(); + this._figure = wrapper.readString(); + this._memberSince = wrapper.readString(); + } + + public get userId(): number + { + return this._userId; + } + + public get userName(): string + { + return this._userName; + } + + public get admin(): boolean + { + return this._type == MemberData.TYPE_ADMIN; + } + + public get owner(): boolean + { + return this._type == MemberData.TYPE_OWNER; + } + + public get pending(): boolean + { + return this._type == MemberData.TYPE_PENDING; + } + + public get member(): boolean + { + return this._type != MemberData.TYPE_MEMBER; + } + + public get blocked(): boolean + { + return this._type == MemberData.TYPE_BLOCKED; + } + + public get figure(): string + { + return this._figure; + } + + public get memberSince(): string + { + return this._memberSince; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/PetRespectNoficationEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/PetRespectNoficationEvent.ts new file mode 100644 index 0000000..b74bffe --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/PetRespectNoficationEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PetRespectNotificationParser } from '../../parser'; + +export class PetRespectNoficationEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetRespectNotificationParser); + } + + public getParser(): PetRespectNotificationParser + { + return this.parser as PetRespectNotificationParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/PetSupplementedNotificationEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/PetSupplementedNotificationEvent.ts new file mode 100644 index 0000000..6a297e8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/PetSupplementedNotificationEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { PetSupplementedNotificationParser } from '../../parser'; + +export class PetSupplementedNotificationEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, PetSupplementedNotificationParser); + } + + public getParser(): PetSupplementedNotificationParser + { + return this.parser as PetSupplementedNotificationParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/RespectReceivedEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/RespectReceivedEvent.ts new file mode 100644 index 0000000..f471295 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/RespectReceivedEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { RespectReceivedParser } from '../../parser'; + +export class RespectReceivedEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RespectReceivedParser); + } + + public getParser(): RespectReceivedParser + { + return this.parser as RespectReceivedParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/ScrSendKickbackInfoMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/ScrSendKickbackInfoMessageEvent.ts new file mode 100644 index 0000000..36b4bf5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/ScrSendKickbackInfoMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { ScrSendKickbackInfoMessageParser } from '../../parser'; + +export class ScrSendKickbackInfoMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, ScrSendKickbackInfoMessageParser); + } + + public getParser(): ScrSendKickbackInfoMessageParser + { + return this.parser as ScrSendKickbackInfoMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/WelcomeGiftChangeEmailResultEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/WelcomeGiftChangeEmailResultEvent.ts new file mode 100644 index 0000000..5561866 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/WelcomeGiftChangeEmailResultEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { WelcomeGiftChangeEmailResultParser } from '../../parser'; + +export class WelcomeGiftChangeEmailResultEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, WelcomeGiftChangeEmailResultParser); + } + + public getParser(): WelcomeGiftChangeEmailResultParser + { + return this.parser as WelcomeGiftChangeEmailResultParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/access/UserPermissionsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/access/UserPermissionsEvent.ts new file mode 100644 index 0000000..18615df --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/access/UserPermissionsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { UserPermissionsParser } from '../../../parser'; + +export class UserPermissionsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserPermissionsParser); + } + + public getParser(): UserPermissionsParser + { + return this.parser as UserPermissionsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/access/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/access/index.ts new file mode 100644 index 0000000..51901c3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/access/index.ts @@ -0,0 +1 @@ +export * from './UserPermissionsEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/data/RelationshipStatusInfoEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/RelationshipStatusInfoEvent.ts new file mode 100644 index 0000000..dd8e9af --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/RelationshipStatusInfoEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { RelationshipStatusInfoMessageParser } from '../../../parser'; + +export class RelationshipStatusInfoEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, RelationshipStatusInfoMessageParser); + } + + public getParser(): RelationshipStatusInfoMessageParser + { + return this.parser as RelationshipStatusInfoMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserCurrentBadgesEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserCurrentBadgesEvent.ts new file mode 100644 index 0000000..8231d90 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserCurrentBadgesEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { UserCurrentBadgesParser } from '../../../parser'; + +export class UserCurrentBadgesEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserCurrentBadgesParser); + } + + public getParser(): UserCurrentBadgesParser + { + return this.parser as UserCurrentBadgesParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserInfoEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserInfoEvent.ts new file mode 100644 index 0000000..2cc8a57 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserInfoEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { UserInfoParser } from '../../../parser'; + +export class UserInfoEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserInfoParser); + } + + public getParser(): UserInfoParser + { + return this.parser as UserInfoParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserNameChangeMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserNameChangeMessageEvent.ts new file mode 100644 index 0000000..0614584 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserNameChangeMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { UserNameChangeMessageParser } from '../../../parser'; + +export class UserNameChangeMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserNameChangeMessageParser); + } + + public getParser(): UserNameChangeMessageParser + { + return this.parser as UserNameChangeMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserProfileEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserProfileEvent.ts new file mode 100644 index 0000000..f8605a4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserProfileEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { UserProfileParser } from '../../../parser'; + +export class UserProfileEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserProfileParser); + } + + public getParser(): UserProfileParser + { + return this.parser as UserProfileParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserSettingsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserSettingsEvent.ts new file mode 100644 index 0000000..9b99632 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserSettingsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { UserSettingsParser } from '../../../parser'; + +export class UserSettingsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserSettingsParser); + } + + public getParser(): UserSettingsParser + { + return this.parser as UserSettingsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserTagsMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserTagsMessageEvent.ts new file mode 100644 index 0000000..0aa1cb5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/UserTagsMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { UserTagsParser } from '../../../parser'; + +export class UserTagsMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserTagsParser); + } + + public getParser(): UserTagsParser + { + return this.parser as UserTagsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/data/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/index.ts new file mode 100644 index 0000000..5994aa9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/data/index.ts @@ -0,0 +1,7 @@ +export * from './RelationshipStatusInfoEvent'; +export * from './UserCurrentBadgesEvent'; +export * from './UserInfoEvent'; +export * from './UserNameChangeMessageEvent'; +export * from './UserProfileEvent'; +export * from './UserSettingsEvent'; +export * from './UserTagsMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/index.ts new file mode 100644 index 0000000..f6f8642 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/index.ts @@ -0,0 +1,27 @@ +export * from './access'; +export * from './AccountSafetyLockStatusChangeMessageEvent'; +export * from './ApproveNameMessageEvent'; +export * from './ChangeEmailResultEvent'; +export * from './data'; +export * from './EmailStatusResultEvent'; +export * from './ExtendedProfileChangedMessageEvent'; +export * from './GroupDetailsChangedMessageEvent'; +export * from './GroupMembershipRequestedMessageEvent'; +export * from './GuildEditFailedMessageEvent'; +export * from './GuildMemberMgmtFailedMessageEvent'; +export * from './GuildMembershipsMessageEvent'; +export * from './HabboGroupBadgesMessageEvent'; +export * from './HabboGroupJoinFailedMessageEvent'; +export * from './IgnoredUsersEvent'; +export * from './IgnoreResultEvent'; +export * from './InClientLinkEvent'; +export * from './inventory'; +export * from './inventory/currency'; +export * from './inventory/subscription'; +export * from './MemberData'; +export * from './PetRespectNoficationEvent'; +export * from './PetSupplementedNotificationEvent'; +export * from './RespectReceivedEvent'; +export * from './ScrSendKickbackInfoMessageEvent'; +export * from './wardrobe'; +export * from './WelcomeGiftChangeEmailResultEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/currency/UserCreditsEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/currency/UserCreditsEvent.ts new file mode 100644 index 0000000..ea15f85 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/currency/UserCreditsEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { UserCreditsParser } from '../../../../parser'; + +export class UserCreditsEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserCreditsParser); + } + + public getParser(): UserCreditsParser + { + return this.parser as UserCreditsParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/currency/UserCurrencyEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/currency/UserCurrencyEvent.ts new file mode 100644 index 0000000..864b97d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/currency/UserCurrencyEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { UserCurrencyParser } from '../../../../parser'; + +export class UserCurrencyEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserCurrencyParser); + } + + public getParser(): UserCurrencyParser + { + return this.parser as UserCurrencyParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/currency/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/currency/index.ts new file mode 100644 index 0000000..f178ba7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/currency/index.ts @@ -0,0 +1,2 @@ +export * from './UserCreditsEvent'; +export * from './UserCurrencyEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/index.ts new file mode 100644 index 0000000..e25bf08 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/index.ts @@ -0,0 +1,2 @@ +export * from './currency'; +export * from './subscription'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/subscription/UserSubscriptionEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/subscription/UserSubscriptionEvent.ts new file mode 100644 index 0000000..5a014a9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/subscription/UserSubscriptionEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../../api'; +import { MessageEvent } from '../../../../../../../events'; +import { UserSubscriptionParser } from '../../../../parser'; + +export class UserSubscriptionEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserSubscriptionParser); + } + + public getParser(): UserSubscriptionParser + { + return this.parser as UserSubscriptionParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/subscription/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/subscription/index.ts new file mode 100644 index 0000000..3d8e4a1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/inventory/subscription/index.ts @@ -0,0 +1 @@ +export * from './UserSubscriptionEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/wardrobe/UserWardrobePageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/wardrobe/UserWardrobePageEvent.ts new file mode 100644 index 0000000..0db5671 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/wardrobe/UserWardrobePageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../../api'; +import { MessageEvent } from '../../../../../../events'; +import { UserWardrobePageParser } from '../../../parser'; + +export class UserWardrobePageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserWardrobePageParser); + } + + public getParser(): UserWardrobePageParser + { + return this.parser as UserWardrobePageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/user/wardrobe/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/user/wardrobe/index.ts new file mode 100644 index 0000000..179e41c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/user/wardrobe/index.ts @@ -0,0 +1 @@ +export * from './UserWardrobePageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/userclassification/UserClassificationMessageEvent.ts b/submodules/renderer/src/nitro/communication/messages/incoming/userclassification/UserClassificationMessageEvent.ts new file mode 100644 index 0000000..6924bb4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/userclassification/UserClassificationMessageEvent.ts @@ -0,0 +1,16 @@ +import { IMessageEvent } from '../../../../../api'; +import { MessageEvent } from '../../../../../events'; +import { UserClassificationMessageParser } from '../../parser'; + +export class UserClassificationMessageEvent extends MessageEvent implements IMessageEvent +{ + constructor(callBack: Function) + { + super(callBack, UserClassificationMessageParser); + } + + public getParser(): UserClassificationMessageParser + { + return this.parser as UserClassificationMessageParser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/incoming/userclassification/index.ts b/submodules/renderer/src/nitro/communication/messages/incoming/userclassification/index.ts new file mode 100644 index 0000000..f56a235 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/incoming/userclassification/index.ts @@ -0,0 +1 @@ +export * from './UserClassificationMessageEvent'; diff --git a/submodules/renderer/src/nitro/communication/messages/index.ts b/submodules/renderer/src/nitro/communication/messages/index.ts new file mode 100644 index 0000000..ab2c88e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/index.ts @@ -0,0 +1,3 @@ +export * from './incoming'; +export * from './outgoing'; +export * from './parser'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/OutgoingHeader.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/OutgoingHeader.ts new file mode 100644 index 0000000..4917a51 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/OutgoingHeader.ts @@ -0,0 +1,471 @@ +export class OutgoingHeader +{ + public static ACHIEVEMENT_LIST = 219; + public static AUTHENTICATION = -1; + public static BOT_CONFIGURATION = 1986; + public static BOT_PICKUP = 3323; + public static BOT_PLACE = 1592; + public static BOT_SKILL_SAVE = 2624; + public static GET_CLUB_OFFERS = 3285; + public static GET_CLUB_GIFT_INFO = 487; + public static GET_CATALOG_INDEX = 1195; + public static GET_CATALOG_PAGE = 412; + public static CATALOG_PURCHASE = 3492; + public static CATALOG_PURCHASE_GIFT = 1411; + public static GET_PRODUCT_OFFER = 2594; + public static CLIENT_LATENCY = 295; + public static CLIENT_LATENCY_MEASURE = 96; + public static CLIENT_POLICY = 26979; + public static CLIENT_PONG = 2596; + public static CLIENT_TOOLBAR_TOGGLE = 2313; + public static CLIENT_VARIABLES = 1053; + public static GET_CURRENT_TIMING_CODE = 2912; + public static DESKTOP_NEWS = 1827; + public static DESKTOP_VIEW = 105; + public static GET_BUNDLE_DISCOUNT_RULESET = 223; + public static EVENT_TRACKER = 3457; + public static FIND_NEW_FRIENDS = 516; + public static FURNITURE_ALIASES = 3898; + public static FURNITURE_FLOOR_UPDATE = 248; + public static FURNITURE_MULTISTATE = 99; + public static FURNITURE_PICKUP = 3456; + public static FURNITURE_PLACE = 1258; + public static FURNITURE_POSTIT_PLACE = 2248; + public static FURNITURE_POSTIT_SAVE_STICKY_POLE = 3283; + public static FURNITURE_RANDOMSTATE = 3617; + public static FURNITURE_WALL_MULTISTATE = 210; + public static FURNITURE_WALL_UPDATE = 168; + public static GAMES_INIT = 2914; + public static GAMES_LIST = 741; + public static ACCEPTGAMEINVITE = 3802; + public static GAMEUNLOADEDMESSAGE = 3207; + public static GETGAMEACHIEVEMENTSMESSAGE = 2399; + public static GETGAMESTATUSMESSAGE = 3171; + public static GETUSERGAMEACHIEVEMENTSMESSAGE = 389; + public static JOINQUEUEMESSAGE = 1458; + public static LEAVEQUEUEMESSAGE = 2384; + public static RESETRESOLUTIONACHIEVEMENTMESSAGE = 3144; + public static GETWEEKLYGAMEREWARDWINNERS = 1054; + public static GAME2GETACCOUNTGAMESTATUSMESSAGE = 11; + public static GAME2CHECKGAMEDIRECTORYSTATUSMESSAGE = 3259; + public static GAME2EXITGAMEMESSAGE = 1445; + public static GAME2GAMECHATMESSAGE = 2502; + public static GAME2LOADSTAGEREADYMESSAGE = 2415; + public static GAME2PLAYAGAINMESSAGE = 3196; + public static GAME2REQUESTFULLSTATUSUPDATEMESSAGE = 1598; + public static GAME2GETWEEKLYFRIENDSLEADERBOARD = 1232; + public static GAME2GETWEEKLYLEADERBOARD = 2565; + public static GET_GIFT_WRAPPING_CONFIG = 418; + public static GROUP_ADMIN_ADD = 2894; + public static GROUP_ADMIN_REMOVE = 722; + public static GROUP_CREATE_OPTIONS = 798; + public static GROUP_FAVORITE = 3549; + public static GET_FORUM_STATS = 3149; + public static GET_FORUM_THREADS = 873; + public static GET_FORUMS_LIST = 436; + public static GET_FORUM_MESSAGES = 232; + public static GET_FORUM_THREAD = 3900; + public static GET_UNREAD_FORUMS_COUNT = 2908; + public static FORUM_MODERATE_MESSAGE = 286; + public static FORUM_MODERATE_THREAD = 1397; + public static FORUM_POST_MESSAGE = 3529; + public static UPDATE_FORUM_READ_MARKER = 1855; + public static UPDATE_FORUM_SETTINGS = 2214; + public static FORUM_UPDATE_THREAD = 3045; + public static GROUP_INFO = 2991; + public static GROUP_DELETE = 1134; + public static GROUP_MEMBER_REMOVE_CONFIRM = 3593; + public static GROUP_MEMBER_REMOVE = 593; + public static GROUP_MEMBERS = 312; + public static GROUP_MEMBERSHIPS = 367; + public static GROUP_REQUEST = 998; + public static GROUP_REQUEST_ACCEPT = 3386; + public static GROUP_REQUEST_DECLINE = 1894; + public static GROUP_SETTINGS = 1004; + public static GROUP_PARTS = 813; + public static GROUP_BUY = 230; + public static GROUP_SAVE_INFORMATION = 3137; + public static GROUP_SAVE_BADGE = 1991; + public static GROUP_SAVE_COLORS = 1764; + public static GROUP_SAVE_PREFERENCES = 3435; + public static GROUP_BADGES = 21; + public static GROUP_UNBLOCK_MEMBER = 2864; + public static GET_BADGE_POINTS_LIMITS = 1371; + public static REQUESTABADGE = 3077; + public static GETISBADGEREQUESTFULFILLED = 1364; + public static ITEM_CLOTHING_REDEEM = 3374; + public static ITEM_COLOR_WHEEL_CLICK = 2144; + public static ITEM_DICE_CLICK = 1990; + public static ITEM_DICE_CLOSE = 1533; + public static ITEM_DIMMER_SAVE = 1648; + public static ITEM_DIMMER_SETTINGS = 2813; + public static ITEM_DIMMER_TOGGLE = 2296; + public static ITEM_EXCHANGE_REDEEM = 3115; + public static ITEM_PAINT = 711; + public static SET_OBJECT_DATA = 3608; + public static ITEM_STACK_HELPER = 3839; + public static ITEM_WALL_CLICK = 210; + public static ITEM_WALL_UPDATE = 168; + public static MARKETPLACE_CONFIG = 2597; + public static ACCEPT_FRIEND = 137; + public static MESSENGER_CHAT = 3567; + public static DECLINE_FRIEND = 2890; + public static FOLLOW_FRIEND = 3997; + public static MESSENGER_FRIENDS = 1523; + public static MESSENGER_INIT = 2781; + public static MESSENGER_RELATIONSHIPS = 2138; + public static SET_RELATIONSHIP_STATUS = 3768; + public static REMOVE_FRIEND = 1689; + public static REQUEST_FRIEND = 3157; + public static GET_FRIEND_REQUESTS = 2448; + public static SEND_ROOM_INVITE = 1276; + public static HABBO_SEARCH = 1210; + public static FRIEND_LIST_UPDATE = 1419; + public static MOD_TOOL_USER_INFO = 3295; + public static GET_USER_FLAT_CATS = 3027; + public static NAVIGATOR_INIT = 2110; + public static NAVIGATOR_SEARCH = 249; + public static NAVIGATOR_SEARCH_CLOSE = 1834; + public static NAVIGATOR_SEARCH_OPEN = 637; + public static NAVIGATOR_SEARCH_SAVE = 2226; + public static GET_USER_EVENT_CATS = 1782; + public static NAVIGATOR_SETTINGS_SAVE = 3159; + public static NAVIGATOR_CATEGORY_LIST_MODE = 1202; + public static NAVIGATOR_DELETE_SAVED_SEARCH = 1954; + public static PET_INFO = 2934; + public static PET_PICKUP = 1581; + public static PET_PLACE = 2647; + public static PET_RESPECT = 3202; + public static PET_RIDE = 1036; + public static PET_MOVE = 3449; + public static PET_OPEN_PACKAGE = 3698; + public static PET_SELECTED = 549; + public static PETS_BREED = 1638; + public static PET_CANCEL_BREEDING = 2713; + public static PET_CONFIRM_BREEDING = 3382; + public static GET_PET_TRAINING_PANEL = 2161; + public static RECYCLER_PRIZES = 398; + public static RECYCLER_STATUS = 1342; + public static RECYCLER_ITEMS = 2771; + public static RELEASE_VERSION = 4000; + public static CALL_FOR_HELP = 1691; + public static ROOM_AMBASSADOR_ALERT = 2996; + public static ROOM_BAN_GIVE = 1477; + public static ROOM_BAN_LIST = 2267; + public static ROOM_BAN_REMOVE = 992; + public static ROOM_CREATE = 2752; + public static ROOM_DELETE = 532; + public static ROOM_DOORBELL = 1644; + public static ROOM_ENTER = 2312; + public static ROOM_FAVORITE = 3817; + public static ROOM_FAVORITE_REMOVE = 309; + public static CAN_CREATE_ROOM = 2128; + public static CANCEL_ROOM_EVENT = 2725; + public static EDIT_ROOM_EVENT = 3991; + public static COMPETITION_ROOM_SEARCH = 433; + public static FORWARD_TO_RANDOM_PROMOTED_ROOM = 10; + public static FORWARD_TO_SOME_ROOM = 1703; + public static GET_CATEGORIES_WITH_USER_COUNT = 3782; + public static GET_GUEST_ROOM = 2230; + public static GET_OFFICIAL_ROOMS = 1229; + public static GET_POPULAR_ROOM_TAGS = 826; + public static GUILD_BASE_SEARCH = 2930; + public static MY_FAVOURITE_ROOMS_SEARCH = 2578; + public static MY_FREQUENT_ROOM_HISTORY_SEARCH = 1002; + public static MY_FRIENDS_ROOM_SEARCH = 2266; + public static MY_GUILD_BASES_SEARCH = 39; + public static MY_RECOMMENDED_ROOMS = 2537; + public static MY_ROOM_HISTORY_SEARCH = 2264; + public static MY_ROOM_RIGHTS_SEARCH = 272; + public static MY_ROOMS_SEARCH = 2277; + public static POPULAR_ROOMS_SEARCH = 2758; + public static ROOM_AD_EVENT_TAB_CLICKED = 2412; + public static ROOM_AD_EVENT_TAB_VIEWED = 2668; + public static ROOM_AD_SEARCH = 2809; + public static ROOM_TEXT_SEARCH = 3943; + public static ROOMS_WHERE_MY_FRIENDS_ARE = 1786; + public static ROOMS_WITH_HIGHEST_SCORE_SEARCH = 2939; + public static SET_ROOM_SESSION_TAGS = 3305; + public static UPDATE_ROOM_THUMBNAIL = 2468; + public static ROOM_KICK = 1320; + public static ROOM_LIKE = 3582; + public static ROOM_MODEL = 2300; + public static GET_OCCUPIED_TILES = 1687; + public static GET_ROOM_ENTRY_TILE = 3559; + public static ROOM_MODEL_SAVE = 875; + public static ROOM_MUTE = 3637; + public static ROOM_MUTE_USER = 3485; + public static ROOM_RIGHTS_GIVE = 808; + public static ROOM_RIGHTS_LIST = 3385; + public static ROOM_RIGHTS_REMOVE = 2064; + public static ROOM_RIGHTS_REMOVE_ALL = 2683; + public static ROOM_RIGHTS_REMOVE_OWN = 3182; + public static ROOM_SETTINGS = 3129; + public static ROOM_SETTINGS_SAVE = 1969; + public static ROOM_SETTINGS_UPDATE_ROOM_CATEGORY_AND_TRADE = 1265; + public static ROOM_STAFF_PICK = 1918; + public static ROOM_FILTER_WORDS = 1911; + public static ROOM_FILTER_WORDS_MODIFY = 3001; + public static MYSTERYBOXWAITINGCANCELEDMESSAGE = 2012; + public static MYSTERYBOX_OPEN_TROPHY = 3074; + public static SECURITY_MACHINE = 2490; + public static SECURITY_TICKET = 2419; + public static TRADE = 1481; + public static TRADE_ACCEPT = 3863; + public static TRADE_CANCEL = 2341; + public static TRADE_CLOSE = 2551; + public static TRADE_CONFIRM = 2760; + public static TRADE_ITEM = 3107; + public static TRADE_ITEM_REMOVE = 3845; + public static TRADE_ITEMS = 1263; + public static TRADE_UNACCEPT = 1444; + public static UNIT_ACTION = 2456; + public static UNIT_CHAT = 1314; + public static UNIT_CHAT_SHOUT = 2085; + public static UNIT_CHAT_WHISPER = 1543; + public static UNIT_DANCE = 2080; + public static UNIT_DROP_HAND_ITEM = 2814; + public static UNIT_GIVE_HANDITEM = 2941; + public static UNIT_LOOK = 3301; + public static UNIT_POSTURE = 2235; + public static UNIT_SIGN = 1975; + public static UNIT_TYPING = 1597; + public static UNIT_TYPING_STOP = 1474; + public static UNIT_WALK = 3320; + public static USER_BADGES = 2769; + public static USER_BADGES_CURRENT = 2091; + public static USER_BADGES_CURRENT_UPDATE = 644; + public static USER_BOTS = 3848; + public static USER_CURRENCY = 273; + public static USER_EFFECT_ACTIVATE = 2959; + public static USER_EFFECT_ENABLE = 1752; + public static USER_FIGURE = 2730; + public static USER_FURNITURE = 3150; // sent when in room + public static REQUESTFURNIINVENTORYWHENNOTINROOM = 3500; // sent when not in room + public static USER_HOME_ROOM = 1740; + public static USER_INFO = 357; + public static USER_MOTTO = 2228; + public static USER_IGNORED = 3878; + public static USER_PETS = 3095; + public static USER_PROFILE = 3265; + public static USER_PROFILE_BY_NAME = 2249; + public static USER_RESPECT = 2694; + public static GET_SOUND_SETTINGS = 2388; + public static USER_SETTINGS_CAMERA = 1461; + public static USER_SETTINGS_CHAT_STYLE = 1030; + public static USER_SETTINGS_INVITES = 1086; + public static USER_SETTINGS_OLD_CHAT = 1262; + public static USER_SETTINGS_VOLUME = 1367; + public static USER_SUBSCRIPTION = 3166; + public static GET_WARDROBE = 2742; + public static SAVE_WARDROBE_OUTFIT = 800; + public static USER_TAGS = 17; + public static PEER_USERS_CLASSIFICATION = 1160; + public static USER_CLASSIFICATION = 2285; + public static VISIT_USER = 2970; + public static WIRED_ACTION_SAVE = 2281; + public static WIRED_APPLY_SNAPSHOT = 3373; + public static WIRED_CONDITION_SAVE = 3203; + public static WIRED_OPEN = 768; + public static WIRED_TRIGGER_SAVE = 1520; + public static GET_ITEM_DATA = 3964; + public static ONE_WAY_DOOR_CLICK = 2765; + public static REMOVE_WALL_ITEM = 3336; + public static SET_ITEM_DATA = 3666; + public static CATALOG_REDEEM_VOUCHER = 339; + public static ROOM_TONER_APPLY = 2880; + public static FRIEND_FURNI_CONFIRM_LOCK = 3775; + public static MANNEQUIN_SAVE_NAME = 2850; + public static MANNEQUIN_SAVE_LOOK = 2209; + public static PRESENT_OPEN_PRESENT = 3558; + public static CATALOG_SELECT_VIP_GIFT = 2276; + public static USER_IGNORE_ID = 3314; + public static USER_IGNORE = 1117; + public static USER_UNIGNORE = 2061; + public static MODTOOL_REQUEST_ROOM_INFO = 707; + public static MODTOOL_CHANGE_ROOM_SETTINGS = 3260; + public static MODTOOL_REQUEST_USER_CHATLOG = 1391; + public static MODTOOL_REQUEST_ROOM_CHATLOG = 2587; + public static MODTOOL_SANCTION_ALERT = 229; + public static MODTOOL_SANCTION_BAN = 2766; + public static MODTOOL_SANCTION_KICK = 2582; + public static MODTOOL_SANCTION_TRADELOCK = 3742; + public static MODTOOL_ALERTEVENT = 1840; + public static MODTOOL_SANCTION_MUTE = 1945; + public static MODTOOL_REQUEST_USER_ROOMS = 3526; + public static MODTOOL_ROOM_ALERT = 3842; + public static MODTOOL_PREFERENCES = 31; + public static CLOSE_ISSUE_DEFAULT_ACTION = 2717; + public static CLOSE_ISSUES = 2067; + public static DEFAULT_SANCTION = 1681; + public static GET_CFH_CHATLOG = 211; + public static MODTOOL_SANCTION = 1392; + public static PICK_ISSUES = 15; + public static RELEASE_ISSUES = 1572; + public static CONVERT_GLOBAL_ROOM_ID = 314; + public static REQUEST_SELL_ITEM = 848; + public static REQUEST_MARKETPLACE_ITEM_STATS = 3288; + public static MARKETPLACE_SELL_ITEM = 3447; + public static MARKETPLACE_REQUEST_OWN_ITEMS = 2105; + public static MARKETPLACE_TAKE_BACK_ITEM = 434; + public static MARKETPLACE_REDEEM_CREDITS = 2650; + public static MARKETPLACE_REQUEST_OFFERS = 2407; + public static MARKETPLACE_BUY_OFFER = 1603; + public static MARKETPLACE_BUY_TOKENS = 1866; + public static CATALOG_REQUESET_PET_BREEDS = 1756; + public static APPROVE_NAME = 2109; + public static UNIT_GIVE_HANDITEM_PET = 2768; + public static PET_MOUNT = 1036; + public static PET_SUPPLEMENT = 749; + public static FURNITURE_GROUP_INFO = 2651; + public static ACHIEVEMENT_RESOLUTION_OPEN = 359; + public static USE_PET_PRODUCT = 1328; + public static REMOVE_PET_SADDLE = 186; + public static TOGGLE_PET_RIDING = 1472; + public static TOGGLE_PET_BREEDING = 3379; + public static UNSEEN_RESET_CATEGORY = 3493; + public static UNSEEN_RESET_ITEMS = 2343; + public static COMMUNITY_GOAL_VOTE_COMPOSER = 3536; + public static GET_PROMO_ARTICLES = 1827; + public static ACCEPT_QUEST = 3604; + public static ACTIVATE_QUEST = 793; + public static CANCEL_QUEST = 3133; + public static FRIEND_REQUEST_QUEST_COMPLETE = 1148; + public static GET_COMMUNITY_GOAL_EARNED_PRIZES = 2688; + public static GET_COMMUNITY_GOAL_HALL_OF_FAME = 2167; + public static GET_COMMUNITY_GOAL_PROGRESS = 1145; + public static GET_CONCURRENT_USERS_GOAL_PROGRESS = 1343; + public static GET_CONCURRENT_USERS_REWARD = 3872; + public static GET_DAILY_QUEST = 2486; + public static GET_QUESTS = 3333; + public static GET_SEASONAL_QUESTS_ONLY = 1190; + public static OPEN_QUEST_TRACKER = 2750; + public static REDEEM_COMMUNITY_GOAL_PRIZE = 90; + public static REJECT_QUEST = 2397; + public static START_CAMPAIGN = 1697; + public static GET_BONUS_RARE_INFO = 957; + public static CRAFT = 3591; + public static CRAFT_SECRET = 1251; + public static GET_CRAFTABLE_PRODUCTS = 633; + public static GET_CRAFTING_RECIPE = 1173; + public static GET_CRAFTING_RECIPES_AVAILABLE = 3086; + public static PHOTO_COMPETITION = 3959; + public static PUBLISH_PHOTO = 2068; + public static PURCHASE_PHOTO = 2408; + public static RENDER_ROOM = 3226; + public static RENDER_ROOM_THUMBNAIL = 1982; + public static REQUEST_CAMERA_CONFIGURATION = 796; + public static ADD_JUKEBOX_DISK = 753; + public static GET_JUKEBOX_PLAYLIST = 1435; + public static GET_NOW_PLAYING = 1325; + public static GET_OFFICIAL_SONG_ID = 3189; + public static GET_SONG_INFO = 3082; + public static GET_SOUND_MACHINE_PLAYLIST = 3498; + public static GET_USER_SONG_DISKS = 2304; + public static REMOVE_JUKEBOX_DISK = 3050; + public static INTERSTITIAL_SHOWN = 1109; + public static GET_INTERSTITIAL = 2519; + public static CHANGE_USERNAME = 2977; + public static CHECK_USERNAME = 3950; + public static OPEN_CAMPAIGN_CALENDAR_DOOR_STAFF= 3889; + public static OPEN_CAMPAIGN_CALENDAR_DOOR = 2257; + public static BUILDERS_CLUB_PLACE_ROOM_ITEM = 1051; + public static BUILDERS_CLUB_PLACE_WALL_ITEM = 462; + public static BUILDERS_CLUB_QUERY_FURNI_COUNT = 2529; + public static GET_CATALOG_PAGE_EXPIRATION = 742; + public static GET_CATALOG_PAGE_WITH_EARLIEST_EXP = 3135; + public static GET_DIRECT_CLUB_BUY_AVAILABLE = 801; + public static GET_HABBO_BASIC_MEMBERSHIP_EXTEND_OFFER = 603; + public static GET_HABBO_CLUB_EXTEND_OFFER = 2462; + public static GET_IS_OFFER_GIFTABLE = 1347; + public static GET_LIMITED_OFFER_APPEARING_NEXT = 410; + public static GET_NEXT_TARGETED_OFFER = 596; + public static GET_ROOM_AD_PURCHASE_INFO = 1075; + public static GET_SEASONAL_CALENDAR_DAILY_OFFER = 3257; + public static GET_TARGETED_OFFER = 2487; + public static MARK_CATALOG_NEW_ADDITIONS_PAGE_OPENED = 2150; + public static PURCHASE_BASIC_MEMBERSHIP_EXTENSION = 2735; + public static PURCHASE_ROOM_AD = 777; + public static PURCHASE_TARGETED_OFFER = 1826; + public static PURCHASE_VIP_MEMBERSHIP_EXTENSION = 3407; + public static ROOM_AD_PURCHASE_INITIATED = 2283; + public static SET_TARGETTED_OFFER_STATE = 2041; + public static SHOP_TARGETED_OFFER_VIEWED = 3483; + public static HELPER_TALENT_TRACK = 196; + public static TALENT_TRACK_GET_LEVEL = 2127; + public static FORWARD_TO_A_COMPETITION_ROOM = 172; + public static FORWARD_TO_A_SUBMITTABLE_ROOM = 1450; + public static FORWARD_TO_RANDOM_COMPETITION_ROOM = 865; + public static GET_IS_USER_PART_OF_COMPETITION = 2077; + public static GET_SECONDS_UNTIL = 271; + public static ROOM_COMPETITION_INIT = 1334; + public static SUBMIT_ROOM_TO_COMPETITION = 2595; + public static VOTE_FOR_ROOM = 143; + public static GET_GIFT = 2436; + public static RESET_PHONE_NUMBER_STATE = 2741; + public static SET_PHONE_NUMBER_VERIFICATION_STATUS = 1379; + public static TRY_PHONE_NUMBER = 790; + public static VERIFY_CODE = 2721; + public static CONTROL_YOUTUBE_DISPLAY_PLAYBACK = 3005; + public static GET_YOUTUBE_DISPLAY_STATUS = 336; + public static SET_YOUTUBE_DISPLAY_PLAYLIST = 2069; + public static GO_TO_FLAT = 685; + public static CHANGE_QUEUE = 3093; + public static CALL_FOR_HELP_FROM_FORUM_MESSAGE = 1412; + public static CALL_FOR_HELP_FROM_FORUM_THREAD = 534; + public static CALL_FOR_HELP_FROM_IM = 2950; + public static CALL_FOR_HELP_FROM_PHOTO = 2492; + public static CALL_FOR_HELP_FROM_SELFIE = 2755; + public static CHAT_REVIEW_GUIDE_DECIDES = 3365; + public static CHAT_REVIEW_GUIDE_DETACHED = 2501; + public static CHAT_REVIEW_GUIDE_VOTE = 3961; + public static CHAT_REVIEW_SESSION_CREATE = 3060; + public static DELETE_PENDING_CALLS_FOR_HELP = 3605; + public static GET_CFH_STATUS = 2746; + public static GET_FAQ_CATEGORY = 3445; + public static GET_FAQ_TEXT = 1849; + public static GET_GUIDE_REPORTING_STATUS = 3786; + public static GET_PENDING_CALLS_FOR_HELP = 3267; + public static GET_QUIZ_QUESTIONS = 1296; + public static GUIDE_SESSION_CREATE = 3338; + public static GUIDE_SESSION_FEEDBACK = 477; + public static GUIDE_SESSION_GET_REQUESTER_ROOM = 1052; + public static GUIDE_SESSION_GUIDE_DECIDES = 1424; + public static GUIDE_SESSION_INVITE_REQUESTER = 234; + public static GUIDE_SESSION_IS_TYPING = 519; + public static GUIDE_SESSION_MESSAGE = 3899; + public static GUIDE_SESSION_ON_DUTY_UPDATE = 1922; + public static GUIDE_SESSION_REPORT = 3969; + public static GUIDE_SESSION_REQUESTER_CANCELS = 291; + public static GUIDE_SESSION_RESOLVED = 887; + public static POST_QUIZ_ANSWERS = 3720; + public static SEARCH_FAQS = 2031; + public static POLL_ANSWER = 3505; + public static POLL_REJECT = 1773; + public static POLL_START = 109; + public static POLL_VOTE_COUNTER = 6200; + public static DISCONNECT = 2445; + public static SCR_GET_KICKBACK_INFO = 869; + public static COMPOST_PLANT = 3835; + public static HARVEST_PET = 1521; + public static SET_CLOTHING_CHANGE_DATA = 924; + public static GROUP_UNFAVORITE = 1820; + public static NEW_USER_EXPERIENCE_GET_GIFTS = 1822; + public static NEW_USER_EXPERIENCE_SCRIPT_PROCEED = 1299; + public static HANDSHAKE_INIT_DIFFIE = 3110; + public static HANDSHAKE_COMPLETE_DIFFIE = 773; + public static WELCOME_OPEN_GIFT = 2638; + public static WELCOME_GIFT_CHANGE_EMAIL = 66; + public static EMAIL_GET_STATUS = 2557; + public static EMAIL_CHANGE = 3965; + public static APPROVE_ALL_MEMBERSHIP_REQUESTS = 882; + public static RENTABLE_SPACE_CANCEL_RENT = 1667; + public static RENTABLE_SPACE_RENT = 2946; + public static RENTABLE_SPACE_STATUS = 872; + public static TRACKING_PERFORMANCE_LOG = 3230; + public static TRACKING_LAG_WARNING_REPORT = 3847; + public static ROOM_DIRECTORY_ROOM_NETWORK_OPEN_CONNECTION = 3736; + public static RENTABLE_EXTEND_RENT_OR_BUYOUT_STRIP_ITEM = 2115; + public static RENTABLE_EXTEND_RENT_OR_BUYOUT_FURNI = 1071; + public static RENTABLE_GET_RENT_OR_BUYOUT_OFFER = 2518; +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/advertisement/GetInterstitialMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/advertisement/GetInterstitialMessageComposer.ts new file mode 100644 index 0000000..1891b75 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/advertisement/GetInterstitialMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetInterstitialMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public dispose(): void + { + return; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/advertisement/InterstitialShownMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/advertisement/InterstitialShownMessageComposer.ts new file mode 100644 index 0000000..d2ee6f2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/advertisement/InterstitialShownMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class InterstitialShownMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public dispose(): void + { + return; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/advertisement/RequestAchievementsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/advertisement/RequestAchievementsMessageComposer.ts new file mode 100644 index 0000000..4abb88b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/advertisement/RequestAchievementsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RequestAchievementsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/advertisement/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/advertisement/index.ts new file mode 100644 index 0000000..20e10fa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/advertisement/index.ts @@ -0,0 +1,3 @@ +export * from './GetInterstitialMessageComposer'; +export * from './InterstitialShownMessageComposer'; +export * from './RequestAchievementsMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/avatar/ChangeUserNameMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/avatar/ChangeUserNameMessageComposer.ts new file mode 100644 index 0000000..a441b7e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/avatar/ChangeUserNameMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ChangeUserNameMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(name: string) + { + this._data = [name]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/avatar/CheckUserNameMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/avatar/CheckUserNameMessageComposer.ts new file mode 100644 index 0000000..954f48f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/avatar/CheckUserNameMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CheckUserNameMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(name: string) + { + this._data = [name]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/avatar/GetWardrobeMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/avatar/GetWardrobeMessageComposer.ts new file mode 100644 index 0000000..a7917ba --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/avatar/GetWardrobeMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetWardrobeMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(pageId: number = 0) + { + this._data = [pageId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/avatar/SaveWardrobeOutfitMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/avatar/SaveWardrobeOutfitMessageComposer.ts new file mode 100644 index 0000000..877bae8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/avatar/SaveWardrobeOutfitMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class SaveWardrobeOutfitMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(slotId: number, look: string, gender: string) + { + this._data = [slotId, look, gender]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/avatar/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/avatar/index.ts new file mode 100644 index 0000000..fc2f210 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/avatar/index.ts @@ -0,0 +1,4 @@ +export * from './ChangeUserNameMessageComposer'; +export * from './CheckUserNameMessageComposer'; +export * from './GetWardrobeMessageComposer'; +export * from './SaveWardrobeOutfitMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/camera/PhotoCompetitionMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/camera/PhotoCompetitionMessageComposer.ts new file mode 100644 index 0000000..47e0411 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/camera/PhotoCompetitionMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PhotoCompetitionMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/camera/PublishPhotoMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/camera/PublishPhotoMessageComposer.ts new file mode 100644 index 0000000..a4f485a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/camera/PublishPhotoMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PublishPhotoMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/camera/PurchasePhotoMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/camera/PurchasePhotoMessageComposer.ts new file mode 100644 index 0000000..96caeeb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/camera/PurchasePhotoMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PurchasePhotoMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(photoId: string) + { + this._data = [photoId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/camera/RenderRoomMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/camera/RenderRoomMessageComposer.ts new file mode 100644 index 0000000..940b731 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/camera/RenderRoomMessageComposer.ts @@ -0,0 +1,43 @@ +import { RenderTexture } from '@pixi/core'; +import { IMessageComposer } from '../../../../../api'; +import { TextureUtils } from '../../../../../pixi-proxy'; + +export class RenderRoomMessageComposer implements IMessageComposer> +{ + private _data: any; + + constructor(k: any = '', _arg_2: string = '', _arg_3: string = '', _arg_4: number = -1, _arg_5: number = -1) + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = []; + } + + public assignBitmap(texture: RenderTexture): void + { + const url = TextureUtils.generateImageUrl(texture); + + if(!url) return; + + const base64Data = url.split(',')[1]; + const binaryData = Uint8Array.from(atob(base64Data), c => c.charCodeAt(0)); + + this._data.push(binaryData.byteLength, binaryData.buffer); + } + + public assignBase64(base64: string): void + { + const base64Data = base64.split(',')[1]; + const binaryData = Uint8Array.from(atob(base64Data), c => c.charCodeAt(0)); + + this._data.push(binaryData.byteLength, binaryData.buffer); + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/camera/RenderRoomThumbnailMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/camera/RenderRoomThumbnailMessageComposer.ts new file mode 100644 index 0000000..78a2bf4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/camera/RenderRoomThumbnailMessageComposer.ts @@ -0,0 +1,9 @@ +import { RenderRoomMessageComposer } from './RenderRoomMessageComposer'; + +export class RenderRoomThumbnailMessageComposer extends RenderRoomMessageComposer +{ + constructor(k:any = '', _arg_2: string = '', _arg_3: string = '', _arg_4: number = -1, _arg_5: number = -1) + { + super(k, _arg_2, _arg_3, _arg_4, _arg_5); + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/camera/RequestCameraConfigurationComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/camera/RequestCameraConfigurationComposer.ts new file mode 100644 index 0000000..3d33db9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/camera/RequestCameraConfigurationComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RequestCameraConfigurationComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/camera/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/camera/index.ts new file mode 100644 index 0000000..626c1cd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/camera/index.ts @@ -0,0 +1,6 @@ +export * from './PhotoCompetitionMessageComposer'; +export * from './PublishPhotoMessageComposer'; +export * from './PurchasePhotoMessageComposer'; +export * from './RenderRoomMessageComposer'; +export * from './RenderRoomThumbnailMessageComposer'; +export * from './RequestCameraConfigurationComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/campaign/OpenCampaignCalendarDoorAsStaffComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/campaign/OpenCampaignCalendarDoorAsStaffComposer.ts new file mode 100644 index 0000000..357c9f9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/campaign/OpenCampaignCalendarDoorAsStaffComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class OpenCampaignCalendarDoorAsStaffComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string, _arg_2: number) + { + this._data = [k, _arg_2]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/campaign/OpenCampaignCalendarDoorComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/campaign/OpenCampaignCalendarDoorComposer.ts new file mode 100644 index 0000000..52d0dcb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/campaign/OpenCampaignCalendarDoorComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class OpenCampaignCalendarDoorComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string, _arg_2: number) + { + this._data = [k, _arg_2]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/campaign/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/campaign/index.ts new file mode 100644 index 0000000..2ecdb09 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/campaign/index.ts @@ -0,0 +1,2 @@ +export * from './OpenCampaignCalendarDoorAsStaffComposer'; +export * from './OpenCampaignCalendarDoorComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/BuildersClubPlaceRoomItemMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/BuildersClubPlaceRoomItemMessageComposer.ts new file mode 100644 index 0000000..30e3b6b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/BuildersClubPlaceRoomItemMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class BuildersClubPlaceRoomItemMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: string, _arg_4: number, _arg_5: number, _arg_6: number) + { + this._data = [k, _arg_2, _arg_3, _arg_4, _arg_5, _arg_6]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/BuildersClubPlaceWallItemMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/BuildersClubPlaceWallItemMessageComposer.ts new file mode 100644 index 0000000..c78e82a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/BuildersClubPlaceWallItemMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class BuildersClubPlaceWallItemMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: string, _arg_4: string) + { + this._data = [k, _arg_2, _arg_3, _arg_4]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/BuildersClubQueryFurniCountMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/BuildersClubQueryFurniCountMessageComposer.ts new file mode 100644 index 0000000..32d8619 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/BuildersClubQueryFurniCountMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class BuildersClubQueryFurniCountMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetBonusRareInfoMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetBonusRareInfoMessageComposer.ts new file mode 100644 index 0000000..b337eb5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetBonusRareInfoMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetBonusRareInfoMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetBundleDiscountRulesetComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetBundleDiscountRulesetComposer.ts new file mode 100644 index 0000000..01e9ee1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetBundleDiscountRulesetComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetBundleDiscountRulesetComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetCatalogIndexComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetCatalogIndexComposer.ts new file mode 100644 index 0000000..b81e4e5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetCatalogIndexComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetCatalogIndexComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(mode: string) + { + this._data = [mode]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetCatalogPageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetCatalogPageComposer.ts new file mode 100644 index 0000000..70ccf9a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetCatalogPageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetCatalogPageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(pageId: number, offerId: number, catalogType: string) + { + this._data = [pageId, offerId, catalogType]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetCatalogPageExpirationComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetCatalogPageExpirationComposer.ts new file mode 100644 index 0000000..2f32445 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetCatalogPageExpirationComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetCatalogPageExpirationComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetCatalogPageWithEarliestExpiryComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetCatalogPageWithEarliestExpiryComposer.ts new file mode 100644 index 0000000..8428ab3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetCatalogPageWithEarliestExpiryComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetCatalogPageWithEarliestExpiryComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetClubGiftInfo.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetClubGiftInfo.ts new file mode 100644 index 0000000..884b772 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetClubGiftInfo.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetClubGiftInfo implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetClubOffersMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetClubOffersMessageComposer.ts new file mode 100644 index 0000000..d3623bd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetClubOffersMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetClubOffersMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(offerId: number) + { + this._data = [offerId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetDirectClubBuyAvailableComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetDirectClubBuyAvailableComposer.ts new file mode 100644 index 0000000..ad20c22 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetDirectClubBuyAvailableComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetDirectClubBuyAvailableComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(days: number) + { + this._data = [days]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetGiftWrappingConfigurationComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetGiftWrappingConfigurationComposer.ts new file mode 100644 index 0000000..5f3a65f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetGiftWrappingConfigurationComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetGiftWrappingConfigurationComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetHabboBasicMembershipExtendOfferComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetHabboBasicMembershipExtendOfferComposer.ts new file mode 100644 index 0000000..68fb03c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetHabboBasicMembershipExtendOfferComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetHabboBasicMembershipExtendOfferComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetHabboClubExtendOfferMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetHabboClubExtendOfferMessageComposer.ts new file mode 100644 index 0000000..e3f11b8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetHabboClubExtendOfferMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetHabboClubExtendOfferMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetIsOfferGiftableComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetIsOfferGiftableComposer.ts new file mode 100644 index 0000000..0c89c56 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetIsOfferGiftableComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetIsOfferGiftableComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetLimitedOfferAppearingNextComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetLimitedOfferAppearingNextComposer.ts new file mode 100644 index 0000000..128a8d4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetLimitedOfferAppearingNextComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetLimitedOfferAppearingNextComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetNextTargetedOfferComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetNextTargetedOfferComposer.ts new file mode 100644 index 0000000..8bcd957 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetNextTargetedOfferComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetNextTargetedOfferComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetProductOfferComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetProductOfferComposer.ts new file mode 100644 index 0000000..686ee7d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetProductOfferComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetProductOfferComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(offerId: number) + { + this._data = [offerId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetRoomAdPurchaseInfoComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetRoomAdPurchaseInfoComposer.ts new file mode 100644 index 0000000..5d69dc3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetRoomAdPurchaseInfoComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetRoomAdPurchaseInfoComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetSeasonalCalendarDailyOfferComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetSeasonalCalendarDailyOfferComposer.ts new file mode 100644 index 0000000..e504752 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetSeasonalCalendarDailyOfferComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetSeasonalCalendarDailyOfferComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetSellablePetPalettesComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetSellablePetPalettesComposer.ts new file mode 100644 index 0000000..1abf0a7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetSellablePetPalettesComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetSellablePetPalettesComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(name: string) + { + this._data = [name]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetTargetedOfferComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetTargetedOfferComposer.ts new file mode 100644 index 0000000..8e42d57 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/GetTargetedOfferComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetTargetedOfferComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/MarkCatalogNewAdditionsPageOpenedComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/MarkCatalogNewAdditionsPageOpenedComposer.ts new file mode 100644 index 0000000..4c6d3e1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/MarkCatalogNewAdditionsPageOpenedComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class MarkCatalogNewAdditionsPageOpenedComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseBasicMembershipExtensionComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseBasicMembershipExtensionComposer.ts new file mode 100644 index 0000000..0af86b6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseBasicMembershipExtensionComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PurchaseBasicMembershipExtensionComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseFromCatalogAsGiftComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseFromCatalogAsGiftComposer.ts new file mode 100644 index 0000000..89bbee1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseFromCatalogAsGiftComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PurchaseFromCatalogAsGiftComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(pageId: number, itemId: number, extraData: string, receivingName: string, giftMessage: string, spriteId: number, boxId: number, ribbonId: number, showMyFace: boolean) + { + this._data = [pageId, itemId, extraData, receivingName, giftMessage, spriteId, boxId, ribbonId, showMyFace]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseFromCatalogComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseFromCatalogComposer.ts new file mode 100644 index 0000000..4aaa164 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseFromCatalogComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PurchaseFromCatalogComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(pageId: number, offerId: number, extraData: string, amount: number) + { + this._data = [pageId, offerId, extraData, amount]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseRoomAdMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseRoomAdMessageComposer.ts new file mode 100644 index 0000000..fbb1ab7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseRoomAdMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PurchaseRoomAdMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: number, _arg_4: string, _arg_5: boolean, _arg_6: string, _arg_7: number) + { + this._data = [k, _arg_2, _arg_3, _arg_4, _arg_5, _arg_6, _arg_7]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseTargetedOfferComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseTargetedOfferComposer.ts new file mode 100644 index 0000000..1cc7325 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseTargetedOfferComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PurchaseTargetedOfferComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseVipMembershipExtensionComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseVipMembershipExtensionComposer.ts new file mode 100644 index 0000000..13113dd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/PurchaseVipMembershipExtensionComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PurchaseVipMembershipExtensionComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/RedeemVoucherMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/RedeemVoucherMessageComposer.ts new file mode 100644 index 0000000..c6d09a3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/RedeemVoucherMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RedeemVoucherMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(voucherCode: string) + { + this._data = [voucherCode]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/RoomAdPurchaseInitiatedComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/RoomAdPurchaseInitiatedComposer.ts new file mode 100644 index 0000000..0dc346f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/RoomAdPurchaseInitiatedComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RoomAdPurchaseInitiatedComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/SelectClubGiftComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/SelectClubGiftComposer.ts new file mode 100644 index 0000000..cc13dad --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/SelectClubGiftComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class SelectClubGiftComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemName: string) + { + this._data = [itemName]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/SetTargetedOfferStateComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/SetTargetedOfferStateComposer.ts new file mode 100644 index 0000000..5e58a00 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/SetTargetedOfferStateComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class SetTargetedOfferStateComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/ShopTargetedOfferViewedComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/ShopTargetedOfferViewedComposer.ts new file mode 100644 index 0000000..41e9758 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/ShopTargetedOfferViewedComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ShopTargetedOfferViewedComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/index.ts new file mode 100644 index 0000000..c30e6e8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/catalog/index.ts @@ -0,0 +1,35 @@ +export * from './BuildersClubPlaceRoomItemMessageComposer'; +export * from './BuildersClubPlaceWallItemMessageComposer'; +export * from './BuildersClubQueryFurniCountMessageComposer'; +export * from './GetBonusRareInfoMessageComposer'; +export * from './GetBundleDiscountRulesetComposer'; +export * from './GetCatalogIndexComposer'; +export * from './GetCatalogPageComposer'; +export * from './GetCatalogPageExpirationComposer'; +export * from './GetCatalogPageWithEarliestExpiryComposer'; +export * from './GetClubGiftInfo'; +export * from './GetClubOffersMessageComposer'; +export * from './GetDirectClubBuyAvailableComposer'; +export * from './GetGiftWrappingConfigurationComposer'; +export * from './GetHabboBasicMembershipExtendOfferComposer'; +export * from './GetHabboClubExtendOfferMessageComposer'; +export * from './GetIsOfferGiftableComposer'; +export * from './GetLimitedOfferAppearingNextComposer'; +export * from './GetNextTargetedOfferComposer'; +export * from './GetProductOfferComposer'; +export * from './GetRoomAdPurchaseInfoComposer'; +export * from './GetSeasonalCalendarDailyOfferComposer'; +export * from './GetSellablePetPalettesComposer'; +export * from './GetTargetedOfferComposer'; +export * from './MarkCatalogNewAdditionsPageOpenedComposer'; +export * from './PurchaseBasicMembershipExtensionComposer'; +export * from './PurchaseFromCatalogAsGiftComposer'; +export * from './PurchaseFromCatalogComposer'; +export * from './PurchaseRoomAdMessageComposer'; +export * from './PurchaseTargetedOfferComposer'; +export * from './PurchaseVipMembershipExtensionComposer'; +export * from './RedeemVoucherMessageComposer'; +export * from './RoomAdPurchaseInitiatedComposer'; +export * from './SelectClubGiftComposer'; +export * from './SetTargetedOfferStateComposer'; +export * from './ShopTargetedOfferViewedComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/competition/ForwardToACompetitionRoomMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/ForwardToACompetitionRoomMessageComposer.ts new file mode 100644 index 0000000..82b9a77 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/ForwardToACompetitionRoomMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ForwardToACompetitionRoomMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string, _arg_2: number) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/competition/ForwardToASubmittableRoomMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/ForwardToASubmittableRoomMessageComposer.ts new file mode 100644 index 0000000..b1d7e15 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/ForwardToASubmittableRoomMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ForwardToASubmittableRoomMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/competition/ForwardToRandomCompetitionRoomMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/ForwardToRandomCompetitionRoomMessageComposer.ts new file mode 100644 index 0000000..55140f8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/ForwardToRandomCompetitionRoomMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ForwardToRandomCompetitionRoomMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/competition/GetCurrentTimingCodeMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/GetCurrentTimingCodeMessageComposer.ts new file mode 100644 index 0000000..2239a7a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/GetCurrentTimingCodeMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetCurrentTimingCodeMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/competition/GetIsUserPartOfCompetitionMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/GetIsUserPartOfCompetitionMessageComposer.ts new file mode 100644 index 0000000..13a0d0d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/GetIsUserPartOfCompetitionMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetIsUserPartOfCompetitionMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/competition/GetSecondsUntilMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/GetSecondsUntilMessageComposer.ts new file mode 100644 index 0000000..9b6fdc9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/GetSecondsUntilMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetSecondsUntilMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/competition/RoomCompetitionInitMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/RoomCompetitionInitMessageComposer.ts new file mode 100644 index 0000000..348dd82 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/RoomCompetitionInitMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RoomCompetitionInitMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/competition/SubmitRoomToCompetitionMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/SubmitRoomToCompetitionMessageComposer.ts new file mode 100644 index 0000000..ed023e1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/SubmitRoomToCompetitionMessageComposer.ts @@ -0,0 +1,26 @@ +import { IMessageComposer } from '../../../../../api'; + +export class SubmitRoomToCompetitionMessageComposer implements IMessageComposer> +{ + public static readonly CONFIRM_LEVEL_NOT_ACCEPTED = 0; + public static readonly CONFIRM_LEVEL_NOT_SUBMITTED = 1; + public static readonly CONFIRM_LEVEL_NOT_CONFIRMED = 2; + public static readonly CONFIRM_LEVEL_COMMIT = 3; + + private _data: ConstructorParameters; + + constructor(k: string, _arg_2: number) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/competition/VoteForRoomMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/VoteForRoomMessageComposer.ts new file mode 100644 index 0000000..f9a6186 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/VoteForRoomMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class VoteForRoomMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/competition/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/index.ts new file mode 100644 index 0000000..c99db8f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/competition/index.ts @@ -0,0 +1,9 @@ +export * from './ForwardToACompetitionRoomMessageComposer'; +export * from './ForwardToASubmittableRoomMessageComposer'; +export * from './ForwardToRandomCompetitionRoomMessageComposer'; +export * from './GetCurrentTimingCodeMessageComposer'; +export * from './GetIsUserPartOfCompetitionMessageComposer'; +export * from './GetSecondsUntilMessageComposer'; +export * from './RoomCompetitionInitMessageComposer'; +export * from './SubmitRoomToCompetitionMessageComposer'; +export * from './VoteForRoomMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/CraftComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/CraftComposer.ts new file mode 100644 index 0000000..c81f4f7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/CraftComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CraftComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: string) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/CraftSecretComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/CraftSecretComposer.ts new file mode 100644 index 0000000..b1314b0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/CraftSecretComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CraftSecretComposer implements IMessageComposer +{ + private _data: number[]; + + constructor(k: number, _arg_2: number[]) + { + this._data = [k, _arg_2.length].concat(_arg_2); + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/GetCraftableProductsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/GetCraftableProductsComposer.ts new file mode 100644 index 0000000..8a68b50 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/GetCraftableProductsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetCraftableProductsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/GetCraftingRecipeComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/GetCraftingRecipeComposer.ts new file mode 100644 index 0000000..321e923 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/GetCraftingRecipeComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetCraftingRecipeComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/GetCraftingRecipesAvailableComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/GetCraftingRecipesAvailableComposer.ts new file mode 100644 index 0000000..2c6a739 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/GetCraftingRecipesAvailableComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetCraftingRecipesAvailableComposer implements IMessageComposer +{ + private _data: number[]; + + constructor(k: number, _arg_2: number[]) + { + this._data = [k, _arg_2.length].concat(_arg_2); + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/index.ts new file mode 100644 index 0000000..ab46a6d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/crafting/index.ts @@ -0,0 +1,5 @@ +export * from './CraftComposer'; +export * from './CraftSecretComposer'; +export * from './GetCraftableProductsComposer'; +export * from './GetCraftingRecipeComposer'; +export * from './GetCraftingRecipesAvailableComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/desktop/DesktopViewComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/desktop/DesktopViewComposer.ts new file mode 100644 index 0000000..6ee27c8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/desktop/DesktopViewComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class DesktopViewComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/desktop/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/desktop/index.ts new file mode 100644 index 0000000..af7fc6e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/desktop/index.ts @@ -0,0 +1 @@ +export * from './DesktopViewComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendfurni/FriendFurniConfirmLockMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendfurni/FriendFurniConfirmLockMessageComposer.ts new file mode 100644 index 0000000..67c93c4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendfurni/FriendFurniConfirmLockMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class FriendFurniConfirmLockMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number, confirmed: boolean) + { + this._data = [itemId, confirmed]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendfurni/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendfurni/index.ts new file mode 100644 index 0000000..545be87 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendfurni/index.ts @@ -0,0 +1 @@ +export * from './FriendFurniConfirmLockMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/AcceptFriendMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/AcceptFriendMessageComposer.ts new file mode 100644 index 0000000..4bfd0b2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/AcceptFriendMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class AcceptFriendMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(...userIds: number[]) + { + this._data = [userIds.length, ...userIds]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/DeclineFriendMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/DeclineFriendMessageComposer.ts new file mode 100644 index 0000000..1581bc6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/DeclineFriendMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class DeclineFriendMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(removeAll: boolean, ...userIds: number[]) + { + this._data = [removeAll, userIds.length, ...userIds]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/FindNewFriendsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/FindNewFriendsMessageComposer.ts new file mode 100644 index 0000000..90619cf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/FindNewFriendsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class FindNewFriendsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/FollowFriendMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/FollowFriendMessageComposer.ts new file mode 100644 index 0000000..cfd195a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/FollowFriendMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class FollowFriendMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number) + { + this._data = [userId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/FriendListUpdateComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/FriendListUpdateComposer.ts new file mode 100644 index 0000000..779ab99 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/FriendListUpdateComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class FriendListUpdateComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/GetFriendRequestsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/GetFriendRequestsComposer.ts new file mode 100644 index 0000000..fa7f50f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/GetFriendRequestsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetFriendRequestsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/HabboSearchComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/HabboSearchComposer.ts new file mode 100644 index 0000000..862c3b3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/HabboSearchComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class HabboSearchComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(search: string) + { + this._data = [search]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/MessengerInitComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/MessengerInitComposer.ts new file mode 100644 index 0000000..07d5eaa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/MessengerInitComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class MessengerInitComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/RemoveFriendComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/RemoveFriendComposer.ts new file mode 100644 index 0000000..80d3bb0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/RemoveFriendComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RemoveFriendComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(...userIds: number[]) + { + this._data = [userIds.length, ...userIds]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/RequestFriendComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/RequestFriendComposer.ts new file mode 100644 index 0000000..61e6446 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/RequestFriendComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RequestFriendComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(username: string) + { + this._data = [username]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/SendMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/SendMessageComposer.ts new file mode 100644 index 0000000..79140eb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/SendMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class SendMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number, message: string) + { + this._data = [userId, message]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/SendRoomInviteComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/SendRoomInviteComposer.ts new file mode 100644 index 0000000..91c5bbe --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/SendRoomInviteComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class SendRoomInviteComposer implements IMessageComposer +{ + private _data: any; + + constructor(message: string, userIds: number[]) + { + this._data = [userIds.length, ...userIds, message]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/SetRelationshipStatusComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/SetRelationshipStatusComposer.ts new file mode 100644 index 0000000..00f731c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/SetRelationshipStatusComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class SetRelationshipStatusComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number, relationship: number) + { + this._data = [userId, relationship]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/VisitUserComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/VisitUserComposer.ts new file mode 100644 index 0000000..5c2572c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/VisitUserComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class VisitUserComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(username: string) + { + this._data = [username]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/index.ts new file mode 100644 index 0000000..501c3c9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/friendlist/index.ts @@ -0,0 +1,14 @@ +export * from './AcceptFriendMessageComposer'; +export * from './DeclineFriendMessageComposer'; +export * from './FindNewFriendsMessageComposer'; +export * from './FollowFriendMessageComposer'; +export * from './FriendListUpdateComposer'; +export * from './GetFriendRequestsComposer'; +export * from './HabboSearchComposer'; +export * from './MessengerInitComposer'; +export * from './RemoveFriendComposer'; +export * from './RequestFriendComposer'; +export * from './SendMessageComposer'; +export * from './SendRoomInviteComposer'; +export * from './SetRelationshipStatusComposer'; +export * from './VisitUserComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/arena/Game2ExitGameMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/arena/Game2ExitGameMessageComposer.ts new file mode 100644 index 0000000..2955ff8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/arena/Game2ExitGameMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class Game2ExitGameMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(exitToRoomBeforeGame = true) + { + this._data = [ exitToRoomBeforeGame ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/arena/Game2GameChatMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/arena/Game2GameChatMessageComposer.ts new file mode 100644 index 0000000..386424d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/arena/Game2GameChatMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class Game2GameChatMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(chatLine: string) + { + this._data = [ chatLine ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/arena/Game2LoadStageReadyMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/arena/Game2LoadStageReadyMessageComposer.ts new file mode 100644 index 0000000..6e07d81 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/arena/Game2LoadStageReadyMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class Game2LoadStageReadyMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [ k ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/arena/Game2PlayAgainMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/arena/Game2PlayAgainMessageComposer.ts new file mode 100644 index 0000000..d49e8ae --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/arena/Game2PlayAgainMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class Game2PlayAgainMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = [ ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/arena/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/arena/index.ts new file mode 100644 index 0000000..b13a00d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/arena/index.ts @@ -0,0 +1,4 @@ +export * from './Game2ExitGameMessageComposer'; +export * from './Game2GameChatMessageComposer'; +export * from './Game2LoadStageReadyMessageComposer'; +export * from './Game2PlayAgainMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/directory/Game2CheckGameDirectoryStatusMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/directory/Game2CheckGameDirectoryStatusMessageComposer.ts new file mode 100644 index 0000000..fb70d2f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/directory/Game2CheckGameDirectoryStatusMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class Game2CheckGameDirectoryStatusMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = [ ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/directory/Game2GetAccountGameStatusMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/directory/Game2GetAccountGameStatusMessageComposer.ts new file mode 100644 index 0000000..3e21dd9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/directory/Game2GetAccountGameStatusMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class Game2GetAccountGameStatusMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [ k ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/directory/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/directory/index.ts new file mode 100644 index 0000000..9274423 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/directory/index.ts @@ -0,0 +1,2 @@ +export * from './Game2CheckGameDirectoryStatusMessageComposer'; +export * from './Game2GetAccountGameStatusMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/index.ts new file mode 100644 index 0000000..af311fb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/index.ts @@ -0,0 +1,5 @@ +export * from './arena'; +export * from './directory'; +export * from './ingame'; +export * from './lobby'; +export * from './score'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/ingame/Game2RequestFullStatusUpdateMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/ingame/Game2RequestFullStatusUpdateMessageComposer.ts new file mode 100644 index 0000000..c78e606 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/ingame/Game2RequestFullStatusUpdateMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class Game2RequestFullStatusUpdateMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [ k ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/ingame/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/ingame/index.ts new file mode 100644 index 0000000..b406813 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/ingame/index.ts @@ -0,0 +1 @@ +export * from './Game2RequestFullStatusUpdateMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/AcceptGameInviteMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/AcceptGameInviteMessageComposer.ts new file mode 100644 index 0000000..3391a4e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/AcceptGameInviteMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class AcceptGameInviteMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k:number, _arg_2:number) + { + this._data = [ k, _arg_2 ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GameUnloadedMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GameUnloadedMessageComposer.ts new file mode 100644 index 0000000..591408f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GameUnloadedMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GameUnloadedMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [ k ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GetGameAchievementsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GetGameAchievementsMessageComposer.ts new file mode 100644 index 0000000..7fdf1f4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GetGameAchievementsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetGameAchievementsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = [ ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GetGameListMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GetGameListMessageComposer.ts new file mode 100644 index 0000000..d8561d0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GetGameListMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetGameListMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = [ ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GetGameStatusMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GetGameStatusMessageComposer.ts new file mode 100644 index 0000000..70f1ced --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GetGameStatusMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetGameStatusMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [ k ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GetResolutionAchievementsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GetResolutionAchievementsMessageComposer.ts new file mode 100644 index 0000000..0413260 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GetResolutionAchievementsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetResolutionAchievementsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(objectId: number, achievementId: number) + { + this._data = [objectId, achievementId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GetUserGameAchievementsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GetUserGameAchievementsMessageComposer.ts new file mode 100644 index 0000000..b4f142e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/GetUserGameAchievementsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetUserGameAchievementsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [ k ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/JoinQueueMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/JoinQueueMessageComposer.ts new file mode 100644 index 0000000..999566f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/JoinQueueMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class JoinQueueMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [ k ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/LeaveQueueMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/LeaveQueueMessageComposer.ts new file mode 100644 index 0000000..c2df0ce --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/LeaveQueueMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class LeaveQueueMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [ k ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/ResetResolutionAchievementMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/ResetResolutionAchievementMessageComposer.ts new file mode 100644 index 0000000..130bdc5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/ResetResolutionAchievementMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class ResetResolutionAchievementMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [ k ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/index.ts new file mode 100644 index 0000000..e6ed4d2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/lobby/index.ts @@ -0,0 +1,10 @@ +export * from './AcceptGameInviteMessageComposer'; +export * from './GameUnloadedMessageComposer'; +export * from './GetGameAchievementsMessageComposer'; +export * from './GetGameListMessageComposer'; +export * from './GetGameStatusMessageComposer'; +export * from './GetResolutionAchievementsMessageComposer'; +export * from './GetUserGameAchievementsMessageComposer'; +export * from './JoinQueueMessageComposer'; +export * from './LeaveQueueMessageComposer'; +export * from './ResetResolutionAchievementMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/score/Game2GetWeeklyFriendsLeaderboardComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/score/Game2GetWeeklyFriendsLeaderboardComposer.ts new file mode 100644 index 0000000..d16594d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/score/Game2GetWeeklyFriendsLeaderboardComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class Game2GetWeeklyFriendsLeaderboardComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k:number, _arg_2:number, _arg_3:number, _arg_4:number, _arg_5:number, _arg_6:number) + { + this._data = [ k, _arg_2, _arg_3, _arg_4, _arg_5, _arg_6 ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/score/Game2GetWeeklyLeaderboardComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/score/Game2GetWeeklyLeaderboardComposer.ts new file mode 100644 index 0000000..6b78af0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/score/Game2GetWeeklyLeaderboardComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class Game2GetWeeklyLeaderboardComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k:number, _arg_2:number, _arg_3:number, _arg_4:number, _arg_5:number, _arg_6:number) + { + this._data = [ k, _arg_2, _arg_3, _arg_4, _arg_5, _arg_6 ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/score/GetWeeklyGameRewardComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/score/GetWeeklyGameRewardComposer.ts new file mode 100644 index 0000000..e9305c2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/score/GetWeeklyGameRewardComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetWeeklyGameRewardComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [ k ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/score/GetWeeklyGameRewardWinnersComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/score/GetWeeklyGameRewardWinnersComposer.ts new file mode 100644 index 0000000..71ee78c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/score/GetWeeklyGameRewardWinnersComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetWeeklyGameRewardWinnersComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [ k ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/game/score/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/game/score/index.ts new file mode 100644 index 0000000..96ea0b1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/game/score/index.ts @@ -0,0 +1,4 @@ +export * from './Game2GetWeeklyFriendsLeaderboardComposer'; +export * from './Game2GetWeeklyLeaderboardComposer'; +export * from './GetWeeklyGameRewardComposer'; +export * from './GetWeeklyGameRewardWinnersComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/GetGiftMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/GetGiftMessageComposer.ts new file mode 100644 index 0000000..666589c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/GetGiftMessageComposer.ts @@ -0,0 +1,23 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetGiftMessageComposer implements IMessageComposer> +{ + public static readonly NO_ISSUE_ID = -1; + + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/ResetPhoneNumberStateMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/ResetPhoneNumberStateMessageComposer.ts new file mode 100644 index 0000000..2bfd0a9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/ResetPhoneNumberStateMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ResetPhoneNumberStateMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/SetPhoneNumberVerificationStatusMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/SetPhoneNumberVerificationStatusMessageComposer.ts new file mode 100644 index 0000000..7498f6c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/SetPhoneNumberVerificationStatusMessageComposer.ts @@ -0,0 +1,23 @@ +import { IMessageComposer } from '../../../../../api'; + +export class SetPhoneNumberVerificationStatusMessageComposer implements IMessageComposer> +{ + public static readonly NO_ISSUE_ID = -1; + + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/TryPhoneNumberMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/TryPhoneNumberMessageComposer.ts new file mode 100644 index 0000000..dfac367 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/TryPhoneNumberMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class TryPhoneNumberMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string, _arg_2: string) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/VerifyCodeMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/VerifyCodeMessageComposer.ts new file mode 100644 index 0000000..1197b6f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/VerifyCodeMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class VerifyCodeMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/index.ts new file mode 100644 index 0000000..daa097b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/gifts/index.ts @@ -0,0 +1,5 @@ +export * from './GetGiftMessageComposer'; +export * from './ResetPhoneNumberStateMessageComposer'; +export * from './SetPhoneNumberVerificationStatusMessageComposer'; +export * from './TryPhoneNumberMessageComposer'; +export * from './VerifyCodeMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/ApproveAllMembershipRequestsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/ApproveAllMembershipRequestsMessageComposer.ts new file mode 100644 index 0000000..8c7d7ee --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/ApproveAllMembershipRequestsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ApproveAllMembershipRequestsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number) + { + this._data = [groupId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupAdminGiveComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupAdminGiveComposer.ts new file mode 100644 index 0000000..d2c459e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupAdminGiveComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupAdminGiveComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number, memberId: number) + { + this._data = [groupId, memberId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupAdminTakeComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupAdminTakeComposer.ts new file mode 100644 index 0000000..30cd906 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupAdminTakeComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupAdminTakeComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number, memberId: number) + { + this._data = [groupId, memberId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupBadgePartsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupBadgePartsComposer.ts new file mode 100644 index 0000000..6bc3fa0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupBadgePartsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupBadgePartsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupBuyComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupBuyComposer.ts new file mode 100644 index 0000000..09648c3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupBuyComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupBuyComposer implements IMessageComposer +{ + private _data: any[]; + + constructor(name: string, description: string, roomId: number, colorA: number, colorB: number, badge: number[]) + { + this._data = [name, description, roomId, colorA, colorB, badge.length, ...badge]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupBuyDataComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupBuyDataComposer.ts new file mode 100644 index 0000000..e6beed9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupBuyDataComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupBuyDataComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupConfirmRemoveMemberComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupConfirmRemoveMemberComposer.ts new file mode 100644 index 0000000..a72a986 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupConfirmRemoveMemberComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupConfirmRemoveMemberComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number, memberId: number) + { + this._data = [groupId, memberId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupDeleteComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupDeleteComposer.ts new file mode 100644 index 0000000..494303f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupDeleteComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupDeleteComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number) + { + this._data = [groupId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupFavoriteComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupFavoriteComposer.ts new file mode 100644 index 0000000..6066430 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupFavoriteComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupFavoriteComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number) + { + this._data = [groupId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupInformationComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupInformationComposer.ts new file mode 100644 index 0000000..7d4b15a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupInformationComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupInformationComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number, flag: boolean) + { + this._data = [groupId, flag]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupJoinComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupJoinComposer.ts new file mode 100644 index 0000000..bf0bf5d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupJoinComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupJoinComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number) + { + this._data = [groupId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupMembersComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupMembersComposer.ts new file mode 100644 index 0000000..c287afd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupMembersComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupMembersComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number, pageId: number, query: string, levelId: number) + { + this._data = [groupId, pageId, query, levelId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupMembershipAcceptComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupMembershipAcceptComposer.ts new file mode 100644 index 0000000..e43fbd5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupMembershipAcceptComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupMembershipAcceptComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number, memberId: number) + { + this._data = [groupId, memberId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupMembershipDeclineComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupMembershipDeclineComposer.ts new file mode 100644 index 0000000..a6bff27 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupMembershipDeclineComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupMembershipDeclineComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number, memberId: number) + { + this._data = [groupId, memberId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupRemoveMemberComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupRemoveMemberComposer.ts new file mode 100644 index 0000000..95006e5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupRemoveMemberComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupRemoveMemberComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number, memberId: number) + { + this._data = [groupId, memberId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupSaveBadgeComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupSaveBadgeComposer.ts new file mode 100644 index 0000000..a8a75e5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupSaveBadgeComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupSaveBadgeComposer implements IMessageComposer +{ + private _data: any[]; + + constructor(groupId: number, badge: number[]) + { + this._data = [groupId, badge.length, ...badge]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupSaveColorsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupSaveColorsComposer.ts new file mode 100644 index 0000000..b844001 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupSaveColorsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupSaveColorsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number, colorA: number, colorB: number) + { + this._data = [groupId, colorA, colorB]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupSaveInformationComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupSaveInformationComposer.ts new file mode 100644 index 0000000..8d4f5bf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupSaveInformationComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupSaveInformationComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number, title: string, description: string) + { + this._data = [groupId, title, description]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupSavePreferencesComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupSavePreferencesComposer.ts new file mode 100644 index 0000000..f5edb1a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupSavePreferencesComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupSavePreferencesComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number, state: number, onlyAdminCanDecorate: number) + { + this._data = [groupId, state, onlyAdminCanDecorate]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupSettingsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupSettingsComposer.ts new file mode 100644 index 0000000..1fa1fc5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupSettingsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupSettingsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number) + { + this._data = [groupId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupUnfavoriteComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupUnfavoriteComposer.ts new file mode 100644 index 0000000..15814ce --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/GroupUnfavoriteComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GroupUnfavoriteComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number) + { + this._data = [groupId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/group/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/group/index.ts new file mode 100644 index 0000000..d8c14a2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/group/index.ts @@ -0,0 +1,21 @@ +export * from './ApproveAllMembershipRequestsMessageComposer'; +export * from './GroupAdminGiveComposer'; +export * from './GroupAdminTakeComposer'; +export * from './GroupBadgePartsComposer'; +export * from './GroupBuyComposer'; +export * from './GroupBuyDataComposer'; +export * from './GroupConfirmRemoveMemberComposer'; +export * from './GroupDeleteComposer'; +export * from './GroupFavoriteComposer'; +export * from './GroupInformationComposer'; +export * from './GroupJoinComposer'; +export * from './GroupMembersComposer'; +export * from './GroupMembershipAcceptComposer'; +export * from './GroupMembershipDeclineComposer'; +export * from './GroupRemoveMemberComposer'; +export * from './GroupSaveBadgeComposer'; +export * from './GroupSaveColorsComposer'; +export * from './GroupSaveInformationComposer'; +export * from './GroupSavePreferencesComposer'; +export * from './GroupSettingsComposer'; +export * from './GroupUnfavoriteComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetForumStatsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetForumStatsMessageComposer.ts new file mode 100644 index 0000000..8d19cdd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetForumStatsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetForumStatsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetForumsListMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetForumsListMessageComposer.ts new file mode 100644 index 0000000..6d88651 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetForumsListMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetForumsListMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: number) + { + this._data = [k, _arg_2, _arg_3]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetMessagesMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetMessagesMessageComposer.ts new file mode 100644 index 0000000..0a5130a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetMessagesMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetMessagesMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: number, _arg_4: number) + { + this._data = [k, _arg_2, _arg_3, _arg_4]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetThreadMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetThreadMessageComposer.ts new file mode 100644 index 0000000..6136b1c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetThreadMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetThreadMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetThreadsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetThreadsMessageComposer.ts new file mode 100644 index 0000000..632cd58 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetThreadsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetThreadsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: number) + { + this._data = [k, _arg_2, _arg_3]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetUnreadForumsCountMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetUnreadForumsCountMessageComposer.ts new file mode 100644 index 0000000..bccc6a6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/GetUnreadForumsCountMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetUnreadForumsCountMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/ModerateMessageMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/ModerateMessageMessageComposer.ts new file mode 100644 index 0000000..21275bc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/ModerateMessageMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ModerateMessageMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: number, _arg_4: number) + { + this._data = [k, _arg_2, _arg_3, _arg_4]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/ModerateThreadMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/ModerateThreadMessageComposer.ts new file mode 100644 index 0000000..8e982d6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/ModerateThreadMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ModerateThreadMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: number) + { + this._data = [k, _arg_2, _arg_3]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/PostMessageMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/PostMessageMessageComposer.ts new file mode 100644 index 0000000..88c5514 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/PostMessageMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PostMessageMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: string, _arg_4: string) + { + this._data = [k, _arg_2, _arg_3, _arg_4]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/UpdateForumReadMarkerMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/UpdateForumReadMarkerMessageComposer.ts new file mode 100644 index 0000000..438ff4b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/UpdateForumReadMarkerMessageComposer.ts @@ -0,0 +1,33 @@ +import { IMessageComposer } from '../../../../../api'; + +export class UpdateForumReadMarkerMessageComposer implements IMessageComposer +{ + private _data: any; + + constructor(...data: UpdateForumReadMarkerEntry[]) + { + this._data = [data.length]; + data.forEach(entry => + { + this._data.push(entry.k); + this._data.push(entry._arg_2); + this._data.push(entry._arg_3); + }); + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} + +export class UpdateForumReadMarkerEntry +{ + constructor(public k: number, public _arg_2: number, public _arg_3: boolean) + { } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/UpdateForumSettingsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/UpdateForumSettingsMessageComposer.ts new file mode 100644 index 0000000..58335eb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/UpdateForumSettingsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class UpdateForumSettingsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: number, _arg_4: number, _arg_5: number) + { + this._data = [k, _arg_2, _arg_3, _arg_4, _arg_5]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/UpdateThreadMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/UpdateThreadMessageComposer.ts new file mode 100644 index 0000000..b7f59ed --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/UpdateThreadMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class UpdateThreadMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: boolean, _arg_4: boolean) + { + this._data = [k, _arg_2, _arg_4, _arg_3]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/index.ts new file mode 100644 index 0000000..fc1825b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/groupforums/index.ts @@ -0,0 +1,12 @@ +export * from './GetForumsListMessageComposer'; +export * from './GetForumStatsMessageComposer'; +export * from './GetMessagesMessageComposer'; +export * from './GetThreadMessageComposer'; +export * from './GetThreadsMessageComposer'; +export * from './GetUnreadForumsCountMessageComposer'; +export * from './ModerateMessageMessageComposer'; +export * from './ModerateThreadMessageComposer'; +export * from './PostMessageMessageComposer'; +export * from './UpdateForumReadMarkerMessageComposer'; +export * from './UpdateForumSettingsMessageComposer'; +export * from './UpdateThreadMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/AuthenticationMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/AuthenticationMessageComposer.ts new file mode 100644 index 0000000..d5402be --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/AuthenticationMessageComposer.ts @@ -0,0 +1,32 @@ +import { IMessageComposer } from '../../../../../api'; + +export class AuthenticationMessageComposer implements IMessageComposer +{ + private _type: string; + private _data: string[]; + + constructor(type: string, keys: string[], values: string[]) + { + this._type = type; + + if(keys.length !== values.length) return; + + this._data = []; + + for(let i = 0; i < keys.length; i++) + { + this._data.push(keys[i]); + this._data.push(values[i]); + } + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/ClientHelloMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/ClientHelloMessageComposer.ts new file mode 100644 index 0000000..5d0b161 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/ClientHelloMessageComposer.ts @@ -0,0 +1,22 @@ +import { ClientDeviceCategoryEnum, ClientPlatformEnum, IMessageComposer } from '../../../../../api'; +import { NitroVersion } from '../../../../../core'; + +export class ClientHelloMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(releaseVersion: string, type: string, platform: number, category: number) + { + this._data = [`NITRO-${NitroVersion.RENDERER_VERSION.replaceAll('.', '-')}`, 'HTML5', ClientPlatformEnum.HTML5, ClientDeviceCategoryEnum.BROWSER]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/CompleteDiffieHandshakeMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/CompleteDiffieHandshakeMessageComposer.ts new file mode 100644 index 0000000..3b25d27 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/CompleteDiffieHandshakeMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CompleteDiffieHandshakeMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(publicKey: string) + { + this._data = [publicKey]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/DisconnectMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/DisconnectMessageComposer.ts new file mode 100644 index 0000000..cf9dcca --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/DisconnectMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class DisconnectMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/InfoRetrieveMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/InfoRetrieveMessageComposer.ts new file mode 100644 index 0000000..72e5db5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/InfoRetrieveMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class InfoRetrieveMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/InitDiffieHandshakeMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/InitDiffieHandshakeMessageComposer.ts new file mode 100644 index 0000000..705c427 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/InitDiffieHandshakeMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class InitDiffieHandshakeMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/PongMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/PongMessageComposer.ts new file mode 100644 index 0000000..703665d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/PongMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PongMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/SSOTicketMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/SSOTicketMessageComposer.ts new file mode 100644 index 0000000..f2c3cd3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/SSOTicketMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class SSOTicketMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(ticket: string, time: number) + { + this._data = [ticket, time]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/UniqueIDMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/UniqueIDMessageComposer.ts new file mode 100644 index 0000000..5edf7d6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/UniqueIDMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class UniqueIDMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(machineId: string, fingerprint: string, flashVersion: string) + { + this._data = [machineId, fingerprint, flashVersion]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/VersionCheckMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/VersionCheckMessageComposer.ts new file mode 100644 index 0000000..7a82a33 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/VersionCheckMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class VersionCheckMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(clientID: number, clientURL: string, externalVariablesURL: string) + { + this._data = [clientID, clientURL, externalVariablesURL]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/index.ts new file mode 100644 index 0000000..4dc6ada --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/handshake/index.ts @@ -0,0 +1,10 @@ +export * from './AuthenticationMessageComposer'; +export * from './ClientHelloMessageComposer'; +export * from './CompleteDiffieHandshakeMessageComposer'; +export * from './DisconnectMessageComposer'; +export * from './InfoRetrieveMessageComposer'; +export * from './InitDiffieHandshakeMessageComposer'; +export * from './PongMessageComposer'; +export * from './SSOTicketMessageComposer'; +export * from './UniqueIDMessageComposer'; +export * from './VersionCheckMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpFromForumMessageMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpFromForumMessageMessageComposer.ts new file mode 100644 index 0000000..f660f51 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpFromForumMessageMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CallForHelpFromForumMessageMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: number, _arg_4: number, _arg_5: string) + { + this._data = [k, _arg_2, _arg_3, _arg_4, _arg_5]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpFromForumThreadMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpFromForumThreadMessageComposer.ts new file mode 100644 index 0000000..89d734b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpFromForumThreadMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CallForHelpFromForumThreadMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: number, _arg_4: string) + { + this._data = [k, _arg_2, _arg_3, _arg_4]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpFromIMMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpFromIMMessageComposer.ts new file mode 100644 index 0000000..5c40fc5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpFromIMMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CallForHelpFromIMMessageComposer implements IMessageComposer +{ + private _data: any; + + constructor(message: string, topicId: number, reportedUserId: number, chatEntries: (string | number)[]) + { + this._data = [message, topicId, reportedUserId, chatEntries.length / 2, ...chatEntries]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpFromPhotoMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpFromPhotoMessageComposer.ts new file mode 100644 index 0000000..04cb280 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpFromPhotoMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CallForHelpFromPhotoMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(extraData: string, roomId: number, reportedUserId: number, topicId: number, roomObjectId: number) + { + this._data = [extraData, roomId, reportedUserId, topicId, roomObjectId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpFromSelfieMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpFromSelfieMessageComposer.ts new file mode 100644 index 0000000..a5bf88a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpFromSelfieMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CallForHelpFromSelfieMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string, _arg_2: number, _arg_3: number, _arg_4: string, _arg_5: number) + { + this._data = [k, _arg_2, _arg_3, _arg_4, _arg_5]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpMessageComposer.ts new file mode 100644 index 0000000..a3af9c5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/CallForHelpMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CallForHelpMessageComposer implements IMessageComposer +{ + private _data: any; + + constructor(message: string, topicIndex: number, reportedUserId: number, reportedRoomId: number, chatEntries: (string | number)[]) + { + this._data = [message, topicIndex, reportedUserId, reportedRoomId, chatEntries.length / 2, ...chatEntries]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/ChatReviewGuideDecidesOnOfferMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/ChatReviewGuideDecidesOnOfferMessageComposer.ts new file mode 100644 index 0000000..bf80e19 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/ChatReviewGuideDecidesOnOfferMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ChatReviewGuideDecidesOnOfferMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: boolean) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/ChatReviewGuideDetachedMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/ChatReviewGuideDetachedMessageComposer.ts new file mode 100644 index 0000000..a01a6f1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/ChatReviewGuideDetachedMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ChatReviewGuideDetachedMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/ChatReviewGuideVoteMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/ChatReviewGuideVoteMessageComposer.ts new file mode 100644 index 0000000..b3ee2e3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/ChatReviewGuideVoteMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ChatReviewGuideVoteMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/ChatReviewSessionCreateMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/ChatReviewSessionCreateMessageComposer.ts new file mode 100644 index 0000000..4f7b624 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/ChatReviewSessionCreateMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ChatReviewSessionCreateMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/DeletePendingCallsForHelpMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/DeletePendingCallsForHelpMessageComposer.ts new file mode 100644 index 0000000..34d5ab0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/DeletePendingCallsForHelpMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class DeletePendingCallsForHelpMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetCfhStatusMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetCfhStatusMessageComposer.ts new file mode 100644 index 0000000..5c75c2e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetCfhStatusMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetCfhStatusMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: boolean) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetFaqCategoryMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetFaqCategoryMessageComposer.ts new file mode 100644 index 0000000..d69a9d0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetFaqCategoryMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetFaqCategoryMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(categoryId: number) + { + this._data = [categoryId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetFaqTextMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetFaqTextMessageComposer.ts new file mode 100644 index 0000000..ba67a66 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetFaqTextMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetFaqTextMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(questionId: number) + { + this._data = [questionId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetGuideReportingStatusMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetGuideReportingStatusMessageComposer.ts new file mode 100644 index 0000000..e39266f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetGuideReportingStatusMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetGuideReportingStatusMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetPendingCallsForHelpMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetPendingCallsForHelpMessageComposer.ts new file mode 100644 index 0000000..0055af0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetPendingCallsForHelpMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetPendingCallsForHelpMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetQuizQuestionsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetQuizQuestionsComposer.ts new file mode 100644 index 0000000..32de486 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GetQuizQuestionsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetQuizQuestionsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionCreateMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionCreateMessageComposer.ts new file mode 100644 index 0000000..a39f725 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionCreateMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GuideSessionCreateMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: string) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionFeedbackMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionFeedbackMessageComposer.ts new file mode 100644 index 0000000..6be380a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionFeedbackMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GuideSessionFeedbackMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: boolean) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionGetRequesterRoomMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionGetRequesterRoomMessageComposer.ts new file mode 100644 index 0000000..a1e67ca --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionGetRequesterRoomMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GuideSessionGetRequesterRoomMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionGuideDecidesMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionGuideDecidesMessageComposer.ts new file mode 100644 index 0000000..e8f4cdf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionGuideDecidesMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GuideSessionGuideDecidesMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: boolean) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionInviteRequesterMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionInviteRequesterMessageComposer.ts new file mode 100644 index 0000000..306327e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionInviteRequesterMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GuideSessionInviteRequesterMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionIsTypingMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionIsTypingMessageComposer.ts new file mode 100644 index 0000000..e68e057 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionIsTypingMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GuideSessionIsTypingMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: boolean) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionMessageMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionMessageMessageComposer.ts new file mode 100644 index 0000000..e0b3e17 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionMessageMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GuideSessionMessageMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionOnDutyUpdateMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionOnDutyUpdateMessageComposer.ts new file mode 100644 index 0000000..6048663 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionOnDutyUpdateMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GuideSessionOnDutyUpdateMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: boolean, _arg_2: boolean, _arg_3: boolean, _arg_4: boolean) + { + this._data = [k, _arg_2, _arg_3, _arg_4]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionReportMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionReportMessageComposer.ts new file mode 100644 index 0000000..65d8344 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionReportMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GuideSessionReportMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionRequesterCancelsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionRequesterCancelsMessageComposer.ts new file mode 100644 index 0000000..d973992 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionRequesterCancelsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GuideSessionRequesterCancelsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionResolvedMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionResolvedMessageComposer.ts new file mode 100644 index 0000000..23ceaa8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/GuideSessionResolvedMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GuideSessionResolvedMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/PostQuizAnswersComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/PostQuizAnswersComposer.ts new file mode 100644 index 0000000..d55b622 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/PostQuizAnswersComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PostQuizAnswersComposer implements IMessageComposer +{ + private _data: any; + + constructor(quizCode: string, answerIds: number[]) + { + this._data = [quizCode, answerIds.length, ...answerIds]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/SearchFaqsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/SearchFaqsMessageComposer.ts new file mode 100644 index 0000000..902b79b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/SearchFaqsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class SearchFaqsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/help/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/help/index.ts new file mode 100644 index 0000000..9824e8c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/help/index.ts @@ -0,0 +1,30 @@ +export * from './CallForHelpFromForumMessageMessageComposer'; +export * from './CallForHelpFromForumThreadMessageComposer'; +export * from './CallForHelpFromIMMessageComposer'; +export * from './CallForHelpFromPhotoMessageComposer'; +export * from './CallForHelpFromSelfieMessageComposer'; +export * from './CallForHelpMessageComposer'; +export * from './ChatReviewGuideDecidesOnOfferMessageComposer'; +export * from './ChatReviewGuideDetachedMessageComposer'; +export * from './ChatReviewGuideVoteMessageComposer'; +export * from './ChatReviewSessionCreateMessageComposer'; +export * from './DeletePendingCallsForHelpMessageComposer'; +export * from './GetCfhStatusMessageComposer'; +export * from './GetFaqCategoryMessageComposer'; +export * from './GetFaqTextMessageComposer'; +export * from './GetGuideReportingStatusMessageComposer'; +export * from './GetPendingCallsForHelpMessageComposer'; +export * from './GetQuizQuestionsComposer'; +export * from './GuideSessionCreateMessageComposer'; +export * from './GuideSessionFeedbackMessageComposer'; +export * from './GuideSessionGetRequesterRoomMessageComposer'; +export * from './GuideSessionGuideDecidesMessageComposer'; +export * from './GuideSessionInviteRequesterMessageComposer'; +export * from './GuideSessionIsTypingMessageComposer'; +export * from './GuideSessionMessageMessageComposer'; +export * from './GuideSessionOnDutyUpdateMessageComposer'; +export * from './GuideSessionReportMessageComposer'; +export * from './GuideSessionRequesterCancelsMessageComposer'; +export * from './GuideSessionResolvedMessageComposer'; +export * from './PostQuizAnswersComposer'; +export * from './SearchFaqsMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/index.ts new file mode 100644 index 0000000..794f8b3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/index.ts @@ -0,0 +1,73 @@ +export * from './advertisement'; +export * from './avatar'; +export * from './camera'; +export * from './campaign'; +export * from './catalog'; +export * from './competition'; +export * from './crafting'; +export * from './desktop'; +export * from './friendfurni'; +export * from './friendlist'; +export * from './game'; +export * from './game/arena'; +export * from './game/directory'; +export * from './game/ingame'; +export * from './game/lobby'; +export * from './game/score'; +export * from './gifts'; +export * from './group'; +export * from './groupforums'; +export * from './handshake'; +export * from './help'; +export * from './inventory'; +export * from './inventory/badges'; +export * from './inventory/bots'; +export * from './inventory/furni'; +export * from './inventory/pets'; +export * from './inventory/trading'; +export * from './inventory/unseen'; +export * from './landingview'; +export * from './landingview/votes'; +export * from './marketplace'; +export * from './moderation'; +export * from './mysterybox'; +export * from './navigator'; +export * from './nux'; +export * from './OutgoingHeader'; +export * from './pet'; +export * from './poll'; +export * from './quest'; +export * from './recycler'; +export * from './room'; +export * from './room/access'; +export * from './room/action'; +export * from './room/bots'; +export * from './room/data'; +export * from './room/engine'; +export * from './room/furniture'; +export * from './room/furniture/dimmer'; +export * from './room/furniture/floor'; +export * from './room/furniture/logic'; +export * from './room/furniture/mannequin'; +export * from './room/furniture/presents'; +export * from './room/furniture/toner'; +export * from './room/furniture/wall'; +export * from './room/furniture/youtube'; +export * from './room/layout'; +export * from './room/pets'; +export * from './room/session'; +export * from './room/unit'; +export * from './room/unit/chat'; +export * from './roomdirectory'; +export * from './roomevents'; +export * from './roomsettings'; +export * from './sound'; +export * from './talent'; +export * from './tracking'; +export * from './user'; +export * from './user/data'; +export * from './user/inventory'; +export * from './user/inventory/currency'; +export * from './user/inventory/subscription'; +export * from './user/settings'; +export * from './userclassification'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/avatareffect/AvatarEffectActivatedComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/avatareffect/AvatarEffectActivatedComposer.ts new file mode 100644 index 0000000..df14e35 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/avatareffect/AvatarEffectActivatedComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class AvatarEffectActivatedComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(type: number) + { + this._data = [ type ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/avatareffect/AvatarEffectSelectedComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/avatareffect/AvatarEffectSelectedComposer.ts new file mode 100644 index 0000000..23b9147 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/avatareffect/AvatarEffectSelectedComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class AvatarEffectSelectedComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(type: number) + { + this._data = [ type ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/avatareffect/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/avatareffect/index.ts new file mode 100644 index 0000000..f03f144 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/avatareffect/index.ts @@ -0,0 +1,2 @@ +export * from './AvatarEffectActivatedComposer'; +export * from './AvatarEffectSelectedComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/GetBadgePointLimitsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/GetBadgePointLimitsComposer.ts new file mode 100644 index 0000000..799bd0f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/GetBadgePointLimitsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetBadgePointLimitsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = [ ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/GetIsBadgeRequestFulfilledComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/GetIsBadgeRequestFulfilledComposer.ts new file mode 100644 index 0000000..8ab55d2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/GetIsBadgeRequestFulfilledComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetIsBadgeRequestFulfilledComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [ k ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/RequestABadgeComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/RequestABadgeComposer.ts new file mode 100644 index 0000000..2b80f3f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/RequestABadgeComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RequestABadgeComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(requestCode: string) + { + this._data = [ requestCode ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/RequestBadgesComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/RequestBadgesComposer.ts new file mode 100644 index 0000000..37c8837 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/RequestBadgesComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RequestBadgesComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/SetActivatedBadgesComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/SetActivatedBadgesComposer.ts new file mode 100644 index 0000000..b2ad8ac --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/SetActivatedBadgesComposer.ts @@ -0,0 +1,29 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class SetActivatedBadgesComposer implements IMessageComposer +{ + private _badges: string[] = []; + + public getMessageArray() + { + const data = []; + + for(let i = 1; i <= this._badges.length; i++) + { + data.push(i); + data.push(this._badges[i - 1]); + } + + return data; + } + + public dispose(): void + { + return; + } + + public addActivatedBadge(badge: string): void + { + this._badges.push(badge); + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/index.ts new file mode 100644 index 0000000..a29bc57 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/badges/index.ts @@ -0,0 +1,5 @@ +export * from './GetBadgePointLimitsComposer'; +export * from './GetIsBadgeRequestFulfilledComposer'; +export * from './RequestABadgeComposer'; +export * from './RequestBadgesComposer'; +export * from './SetActivatedBadgesComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/bots/GetBotInventoryComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/bots/GetBotInventoryComposer.ts new file mode 100644 index 0000000..e67a64c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/bots/GetBotInventoryComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetBotInventoryComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/bots/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/bots/index.ts new file mode 100644 index 0000000..bab9f59 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/bots/index.ts @@ -0,0 +1 @@ +export * from './GetBotInventoryComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/furni/FurnitureListComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/furni/FurnitureListComposer.ts new file mode 100644 index 0000000..07073d8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/furni/FurnitureListComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class FurnitureListComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/furni/RequestFurniInventoryWhenNotInRoomComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/furni/RequestFurniInventoryWhenNotInRoomComposer.ts new file mode 100644 index 0000000..cc62ed3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/furni/RequestFurniInventoryWhenNotInRoomComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RequestFurniInventoryWhenNotInRoomComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/furni/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/furni/index.ts new file mode 100644 index 0000000..9e0a8f7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/furni/index.ts @@ -0,0 +1,2 @@ +export * from './FurnitureListComposer'; +export * from './RequestFurniInventoryWhenNotInRoomComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/index.ts new file mode 100644 index 0000000..4fc8506 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/index.ts @@ -0,0 +1,7 @@ +export * from './avatareffect'; +export * from './badges'; +export * from './bots'; +export * from './furni'; +export * from './pets'; +export * from './trading'; +export * from './unseen'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/pets/CancelPetBreedingComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/pets/CancelPetBreedingComposer.ts new file mode 100644 index 0000000..364fe83 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/pets/CancelPetBreedingComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class CancelPetBreedingComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number) + { + this._data = [itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/pets/ConfirmPetBreedingComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/pets/ConfirmPetBreedingComposer.ts new file mode 100644 index 0000000..6658627 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/pets/ConfirmPetBreedingComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class ConfirmPetBreedingComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number, name: string, petOneId: number, petTwoId: number) + { + this._data = [itemId, name, petOneId, petTwoId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/pets/RequestPetsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/pets/RequestPetsComposer.ts new file mode 100644 index 0000000..8c0e129 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/pets/RequestPetsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RequestPetsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/pets/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/pets/index.ts new file mode 100644 index 0000000..af32d91 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/pets/index.ts @@ -0,0 +1,3 @@ +export * from './CancelPetBreedingComposer'; +export * from './ConfirmPetBreedingComposer'; +export * from './RequestPetsComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingAcceptComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingAcceptComposer.ts new file mode 100644 index 0000000..88b1530 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingAcceptComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class TradingAcceptComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingCancelComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingCancelComposer.ts new file mode 100644 index 0000000..1bb2880 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingCancelComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class TradingCancelComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingCloseComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingCloseComposer.ts new file mode 100644 index 0000000..8e28191 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingCloseComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class TradingCloseComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingConfirmationComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingConfirmationComposer.ts new file mode 100644 index 0000000..681f296 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingConfirmationComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class TradingConfirmationComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingListAddItemComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingListAddItemComposer.ts new file mode 100644 index 0000000..7b3b358 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingListAddItemComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class TradingListAddItemComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number) + { + this._data = [itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingListAddItemsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingListAddItemsComposer.ts new file mode 100644 index 0000000..1bea656 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingListAddItemsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class TradingListAddItemsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(...itemIds: number[]) + { + this._data = [itemIds.length, ...itemIds]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingListRemoveItemComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingListRemoveItemComposer.ts new file mode 100644 index 0000000..cc8c280 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingListRemoveItemComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class TradingListItemRemoveComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number) + { + this._data = [itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingOpenComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingOpenComposer.ts new file mode 100644 index 0000000..c9a2191 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingOpenComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class TradingOpenComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number) + { + this._data = [userId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingUnacceptComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingUnacceptComposer.ts new file mode 100644 index 0000000..c2d507c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/TradingUnacceptComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class TradingUnacceptComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/index.ts new file mode 100644 index 0000000..6f850eb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/trading/index.ts @@ -0,0 +1,9 @@ +export * from './TradingAcceptComposer'; +export * from './TradingCancelComposer'; +export * from './TradingCloseComposer'; +export * from './TradingConfirmationComposer'; +export * from './TradingListAddItemComposer'; +export * from './TradingListAddItemsComposer'; +export * from './TradingListRemoveItemComposer'; +export * from './TradingOpenComposer'; +export * from './TradingUnacceptComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/unseen/UnseenResetCategoryComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/unseen/UnseenResetCategoryComposer.ts new file mode 100644 index 0000000..7384ced --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/unseen/UnseenResetCategoryComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class UnseenResetCategoryComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(category: number) + { + this._data = [category]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/unseen/UnseenResetItemsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/unseen/UnseenResetItemsComposer.ts new file mode 100644 index 0000000..a8f441d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/unseen/UnseenResetItemsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class UnseenResetItemsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(category: number, ...itemIds: number[]) + { + this._data = [category, itemIds.length, ...itemIds]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/unseen/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/unseen/index.ts new file mode 100644 index 0000000..52f1b4e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/inventory/unseen/index.ts @@ -0,0 +1,2 @@ +export * from './UnseenResetCategoryComposer'; +export * from './UnseenResetItemsComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/landingview/GetPromoArticlesComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/landingview/GetPromoArticlesComposer.ts new file mode 100644 index 0000000..e59c4bc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/landingview/GetPromoArticlesComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetPromoArticlesComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/landingview/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/landingview/index.ts new file mode 100644 index 0000000..9adfb30 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/landingview/index.ts @@ -0,0 +1,2 @@ +export * from './GetPromoArticlesComposer'; +export * from './votes'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/landingview/votes/CommunityGoalVoteMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/landingview/votes/CommunityGoalVoteMessageComposer.ts new file mode 100644 index 0000000..eb578e7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/landingview/votes/CommunityGoalVoteMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class CommunityGoalVoteMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(voteOption: number) + { + this._data = [voteOption]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/landingview/votes/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/landingview/votes/index.ts new file mode 100644 index 0000000..ceaf9d7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/landingview/votes/index.ts @@ -0,0 +1 @@ +export * from './CommunityGoalVoteMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/BuyMarketplaceOfferMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/BuyMarketplaceOfferMessageComposer.ts new file mode 100644 index 0000000..f71a50f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/BuyMarketplaceOfferMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class BuyMarketplaceOfferMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(offerId: number) + { + this._data = [offerId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/BuyMarketplaceTokensMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/BuyMarketplaceTokensMessageComposer.ts new file mode 100644 index 0000000..1d7037e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/BuyMarketplaceTokensMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class BuyMarketplaceTokensMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/CancelMarketplaceOfferMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/CancelMarketplaceOfferMessageComposer.ts new file mode 100644 index 0000000..8a61947 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/CancelMarketplaceOfferMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CancelMarketplaceOfferMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(offerId: number) + { + this._data = [offerId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/GetMarketplaceCanMakeOfferComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/GetMarketplaceCanMakeOfferComposer.ts new file mode 100644 index 0000000..afef9bf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/GetMarketplaceCanMakeOfferComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetMarketplaceCanMakeOfferComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/GetMarketplaceConfigurationMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/GetMarketplaceConfigurationMessageComposer.ts new file mode 100644 index 0000000..ca8b768 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/GetMarketplaceConfigurationMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetMarketplaceConfigurationMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/GetMarketplaceItemStatsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/GetMarketplaceItemStatsComposer.ts new file mode 100644 index 0000000..3259494 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/GetMarketplaceItemStatsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetMarketplaceItemStatsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(unknown: number, itemId: number) + { + this._data = [unknown, itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/GetMarketplaceOffersMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/GetMarketplaceOffersMessageComposer.ts new file mode 100644 index 0000000..f99054f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/GetMarketplaceOffersMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetMarketplaceOffersMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(min: number, max: number, query: string, type: number) + { + this._data = [min, max, query, type]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/GetMarketplaceOwnOffersMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/GetMarketplaceOwnOffersMessageComposer.ts new file mode 100644 index 0000000..1a12d83 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/GetMarketplaceOwnOffersMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetMarketplaceOwnOffersMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/MakeOfferMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/MakeOfferMessageComposer.ts new file mode 100644 index 0000000..06226e8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/MakeOfferMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class MakeOfferMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(credits: number, arg2: number, itemId: number) + { + this._data = [credits, arg2, itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/RedeemMarketplaceOfferCreditsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/RedeemMarketplaceOfferCreditsMessageComposer.ts new file mode 100644 index 0000000..af07b64 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/RedeemMarketplaceOfferCreditsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RedeemMarketplaceOfferCreditsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + this._data = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/index.ts new file mode 100644 index 0000000..742161a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/marketplace/index.ts @@ -0,0 +1,10 @@ +export * from './BuyMarketplaceOfferMessageComposer'; +export * from './BuyMarketplaceTokensMessageComposer'; +export * from './CancelMarketplaceOfferMessageComposer'; +export * from './GetMarketplaceCanMakeOfferComposer'; +export * from './GetMarketplaceConfigurationMessageComposer'; +export * from './GetMarketplaceItemStatsComposer'; +export * from './GetMarketplaceOffersMessageComposer'; +export * from './GetMarketplaceOwnOffersMessageComposer'; +export * from './MakeOfferMessageComposer'; +export * from './RedeemMarketplaceOfferCreditsMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/CloseIssueDefaultActionMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/CloseIssueDefaultActionMessageComposer.ts new file mode 100644 index 0000000..781c4f8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/CloseIssueDefaultActionMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CloseIssueDefaultActionMessageComposer implements IMessageComposer +{ + private _data: number[]; + + constructor(k: number, issueIds: number[], _arg_2: number) + { + this._data = [k, issueIds.length, ...issueIds, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/CloseIssuesMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/CloseIssuesMessageComposer.ts new file mode 100644 index 0000000..d647bae --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/CloseIssuesMessageComposer.ts @@ -0,0 +1,25 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CloseIssuesMessageComposer implements IMessageComposer +{ + public static readonly RESOLUTION_USELESS = 1; + public static readonly RESOLUTION_ABUSIVE = 2; + public static readonly RESOLUTION_RESOLVED = 3; + + private _data: number[]; + + constructor(issueIds: number[], resolutionType: number) + { + this._data = [resolutionType, issueIds.length, ...issueIds]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/DefaultSanctionMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/DefaultSanctionMessageComposer.ts new file mode 100644 index 0000000..207b081 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/DefaultSanctionMessageComposer.ts @@ -0,0 +1,26 @@ +import { IMessageComposer } from '../../../../../api'; +import { ModBanMessageComposer } from './ModBanMessageComposer'; + +export class DefaultSanctionMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: string, _arg_4: number = -1) + { + this._data = [k, _arg_2, _arg_3]; + if(_arg_4 != ModBanMessageComposer.NO_ISSUE_ID) + { + this._data.push(_arg_4); + } + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetCfhChatlogMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetCfhChatlogMessageComposer.ts new file mode 100644 index 0000000..b486c7f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetCfhChatlogMessageComposer.ts @@ -0,0 +1,22 @@ +import { IMessageComposer } from '../../../../../api'; + + +export class GetCfhChatlogMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(issueId: number) + { + this._data = [issueId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetModeratorRoomInfoMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetModeratorRoomInfoMessageComposer.ts new file mode 100644 index 0000000..524660c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetModeratorRoomInfoMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetModeratorRoomInfoMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(roomId: number) + { + this._data = [roomId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetModeratorUserInfoMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetModeratorUserInfoMessageComposer.ts new file mode 100644 index 0000000..b668ce5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetModeratorUserInfoMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetModeratorUserInfoMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number) + { + this._data = [userId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetRoomChatlogMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetRoomChatlogMessageComposer.ts new file mode 100644 index 0000000..8724d72 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetRoomChatlogMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetRoomChatlogMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(roomId: number, useless: number = 0) + { + this._data = [useless, roomId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetRoomVisitsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetRoomVisitsMessageComposer.ts new file mode 100644 index 0000000..037e5c4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetRoomVisitsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetRoomVisitsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetUserChatlogMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetUserChatlogMessageComposer.ts new file mode 100644 index 0000000..30d40d4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/GetUserChatlogMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetUserChatlogMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number) + { + this._data = [userId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModAlertMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModAlertMessageComposer.ts new file mode 100644 index 0000000..4b91007 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModAlertMessageComposer.ts @@ -0,0 +1,26 @@ +import { IMessageComposer } from '../../../../../api'; +import { ModBanMessageComposer } from './ModBanMessageComposer'; + +export class ModAlertMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, arg2: string, arg3: number, arg4: number = -1) + { + this._data = [k, arg2, arg3]; + if(arg4 != ModBanMessageComposer.NO_ISSUE_ID) + { + this._data.push(arg4); + } + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModBanMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModBanMessageComposer.ts new file mode 100644 index 0000000..4b32fd0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModBanMessageComposer.ts @@ -0,0 +1,27 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ModBanMessageComposer implements IMessageComposer> +{ + public static readonly NO_ISSUE_ID = -1; + + private _data: ConstructorParameters; + + constructor(k: number, arg2: string, arg3: number, arg4: number, arg5: boolean, arg6: number = -1) + { + this._data = [k, arg2, arg3, arg4, arg5]; + if(arg6 != ModBanMessageComposer.NO_ISSUE_ID) + { + this._data.push(arg6); + } + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModKickMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModKickMessageComposer.ts new file mode 100644 index 0000000..c3500f7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModKickMessageComposer.ts @@ -0,0 +1,27 @@ +import { IMessageComposer } from '../../../../../api'; +import { ModBanMessageComposer } from './ModBanMessageComposer'; + +export class ModKickMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, arg2: string, arg3: number, arg4: number = -1) + { + this._data = [k, arg2, arg3]; + + if(arg4 != ModBanMessageComposer.NO_ISSUE_ID) + { + this._data.push(arg4); + } + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModMessageMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModMessageMessageComposer.ts new file mode 100644 index 0000000..0c1c8fa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModMessageMessageComposer.ts @@ -0,0 +1,30 @@ +import { IMessageComposer } from '../../../../../api'; +import { ModBanMessageComposer } from './ModBanMessageComposer'; + +export class ModMessageMessageComposer implements IMessageComposer +{ + private _data: any[] = []; + + constructor(k: number, arg2: string, arg3: number, arg4: number = -1) + { + this._data.push(k); + this._data.push(arg2); + this._data.push(''); + this._data.push(''); + this._data.push(arg3); + if(arg4 != ModBanMessageComposer.NO_ISSUE_ID) + { + this._data.push(arg4); + } + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModMuteMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModMuteMessageComposer.ts new file mode 100644 index 0000000..4ccdf7f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModMuteMessageComposer.ts @@ -0,0 +1,26 @@ +import { IMessageComposer } from '../../../../../api'; +import { ModBanMessageComposer } from './ModBanMessageComposer'; + +export class ModMuteMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, arg2: string, arg3: number, arg4: number = -1) + { + this._data = [k, arg2, arg3]; + if(arg4 != ModBanMessageComposer.NO_ISSUE_ID) + { + this._data.push(arg4); + } + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModToolPreferencesComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModToolPreferencesComposer.ts new file mode 100644 index 0000000..d350940 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModToolPreferencesComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ModToolPreferencesComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: number, _arg_4: number) + { + this._data = [k, _arg_2, _arg_3, _arg_4]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModToolSanctionComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModToolSanctionComposer.ts new file mode 100644 index 0000000..81965c3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModToolSanctionComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ModToolSanctionComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: number) + { + this._data = [k, _arg_2, _arg_3]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModTradingLockMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModTradingLockMessageComposer.ts new file mode 100644 index 0000000..568d33e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModTradingLockMessageComposer.ts @@ -0,0 +1,27 @@ +import { IMessageComposer } from '../../../../../api'; +import { ModBanMessageComposer } from './ModBanMessageComposer'; + +export class ModTradingLockMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, arg2: string, arg3: number, arg4: number, arg5: number = -1) + { + this._data = [k, arg2, arg3, arg4]; + + if(arg5 != ModBanMessageComposer.NO_ISSUE_ID) + { + this._data.push(arg5); + } + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModerateRoomMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModerateRoomMessageComposer.ts new file mode 100644 index 0000000..1aa5af8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModerateRoomMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ModerateRoomMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(roomId: number, lockDoor: number, changeTitle: number, kickUsers: number) + { + this._data = [roomId, lockDoor, changeTitle, kickUsers]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModeratorActionMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModeratorActionMessageComposer.ts new file mode 100644 index 0000000..a693b97 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ModeratorActionMessageComposer.ts @@ -0,0 +1,28 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ModeratorActionMessageComposer implements IMessageComposer +{ + public static readonly ACTION_ALERT = 0; + public static readonly ACTION_KICK = 1; + public static readonly ACTION_MESSAGE = 3; + public static readonly ACTION_MESSAGE_AND_SOFT_KICK = 4; + + private _data: any[] = []; + + constructor(k: number, arg2: string, arg3: string) + { + this._data.push(k); + this._data.push(arg2); + this._data.push(arg3); + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/PickIssuesMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/PickIssuesMessageComposer.ts new file mode 100644 index 0000000..7c88045 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/PickIssuesMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PickIssuesMessageComposer implements IMessageComposer +{ + private _data: any; + + constructor(issueIds: number[], retryEnabled: boolean, retryCount: number, message: string) + { + this._data = [issueIds.length, ...issueIds, retryEnabled, retryCount, message]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ReleaseIssuesMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ReleaseIssuesMessageComposer.ts new file mode 100644 index 0000000..7ab553b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/ReleaseIssuesMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ReleaseIssuesMessageComposer implements IMessageComposer +{ + private _data: number[]; + + constructor(issueIds: number[]) + { + this._data = [issueIds.length, ...issueIds]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/index.ts new file mode 100644 index 0000000..6f35762 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/moderation/index.ts @@ -0,0 +1,21 @@ +export * from './CloseIssueDefaultActionMessageComposer'; +export * from './CloseIssuesMessageComposer'; +export * from './DefaultSanctionMessageComposer'; +export * from './GetCfhChatlogMessageComposer'; +export * from './GetModeratorRoomInfoMessageComposer'; +export * from './GetModeratorUserInfoMessageComposer'; +export * from './GetRoomChatlogMessageComposer'; +export * from './GetRoomVisitsMessageComposer'; +export * from './GetUserChatlogMessageComposer'; +export * from './ModAlertMessageComposer'; +export * from './ModBanMessageComposer'; +export * from './ModerateRoomMessageComposer'; +export * from './ModeratorActionMessageComposer'; +export * from './ModKickMessageComposer'; +export * from './ModMessageMessageComposer'; +export * from './ModMuteMessageComposer'; +export * from './ModToolPreferencesComposer'; +export * from './ModToolSanctionComposer'; +export * from './ModTradingLockMessageComposer'; +export * from './PickIssuesMessageComposer'; +export * from './ReleaseIssuesMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/mysterybox/MysteryBoxWaitingCanceledMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/mysterybox/MysteryBoxWaitingCanceledMessageComposer.ts new file mode 100644 index 0000000..cfbfb6d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/mysterybox/MysteryBoxWaitingCanceledMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class MysteryBoxWaitingCanceledMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [ k ]; + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/mysterybox/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/mysterybox/index.ts new file mode 100644 index 0000000..d4ed8fb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/mysterybox/index.ts @@ -0,0 +1 @@ +export * from './MysteryBoxWaitingCanceledMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/AddFavouriteRoomMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/AddFavouriteRoomMessageComposer.ts new file mode 100644 index 0000000..7a438b3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/AddFavouriteRoomMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class AddFavouriteRoomMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(roomId: number) + { + this._data = [roomId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/CanCreateRoomMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/CanCreateRoomMessageComposer.ts new file mode 100644 index 0000000..f133d15 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/CanCreateRoomMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CanCreateRoomMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/CancelEventMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/CancelEventMessageComposer.ts new file mode 100644 index 0000000..527d86c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/CancelEventMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CancelEventMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/CompetitionRoomsSearchMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/CompetitionRoomsSearchMessageComposer.ts new file mode 100644 index 0000000..b5fb83b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/CompetitionRoomsSearchMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CompetitionRoomsSearchMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/ConvertGlobalRoomIdComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/ConvertGlobalRoomIdComposer.ts new file mode 100644 index 0000000..2025788 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/ConvertGlobalRoomIdComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ConvertGlobalRoomIdMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(flatId: string) + { + this._data = [flatId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/CreateFlatMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/CreateFlatMessageComposer.ts new file mode 100644 index 0000000..01f2ad6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/CreateFlatMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CreateFlatMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(roomName: string, roomDesc: string, modelName: string, categoryId: number, maxVisitors: number, tradeType: number) + { + this._data = [roomName, roomDesc, modelName, categoryId, maxVisitors, tradeType]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/DeleteFavouriteRoomMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/DeleteFavouriteRoomMessageComposer.ts new file mode 100644 index 0000000..1d8c951 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/DeleteFavouriteRoomMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class DeleteFavouriteRoomMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/EditEventMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/EditEventMessageComposer.ts new file mode 100644 index 0000000..8f1ecb9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/EditEventMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class EditEventMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: string, _arg_3: string) + { + this._data = [k, _arg_2, _arg_3]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/ForwardToARandomPromotedRoomMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/ForwardToARandomPromotedRoomMessageComposer.ts new file mode 100644 index 0000000..4ddba7c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/ForwardToARandomPromotedRoomMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ForwardToARandomPromotedRoomMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/ForwardToSomeRoomMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/ForwardToSomeRoomMessageComposer.ts new file mode 100644 index 0000000..f86eb05 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/ForwardToSomeRoomMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ForwardToSomeRoomMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetCategoriesWithUserCountMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetCategoriesWithUserCountMessageComposer.ts new file mode 100644 index 0000000..512c8aa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetCategoriesWithUserCountMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetCategoriesWithUserCountMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetCustomRoomFilterMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetCustomRoomFilterMessageComposer.ts new file mode 100644 index 0000000..27b66c3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetCustomRoomFilterMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetCustomRoomFilterMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(roomId: number) + { + this._data = [roomId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetGuestRoomMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetGuestRoomMessageComposer.ts new file mode 100644 index 0000000..439097c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetGuestRoomMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetGuestRoomMessageComposer implements IMessageComposer<[number, number, number]> +{ + private _data: [number, number, number]; + + constructor(roomId: number, enterRoom: boolean, forwardRoom: boolean) + { + this._data = [roomId, (enterRoom ? 1 : 0), (forwardRoom ? 1 : 0)]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetOfficialRoomsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetOfficialRoomsMessageComposer.ts new file mode 100644 index 0000000..661e67c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetOfficialRoomsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetOfficialRoomsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number = 0) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetPopularRoomTagsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetPopularRoomTagsMessageComposer.ts new file mode 100644 index 0000000..8932ae2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetPopularRoomTagsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetPopularRoomTagsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetUserEventCatsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetUserEventCatsMessageComposer.ts new file mode 100644 index 0000000..06a8806 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetUserEventCatsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetUserEventCatsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetUserFlatCatsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetUserFlatCatsMessageComposer.ts new file mode 100644 index 0000000..8a020c3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GetUserFlatCatsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetUserFlatCatsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GuildBaseSearchMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GuildBaseSearchMessageComposer.ts new file mode 100644 index 0000000..cff4a23 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/GuildBaseSearchMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GuildBaseSearchMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyFavouriteRoomsSearchMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyFavouriteRoomsSearchMessageComposer.ts new file mode 100644 index 0000000..94c97d2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyFavouriteRoomsSearchMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class MyFavouriteRoomsSearchMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyFrequentRoomHistorySearchMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyFrequentRoomHistorySearchMessageComposer.ts new file mode 100644 index 0000000..362ec95 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyFrequentRoomHistorySearchMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class MyFrequentRoomHistorySearchMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyFriendsRoomsSearchMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyFriendsRoomsSearchMessageComposer.ts new file mode 100644 index 0000000..1ba68ef --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyFriendsRoomsSearchMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class MyFriendsRoomsSearchMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyGuildBasesSearchMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyGuildBasesSearchMessageComposer.ts new file mode 100644 index 0000000..6b9e882 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyGuildBasesSearchMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class MyGuildBasesSearchMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyRecommendedRoomsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyRecommendedRoomsMessageComposer.ts new file mode 100644 index 0000000..ffea2a5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyRecommendedRoomsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class MyRecommendedRoomsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyRoomHistorySearchMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyRoomHistorySearchMessageComposer.ts new file mode 100644 index 0000000..fe55281 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyRoomHistorySearchMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class MyRoomHistorySearchMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyRoomRightsSearchMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyRoomRightsSearchMessageComposer.ts new file mode 100644 index 0000000..d97db35 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyRoomRightsSearchMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class MyRoomRightsSearchMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyRoomsSearchMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyRoomsSearchMessageComposer.ts new file mode 100644 index 0000000..8c5f91f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/MyRoomsSearchMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class MyRoomsSearchMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorCategoryListModeComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorCategoryListModeComposer.ts new file mode 100644 index 0000000..5b539d1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorCategoryListModeComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class NavigatorCategoryListModeComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(category: string, listmode: number) + { + this._data = [category, listmode]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorDeleteSavedSearchComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorDeleteSavedSearchComposer.ts new file mode 100644 index 0000000..a8ac643 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorDeleteSavedSearchComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class NavigatorDeleteSavedSearchComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(searchId: number) + { + this._data = [searchId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorInitComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorInitComposer.ts new file mode 100644 index 0000000..7b70cdd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorInitComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class NavigatorInitComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorSearchCloseComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorSearchCloseComposer.ts new file mode 100644 index 0000000..345bbdd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorSearchCloseComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class NavigatorSearchCloseComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(code: string) + { + this._data = [code]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorSearchComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorSearchComposer.ts new file mode 100644 index 0000000..0e5ce86 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorSearchComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class NavigatorSearchComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(code: string, data: string) + { + this._data = [code, data]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorSearchOpenComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorSearchOpenComposer.ts new file mode 100644 index 0000000..8aee0be --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorSearchOpenComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class NavigatorSearchOpenComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(code: string) + { + this._data = [code]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorSearchSaveComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorSearchSaveComposer.ts new file mode 100644 index 0000000..af2bd84 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorSearchSaveComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class NavigatorSearchSaveComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(code: string, data: string) + { + this._data = [code, data]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorSettingsSaveComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorSettingsSaveComposer.ts new file mode 100644 index 0000000..f66bfc8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/NavigatorSettingsSaveComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class NavigatorSettingsSaveComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(x: number, y: number, width: number, height: number, leftSideOpen: boolean, mode: number) + { + this._data = [x, y, width, height, leftSideOpen, mode]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/PopularRoomsSearchMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/PopularRoomsSearchMessageComposer.ts new file mode 100644 index 0000000..a8a4179 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/PopularRoomsSearchMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PopularRoomsSearchMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string, _arg_2: number) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RateFlatMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RateFlatMessageComposer.ts new file mode 100644 index 0000000..173610b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RateFlatMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RateFlatMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RemoveOwnRoomRightsRoomMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RemoveOwnRoomRightsRoomMessageComposer.ts new file mode 100644 index 0000000..cd95d63 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RemoveOwnRoomRightsRoomMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RemoveOwnRoomRightsRoomMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(roomId: number) + { + this._data = [roomId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomAdEventTabAdClickedComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomAdEventTabAdClickedComposer.ts new file mode 100644 index 0000000..3aee567 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomAdEventTabAdClickedComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RoomAdEventTabAdClickedComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: string, _arg_3: number) + { + this._data = [k, _arg_2, _arg_3]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomAdEventTabViewedComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomAdEventTabViewedComposer.ts new file mode 100644 index 0000000..1ce7ebc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomAdEventTabViewedComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RoomAdEventTabViewedComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomAdSearchMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomAdSearchMessageComposer.ts new file mode 100644 index 0000000..6d6534e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomAdSearchMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RoomAdSearchMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomTextSearchMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomTextSearchMessageComposer.ts new file mode 100644 index 0000000..98aeb37 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomTextSearchMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RoomTextSearchMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomsWhereMyFriendsAreSearchMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomsWhereMyFriendsAreSearchMessageComposer.ts new file mode 100644 index 0000000..0ddaac7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomsWhereMyFriendsAreSearchMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RoomsWhereMyFriendsAreSearchMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomsWithHighestScoreSearchMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomsWithHighestScoreSearchMessageComposer.ts new file mode 100644 index 0000000..c4ddee5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/RoomsWithHighestScoreSearchMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RoomsWithHighestScoreSearchMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/SetRoomSessionTagsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/SetRoomSessionTagsMessageComposer.ts new file mode 100644 index 0000000..26d50b0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/SetRoomSessionTagsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class SetRoomSessionTagsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string, _arg_2: string) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/ToggleStaffPickMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/ToggleStaffPickMessageComposer.ts new file mode 100644 index 0000000..07302f8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/ToggleStaffPickMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ToggleStaffPickMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(roomId: number) + { + this._data = [roomId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/UpdateHomeRoomMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/UpdateHomeRoomMessageComposer.ts new file mode 100644 index 0000000..af52116 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/UpdateHomeRoomMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class UpdateHomeRoomMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(roomId: number) + { + this._data = [roomId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/UpdateRoomFilterMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/UpdateRoomFilterMessageComposer.ts new file mode 100644 index 0000000..f72b7ae --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/UpdateRoomFilterMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class UpdateRoomFilterMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(roomId: number, isAddingWord: boolean, word: string) + { + this._data = [roomId, isAddingWord, word]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/UpdateRoomThumbnailMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/UpdateRoomThumbnailMessageComposer.ts new file mode 100644 index 0000000..4e4221d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/UpdateRoomThumbnailMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class UpdateRoomThumbnailMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(flatId: number, bgImgId: number, frontImgId: number, objCount: number) + { + this._data = [flatId, bgImgId, frontImgId, objCount]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/index.ts new file mode 100644 index 0000000..4a73ec7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/navigator/index.ts @@ -0,0 +1,48 @@ +export * from './AddFavouriteRoomMessageComposer'; +export * from './CancelEventMessageComposer'; +export * from './CanCreateRoomMessageComposer'; +export * from './CompetitionRoomsSearchMessageComposer'; +export * from './ConvertGlobalRoomIdComposer'; +export * from './CreateFlatMessageComposer'; +export * from './DeleteFavouriteRoomMessageComposer'; +export * from './EditEventMessageComposer'; +export * from './ForwardToARandomPromotedRoomMessageComposer'; +export * from './ForwardToSomeRoomMessageComposer'; +export * from './GetCategoriesWithUserCountMessageComposer'; +export * from './GetCustomRoomFilterMessageComposer'; +export * from './GetGuestRoomMessageComposer'; +export * from './GetOfficialRoomsMessageComposer'; +export * from './GetPopularRoomTagsMessageComposer'; +export * from './GetUserEventCatsMessageComposer'; +export * from './GetUserFlatCatsMessageComposer'; +export * from './GuildBaseSearchMessageComposer'; +export * from './MyFavouriteRoomsSearchMessageComposer'; +export * from './MyFrequentRoomHistorySearchMessageComposer'; +export * from './MyFriendsRoomsSearchMessageComposer'; +export * from './MyGuildBasesSearchMessageComposer'; +export * from './MyRecommendedRoomsMessageComposer'; +export * from './MyRoomHistorySearchMessageComposer'; +export * from './MyRoomRightsSearchMessageComposer'; +export * from './MyRoomsSearchMessageComposer'; +export * from './NavigatorCategoryListModeComposer'; +export * from './NavigatorDeleteSavedSearchComposer'; +export * from './NavigatorInitComposer'; +export * from './NavigatorSearchCloseComposer'; +export * from './NavigatorSearchComposer'; +export * from './NavigatorSearchOpenComposer'; +export * from './NavigatorSearchSaveComposer'; +export * from './NavigatorSettingsSaveComposer'; +export * from './PopularRoomsSearchMessageComposer'; +export * from './RateFlatMessageComposer'; +export * from './RemoveOwnRoomRightsRoomMessageComposer'; +export * from './RoomAdEventTabAdClickedComposer'; +export * from './RoomAdEventTabViewedComposer'; +export * from './RoomAdSearchMessageComposer'; +export * from './RoomsWhereMyFriendsAreSearchMessageComposer'; +export * from './RoomsWithHighestScoreSearchMessageComposer'; +export * from './RoomTextSearchMessageComposer'; +export * from './SetRoomSessionTagsMessageComposer'; +export * from './ToggleStaffPickMessageComposer'; +export * from './UpdateHomeRoomMessageComposer'; +export * from './UpdateRoomFilterMessageComposer'; +export * from './UpdateRoomThumbnailMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/nux/NewUserExperienceGetGiftsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/nux/NewUserExperienceGetGiftsComposer.ts new file mode 100644 index 0000000..1c12dbc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/nux/NewUserExperienceGetGiftsComposer.ts @@ -0,0 +1,28 @@ +import { IMessageComposer } from '../../../../../api'; +import { NewUserExperienceGetGiftsSelection } from './NewUserExperienceGetGiftsSelection'; + +export class NewUserExperienceGetGiftsComposer implements IMessageComposer> +{ + private _data: any; + + constructor(...data: NewUserExperienceGetGiftsSelection[]) + { + this._data = [data.length * 3]; + data.forEach(entry => + { + this._data.push(entry.dayIndex); + this._data.push(entry.stepIndex); + this._data.push(entry.giftIndex); + }); + } + + dispose(): void + { + this._data = null; + } + + public getMessageArray() + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/nux/NewUserExperienceGetGiftsSelection.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/nux/NewUserExperienceGetGiftsSelection.ts new file mode 100644 index 0000000..fd95d6b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/nux/NewUserExperienceGetGiftsSelection.ts @@ -0,0 +1,28 @@ +export class NewUserExperienceGetGiftsSelection +{ + private _dayIndex: number; + private _stepIndex: number; + private _giftIndex: number; + + constructor(dayIndex: number, stepIndex: number, giftIndex: number) + { + this._dayIndex = dayIndex; + this._stepIndex = stepIndex; + this._giftIndex = giftIndex; + } + + public get dayIndex(): number + { + return this._dayIndex; + } + + public get stepIndex(): number + { + return this._stepIndex; + } + + public get giftIndex(): number + { + return this._giftIndex; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/nux/NewUserExperienceScriptProceedComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/nux/NewUserExperienceScriptProceedComposer.ts new file mode 100644 index 0000000..223c883 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/nux/NewUserExperienceScriptProceedComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class NewUserExperienceScriptProceedComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/nux/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/nux/index.ts new file mode 100644 index 0000000..31d517b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/nux/index.ts @@ -0,0 +1,3 @@ +export * from './NewUserExperienceGetGiftsComposer'; +export * from './NewUserExperienceGetGiftsSelection'; +export * from './NewUserExperienceScriptProceedComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/pet/GetPetCommandsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/GetPetCommandsComposer.ts new file mode 100644 index 0000000..205b4d1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/GetPetCommandsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetPetCommandsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(petId: number) + { + this._data = [petId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/pet/PetMountComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/PetMountComposer.ts new file mode 100644 index 0000000..27d1b16 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/PetMountComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PetMountComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(petId: number, flag: boolean) + { + this._data = [petId, flag]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/pet/PetRespectComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/PetRespectComposer.ts new file mode 100644 index 0000000..7a2dc35 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/PetRespectComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PetRespectComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(petId: number) + { + this._data = [petId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/pet/PetSupplementComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/PetSupplementComposer.ts new file mode 100644 index 0000000..30a634d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/PetSupplementComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PetSupplementComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(petId: number, supplement: number) + { + this._data = [petId, supplement]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/pet/RemovePetSaddleComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/RemovePetSaddleComposer.ts new file mode 100644 index 0000000..cbe18f1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/RemovePetSaddleComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RemovePetSaddleComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(petId: number) + { + this._data = [petId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/pet/RequestPetInfoComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/RequestPetInfoComposer.ts new file mode 100644 index 0000000..506d3c5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/RequestPetInfoComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RequestPetInfoComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(petId: number) + { + this._data = [petId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/pet/TogglePetBreedingComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/TogglePetBreedingComposer.ts new file mode 100644 index 0000000..f94e54c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/TogglePetBreedingComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class TogglePetBreedingComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(petId: number) + { + this._data = [petId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/pet/TogglePetRidingComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/TogglePetRidingComposer.ts new file mode 100644 index 0000000..af1497a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/TogglePetRidingComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class TogglePetRidingComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(petId: number) + { + this._data = [petId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/pet/UsePetProductComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/UsePetProductComposer.ts new file mode 100644 index 0000000..e9b46e4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/UsePetProductComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class UsePetProductComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number, petId: number) + { + this._data = [itemId, petId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/pet/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/index.ts new file mode 100644 index 0000000..6e1205d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/pet/index.ts @@ -0,0 +1,9 @@ +export * from './GetPetCommandsComposer'; +export * from './PetMountComposer'; +export * from './PetRespectComposer'; +export * from './PetSupplementComposer'; +export * from './RemovePetSaddleComposer'; +export * from './RequestPetInfoComposer'; +export * from './TogglePetBreedingComposer'; +export * from './TogglePetRidingComposer'; +export * from './UsePetProductComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/poll/PollAnswerComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/poll/PollAnswerComposer.ts new file mode 100644 index 0000000..c9512c9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/poll/PollAnswerComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PollAnswerComposer implements IMessageComposer +{ + private _data: any; + + constructor(pollId: number, questionId: number, answers: string[]) + { + this._data = [pollId, questionId, answers.length, ...answers]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/poll/PollRejectComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/poll/PollRejectComposer.ts new file mode 100644 index 0000000..4fc7a57 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/poll/PollRejectComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PollRejectComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/poll/PollStartComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/poll/PollStartComposer.ts new file mode 100644 index 0000000..1782e55 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/poll/PollStartComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PollStartComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/poll/VotePollCounterMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/poll/VotePollCounterMessageComposer.ts new file mode 100644 index 0000000..0422131 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/poll/VotePollCounterMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class VotePollCounterMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(counter: number) + { + this._data = [counter]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/poll/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/poll/index.ts new file mode 100644 index 0000000..0055b90 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/poll/index.ts @@ -0,0 +1,4 @@ +export * from './PollAnswerComposer'; +export * from './PollRejectComposer'; +export * from './PollStartComposer'; +export * from './VotePollCounterMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/AcceptQuestMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/AcceptQuestMessageComposer.ts new file mode 100644 index 0000000..f1c6cb4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/AcceptQuestMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class AcceptQuestMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/ActivateQuestMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/ActivateQuestMessageComposer.ts new file mode 100644 index 0000000..907ac6f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/ActivateQuestMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ActivateQuestMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/CancelQuestMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/CancelQuestMessageComposer.ts new file mode 100644 index 0000000..86ee8b8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/CancelQuestMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CancelQuestMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/FriendRequestQuestCompleteMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/FriendRequestQuestCompleteMessageComposer.ts new file mode 100644 index 0000000..29ac2aa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/FriendRequestQuestCompleteMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class FriendRequestQuestCompleteMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetCommunityGoalEarnedPrizesMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetCommunityGoalEarnedPrizesMessageComposer.ts new file mode 100644 index 0000000..4cbe7a4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetCommunityGoalEarnedPrizesMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetCommunityGoalEarnedPrizesMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetCommunityGoalHallOfFameMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetCommunityGoalHallOfFameMessageComposer.ts new file mode 100644 index 0000000..aef7191 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetCommunityGoalHallOfFameMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetCommunityGoalHallOfFameMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetCommunityGoalProgressMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetCommunityGoalProgressMessageComposer.ts new file mode 100644 index 0000000..7c3e9ff --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetCommunityGoalProgressMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetCommunityGoalProgressMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetConcurrentUsersGoalProgressMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetConcurrentUsersGoalProgressMessageComposer.ts new file mode 100644 index 0000000..9d1da70 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetConcurrentUsersGoalProgressMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetConcurrentUsersGoalProgressMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetConcurrentUsersRewardMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetConcurrentUsersRewardMessageComposer.ts new file mode 100644 index 0000000..a293e00 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetConcurrentUsersRewardMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetConcurrentUsersRewardMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetDailyQuestMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetDailyQuestMessageComposer.ts new file mode 100644 index 0000000..de6e7db --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetDailyQuestMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetDailyQuestMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: boolean, _arg_2: number) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetQuestsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetQuestsMessageComposer.ts new file mode 100644 index 0000000..6bc8447 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetQuestsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetQuestsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetSeasonalQuestsOnlyMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetSeasonalQuestsOnlyMessageComposer.ts new file mode 100644 index 0000000..0ca5e35 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/GetSeasonalQuestsOnlyMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetSeasonalQuestsOnlyMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/OpenQuestTrackerMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/OpenQuestTrackerMessageComposer.ts new file mode 100644 index 0000000..8658579 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/OpenQuestTrackerMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class OpenQuestTrackerMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/RedeemCommunityGoalPrizeMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/RedeemCommunityGoalPrizeMessageComposer.ts new file mode 100644 index 0000000..a53e472 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/RedeemCommunityGoalPrizeMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RedeemCommunityGoalPrizeMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(communityGoalId: number) + { + this._data = [communityGoalId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/RejectQuestMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/RejectQuestMessageComposer.ts new file mode 100644 index 0000000..0505b85 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/RejectQuestMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RejectQuestMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/StartCampaignMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/StartCampaignMessageComposer.ts new file mode 100644 index 0000000..9fc9ba1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/StartCampaignMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class StartCampaignMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/quest/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/index.ts new file mode 100644 index 0000000..e9f5c99 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/quest/index.ts @@ -0,0 +1,16 @@ +export * from './AcceptQuestMessageComposer'; +export * from './ActivateQuestMessageComposer'; +export * from './CancelQuestMessageComposer'; +export * from './FriendRequestQuestCompleteMessageComposer'; +export * from './GetCommunityGoalEarnedPrizesMessageComposer'; +export * from './GetCommunityGoalHallOfFameMessageComposer'; +export * from './GetCommunityGoalProgressMessageComposer'; +export * from './GetConcurrentUsersGoalProgressMessageComposer'; +export * from './GetConcurrentUsersRewardMessageComposer'; +export * from './GetDailyQuestMessageComposer'; +export * from './GetQuestsMessageComposer'; +export * from './GetSeasonalQuestsOnlyMessageComposer'; +export * from './OpenQuestTrackerMessageComposer'; +export * from './RedeemCommunityGoalPrizeMessageComposer'; +export * from './RejectQuestMessageComposer'; +export * from './StartCampaignMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/recycler/GetRecyclerStatusMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/recycler/GetRecyclerStatusMessageComposer.ts new file mode 100644 index 0000000..b708a06 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/recycler/GetRecyclerStatusMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetRecyclerStatusMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/recycler/RecycleItemsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/recycler/RecycleItemsMessageComposer.ts new file mode 100644 index 0000000..2c2b54d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/recycler/RecycleItemsMessageComposer.ts @@ -0,0 +1,31 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RecycleItemsMessageComposer implements IMessageComposer +{ + private _data: any; + + constructor(...data: RecycleItemsEntry[]) + { + this._data = [data.length]; + data.forEach(entry => + { + this._data.push(entry.itemId); + }); + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} + +export class RecycleItemsEntry +{ + constructor(public itemId: number) + { } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/recycler/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/recycler/index.ts new file mode 100644 index 0000000..b3fc57c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/recycler/index.ts @@ -0,0 +1,2 @@ +export * from './GetRecyclerStatusMessageComposer'; +export * from './RecycleItemsMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/RedeemItemClothingComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/RedeemItemClothingComposer.ts new file mode 100644 index 0000000..124a0cd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/RedeemItemClothingComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RedeemItemClothingComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(setId: number) + { + this._data = [setId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/access/RoomDoorbellAccessComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/access/RoomDoorbellAccessComposer.ts new file mode 100644 index 0000000..700ab09 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/access/RoomDoorbellAccessComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomDoorbellAccessComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(user: string, allowedEntry: boolean) + { + this._data = [user, allowedEntry]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/access/RoomEnterComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/access/RoomEnterComposer.ts new file mode 100644 index 0000000..33e2af2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/access/RoomEnterComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomEnterComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(roomId: number, password: string = null) + { + this._data = [roomId, password]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/access/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/access/index.ts new file mode 100644 index 0000000..2025545 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/access/index.ts @@ -0,0 +1,2 @@ +export * from './RoomDoorbellAccessComposer'; +export * from './RoomEnterComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RemoveAllRightsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RemoveAllRightsMessageComposer.ts new file mode 100644 index 0000000..6987150 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RemoveAllRightsMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RemoveAllRightsMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(roomId: number) + { + this._data = [roomId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomAmbassadorAlertComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomAmbassadorAlertComposer.ts new file mode 100644 index 0000000..2db839b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomAmbassadorAlertComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomAmbassadorAlertComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number) + { + this._data = [userId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomBanUserComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomBanUserComposer.ts new file mode 100644 index 0000000..d3a6d91 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomBanUserComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomBanUserComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number, roomId: number = 0, type: string) + { + this._data = [userId, roomId, type]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomDeleteComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomDeleteComposer.ts new file mode 100644 index 0000000..1b0d4e9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomDeleteComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomDeleteComposer implements IMessageComposer<[number]> +{ + private _data: [number]; + + constructor(roomId: number) + { + this._data = [roomId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomGiveRightsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomGiveRightsComposer.ts new file mode 100644 index 0000000..fc19a8d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomGiveRightsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomGiveRightsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number) + { + this._data = [userId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomKickUserComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomKickUserComposer.ts new file mode 100644 index 0000000..868b068 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomKickUserComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomKickUserComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number) + { + this._data = [userId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomMuteUserComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomMuteUserComposer.ts new file mode 100644 index 0000000..da0a939 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomMuteUserComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomMuteUserComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number, minutes: number, roomId: number = 0) + { + this._data = [userId, roomId, minutes]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomTakeRightsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomTakeRightsComposer.ts new file mode 100644 index 0000000..210564e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomTakeRightsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomTakeRightsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(...userIds: number[]) + { + this._data = [userIds.length, ...userIds]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomUnbanUserComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomUnbanUserComposer.ts new file mode 100644 index 0000000..8385068 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/RoomUnbanUserComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomUnbanUserComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number, roomId: number) + { + this._data = [userId, roomId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/index.ts new file mode 100644 index 0000000..3846b4a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/action/index.ts @@ -0,0 +1,9 @@ +export * from './RemoveAllRightsMessageComposer'; +export * from './RoomAmbassadorAlertComposer'; +export * from './RoomBanUserComposer'; +export * from './RoomDeleteComposer'; +export * from './RoomGiveRightsComposer'; +export * from './RoomKickUserComposer'; +export * from './RoomMuteUserComposer'; +export * from './RoomTakeRightsComposer'; +export * from './RoomUnbanUserComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/bots/RequestBotConfigurationComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/bots/RequestBotConfigurationComposer.ts new file mode 100644 index 0000000..60c5f39 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/bots/RequestBotConfigurationComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RequestBotCommandConfigurationComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(botId: number, skillId: number) + { + this._data = [botId, skillId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/bots/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/bots/index.ts new file mode 100644 index 0000000..d4b295a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/bots/index.ts @@ -0,0 +1 @@ +export * from './RequestBotConfigurationComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/data/RoomBannedUsersComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/data/RoomBannedUsersComposer.ts new file mode 100644 index 0000000..d381321 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/data/RoomBannedUsersComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomBannedUsersComposer implements IMessageComposer<[number]> +{ + private _data: [number]; + + constructor(roomId: number) + { + this._data = [roomId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/data/RoomSettingsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/data/RoomSettingsComposer.ts new file mode 100644 index 0000000..2d4e46a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/data/RoomSettingsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomSettingsComposer implements IMessageComposer<[number]> +{ + private _data: [number]; + + constructor(roomId: number) + { + this._data = [roomId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/data/RoomUsersWithRightsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/data/RoomUsersWithRightsComposer.ts new file mode 100644 index 0000000..b221a03 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/data/RoomUsersWithRightsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomUsersWithRightsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(roomId: number) + { + this._data = [roomId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/data/SaveRoomSettingsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/data/SaveRoomSettingsComposer.ts new file mode 100644 index 0000000..ffefa53 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/data/SaveRoomSettingsComposer.ts @@ -0,0 +1,81 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class SaveRoomSettingsComposer +implements + IMessageComposer< + ConstructorParameters + > +{ + private _data: ConstructorParameters; + + constructor( + roomId: number, + roomName: string, + roomDescription: string, + lockState: number, + password: string, + userCount: number, + categoryId: number, + tagsCount: number, + tags: string[], + tradeState: number, + allowPets: boolean, + allowPetsEat: boolean, + allowWalkthrough: boolean, + hideWalls: boolean, + wallThickness: number, + floorThickness: number, + muteState: number, + kickState: number, + banState: number, + chatBubbleMode: number, + chatBubbleWeight: number, + chatBubbleSpeed: number, + chatDistance: number, + chatFloodProtection: number + ) + { + //@ts-ignore + this._data = []; + + this._data.push( + roomId, + roomName, + roomDescription, + lockState, + password, + userCount, + categoryId + ); + + this._data.push(tags.length, ...tags); + + this._data.push( + tradeState, + allowPets, + allowPetsEat, + allowWalkthrough, + hideWalls, + wallThickness, + floorThickness, + muteState, + kickState, + banState, + chatBubbleMode, + chatBubbleWeight, + chatBubbleSpeed, + chatDistance, + chatFloodProtection + ); + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/data/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/data/index.ts new file mode 100644 index 0000000..27df6c7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/data/index.ts @@ -0,0 +1,4 @@ +export * from './RoomBannedUsersComposer'; +export * from './RoomSettingsComposer'; +export * from './RoomUsersWithRightsComposer'; +export * from './SaveRoomSettingsComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/BotPlaceComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/BotPlaceComposer.ts new file mode 100644 index 0000000..2046493 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/BotPlaceComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class BotPlaceComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(botId: number, x: number, y: number) + { + this._data = [botId, x, y]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/BotRemoveComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/BotRemoveComposer.ts new file mode 100644 index 0000000..2c95a65 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/BotRemoveComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class BotRemoveComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(botId: number) + { + this._data = [botId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/BotSkillSaveComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/BotSkillSaveComposer.ts new file mode 100644 index 0000000..eb0754a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/BotSkillSaveComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class BotSkillSaveComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(botId: number, skill: number, data: string) + { + this._data = [botId, skill, data]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/CompostPlantMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/CompostPlantMessageComposer.ts new file mode 100644 index 0000000..bc23ccb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/CompostPlantMessageComposer.ts @@ -0,0 +1,9 @@ +import { PetMessageComposer } from './PetMessageComposer'; + +export class CompostPlantMessageComposer extends PetMessageComposer +{ + constructor(id: number) + { + super(id); + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/GetItemDataComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/GetItemDataComposer.ts new file mode 100644 index 0000000..99dc87a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/GetItemDataComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetItemDataComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number) + { + this._data = [itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/HarvestPetMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/HarvestPetMessageComposer.ts new file mode 100644 index 0000000..8c14acc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/HarvestPetMessageComposer.ts @@ -0,0 +1,9 @@ +import { PetMessageComposer } from './PetMessageComposer'; + +export class HarvestPetMessageComposer extends PetMessageComposer +{ + constructor(id: number) + { + super(id); + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/PetMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/PetMessageComposer.ts new file mode 100644 index 0000000..a8538ff --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/PetMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class PetMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(id: number) + { + this._data = [id]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/PetMoveComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/PetMoveComposer.ts new file mode 100644 index 0000000..e545a0b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/PetMoveComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class PetMoveComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(petId: number, x: number, y: number, direction: number) + { + this._data = [petId, x, y, direction]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/PetPlaceComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/PetPlaceComposer.ts new file mode 100644 index 0000000..ad7916c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/PetPlaceComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class PetPlaceComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(petId: number, x: number, y: number) + { + this._data = [petId, x, y]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/PetRemoveComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/PetRemoveComposer.ts new file mode 100644 index 0000000..8a59627 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/PetRemoveComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class PetRemoveComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(petId: number) + { + this._data = [petId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/RemoveWallItemComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/RemoveWallItemComposer.ts new file mode 100644 index 0000000..026304d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/RemoveWallItemComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RemoveWallItemComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number) + { + this._data = [itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/SetClothingChangeDataMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/SetClothingChangeDataMessageComposer.ts new file mode 100644 index 0000000..c26d888 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/SetClothingChangeDataMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class SetClothingChangeDataMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(objectId: number, gender: string, look: string = '') + { + this._data = [objectId, gender, look]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/SetItemDataMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/SetItemDataMessageComposer.ts new file mode 100644 index 0000000..9e9a9ce --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/SetItemDataMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class SetItemDataMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number, colorHex: string, text: string) + { + this._data = [itemId, colorHex, text]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/SetObjectDataMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/SetObjectDataMessageComposer.ts new file mode 100644 index 0000000..9ffb7b0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/SetObjectDataMessageComposer.ts @@ -0,0 +1,23 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class SetObjectDataMessageComposer implements IMessageComposer +{ + private _data: any[]; + + constructor(objectId: number, data: Map) + { + this._data = [objectId, (data.size * 2)]; + + for(const [key, value] of data.entries()) this._data.push(key, value); + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/index.ts new file mode 100644 index 0000000..d8c89dc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/engine/index.ts @@ -0,0 +1,14 @@ +export * from './BotPlaceComposer'; +export * from './BotRemoveComposer'; +export * from './BotSkillSaveComposer'; +export * from './CompostPlantMessageComposer'; +export * from './GetItemDataComposer'; +export * from './HarvestPetMessageComposer'; +export * from './PetMessageComposer'; +export * from './PetMoveComposer'; +export * from './PetPlaceComposer'; +export * from './PetRemoveComposer'; +export * from './RemoveWallItemComposer'; +export * from './SetClothingChangeDataMessageComposer'; +export * from './SetItemDataMessageComposer'; +export * from './SetObjectDataMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/AddSpamWallPostItMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/AddSpamWallPostItMessageComposer.ts new file mode 100644 index 0000000..4b5c68b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/AddSpamWallPostItMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class AddSpamWallPostItMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number, location: string, colorHex: string, message: string) + { + this._data = [itemId, location, colorHex, message]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/ExtendRentOrBuyoutFurniMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/ExtendRentOrBuyoutFurniMessageComposer.ts new file mode 100644 index 0000000..49fbb13 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/ExtendRentOrBuyoutFurniMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class ExtendRentOrBuyoutFurniMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(isWall: boolean, roomInstanceId: number, isBuyout: boolean) + { + this._data = [isWall, roomInstanceId, isBuyout]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/ExtendRentOrBuyoutStripItemMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/ExtendRentOrBuyoutStripItemMessageComposer.ts new file mode 100644 index 0000000..fa752c3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/ExtendRentOrBuyoutStripItemMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class ExtendRentOrBuyoutStripItemMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(stripId: number, isBuyout: boolean) + { + this._data = [stripId, isBuyout]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurnitureAliasesComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurnitureAliasesComposer.ts new file mode 100644 index 0000000..aeb1462 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurnitureAliasesComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class FurnitureAliasesComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurnitureGroupInfoComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurnitureGroupInfoComposer.ts new file mode 100644 index 0000000..24514cc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurnitureGroupInfoComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class FurnitureGroupInfoComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(objectId: number, guildId: number) + { + this._data = [objectId, guildId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurniturePickupComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurniturePickupComposer.ts new file mode 100644 index 0000000..5ed29ae --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurniturePickupComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class FurniturePickupComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(category: number, objectId: number) + { + this._data = [category, objectId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurniturePlaceComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurniturePlaceComposer.ts new file mode 100644 index 0000000..66d9d0b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurniturePlaceComposer.ts @@ -0,0 +1,39 @@ +import { IMessageComposer, RoomObjectCategory } from '../../../../../../api'; + +export class FurniturePlaceComposer implements IMessageComposer +{ + private _itemId: number; + private _category: number; + private _wallLocation: string; + private _x: number; + private _y: number; + private _direction: number; + + constructor(itemId: number, category: number, wallLocation: string, x: number, y: number, direction: number) + { + this._itemId = itemId; + this._category = category; + this._wallLocation = wallLocation; + this._x = x; + this._y = y; + this._direction = direction; + } + + public getMessageArray() + { + switch(this._category) + { + case RoomObjectCategory.FLOOR: + return [`${this._itemId} ${this._x} ${this._y} ${this._direction}`]; + case RoomObjectCategory.WALL: + return [`${this._itemId} ${this._wallLocation} `]; + default: + return []; + } + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurniturePlacePaintComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurniturePlacePaintComposer.ts new file mode 100644 index 0000000..fd97060 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurniturePlacePaintComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class FurniturePlacePaintComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(furniId: number) + { + this._data = [furniId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurniturePostItPlaceComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurniturePostItPlaceComposer.ts new file mode 100644 index 0000000..1cf9cfe --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/FurniturePostItPlaceComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class FurniturePostItPlaceComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number, wallLocation: string) + { + this._data = [itemId, wallLocation]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/GetRentOrBuyoutOfferMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/GetRentOrBuyoutOfferMessageComposer.ts new file mode 100644 index 0000000..0b4f2b4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/GetRentOrBuyoutOfferMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetRentOrBuyoutOfferMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(isWall: boolean, furnitureFullName: string, isBuyout: boolean) + { + this._data = [isWall, furnitureFullName, isBuyout]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/OpenMysteryTrophyMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/OpenMysteryTrophyMessageComposer.ts new file mode 100644 index 0000000..0997e1a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/OpenMysteryTrophyMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class OpenMysteryTrophyMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(objectId: number, text: string) + { + this._data = [objectId, text]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/OpenPetPackageMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/OpenPetPackageMessageComposer.ts new file mode 100644 index 0000000..87e1488 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/OpenPetPackageMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class OpenPetPackageMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(objectId: number, petName: string) + { + this._data = [objectId, petName]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/OpenWelcomeGiftComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/OpenWelcomeGiftComposer.ts new file mode 100644 index 0000000..32bda4e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/OpenWelcomeGiftComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class OpenWelcomeGiftComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(furniId: number) + { + this._data = [furniId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/RentableSpaceCancelRentMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/RentableSpaceCancelRentMessageComposer.ts new file mode 100644 index 0000000..c608fcc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/RentableSpaceCancelRentMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RentableSpaceCancelRentMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number) + { + this._data = [itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/RentableSpaceRentMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/RentableSpaceRentMessageComposer.ts new file mode 100644 index 0000000..e6a0588 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/RentableSpaceRentMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RentableSpaceRentMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number) + { + this._data = [itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/RentableSpaceStatusMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/RentableSpaceStatusMessageComposer.ts new file mode 100644 index 0000000..2cac294 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/RentableSpaceStatusMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RentableSpaceStatusMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number) + { + this._data = [itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/dimmer/MoodlightSettingsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/dimmer/MoodlightSettingsComposer.ts new file mode 100644 index 0000000..5539ffb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/dimmer/MoodlightSettingsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class MoodlightSettingsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/dimmer/MoodlightSettingsSaveComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/dimmer/MoodlightSettingsSaveComposer.ts new file mode 100644 index 0000000..02f8527 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/dimmer/MoodlightSettingsSaveComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class MoodlightSettingsSaveComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, arg2: number, arg3: string, arg4: number, arg5: boolean) + { + this._data = [k, arg2, arg3, arg4, arg5]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/dimmer/MoodlightTogggleStateComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/dimmer/MoodlightTogggleStateComposer.ts new file mode 100644 index 0000000..2f381c2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/dimmer/MoodlightTogggleStateComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class MoodlightTogggleStateComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/dimmer/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/dimmer/index.ts new file mode 100644 index 0000000..842aa30 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/dimmer/index.ts @@ -0,0 +1,3 @@ +export * from './MoodlightSettingsComposer'; +export * from './MoodlightSettingsSaveComposer'; +export * from './MoodlightTogggleStateComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/floor/FurnitureFloorUpdateComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/floor/FurnitureFloorUpdateComposer.ts new file mode 100644 index 0000000..e51aac2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/floor/FurnitureFloorUpdateComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class FurnitureFloorUpdateComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number, x: number, y: number, direction: number) + { + this._data = [itemId, x, y, direction]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/floor/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/floor/index.ts new file mode 100644 index 0000000..8dde729 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/floor/index.ts @@ -0,0 +1 @@ +export * from './FurnitureFloorUpdateComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/index.ts new file mode 100644 index 0000000..c8fb636 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/index.ts @@ -0,0 +1,24 @@ +export * from './AddSpamWallPostItMessageComposer'; +export * from './dimmer'; +export * from './ExtendRentOrBuyoutFurniMessageComposer'; +export * from './ExtendRentOrBuyoutStripItemMessageComposer'; +export * from './floor'; +export * from './FurnitureAliasesComposer'; +export * from './FurnitureGroupInfoComposer'; +export * from './FurniturePickupComposer'; +export * from './FurniturePlaceComposer'; +export * from './FurniturePlacePaintComposer'; +export * from './FurniturePostItPlaceComposer'; +export * from './GetRentOrBuyoutOfferMessageComposer'; +export * from './logic'; +export * from './mannequin'; +export * from './OpenMysteryTrophyMessageComposer'; +export * from './OpenPetPackageMessageComposer'; +export * from './OpenWelcomeGiftComposer'; +export * from './presents'; +export * from './RentableSpaceCancelRentMessageComposer'; +export * from './RentableSpaceRentMessageComposer'; +export * from './RentableSpaceStatusMessageComposer'; +export * from './toner'; +export * from './wall'; +export * from './youtube'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureColorWheelComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureColorWheelComposer.ts new file mode 100644 index 0000000..b0f2f23 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureColorWheelComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class FurnitureColorWheelComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number) + { + this._data = [itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureDiceActivateComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureDiceActivateComposer.ts new file mode 100644 index 0000000..f04cde8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureDiceActivateComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class FurnitureDiceActivateComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number) + { + this._data = [itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureDiceDeactivateComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureDiceDeactivateComposer.ts new file mode 100644 index 0000000..6666007 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureDiceDeactivateComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class FurnitureDiceDeactivateComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number) + { + this._data = [itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureExchangeComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureExchangeComposer.ts new file mode 100644 index 0000000..c2b39cc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureExchangeComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class FurnitureExchangeComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number) + { + this._data = [itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureMultiStateComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureMultiStateComposer.ts new file mode 100644 index 0000000..409a7fa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureMultiStateComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class FurnitureMultiStateComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number, state: number = 0) + { + this._data = [itemId, state]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureOneWayDoorComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureOneWayDoorComposer.ts new file mode 100644 index 0000000..e97ba08 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureOneWayDoorComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class FurnitureOneWayDoorComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number) + { + this._data = [itemId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureRandomStateComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureRandomStateComposer.ts new file mode 100644 index 0000000..d491a41 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureRandomStateComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class FurnitureRandomStateComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number, state: number) + { + this._data = [itemId, state]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureStackHeightComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureStackHeightComposer.ts new file mode 100644 index 0000000..e313044 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureStackHeightComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class FurnitureStackHeightComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number, height: number = -100) + { + this._data = [itemId, height]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureWallMultiStateComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureWallMultiStateComposer.ts new file mode 100644 index 0000000..fc46660 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/FurnitureWallMultiStateComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class FurnitureWallMultiStateComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number, state: number) + { + this._data = [itemId, state]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/index.ts new file mode 100644 index 0000000..838e338 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/logic/index.ts @@ -0,0 +1,9 @@ +export * from './FurnitureColorWheelComposer'; +export * from './FurnitureDiceActivateComposer'; +export * from './FurnitureDiceDeactivateComposer'; +export * from './FurnitureExchangeComposer'; +export * from './FurnitureMultiStateComposer'; +export * from './FurnitureOneWayDoorComposer'; +export * from './FurnitureRandomStateComposer'; +export * from './FurnitureStackHeightComposer'; +export * from './FurnitureWallMultiStateComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/mannequin/FurnitureMannequinSaveLookComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/mannequin/FurnitureMannequinSaveLookComposer.ts new file mode 100644 index 0000000..fdfbb83 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/mannequin/FurnitureMannequinSaveLookComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class FurnitureMannequinSaveLookComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/mannequin/FurnitureMannequinSaveNameComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/mannequin/FurnitureMannequinSaveNameComposer.ts new file mode 100644 index 0000000..6704863 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/mannequin/FurnitureMannequinSaveNameComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class FurnitureMannequinSaveNameComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number, name: string) + { + this._data = [itemId, name]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/mannequin/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/mannequin/index.ts new file mode 100644 index 0000000..ed49256 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/mannequin/index.ts @@ -0,0 +1,2 @@ +export * from './FurnitureMannequinSaveLookComposer'; +export * from './FurnitureMannequinSaveNameComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/presents/OpenPresentComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/presents/OpenPresentComposer.ts new file mode 100644 index 0000000..e7bd38a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/presents/OpenPresentComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class OpenPresentComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/presents/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/presents/index.ts new file mode 100644 index 0000000..d0d4ced --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/presents/index.ts @@ -0,0 +1 @@ +export * from './OpenPresentComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/toner/ApplyTonerComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/toner/ApplyTonerComposer.ts new file mode 100644 index 0000000..084b000 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/toner/ApplyTonerComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class ApplyTonerComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, arg2: number, arg3: number, arg4: number) + { + this._data = [k, arg2, arg3, arg4]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/toner/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/toner/index.ts new file mode 100644 index 0000000..f8e9d81 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/toner/index.ts @@ -0,0 +1 @@ +export * from './ApplyTonerComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/wall/FurnitureWallUpdateComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/wall/FurnitureWallUpdateComposer.ts new file mode 100644 index 0000000..99414f5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/wall/FurnitureWallUpdateComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class FurnitureWallUpdateComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(itemId: number, location: string) + { + this._data = [itemId, location]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/wall/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/wall/index.ts new file mode 100644 index 0000000..75abfb7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/wall/index.ts @@ -0,0 +1 @@ +export * from './FurnitureWallUpdateComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/youtube/ControlYoutubeDisplayPlaybackMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/youtube/ControlYoutubeDisplayPlaybackMessageComposer.ts new file mode 100644 index 0000000..9991c60 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/youtube/ControlYoutubeDisplayPlaybackMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class ControlYoutubeDisplayPlaybackMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/youtube/GetYoutubeDisplayStatusMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/youtube/GetYoutubeDisplayStatusMessageComposer.ts new file mode 100644 index 0000000..d4a0cc6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/youtube/GetYoutubeDisplayStatusMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class GetYoutubeDisplayStatusMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/youtube/SetYoutubeDisplayPlaylistMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/youtube/SetYoutubeDisplayPlaylistMessageComposer.ts new file mode 100644 index 0000000..d652de0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/youtube/SetYoutubeDisplayPlaylistMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class SetYoutubeDisplayPlaylistMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: string) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/youtube/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/youtube/index.ts new file mode 100644 index 0000000..c72bc63 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/furniture/youtube/index.ts @@ -0,0 +1,3 @@ +export * from './ControlYoutubeDisplayPlaybackMessageComposer'; +export * from './GetYoutubeDisplayStatusMessageComposer'; +export * from './SetYoutubeDisplayPlaylistMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/index.ts new file mode 100644 index 0000000..0067ee0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/index.ts @@ -0,0 +1,19 @@ +export * from './access'; +export * from './action'; +export * from './bots'; +export * from './data'; +export * from './engine'; +export * from './furniture'; +export * from './furniture/dimmer'; +export * from './furniture/floor'; +export * from './furniture/logic'; +export * from './furniture/mannequin'; +export * from './furniture/presents'; +export * from './furniture/toner'; +export * from './furniture/wall'; +export * from './furniture/youtube'; +export * from './layout'; +export * from './RedeemItemClothingComposer'; +export * from './session'; +export * from './unit'; +export * from './unit/chat'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/layout/GetOccupiedTilesMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/layout/GetOccupiedTilesMessageComposer.ts new file mode 100644 index 0000000..b3821d4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/layout/GetOccupiedTilesMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetOccupiedTilesMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/layout/GetRoomEntryDataMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/layout/GetRoomEntryDataMessageComposer.ts new file mode 100644 index 0000000..c99ecf4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/layout/GetRoomEntryDataMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetRoomEntryDataMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/layout/GetRoomEntryTileMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/layout/GetRoomEntryTileMessageComposer.ts new file mode 100644 index 0000000..ad2ed72 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/layout/GetRoomEntryTileMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetRoomEntryTileMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/layout/UpdateFloorPropertiesMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/layout/UpdateFloorPropertiesMessageComposer.ts new file mode 100644 index 0000000..1422709 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/layout/UpdateFloorPropertiesMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class UpdateFloorPropertiesMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(model: string, doorX: number, doorY: number, doorDirection: number, thicknessWall: number, thicknessFloor: number, wallHeight: number) + { + this._data = [model, doorX, doorY, doorDirection, thicknessWall, thicknessFloor, wallHeight]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/layout/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/layout/index.ts new file mode 100644 index 0000000..e8a3d7c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/layout/index.ts @@ -0,0 +1,4 @@ +export * from './GetOccupiedTilesMessageComposer'; +export * from './GetRoomEntryDataMessageComposer'; +export * from './GetRoomEntryTileMessageComposer'; +export * from './UpdateFloorPropertiesMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/pets/BreedPetsMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/pets/BreedPetsMessageComposer.ts new file mode 100644 index 0000000..1dc2f4c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/pets/BreedPetsMessageComposer.ts @@ -0,0 +1,25 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class BreedPetsMessageComposer implements IMessageComposer> +{ + public static readonly STATE_START: number = 0; + public static readonly STATE_CANCEL: number = 1; + public static readonly STATE_ACCEPT: number = 2; + + private _data: ConstructorParameters; + + constructor(state: number, petOneId: number, petTwoId: number) + { + this._data = [state, petOneId, petTwoId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/pets/PetSelectedMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/pets/PetSelectedMessageComposer.ts new file mode 100644 index 0000000..8e7bc5d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/pets/PetSelectedMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class PetSelectedMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(petId: number) + { + this._data = [petId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/pets/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/pets/index.ts new file mode 100644 index 0000000..e53e7a0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/pets/index.ts @@ -0,0 +1,2 @@ +export * from './BreedPetsMessageComposer'; +export * from './PetSelectedMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/session/ChangeQueueMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/session/ChangeQueueMessageComposer.ts new file mode 100644 index 0000000..823a312 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/session/ChangeQueueMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class ChangeQueueMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(targetQueue: number) + { + this._data = [targetQueue]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/session/GoToFlatMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/session/GoToFlatMessageComposer.ts new file mode 100644 index 0000000..d810baa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/session/GoToFlatMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GoToFlatMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(roomId: number) + { + this._data = [roomId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/session/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/session/index.ts new file mode 100644 index 0000000..990e23c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/session/index.ts @@ -0,0 +1,2 @@ +export * from './ChangeQueueMessageComposer'; +export * from './GoToFlatMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitActionComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitActionComposer.ts new file mode 100644 index 0000000..79e908c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitActionComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomUnitActionComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(actionType: number) + { + this._data = [actionType]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitDanceComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitDanceComposer.ts new file mode 100644 index 0000000..2d1c89e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitDanceComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomUnitDanceComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(danceType: number) + { + this._data = [danceType]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitDropHandItemComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitDropHandItemComposer.ts new file mode 100644 index 0000000..57d9b1d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitDropHandItemComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomUnitDropHandItemComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitGiveHandItemComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitGiveHandItemComposer.ts new file mode 100644 index 0000000..8611920 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitGiveHandItemComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomUnitGiveHandItemComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(unitId: number) + { + this._data = [unitId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitGiveHandItemPetComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitGiveHandItemPetComposer.ts new file mode 100644 index 0000000..c84a81a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitGiveHandItemPetComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomUnitGiveHandItemPetComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(unitId: number) + { + this._data = [unitId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitLookComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitLookComposer.ts new file mode 100644 index 0000000..55a76c6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitLookComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomUnitLookComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(x: number, y: number) + { + this._data = [x, y]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitPostureComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitPostureComposer.ts new file mode 100644 index 0000000..533a3a0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitPostureComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomUnitPostureComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(posture: number) + { + this._data = [posture]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitSignComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitSignComposer.ts new file mode 100644 index 0000000..84da5cb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitSignComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomUnitSignComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(signType: number) + { + this._data = [signType]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitWalkComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitWalkComposer.ts new file mode 100644 index 0000000..b291b72 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/RoomUnitWalkComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class RoomUnitWalkComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(x: number, y: number) + { + this._data = [x, y]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitChatComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitChatComposer.ts new file mode 100644 index 0000000..3dfe51c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitChatComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class RoomUnitChatComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(message: string, styleId: number = 0) + { + this._data = [message, styleId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitChatShoutComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitChatShoutComposer.ts new file mode 100644 index 0000000..b3bdeb5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitChatShoutComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class RoomUnitChatShoutComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(message: string, styleId: number) + { + this._data = [message, styleId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitChatStyleComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitChatStyleComposer.ts new file mode 100644 index 0000000..4411ad6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitChatStyleComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class RoomUnitChatStyleComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(styleId: number) + { + this._data = [styleId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitChatWhisperComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitChatWhisperComposer.ts new file mode 100644 index 0000000..e500f3a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitChatWhisperComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class RoomUnitChatWhisperComposer implements IMessageComposer<[string, number]> +{ + private _data: [string, number]; + + constructor(recipientName: string, message: string, styleId: number) + { + this._data = [(recipientName + ' ' + message), styleId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitTypingStartComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitTypingStartComposer.ts new file mode 100644 index 0000000..010b4b8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitTypingStartComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class RoomUnitTypingStartComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitTypingStopComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitTypingStopComposer.ts new file mode 100644 index 0000000..01d435f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/RoomUnitTypingStopComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class RoomUnitTypingStopComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/index.ts new file mode 100644 index 0000000..6e53b78 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/chat/index.ts @@ -0,0 +1,6 @@ +export * from './RoomUnitChatComposer'; +export * from './RoomUnitChatShoutComposer'; +export * from './RoomUnitChatStyleComposer'; +export * from './RoomUnitChatWhisperComposer'; +export * from './RoomUnitTypingStartComposer'; +export * from './RoomUnitTypingStopComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/index.ts new file mode 100644 index 0000000..52a7296 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/room/unit/index.ts @@ -0,0 +1,10 @@ +export * from './chat'; +export * from './RoomUnitActionComposer'; +export * from './RoomUnitDanceComposer'; +export * from './RoomUnitDropHandItemComposer'; +export * from './RoomUnitGiveHandItemComposer'; +export * from './RoomUnitGiveHandItemPetComposer'; +export * from './RoomUnitLookComposer'; +export * from './RoomUnitPostureComposer'; +export * from './RoomUnitSignComposer'; +export * from './RoomUnitWalkComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/roomdirectory/RoomNetworkOpenConnectionMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/roomdirectory/RoomNetworkOpenConnectionMessageComposer.ts new file mode 100644 index 0000000..95dc7df --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/roomdirectory/RoomNetworkOpenConnectionMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RoomNetworkOpenConnectionMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number) + { + this._data = [k, _arg_2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/roomdirectory/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/roomdirectory/index.ts new file mode 100644 index 0000000..4899347 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/roomdirectory/index.ts @@ -0,0 +1 @@ +export * from './RoomNetworkOpenConnectionMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/ApplySnapshotMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/ApplySnapshotMessageComposer.ts new file mode 100644 index 0000000..5f52c03 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/ApplySnapshotMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ApplySnapshotMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(id: number) + { + this._data = [id]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/OpenMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/OpenMessageComposer.ts new file mode 100644 index 0000000..935750d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/OpenMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class OpenMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(id: number) + { + this._data = [id]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/RoomMuteComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/RoomMuteComposer.ts new file mode 100644 index 0000000..7da903b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/RoomMuteComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RoomMuteComposer implements IMessageComposer +{ + private _data: unknown[]; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/UpdateActionMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/UpdateActionMessageComposer.ts new file mode 100644 index 0000000..1e93ff5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/UpdateActionMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class UpdateActionMessageComposer implements IMessageComposer +{ + private _data: unknown[]; + + constructor(id: number, ints: number[], string: string, stuffs: number[], delay: number, selectionCode: number) + { + this._data = [id, ints.length, ...ints, string, stuffs.length, ...stuffs, delay, selectionCode]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/UpdateConditionMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/UpdateConditionMessageComposer.ts new file mode 100644 index 0000000..03b65f9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/UpdateConditionMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class UpdateConditionMessageComposer implements IMessageComposer +{ + private _data: unknown[]; + + constructor(id: number, ints: number[], string: string, stuffs: number[], selectionCode: number) + { + this._data = [id, ints.length, ...ints, string, stuffs.length, ...stuffs, selectionCode]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/UpdateTriggerMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/UpdateTriggerMessageComposer.ts new file mode 100644 index 0000000..27ca0af --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/UpdateTriggerMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class UpdateTriggerMessageComposer implements IMessageComposer +{ + private _data: unknown[]; + + constructor(id: number, ints: number[], string: string, stuffs: number[], selectionCode: number) + { + this._data = [id, ints.length, ...ints, string, stuffs.length, ...stuffs, selectionCode]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/index.ts new file mode 100644 index 0000000..9c4372e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/roomevents/index.ts @@ -0,0 +1,6 @@ +export * from './ApplySnapshotMessageComposer'; +export * from './OpenMessageComposer'; +export * from './RoomMuteComposer'; +export * from './UpdateActionMessageComposer'; +export * from './UpdateConditionMessageComposer'; +export * from './UpdateTriggerMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/roomsettings/SaveableRoomSettingsData.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/roomsettings/SaveableRoomSettingsData.ts new file mode 100644 index 0000000..521045e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/roomsettings/SaveableRoomSettingsData.ts @@ -0,0 +1,267 @@ +export class SaveableRoomSettingsData +{ + private _roomId: number; + private _name: string; + private _description: string; + private _doorMode: number; + private _password: string; + private _categoryId: number; + private _maximumVisitors: number; + private _tags: string[]; + private _tradeMode: number; + private _allowPets: boolean; + private _allowFoodConsume: boolean; + private _allowWalkThrough: boolean; + private _allowNavigatorDynCats: boolean; + private _hideWalls: boolean; + private _wallThickness: number; + private _floorThickness: number; + private _whoCanMute: number; + private _whoCanKick: number; + private _whoCanBan: number; + private _chatMode: number; + private _chatBubbleSize: number; + private _chatScrollUpFrequency: number; + private _chatFullHearRange: number; + private _chatFloodSensitivity: number; + + public get tradeMode(): number + { + return this._tradeMode; + } + + public set tradeMode(mode: number) + { + this._tradeMode = mode; + } + + public get allowPets(): boolean + { + return this._allowPets; + } + + public set allowPets(flag: boolean) + { + this._allowPets = flag; + } + + public get allowFoodConsume(): boolean + { + return this._allowFoodConsume; + } + + public set allowFoodConsume(flag: boolean) + { + this._allowFoodConsume = flag; + } + + public get allowWalkThrough(): boolean + { + return this._allowWalkThrough; + } + + public set allowWalkThrough(flag: boolean) + { + this._allowWalkThrough = flag; + } + + public get hideWalls(): boolean + { + return this._hideWalls; + } + + public set hideWalls(flag: boolean) + { + this._hideWalls = flag; + } + + public get wallThickness(): number + { + return this._wallThickness; + } + + public set wallThickness(thickness: number) + { + this._wallThickness = thickness; + } + + public get floorThickness(): number + { + return this._floorThickness; + } + + public set floorThickness(thickness: number) + { + this._floorThickness = thickness; + } + + public get roomId(): number + { + return this._roomId; + } + + public set roomId(id: number) + { + this._roomId = id; + } + + public get name(): string + { + return this._name; + } + + public set name(name: string) + { + this._name = name; + } + + public get description(): string + { + return this._description; + } + + public set description(description: string) + { + this._description = description; + } + + public get doorMode(): number + { + return this._doorMode; + } + + public set doorMode(mode: number) + { + this._doorMode = mode; + } + + public get password(): string + { + return this._password; + } + + public set password(password: string) + { + this._password = password; + } + + public get categoryId(): number + { + return this._categoryId; + } + + public set categoryId(id: number) + { + this._categoryId = id; + } + + public get maximumVisitors(): number + { + return this._maximumVisitors; + } + + public set maximumVisitors(max: number) + { + this._maximumVisitors = max; + } + + public get tags(): string[] + { + return this._tags; + } + + public set tags(tags: string[]) + { + this._tags = tags; + } + + public get whoCanMute(): number + { + return this._whoCanMute; + } + + public set whoCanMute(mute: number) + { + this._whoCanMute = mute; + } + + public get whoCanKick(): number + { + return this._whoCanKick; + } + + public set whoCanKick(kick: number) + { + this._whoCanKick = kick; + } + + public get whoCanBan(): number + { + return this._whoCanBan; + } + + public set whoCanBan(ban: number) + { + this._whoCanBan = ban; + } + + public get chatMode(): number + { + return this._chatMode; + } + + public set chatMode(mode: number) + { + this._chatMode = mode; + } + + public get chatBubbleSize(): number + { + return this._chatBubbleSize; + } + + public set chatBubbleSize(size: number) + { + this._chatBubbleSize = size; + } + + public get chatScrollUpFrequency(): number + { + return this._chatScrollUpFrequency; + } + + public set chatScrollUpFrequency(frequency: number) + { + this._chatScrollUpFrequency = frequency; + } + + public get chatFullHearRange(): number + { + return this._chatFullHearRange; + } + + public set chatFullHearRange(range: number) + { + this._chatFullHearRange = range; + } + + public get chatFloodSensitivity(): number + { + return this._chatFloodSensitivity; + } + + public set chatFloodSensitivity(sensitivity: number) + { + this._chatFloodSensitivity = sensitivity; + } + + public get allowNavigatorDynCats(): boolean + { + return this._allowNavigatorDynCats; + } + + public set allowNavigatorDynCats(flag: boolean) + { + this._allowNavigatorDynCats = flag; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/roomsettings/UpdateRoomCategoryAndTradeSettingsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/roomsettings/UpdateRoomCategoryAndTradeSettingsComposer.ts new file mode 100644 index 0000000..a9f632b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/roomsettings/UpdateRoomCategoryAndTradeSettingsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class UpdateRoomCategoryAndTradeSettingsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg_2: number, _arg_3: number) + { + this._data = [k, _arg_2, _arg_3]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/roomsettings/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/roomsettings/index.ts new file mode 100644 index 0000000..21363c6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/roomsettings/index.ts @@ -0,0 +1,2 @@ +export * from './SaveableRoomSettingsData'; +export * from './UpdateRoomCategoryAndTradeSettingsComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/sound/AddJukeboxDiskComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/AddJukeboxDiskComposer.ts new file mode 100644 index 0000000..982034a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/AddJukeboxDiskComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class AddJukeboxDiskComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, _arg2: number) + { + this._data = [k, _arg2]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetJukeboxPlayListMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetJukeboxPlayListMessageComposer.ts new file mode 100644 index 0000000..ea8f411 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetJukeboxPlayListMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetJukeboxPlayListMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetNowPlayingMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetNowPlayingMessageComposer.ts new file mode 100644 index 0000000..1849b03 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetNowPlayingMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetNowPlayingMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetOfficialSongIdMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetOfficialSongIdMessageComposer.ts new file mode 100644 index 0000000..0538ec7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetOfficialSongIdMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetOfficialSongIdMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: string) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetSongInfoMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetSongInfoMessageComposer.ts new file mode 100644 index 0000000..5ef3f8e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetSongInfoMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetSongInfoMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(...args: number[]) + { + this._data = [args.length].concat(args); + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetSoundMachinePlayListMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetSoundMachinePlayListMessageComposer.ts new file mode 100644 index 0000000..6d97352 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetSoundMachinePlayListMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetSoundMachinePlayListMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetSoundSettingsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetSoundSettingsComposer.ts new file mode 100644 index 0000000..0655845 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetSoundSettingsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetSoundSettingsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetUserSongDisksMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetUserSongDisksMessageComposer.ts new file mode 100644 index 0000000..84bda04 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/GetUserSongDisksMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetUserSongDisksMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/sound/RemoveJukeboxDiskComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/RemoveJukeboxDiskComposer.ts new file mode 100644 index 0000000..7148578 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/RemoveJukeboxDiskComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RemoveJukeboxDiskComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number) + { + this._data = [k]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/sound/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/index.ts new file mode 100644 index 0000000..bb1dffd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/sound/index.ts @@ -0,0 +1,9 @@ +export * from './AddJukeboxDiskComposer'; +export * from './GetJukeboxPlayListMessageComposer'; +export * from './GetNowPlayingMessageComposer'; +export * from './GetOfficialSongIdMessageComposer'; +export * from './GetSongInfoMessageComposer'; +export * from './GetSoundMachinePlayListMessageComposer'; +export * from './GetSoundSettingsComposer'; +export * from './GetUserSongDisksMessageComposer'; +export * from './RemoveJukeboxDiskComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/talent/GetTalentTrackLevelMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/talent/GetTalentTrackLevelMessageComposer.ts new file mode 100644 index 0000000..77fdca6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/talent/GetTalentTrackLevelMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetTalentTrackLevelMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(name: string) + { + this._data = [name]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/talent/TalentTrackComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/talent/TalentTrackComposer.ts new file mode 100644 index 0000000..7615410 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/talent/TalentTrackComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class TalentTrackComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(type: string) + { + this._data = [type]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/talent/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/talent/index.ts new file mode 100644 index 0000000..7d45f30 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/talent/index.ts @@ -0,0 +1,2 @@ +export * from './GetTalentTrackLevelMessageComposer'; +export * from './TalentTrackComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/tracking/LagWarningReportMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/tracking/LagWarningReportMessageComposer.ts new file mode 100644 index 0000000..7179046 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/tracking/LagWarningReportMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class LagWarningReportMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(warningCount: number) + { + this._data = [warningCount]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/tracking/PerformanceLogMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/tracking/PerformanceLogMessageComposer.ts new file mode 100644 index 0000000..eb98198 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/tracking/PerformanceLogMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PerformanceLogMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(k: number, userAgent: string, flashVersion: string, operatingSystem: string, cpuArchitecture: string, isDebugger: boolean, totalMemory: number, _arg_8: number, gcCount: number, averageUpdateInterval: number, slowUpdateCount: number) + { + this._data = [k, userAgent, flashVersion, operatingSystem, cpuArchitecture, isDebugger, totalMemory, _arg_8, gcCount, averageUpdateInterval, slowUpdateCount]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/tracking/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/tracking/index.ts new file mode 100644 index 0000000..4a848a3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/tracking/index.ts @@ -0,0 +1,2 @@ +export * from './LagWarningReportMessageComposer'; +export * from './PerformanceLogMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/ApproveNameMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/ApproveNameMessageComposer.ts new file mode 100644 index 0000000..d98ff0b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/ApproveNameMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ApproveNameMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(name: string, type: number) + { + this._data = [name, type]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/CatalogGroupsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/CatalogGroupsComposer.ts new file mode 100644 index 0000000..b21a4c8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/CatalogGroupsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class CatalogGroupsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/ChangeEmailComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/ChangeEmailComposer.ts new file mode 100644 index 0000000..bc31c55 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/ChangeEmailComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ChangeEmailComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(newEmail: string) + { + this._data = [newEmail]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/GetEmailStatusComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/GetEmailStatusComposer.ts new file mode 100644 index 0000000..4b6d866 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/GetEmailStatusComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetEmailStatusComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/GetHabboGroupBadgesMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/GetHabboGroupBadgesMessageComposer.ts new file mode 100644 index 0000000..c76639f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/GetHabboGroupBadgesMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class GetHabboGroupBadgesMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/ScrGetKickbackInfoMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/ScrGetKickbackInfoMessageComposer.ts new file mode 100644 index 0000000..2a3d7a2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/ScrGetKickbackInfoMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class ScrGetKickbackInfoMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/UnblockGroupMemberMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/UnblockGroupMemberMessageComposer.ts new file mode 100644 index 0000000..b1d0fa9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/UnblockGroupMemberMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class UnblockGroupMemberMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(groupId: number, userId: number) + { + this._data = [groupId, userId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/UserRespectComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/UserRespectComposer.ts new file mode 100644 index 0000000..a0f66a4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/UserRespectComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class UserRespectComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number) + { + this._data = [userId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/WelcomeGiftChangeEmailComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/WelcomeGiftChangeEmailComposer.ts new file mode 100644 index 0000000..93e5a68 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/WelcomeGiftChangeEmailComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class WelcomeGiftChangeEmailComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(newEmail: string) + { + this._data = [newEmail]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/GetExtendedProfileByNameMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/GetExtendedProfileByNameMessageComposer.ts new file mode 100644 index 0000000..51a4429 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/GetExtendedProfileByNameMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetExtendedProfileByNameMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(username: string) + { + this._data = [username]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/GetIgnoredUsersComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/GetIgnoredUsersComposer.ts new file mode 100644 index 0000000..e07bc6b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/GetIgnoredUsersComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetIgnoredUsersComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(username: string) + { + this._data = [username]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/GetUserTagsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/GetUserTagsComposer.ts new file mode 100644 index 0000000..24aa1e5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/GetUserTagsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class GetUserTagsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(roomUnitId: number) + { + this._data = [roomUnitId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/IgnoreUserComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/IgnoreUserComposer.ts new file mode 100644 index 0000000..f778c25 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/IgnoreUserComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class IgnoreUserComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(username: string) + { + this._data = [username]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/IgnoreUserIdComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/IgnoreUserIdComposer.ts new file mode 100644 index 0000000..7b0f851 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/IgnoreUserIdComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class IgnoreUserIdComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number) + { + this._data = [userId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UnignoreUserComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UnignoreUserComposer.ts new file mode 100644 index 0000000..1ca0af5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UnignoreUserComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class UnignoreUserComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(username: string) + { + this._data = [username]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UserCurrentBadgesComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UserCurrentBadgesComposer.ts new file mode 100644 index 0000000..6d087d0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UserCurrentBadgesComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class UserCurrentBadgesComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number) + { + this._data = [userId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UserFigureComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UserFigureComposer.ts new file mode 100644 index 0000000..bf51690 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UserFigureComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class UserFigureComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(gender: string, figure: string) + { + this._data = [gender, figure]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UserMottoComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UserMottoComposer.ts new file mode 100644 index 0000000..eab7611 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UserMottoComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class UserMottoComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(motto: string) + { + this._data = [motto]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UserProfileComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UserProfileComposer.ts new file mode 100644 index 0000000..8aeaa75 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UserProfileComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class UserProfileComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number, flag: boolean = true) + { + this._data = [userId, flag]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UserRelationshipsComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UserRelationshipsComposer.ts new file mode 100644 index 0000000..85dacce --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/UserRelationshipsComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class UserRelationshipsComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userId: number) + { + this._data = [userId]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/index.ts new file mode 100644 index 0000000..edc3289 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/data/index.ts @@ -0,0 +1,11 @@ +export * from './GetExtendedProfileByNameMessageComposer'; +export * from './GetIgnoredUsersComposer'; +export * from './GetUserTagsComposer'; +export * from './IgnoreUserComposer'; +export * from './IgnoreUserIdComposer'; +export * from './UnignoreUserComposer'; +export * from './UserCurrentBadgesComposer'; +export * from './UserFigureComposer'; +export * from './UserMottoComposer'; +export * from './UserProfileComposer'; +export * from './UserRelationshipsComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/index.ts new file mode 100644 index 0000000..9a10b1f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/index.ts @@ -0,0 +1,14 @@ +export * from './ApproveNameMessageComposer'; +export * from './CatalogGroupsComposer'; +export * from './ChangeEmailComposer'; +export * from './data'; +export * from './GetEmailStatusComposer'; +export * from './GetHabboGroupBadgesMessageComposer'; +export * from './inventory'; +export * from './inventory/currency'; +export * from './inventory/subscription'; +export * from './ScrGetKickbackInfoMessageComposer'; +export * from './settings'; +export * from './UnblockGroupMemberMessageComposer'; +export * from './UserRespectComposer'; +export * from './WelcomeGiftChangeEmailComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/inventory/currency/UserCurrencyComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/inventory/currency/UserCurrencyComposer.ts new file mode 100644 index 0000000..fb627bc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/inventory/currency/UserCurrencyComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class UserCurrencyComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor() + { + this._data = []; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/inventory/currency/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/inventory/currency/index.ts new file mode 100644 index 0000000..5949cbb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/inventory/currency/index.ts @@ -0,0 +1 @@ +export * from './UserCurrencyComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/inventory/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/inventory/index.ts new file mode 100644 index 0000000..e25bf08 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/inventory/index.ts @@ -0,0 +1,2 @@ +export * from './currency'; +export * from './subscription'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/inventory/subscription/UserSubscriptionComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/inventory/subscription/UserSubscriptionComposer.ts new file mode 100644 index 0000000..88ba389 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/inventory/subscription/UserSubscriptionComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../../api'; + +export class UserSubscriptionComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(type: string) + { + this._data = [type]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/inventory/subscription/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/inventory/subscription/index.ts new file mode 100644 index 0000000..34fd638 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/inventory/subscription/index.ts @@ -0,0 +1 @@ +export * from './UserSubscriptionComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/settings/UserSettingsCameraFollowComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/settings/UserSettingsCameraFollowComposer.ts new file mode 100644 index 0000000..1928dab --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/settings/UserSettingsCameraFollowComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class UserSettingsCameraFollowComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(value: boolean) + { + this._data = [value]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/settings/UserSettingsOldChatComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/settings/UserSettingsOldChatComposer.ts new file mode 100644 index 0000000..ac3f6da --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/settings/UserSettingsOldChatComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class UserSettingsOldChatComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(value: boolean) + { + this._data = [value]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/settings/UserSettingsRoomInvitesComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/settings/UserSettingsRoomInvitesComposer.ts new file mode 100644 index 0000000..2383291 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/settings/UserSettingsRoomInvitesComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class UserSettingsRoomInvitesComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(value: boolean) + { + this._data = [value]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/settings/UserSettingsSoundComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/settings/UserSettingsSoundComposer.ts new file mode 100644 index 0000000..59fd149 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/settings/UserSettingsSoundComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../../api'; + +export class UserSettingsSoundComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(volumeSystem: number, volumeFurni: number, volumeTrax: number) + { + this._data = [volumeSystem, volumeFurni, volumeTrax]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/user/settings/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/user/settings/index.ts new file mode 100644 index 0000000..fefcdbc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/user/settings/index.ts @@ -0,0 +1,4 @@ +export * from './UserSettingsCameraFollowComposer'; +export * from './UserSettingsOldChatComposer'; +export * from './UserSettingsRoomInvitesComposer'; +export * from './UserSettingsSoundComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/userclassification/PeerUsersClassificationMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/userclassification/PeerUsersClassificationMessageComposer.ts new file mode 100644 index 0000000..cf29901 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/userclassification/PeerUsersClassificationMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class PeerUsersClassificationMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userClassType: string) + { + this._data = [userClassType]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/userclassification/RoomUsersClassificationMessageComposer.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/userclassification/RoomUsersClassificationMessageComposer.ts new file mode 100644 index 0000000..a7f6d80 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/userclassification/RoomUsersClassificationMessageComposer.ts @@ -0,0 +1,21 @@ +import { IMessageComposer } from '../../../../../api'; + +export class RoomUsersClassificationMessageComposer implements IMessageComposer> +{ + private _data: ConstructorParameters; + + constructor(userClassType: string) + { + this._data = [userClassType]; + } + + public getMessageArray() + { + return this._data; + } + + public dispose(): void + { + return; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/outgoing/userclassification/index.ts b/submodules/renderer/src/nitro/communication/messages/outgoing/userclassification/index.ts new file mode 100644 index 0000000..0dc5c96 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/outgoing/userclassification/index.ts @@ -0,0 +1,2 @@ +export * from './PeerUsersClassificationMessageComposer'; +export * from './RoomUsersClassificationMessageComposer'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/advertisement/InterstitialMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/advertisement/InterstitialMessageParser.ts new file mode 100644 index 0000000..bccb04d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/advertisement/InterstitialMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class InterstitialMessageParser implements IMessageParser +{ + private _canShowInterstitial: boolean; + + public flush(): boolean + { + this._canShowInterstitial = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._canShowInterstitial = wrapper.readBoolean(); + + return true; + } + + public get canShowInterstitial(): boolean + { + return this._canShowInterstitial; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/advertisement/RoomAdErrorMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/advertisement/RoomAdErrorMessageParser.ts new file mode 100644 index 0000000..8b248bb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/advertisement/RoomAdErrorMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RoomAdErrorMessageParser implements IMessageParser +{ + private _errorCode: number; + private _filteredText: string; + + public flush(): boolean + { + this._errorCode = 0; + this._filteredText = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._errorCode = wrapper.readInt(); + this._filteredText = wrapper.readString(); + + return true; + } + + public get errorCode(): number + { + return this._errorCode; + } + + public get filteredText(): string + { + return this._filteredText; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/advertisement/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/advertisement/index.ts new file mode 100644 index 0000000..d7b6995 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/advertisement/index.ts @@ -0,0 +1,2 @@ +export * from './InterstitialMessageParser'; +export * from './RoomAdErrorMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/availability/AvailabilityStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/availability/AvailabilityStatusMessageParser.ts new file mode 100644 index 0000000..0c6593f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/availability/AvailabilityStatusMessageParser.ts @@ -0,0 +1,47 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class AvailabilityStatusMessageParser implements IMessageParser +{ + private _isOpen: boolean; + private _onShutdown: boolean; + private _isAuthenticUser: boolean; + + public flush(): boolean + { + this._isOpen = false; + this._onShutdown = false; + this._isAuthenticUser = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._isOpen = wrapper.readBoolean(); + this._onShutdown = wrapper.readBoolean(); + + if(wrapper.bytesAvailable) + { + this._isAuthenticUser = wrapper.readBoolean(); + } + + return true; + } + + public get isOpen(): boolean + { + return this._isOpen; + } + + public get onShutdown(): boolean + { + return this._onShutdown; + } + + public get isAuthenticUser(): boolean + { + return this._isAuthenticUser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/availability/AvailabilityTimeMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/availability/AvailabilityTimeMessageParser.ts new file mode 100644 index 0000000..6744f7d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/availability/AvailabilityTimeMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class AvailabilityTimeMessageParser implements IMessageParser +{ + private _isOpen: boolean; + private _minutesUntilChange: number; + + public flush(): boolean + { + this._isOpen = false; + this._minutesUntilChange = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._isOpen = (wrapper.readInt() > 0); + this._minutesUntilChange = wrapper.readInt(); + + return true; + } + + public get isOpen(): boolean + { + return this._isOpen; + } + + public get minutesUntilChange(): number + { + return this._minutesUntilChange; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/availability/HotelClosedAndOpensMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/availability/HotelClosedAndOpensMessageParser.ts new file mode 100644 index 0000000..8f1b67a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/availability/HotelClosedAndOpensMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class HotelClosedAndOpensMessageParser implements IMessageParser +{ + private _openHour: number; + private _openMinute: number; + + public flush(): boolean + { + this._openHour = 0; + this._openMinute = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._openHour = wrapper.readInt(); + this._openMinute = wrapper.readInt(); + + return true; + } + + public get openHour(): number + { + return this._openHour; + } + + public get openMinute(): number + { + return this._openMinute; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/availability/HotelClosesAndWillOpenAtMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/availability/HotelClosesAndWillOpenAtMessageParser.ts new file mode 100644 index 0000000..53f1334 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/availability/HotelClosesAndWillOpenAtMessageParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class HotelClosesAndWillOpenAtMessageParser implements IMessageParser +{ + private _openHour: number; + private _openMinute: number; + private _userThrownOutAtClose: boolean; + + public flush(): boolean + { + this._openHour = 0; + this._openMinute = 0; + this._userThrownOutAtClose = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._openHour = wrapper.readInt(); + this._openMinute = wrapper.readInt(); + this._userThrownOutAtClose = wrapper.readBoolean(); + + return true; + } + + public get openHour(): number + { + return this._openHour; + } + + public get openMinute(): number + { + return this._openMinute; + } + + public get userThrowOutAtClose(): boolean + { + return this._userThrownOutAtClose; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/availability/HotelWillCloseInMinutesMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/availability/HotelWillCloseInMinutesMessageParser.ts new file mode 100644 index 0000000..af5cba3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/availability/HotelWillCloseInMinutesMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class HotelWillCloseInMinutesMessageParser implements IMessageParser +{ + private _minutes: number; + + public flush(): boolean + { + this._minutes = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._minutes = wrapper.readInt(); + + return true; + } + + public get openMinute(): number + { + return this._minutes; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/availability/MaintenanceStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/availability/MaintenanceStatusMessageParser.ts new file mode 100644 index 0000000..8e3c2bd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/availability/MaintenanceStatusMessageParser.ts @@ -0,0 +1,47 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class MaintenanceStatusMessageParser implements IMessageParser +{ + private _isInMaintenance: boolean; + private _minutesUntilMaintenance: number; + private _duration: number; + + public flush(): boolean + { + this._isInMaintenance = false; + this._minutesUntilMaintenance = 0; + this._duration = 15; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._isInMaintenance = wrapper.readBoolean(); + this._minutesUntilMaintenance = wrapper.readInt(); + + if(wrapper.bytesAvailable) + { + this._duration = wrapper.readInt(); + } + + return true; + } + + public get isInMaintenance(): boolean + { + return this._isInMaintenance; + } + + public get minutesUntilMaintenance(): number + { + return this._minutesUntilMaintenance; + } + + public get duration(): number + { + return this._duration; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/availability/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/availability/index.ts new file mode 100644 index 0000000..4f61945 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/availability/index.ts @@ -0,0 +1,6 @@ +export * from './AvailabilityStatusMessageParser'; +export * from './AvailabilityTimeMessageParser'; +export * from './HotelClosedAndOpensMessageParser'; +export * from './HotelClosesAndWillOpenAtMessageParser'; +export * from './HotelWillCloseInMinutesMessageParser'; +export * from './MaintenanceStatusMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/avatar/ChangeUserNameResultMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/avatar/ChangeUserNameResultMessageParser.ts new file mode 100644 index 0000000..1eb94ee --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/avatar/ChangeUserNameResultMessageParser.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ChangeUserNameResultMessageParser implements IMessageParser +{ + private _resultCode: number; + private _name: string; + private _nameSuggestions: string[]; + + public flush(): boolean + { + this._resultCode = -1; + this._name = ''; + this._nameSuggestions = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._resultCode = wrapper.readInt(); + this._name = wrapper.readString(); + + let totalSuggestions = wrapper.readInt(); + + while(totalSuggestions > 0) + { + this._nameSuggestions.push(wrapper.readString()); + + totalSuggestions--; + } + + return true; + } + + public get resultCode(): number + { + return this._resultCode; + } + + public get name(): string + { + return this._name; + } + + public get nameSuggestions(): string[] + { + return this._nameSuggestions; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/avatar/CheckUserNameResultMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/avatar/CheckUserNameResultMessageParser.ts new file mode 100644 index 0000000..0296bf2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/avatar/CheckUserNameResultMessageParser.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CheckUserNameResultMessageParser implements IMessageParser +{ + private _resultCode: number; + private _name: string; + private _nameSuggestions: string[]; + + public flush(): boolean + { + this._resultCode = -1; + this._name = ''; + this._nameSuggestions = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._resultCode = wrapper.readInt(); + this._name = wrapper.readString(); + + let totalSuggestions = wrapper.readInt(); + + while(totalSuggestions > 0) + { + this._nameSuggestions.push(wrapper.readString()); + + totalSuggestions--; + } + + return true; + } + + public get resultCode(): number + { + return this._resultCode; + } + + public get name(): string + { + return this._name; + } + + public get nameSuggestions(): string[] + { + return this._nameSuggestions; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/avatar/FigureUpdateParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/avatar/FigureUpdateParser.ts new file mode 100644 index 0000000..f60ea35 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/avatar/FigureUpdateParser.ts @@ -0,0 +1,37 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class FigureUpdateParser implements IMessageParser +{ + private _figure: string; + private _gender: string; + + public flush(): boolean + { + this._figure = ''; + this._gender = ''; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._figure = wrapper.readString(); + this._gender = wrapper.readString(); + + if(this._gender) this._gender = this._gender.toUpperCase(); + + return true; + } + + public get figure(): string + { + return this._figure; + } + + public get gender(): string + { + return this._gender; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/avatar/OutfitData.ts b/submodules/renderer/src/nitro/communication/messages/parser/avatar/OutfitData.ts new file mode 100644 index 0000000..4acde6d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/avatar/OutfitData.ts @@ -0,0 +1,30 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class OutfitData +{ + private _slotId: number; + private _figureString: string; + private _gender: string; + + constructor(wrapper: IMessageDataWrapper) + { + this._slotId = wrapper.readInt(); + this._figureString = wrapper.readString(); + this._gender = wrapper.readString(); + } + + public get slotId(): number + { + return this._slotId; + } + + public get figureString(): string + { + return this._figureString; + } + + public get gender(): string + { + return this._gender; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/avatar/WardrobeMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/avatar/WardrobeMessageParser.ts new file mode 100644 index 0000000..4a0103f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/avatar/WardrobeMessageParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { OutfitData } from './OutfitData'; + +export class WardrobeMessageParser implements IMessageParser +{ + private _state: number; + private _outfits: OutfitData[]; + + public flush(): boolean + { + this._state = 0; + this._outfits = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._state = wrapper.readInt(); + + let count = wrapper.readInt(); + + while(count > 0) + { + this._outfits.push(new OutfitData(wrapper)); + + count--; + } + + return true; + } + + public get state(): number + { + return this._state; + } + + public get outfits(): OutfitData[] + { + return this._outfits; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/avatar/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/avatar/index.ts new file mode 100644 index 0000000..ca0d335 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/avatar/index.ts @@ -0,0 +1,5 @@ +export * from './ChangeUserNameResultMessageParser'; +export * from './CheckUserNameResultMessageParser'; +export * from './FigureUpdateParser'; +export * from './OutfitData'; +export * from './WardrobeMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/bots/BotAddedToInventoryParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/bots/BotAddedToInventoryParser.ts new file mode 100644 index 0000000..312b6f3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/bots/BotAddedToInventoryParser.ts @@ -0,0 +1,36 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { BotData } from './BotData'; + +export class BotAddedToInventoryParser implements IMessageParser +{ + private _item: BotData; + private _openInventory: boolean; + + public flush(): boolean + { + this._item = null; + this._openInventory = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._item = new BotData(wrapper); + this._openInventory = wrapper.readBoolean(); + + return true; + } + + public get item(): BotData + { + return this._item; + } + + public openInventory(): boolean + { + return this._openInventory; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/bots/BotData.ts b/submodules/renderer/src/nitro/communication/messages/parser/bots/BotData.ts new file mode 100644 index 0000000..b6ef3d0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/bots/BotData.ts @@ -0,0 +1,46 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class BotData +{ + private _id: number; + private _name: string; + private _motto: string; + private _gender: string; + private _figure: string; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_parser'); + + this._id = wrapper.readInt(); + this._name = wrapper.readString(); + this._motto = wrapper.readString(); + this._gender = wrapper.readString(); + this._figure = wrapper.readString(); + } + + public get id(): number + { + return this._id; + } + + public get name(): string + { + return this._name; + } + + public get motto(): string + { + return this._motto; + } + + public get figure(): string + { + return this._figure; + } + + public get gender(): string + { + return this._gender; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/bots/BotInventoryMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/bots/BotInventoryMessageParser.ts new file mode 100644 index 0000000..243c6b7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/bots/BotInventoryMessageParser.ts @@ -0,0 +1,37 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { BotData } from './BotData'; + +export class BotInventoryMessageParser implements IMessageParser +{ + private _items: Map; + + public flush(): boolean + { + this._items = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._items = new Map(); + + let count = wrapper.readInt(); + + while(count > 0) + { + const data = new BotData(wrapper); + + this._items.set(data.id, data); + + count--; + } + + return true; + } + + public get items(): Map + { + return this._items; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/bots/BotReceivedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/bots/BotReceivedMessageParser.ts new file mode 100644 index 0000000..336d076 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/bots/BotReceivedMessageParser.ts @@ -0,0 +1,36 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { BotData } from './BotData'; + +export class BotReceivedMessageParser implements IMessageParser +{ + private _boughtAsGift: boolean; + private _item: BotData; + + public flush(): boolean + { + this._boughtAsGift = false; + this._item = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._boughtAsGift = wrapper.readBoolean(); + this._item = new BotData(wrapper); + + return true; + } + + public get boughtAsGift(): boolean + { + return this._boughtAsGift; + } + + public get item(): BotData + { + return this._item; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/bots/BotRemovedFromInventoryParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/bots/BotRemovedFromInventoryParser.ts new file mode 100644 index 0000000..3124956 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/bots/BotRemovedFromInventoryParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class BotRemovedFromInventoryParser implements IMessageParser +{ + private _itemId: number; + + public flush(): boolean + { + this._itemId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemId = wrapper.readInt(); + + return true; + } + + public get itemId(): number + { + return this._itemId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/bots/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/bots/index.ts new file mode 100644 index 0000000..1224c4e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/bots/index.ts @@ -0,0 +1,5 @@ +export * from './BotAddedToInventoryParser'; +export * from './BotData'; +export * from './BotInventoryMessageParser'; +export * from './BotReceivedMessageParser'; +export * from './BotRemovedFromInventoryParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/CallForHelpCategoryData.ts b/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/CallForHelpCategoryData.ts new file mode 100644 index 0000000..c6f3d4a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/CallForHelpCategoryData.ts @@ -0,0 +1,48 @@ +import { IDisposable, IMessageDataWrapper } from '../../../../../api'; +import { INamed } from '../moderation'; +import { CallForHelpTopicData } from './CallForHelpTopicData'; + +export class CallForHelpCategoryData implements INamed, IDisposable +{ + private _name: string; + private _topics: CallForHelpTopicData[]; + private _disposed: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + this._topics = []; + this._name = wrapper.readString(); + + let count = wrapper.readInt(); + + while(count > 0) + { + this._topics.push(new CallForHelpTopicData(wrapper)); + + count--; + } + } + + public dispose(): void + { + if(this._disposed) return; + + this._disposed = true; + this._topics = null; + } + + public get disposed(): boolean + { + return this._disposed; + } + + public get name(): string + { + return this._name; + } + + public get topics(): CallForHelpTopicData[] + { + return this._topics; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/CallForHelpTopicData.ts b/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/CallForHelpTopicData.ts new file mode 100644 index 0000000..dc485bd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/CallForHelpTopicData.ts @@ -0,0 +1,31 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { INamed } from '../moderation'; + +export class CallForHelpTopicData implements INamed +{ + private _name: string; + private _id: number; + private _consequence: string; + + constructor(wrapper: IMessageDataWrapper) + { + this._name = wrapper.readString(); + this._id = wrapper.readInt(); + this._consequence = wrapper.readString(); + } + + public get name(): string + { + return this._name; + } + + public get id(): number + { + return this._id; + } + + public get consequence(): string + { + return this._consequence; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/CfhSanctionMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/CfhSanctionMessageParser.ts new file mode 100644 index 0000000..489db85 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/CfhSanctionMessageParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CfhSanctionTypeData } from './CfhSanctionTypeData'; + +export class CfhSanctionMessageParser implements IMessageParser +{ + private _issueId: number; + private _accountId: number; + private _sanctionType: CfhSanctionTypeData; + + public flush(): boolean + { + this._issueId = -1; + this._accountId = 1; + this._sanctionType = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._issueId = wrapper.readInt(); + this._accountId = wrapper.readInt(); + this._sanctionType = new CfhSanctionTypeData(wrapper); + + return true; + } + + public get issueId(): number + { + return this._issueId; + } + + public get accountId(): number + { + return this._accountId; + } + + public get sanctionType(): CfhSanctionTypeData + { + return this._sanctionType; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/CfhSanctionTypeData.ts b/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/CfhSanctionTypeData.ts new file mode 100644 index 0000000..c77e4e4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/CfhSanctionTypeData.ts @@ -0,0 +1,49 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { INamed } from '../moderation'; + +export class CfhSanctionTypeData implements INamed +{ + private _name: string; + private _sanctionLengthInHours: number; + private _probationDays: number; + private _avatarOnly: boolean; + private _tradeLockInfo: string = ''; + private _machineBanInfo: string = ''; + + constructor(wrapper: IMessageDataWrapper) + { + this._name = wrapper.readString(); + this._sanctionLengthInHours = wrapper.readInt(); + this._probationDays = wrapper.readInt(); + this._avatarOnly = wrapper.readBoolean(); + + if(wrapper.bytesAvailable) this._tradeLockInfo = wrapper.readString(); + + if(wrapper.bytesAvailable) this._machineBanInfo = wrapper.readString(); + } + + public get name(): string + { + return this._name; + } + + public get sanctionLengthInHours(): number + { + return this._sanctionLengthInHours; + } + + public get avatarOnly(): boolean + { + return this._avatarOnly; + } + + public get tradeLockInfo(): string + { + return this._tradeLockInfo; + } + + public get machineBanInfo(): string + { + return this._machineBanInfo; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/CfhTopicsInitMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/CfhTopicsInitMessageParser.ts new file mode 100644 index 0000000..8d4bfb0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/CfhTopicsInitMessageParser.ts @@ -0,0 +1,37 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CallForHelpCategoryData } from './CallForHelpCategoryData'; + +export class CfhTopicsInitMessageParser implements IMessageParser +{ + private _callForHelpCategories: CallForHelpCategoryData[]; + + public flush(): boolean + { + this._callForHelpCategories = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._callForHelpCategories = []; + + let count = wrapper.readInt(); + + while(count > 0) + { + this._callForHelpCategories.push(new CallForHelpCategoryData(wrapper)); + + count--; + } + + return true; + } + + public get callForHelpCategories(): CallForHelpCategoryData[] + { + return this._callForHelpCategories; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/SanctionStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/SanctionStatusMessageParser.ts new file mode 100644 index 0000000..c280eb5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/SanctionStatusMessageParser.ts @@ -0,0 +1,114 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class SanctionStatusMessageParser implements IMessageParser +{ + private _isSanctionNew: boolean; + private _isSanctionActive: boolean; + private _sanctionName: string; + private _sanctionLengthHours: number; + private _sanctionReason: string; + private _sanctionCreationTime: string; + private _probationHoursLeft: number; + private _nextSanctionName: string; + private _nextSanctionLengthHours: number; + private _hasCustomMute: boolean; + private _tradeLockExpiryTime: string; + + public flush(): boolean + { + this._isSanctionNew = false; + this._isSanctionActive = false; + this._sanctionName = null; + this._sanctionLengthHours = 0; + this._sanctionReason = null; + this._sanctionCreationTime = null; + this._probationHoursLeft = 0; + this._nextSanctionName = null; + this._nextSanctionLengthHours = 0; + this._hasCustomMute = false; + this._tradeLockExpiryTime = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._isSanctionNew = wrapper.readBoolean(); + this._isSanctionActive = wrapper.readBoolean(); + this._sanctionName = wrapper.readString(); + this._sanctionLengthHours = wrapper.readInt(); + + wrapper.readInt(); + + this._sanctionReason = wrapper.readString(); + this._sanctionCreationTime = wrapper.readString(); + this._probationHoursLeft = wrapper.readInt(); + this._nextSanctionName = wrapper.readString(); + this._nextSanctionLengthHours = wrapper.readInt(); + + wrapper.readInt(); + + this._hasCustomMute = wrapper.readBoolean(); + + if(wrapper.bytesAvailable) this._tradeLockExpiryTime = wrapper.readString(); + + return true; + } + + public get isSanctionNew(): boolean + { + return this._isSanctionNew; + } + + public get isSanctionActive(): boolean + { + return this._isSanctionActive; + } + + public get sanctionName(): string + { + return this._sanctionName; + } + + public get sanctionLengthHours(): number + { + return this._sanctionLengthHours; + } + + public get sanctionReason(): string + { + return this._sanctionReason; + } + + public get sanctionCreationTime(): string + { + return this._sanctionCreationTime; + } + + public get probationHoursLeft(): number + { + return this._probationHoursLeft; + } + + public get nextSanctionName(): string + { + return this._nextSanctionName; + } + + public get nextSanctionLengthHours(): number + { + return this._nextSanctionLengthHours; + } + + public get hasCustomMute(): boolean + { + return this._hasCustomMute; + } + + public get tradeLockExpiryTime(): string + { + return this._tradeLockExpiryTime; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/index.ts new file mode 100644 index 0000000..578158f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/callforhelp/index.ts @@ -0,0 +1,6 @@ +export * from './CallForHelpCategoryData'; +export * from './CallForHelpTopicData'; +export * from './CfhSanctionMessageParser'; +export * from './CfhSanctionTypeData'; +export * from './CfhTopicsInitMessageParser'; +export * from './SanctionStatusMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/camera/CameraPublishStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/camera/CameraPublishStatusMessageParser.ts new file mode 100644 index 0000000..a1fbcbc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/camera/CameraPublishStatusMessageParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CameraPublishStatusMessageParser implements IMessageParser +{ + private _ok: boolean = false; + private _secondsToWait: number = 0; + private _extraDataId: string; + + public flush(): boolean + { + this._ok = false; + this._secondsToWait = 0; + this._extraDataId = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._ok = wrapper.readBoolean(); + this._secondsToWait = wrapper.readInt(); + + if(this._ok && wrapper.bytesAvailable) this._extraDataId = wrapper.readString(); + + return true; + } + + public get ok(): boolean + { + return this._ok; + } + + public get secondsToWait(): number + { + return this._secondsToWait; + } + + public get extraDataId(): string + { + return this._extraDataId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/camera/CameraPurchaseOKMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/camera/CameraPurchaseOKMessageParser.ts new file mode 100644 index 0000000..036e334 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/camera/CameraPurchaseOKMessageParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CameraPurchaseOKMessageParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/camera/CameraSnapshotMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/camera/CameraSnapshotMessageParser.ts new file mode 100644 index 0000000..e0aa6dc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/camera/CameraSnapshotMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CameraSnapshotMessageParser implements IMessageParser +{ + private _roomType: string; + private _roomId: number; + + public flush(): boolean + { + this._roomType = null; + this._roomId = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomType = wrapper.readString(); + this._roomId = wrapper.readInt(); + + return true; + } + + public get roomType(): string + { + return this._roomType; + } + + public get roomId(): number + { + return this._roomId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/camera/CameraStorageUrlMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/camera/CameraStorageUrlMessageParser.ts new file mode 100644 index 0000000..973eb2b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/camera/CameraStorageUrlMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CameraStorageUrlMessageParser implements IMessageParser +{ + private _url: string; + + public flush(): boolean + { + this._url = ''; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._url = wrapper.readString(); + + return true; + } + + public get url(): string + { + return this._url; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/camera/CompetitionStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/camera/CompetitionStatusMessageParser.ts new file mode 100644 index 0000000..594ea8b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/camera/CompetitionStatusMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CompetitionStatusMessageParser implements IMessageParser +{ + private _ok: boolean = false; + private _errorReason: string = null; + + public flush(): boolean + { + this._ok = false; + this._errorReason = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._ok = wrapper.readBoolean(); + this._errorReason = wrapper.readString(); + + return true; + } + + public get ok(): boolean + { + return this._ok; + } + + public get errorReason(): string + { + return this._errorReason; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/camera/InitCameraMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/camera/InitCameraMessageParser.ts new file mode 100644 index 0000000..eb195c1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/camera/InitCameraMessageParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class InitCameraMessageParser implements IMessageParser +{ + private _creditPrice: number = 0; + private _ducketPrice: number = 0; + private _publishDucketPrice: number = 0; + + public flush(): boolean + { + this._creditPrice = 0; + this._ducketPrice = 0; + this._publishDucketPrice = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._creditPrice = wrapper.readInt(); + this._ducketPrice = wrapper.readInt(); + + if(wrapper.bytesAvailable) this._publishDucketPrice = wrapper.readInt(); + + return true; + } + + public get creditPrice(): number + { + return this._creditPrice; + } + + public get ducketPrice(): number + { + return this._ducketPrice; + } + + public get publishDucketPrice(): number + { + return this._publishDucketPrice; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/camera/ThumbnailStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/camera/ThumbnailStatusMessageParser.ts new file mode 100644 index 0000000..837dd12 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/camera/ThumbnailStatusMessageParser.ts @@ -0,0 +1,37 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ThumbnailStatusMessageParser implements IMessageParser +{ + private _ok: boolean = true; + private _renderLimitHit: boolean = false; + + public flush(): boolean + { + this._ok = true; + this._renderLimitHit = false; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + if(wrapper.bytesAvailable) + { + this._ok = wrapper.readBoolean(); + this._renderLimitHit = wrapper.readBoolean(); + } + + return true; + } + + public get ok(): boolean + { + return this._ok; + } + + public get isRenderLimitHit(): boolean + { + return this._renderLimitHit; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/camera/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/camera/index.ts new file mode 100644 index 0000000..8215d77 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/camera/index.ts @@ -0,0 +1,7 @@ +export * from './CameraPublishStatusMessageParser'; +export * from './CameraPurchaseOKMessageParser'; +export * from './CameraSnapshotMessageParser'; +export * from './CameraStorageUrlMessageParser'; +export * from './CompetitionStatusMessageParser'; +export * from './InitCameraMessageParser'; +export * from './ThumbnailStatusMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/campaign/CampaignCalendarData.ts b/submodules/renderer/src/nitro/communication/messages/parser/campaign/CampaignCalendarData.ts new file mode 100644 index 0000000..f27dad1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/campaign/CampaignCalendarData.ts @@ -0,0 +1,114 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class CampaignCalendarData +{ + private _campaignName: string; + private _campaignImage: string; + private _currentDay: number; + private _campaignDays: number; + private _openedDays: number[]; + private _missedDays: number[]; + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._campaignName = wrapper.readString(); + this._campaignImage = wrapper.readString(); + this._currentDay = wrapper.readInt(); + this._campaignDays = wrapper.readInt(); + this._openedDays = []; + + let count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + this._openedDays.push(wrapper.readInt()); + } + + this._missedDays = []; + + count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + this._missedDays.push(wrapper.readInt()); + } + + return true; + } + + public clone(): CampaignCalendarData + { + const data = new CampaignCalendarData(); + + data.campaignDays = this._campaignDays; + data.campaignImage = this._campaignImage; + data.campaignName = this._campaignName; + data.currentDay = this._currentDay; + data.missedDays = this._missedDays; + data.openedDays = this._openedDays; + + return data; + } + + public get campaignName(): string + { + return this._campaignName; + } + + public set campaignName(name: string) + { + this._campaignName = name; + } + + public get campaignImage(): string + { + return this._campaignImage; + } + + public set campaignImage(image: string) + { + this._campaignImage = image; + } + + public get currentDay(): number + { + return this._currentDay; + } + + public set currentDay(day: number) + { + this._currentDay = day; + } + + public get campaignDays(): number + { + return this._campaignDays; + } + + public set campaignDays(days: number) + { + this._campaignDays = days; + } + + public get openedDays(): number[] + { + return this._openedDays; + } + + public set openedDays(days: number[]) + { + this._openedDays = days; + } + + public get missedDays(): number[] + { + return this._missedDays; + } + + public set missedDays(days: number[]) + { + this._missedDays = days; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/campaign/CampaignCalendarDataMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/campaign/CampaignCalendarDataMessageParser.ts new file mode 100644 index 0000000..4c65292 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/campaign/CampaignCalendarDataMessageParser.ts @@ -0,0 +1,29 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CampaignCalendarData } from './CampaignCalendarData'; + +export class CampaignCalendarDataMessageParser implements IMessageParser +{ + private _calendarData: CampaignCalendarData; + + public flush(): boolean + { + this._calendarData = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._calendarData = new CampaignCalendarData(); + this._calendarData.parse(wrapper); + + return true; + } + + public get calendarData(): CampaignCalendarData + { + return this._calendarData; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/campaign/CampaignCalendarDoorOpenedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/campaign/CampaignCalendarDoorOpenedMessageParser.ts new file mode 100644 index 0000000..4c06ffc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/campaign/CampaignCalendarDoorOpenedMessageParser.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CampaignCalendarDoorOpenedMessageParser implements IMessageParser +{ + private _doorOpened: boolean; + private _productName: string; + private _customImage: string; + private _furnitureClassName: string; + + public flush(): boolean + { + this._doorOpened = false; + this._productName = null; + this._customImage = null; + this._furnitureClassName = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._doorOpened = wrapper.readBoolean(); + this._productName = wrapper.readString(); + this._customImage = wrapper.readString(); + this._furnitureClassName = wrapper.readString(); + + return true; + } + + public get doorOpened(): boolean + { + return this._doorOpened; + } + + public get productName(): string + { + return this._productName; + } + + public get customImage(): string + { + return this._customImage; + } + + public get furnitureClassName(): string + { + return this._furnitureClassName; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/campaign/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/campaign/index.ts new file mode 100644 index 0000000..bb30603 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/campaign/index.ts @@ -0,0 +1,3 @@ +export * from './CampaignCalendarData'; +export * from './CampaignCalendarDataMessageParser'; +export * from './CampaignCalendarDoorOpenedMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/BonusRareInfoMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/BonusRareInfoMessageParser.ts new file mode 100644 index 0000000..5feca2e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/BonusRareInfoMessageParser.ts @@ -0,0 +1,49 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class BonusRareInfoMessageParser implements IMessageParser +{ + private _productType: string; + private _productClassId: number; + private _totalCoinsForBonus: number; + private _coinsStillRequiredToBuy: number; + + public flush(): boolean + { + this._totalCoinsForBonus = -1; + this._coinsStillRequiredToBuy = -1; + this._productType = ''; + this._productClassId = -1; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._productType = wrapper.readString(); + this._productClassId = wrapper.readInt(); + this._totalCoinsForBonus = wrapper.readInt(); + this._coinsStillRequiredToBuy = wrapper.readInt(); + return true; + } + + public get totalCoinsForBonus(): number + { + return this._totalCoinsForBonus; + } + + public get coinsStillRequiredToBuy(): number + { + return this._coinsStillRequiredToBuy; + } + + public get productType(): string + { + return this._productType; + } + + public get productClassId(): number + { + return this._productClassId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/BuildersClubFurniCountMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/BuildersClubFurniCountMessageParser.ts new file mode 100644 index 0000000..7b89982 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/BuildersClubFurniCountMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class BuildersClubFurniCountMessageParser implements IMessageParser +{ + private _furniCount: number; + + public flush(): boolean + { + this._furniCount = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._furniCount = wrapper.readInt(); + + return true; + } + + public get furniCount(): number + { + return this._furniCount; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/BuildersClubSubscriptionStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/BuildersClubSubscriptionStatusMessageParser.ts new file mode 100644 index 0000000..d96546b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/BuildersClubSubscriptionStatusMessageParser.ts @@ -0,0 +1,53 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class BuildersClubSubscriptionStatusMessageParser implements IMessageParser +{ + private _secondsLeft: number; + private _furniLimit: number; + private _maxFurniLimit: number; + private _secondsLeftWithGrace: number; + + public flush(): boolean + { + this._secondsLeft = 0; + this._furniLimit = 0; + this._maxFurniLimit = 0; + this._secondsLeftWithGrace = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._secondsLeft = wrapper.readInt(); + this._furniLimit = wrapper.readInt(); + this._maxFurniLimit = wrapper.readInt(); + + if(wrapper.bytesAvailable) this._secondsLeftWithGrace = wrapper.readInt(); + else this._secondsLeftWithGrace = this._secondsLeft; + + return true; + } + + public get secondsLeft(): number + { + return this._secondsLeft; + } + + public get furniLimit(): number + { + return this._furniLimit; + } + + public get maxFurniLimit(): number + { + return this._maxFurniLimit; + } + + public get secondsLeftWithGrace(): number + { + return this._secondsLeftWithGrace; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/BundleDiscountRuleset.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/BundleDiscountRuleset.ts new file mode 100644 index 0000000..ef61fe0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/BundleDiscountRuleset.ts @@ -0,0 +1,53 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class BundleDiscountRuleset +{ + private _maxPurchaseSize: number; + private _bundleSize: number; + private _bundleDiscountSize: number; + private _bonusThreshold: number; + private _additionalBonusDiscountThresholdQuantities: number[]; + + constructor(wrapper: IMessageDataWrapper) + { + this._maxPurchaseSize = wrapper.readInt(); + this._bundleSize = wrapper.readInt(); + this._bundleDiscountSize = wrapper.readInt(); + this._bonusThreshold = wrapper.readInt(); + this._additionalBonusDiscountThresholdQuantities = []; + + let count = wrapper.readInt(); + + while(count > 0) + { + this._additionalBonusDiscountThresholdQuantities.push(wrapper.readInt()); + + count--; + } + } + + public get maxPurchaseSize(): number + { + return this._maxPurchaseSize; + } + + public get bundleSize(): number + { + return this._bundleSize; + } + + public get bundleDiscountSize(): number + { + return this._bundleDiscountSize; + } + + public get bonusThreshold(): number + { + return this._bonusThreshold; + } + + public get additionalBonusDiscountThresholdQuantities(): number[] + { + return this._additionalBonusDiscountThresholdQuantities; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/BundleDiscountRulesetMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/BundleDiscountRulesetMessageParser.ts new file mode 100644 index 0000000..ca73985 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/BundleDiscountRulesetMessageParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { BundleDiscountRuleset } from './BundleDiscountRuleset'; + +export class BundleDiscountRulesetMessageParser implements IMessageParser +{ + private _bundleDiscountRuleset: BundleDiscountRuleset; + + public flush(): boolean + { + this._bundleDiscountRuleset = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._bundleDiscountRuleset = new BundleDiscountRuleset(wrapper); + + return true; + } + + public get bundleDiscountRuleset(): BundleDiscountRuleset + { + return this._bundleDiscountRuleset; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogIndexMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogIndexMessageParser.ts new file mode 100644 index 0000000..b291f64 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogIndexMessageParser.ts @@ -0,0 +1,42 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { NodeData } from './NodeData'; + +export class CatalogIndexMessageParser implements IMessageParser +{ + private _root: NodeData; + private _newAdditionsAvailable: boolean; + private _catalogType: string; + + public flush(): boolean + { + this._root = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._root = new NodeData(wrapper); + this._newAdditionsAvailable = wrapper.readBoolean(); + this._catalogType = wrapper.readString(); + + return true; + } + + public get root(): NodeData + { + return this._root; + } + + public get newAdditionsAvailable(): boolean + { + return this._newAdditionsAvailable; + } + + public get catalogType(): string + { + return this._catalogType; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogLocalizationData.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogLocalizationData.ts new file mode 100644 index 0000000..793e6ba --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogLocalizationData.ts @@ -0,0 +1,41 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class CatalogLocalizationData +{ + private _images: string[]; + private _texts: string[]; + + constructor(wrapper: IMessageDataWrapper) + { + this._images = []; + this._texts = []; + + let totalImages = wrapper.readInt(); + + while(totalImages > 0) + { + this._images.push(wrapper.readString()); + + totalImages--; + } + + let totalTexts = wrapper.readInt(); + + while(totalTexts > 0) + { + this._texts.push(wrapper.readString()); + + totalTexts--; + } + } + + public get images(): string[] + { + return this._images; + } + + public get texts(): string[] + { + return this._texts; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPageExpirationParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPageExpirationParser.ts new file mode 100644 index 0000000..b5d8a81 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPageExpirationParser.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CatalogPageExpirationParser implements IMessageParser +{ + private _pageName: string; + private _pageId: number; + private _secondsToExpiry: number; + private _image: string; + + public flush(): boolean + { + this._pageName = null; + this._pageId = 0; + this._secondsToExpiry = 0; + this._image = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._pageId = wrapper.readInt(); + this._pageName = wrapper.readString(); + this._secondsToExpiry = wrapper.readInt(); + this._image = wrapper.readString(); + + return true; + } + + public get pageName(): string + { + return this._pageName; + } + + public get pageId(): number + { + return this._pageId; + } + + public get secondsToExpiry(): number + { + return this._secondsToExpiry; + } + + public get image(): string + { + return this._image; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPageMessageOfferData.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPageMessageOfferData.ts new file mode 100644 index 0000000..085a866 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPageMessageOfferData.ts @@ -0,0 +1,105 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { CatalogPageMessageProductData } from './CatalogPageMessageProductData'; + +export class CatalogPageMessageOfferData +{ + private _offerId: number; + private _localizationId: string; + private _rent: boolean; + private _priceCredits: number; + private _priceActivityPoints: number; + private _priceActivityPointsType: number; + private _clubLevel: number; + private _giftable: boolean; + private _bundlePurchaseAllowed: boolean; + private _isPet: boolean; + private _previewImage: string; + private _products: CatalogPageMessageProductData[]; + + constructor(wrapper: IMessageDataWrapper) + { + this._offerId = wrapper.readInt(); + this._localizationId = wrapper.readString(); + this._rent = wrapper.readBoolean(); + this._priceCredits = wrapper.readInt(); + this._priceActivityPoints = wrapper.readInt(); + this._priceActivityPointsType = wrapper.readInt(); + this._giftable = wrapper.readBoolean(); + + this._products = []; + + let totalProducts = wrapper.readInt(); + + while(totalProducts > 0) + { + this._products.push(new CatalogPageMessageProductData(wrapper)); + + totalProducts--; + } + + this._clubLevel = wrapper.readInt(); + this._bundlePurchaseAllowed = wrapper.readBoolean(); + this._isPet = wrapper.readBoolean(); + this._previewImage = wrapper.readString(); + } + + public get offerId(): number + { + return this._offerId; + } + + public get localizationId(): string + { + return this._localizationId; + } + + public get rent(): boolean + { + return this._rent; + } + + public get priceCredits(): number + { + return this._priceCredits; + } + + public get priceActivityPoints(): number + { + return this._priceActivityPoints; + } + + public get priceActivityPointsType(): number + { + return this._priceActivityPointsType; + } + + public get clubLevel(): number + { + return this._clubLevel; + } + + public get giftable(): boolean + { + return this._giftable; + } + + public get bundlePurchaseAllowed(): boolean + { + return this._bundlePurchaseAllowed; + } + + public get isPet(): boolean + { + return this._isPet; + } + + public get previewImage(): string + { + return this._previewImage; + } + + public get products(): CatalogPageMessageProductData[] + { + return this._products; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPageMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPageMessageParser.ts new file mode 100644 index 0000000..387f2c9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPageMessageParser.ts @@ -0,0 +1,106 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CatalogLocalizationData } from './CatalogLocalizationData'; +import { CatalogPageMessageOfferData } from './CatalogPageMessageOfferData'; +import { FrontPageItem } from './FrontPageItem'; + +export class CatalogPageMessageParser implements IMessageParser +{ + private _pageId: number; + private _catalogType: string; + private _layoutCode: string; + private _localization: CatalogLocalizationData; + private _offers: CatalogPageMessageOfferData[]; + private _offerId: number; + private _acceptSeasonCurrencyAsCredits: boolean; + private _frontPageItems: FrontPageItem[]; + + public flush(): boolean + { + this._pageId = -1; + this._catalogType = null; + this._layoutCode = null; + this._localization = null; + this._offers = []; + this._offerId = -1; + this._acceptSeasonCurrencyAsCredits = false; + this._frontPageItems = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._pageId = wrapper.readInt(); + this._catalogType = wrapper.readString(); + this._layoutCode = wrapper.readString(); + this._localization = new CatalogLocalizationData(wrapper); + + let totalOffers = wrapper.readInt(); + + while(totalOffers > 0) + { + this._offers.push(new CatalogPageMessageOfferData(wrapper)); + + totalOffers--; + } + + this._offerId = wrapper.readInt(); + this._acceptSeasonCurrencyAsCredits = wrapper.readBoolean(); + + if(wrapper.bytesAvailable) + { + let totalFrontPageItems = wrapper.readInt(); + + while(totalFrontPageItems > 0) + { + this._frontPageItems.push(new FrontPageItem(wrapper)); + + totalFrontPageItems--; + } + } + + return true; + } + + public get pageId(): number + { + return this._pageId; + } + + public get catalogType(): string + { + return this._catalogType; + } + + public get layoutCode(): string + { + return this._layoutCode; + } + + public get localization(): CatalogLocalizationData + { + return this._localization; + } + + public get offers(): CatalogPageMessageOfferData[] + { + return this._offers; + } + + public get offerId(): number + { + return this._offerId; + } + + public get acceptSeasonCurrencyAsCredits(): boolean + { + return this._acceptSeasonCurrencyAsCredits; + } + + public get frontPageItems(): FrontPageItem[] + { + return this._frontPageItems; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPageMessageProductData.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPageMessageProductData.ts new file mode 100644 index 0000000..c686a80 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPageMessageProductData.ts @@ -0,0 +1,98 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class CatalogPageMessageProductData +{ + public static I: string = 'i'; + public static S: string = 's'; + public static E: string = 'e'; + public static B: string = 'b'; + + private _productType: string; + private _furniClassId: number; + private _extraParam: string; + private _productCount: number; + private _uniqueLimitedItem: boolean; + private _uniqueLimitedItemSeriesSize: number; + private _uniqueLimitedItemsLeft: number; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._productType = null; + this._furniClassId = -1; + this._extraParam = null; + this._productCount = 0; + this._uniqueLimitedItem = false; + this._uniqueLimitedItemSeriesSize = 0; + this._uniqueLimitedItemsLeft = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._productType = wrapper.readString(); + + switch(this._productType) + { + case CatalogPageMessageProductData.B: + this._extraParam = wrapper.readString(); + this._productCount = 1; + return true; + default: + this._furniClassId = wrapper.readInt(); + this._extraParam = wrapper.readString(); + this._productCount = wrapper.readInt(); + this._uniqueLimitedItem = wrapper.readBoolean(); + + if(this._uniqueLimitedItem) + { + this._uniqueLimitedItemSeriesSize = wrapper.readInt(); + this._uniqueLimitedItemsLeft = wrapper.readInt(); + } + return true; + } + } + + public get productType(): string + { + return this._productType; + } + + public get furniClassId(): number + { + return this._furniClassId; + } + + public get extraParam(): string + { + return this._extraParam; + } + + public get productCount(): number + { + return this._productCount; + } + + public get uniqueLimitedItem(): boolean + { + return this._uniqueLimitedItem; + } + + public get uniqueLimitedSeriesSize(): number + { + return this._uniqueLimitedItemSeriesSize; + } + + public get uniqueLimitedItemsLeft(): number + { + return this._uniqueLimitedItemsLeft; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPageWithEarliestExpiryMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPageWithEarliestExpiryMessageParser.ts new file mode 100644 index 0000000..6cfc5a6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPageWithEarliestExpiryMessageParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CatalogPageWithEarliestExpiryMessageParser implements IMessageParser +{ + private _pageName: string; + private _secondsToExpiry: number; + private _image: string; + + public flush(): boolean + { + this._pageName = null; + this._secondsToExpiry = 0; + this._image = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._pageName = wrapper.readString(); + this._secondsToExpiry = wrapper.readInt(); + this._image = wrapper.readString(); + + return true; + } + + public get pageName(): string + { + return this._pageName; + } + + public get secondsToExpiry(): number + { + return this._secondsToExpiry; + } + + public get image(): string + { + return this._image; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPublishedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPublishedMessageParser.ts new file mode 100644 index 0000000..c90d46d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/CatalogPublishedMessageParser.ts @@ -0,0 +1,36 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CatalogPublishedMessageParser implements IMessageParser +{ + private _instantlyRefreshCatalogue: boolean; + private _newFurniDataHash: string; + + public flush(): boolean + { + this._instantlyRefreshCatalogue = false; + this._newFurniDataHash = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._instantlyRefreshCatalogue = wrapper.readBoolean(); + + if(wrapper.bytesAvailable) this._newFurniDataHash = wrapper.readString(); + + return true; + } + + public get instantlyRefreshCatalogue(): boolean + { + return this._instantlyRefreshCatalogue; + } + + public get newFurniDataHash(): string + { + return this._newFurniDataHash; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/ClubGiftData.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/ClubGiftData.ts new file mode 100644 index 0000000..d566401 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/ClubGiftData.ts @@ -0,0 +1,37 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class ClubGiftData +{ + private _offerId: number; + private _isVip: boolean; + private _isSelectable: boolean; + private _daysRequired: number; + + constructor(wrapper: IMessageDataWrapper) + { + this._offerId = wrapper.readInt(); + this._isVip = wrapper.readBoolean(); + this._daysRequired = wrapper.readInt(); + this._isSelectable = wrapper.readBoolean(); + } + + public get offerId(): number + { + return this._offerId; + } + + public get isVip(): boolean + { + return this._isVip; + } + + public get isSelectable(): boolean + { + return this._isSelectable; + } + + public get daysRequired(): number + { + return this._daysRequired; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/ClubGiftInfoParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/ClubGiftInfoParser.ts new file mode 100644 index 0000000..6b57c93 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/ClubGiftInfoParser.ts @@ -0,0 +1,77 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CatalogPageMessageOfferData } from './CatalogPageMessageOfferData'; +import { ClubGiftData } from './ClubGiftData'; + +export class ClubGiftInfoParser implements IMessageParser +{ + private _daysUntilNextGift: number; + private _giftsAvailable: number; + private _offers: CatalogPageMessageOfferData[]; + private _giftData: Map; + + public flush(): boolean + { + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._offers = []; + this._giftData = new Map(); + this._daysUntilNextGift = wrapper.readInt(); + this._giftsAvailable = wrapper.readInt(); + + const offerCount = wrapper.readInt(); + + for(let i = 0; i < offerCount; i++) + { + this._offers.push(new CatalogPageMessageOfferData(wrapper)); + } + + const giftDataCount = wrapper.readInt(); + + for(let i = 0; i < giftDataCount; i++) + { + const item = new ClubGiftData(wrapper); + this._giftData.set(item.offerId, item); + } + + return true; + } + + public get offers(): CatalogPageMessageOfferData[] + { + return this._offers; + } + + public get daysUntilNextGift(): number + { + return this._daysUntilNextGift; + } + + public get giftsAvailable(): number + { + return this._giftsAvailable; + } + + public set giftsAvailable(gifts: number) + { + this._giftsAvailable = gifts; + } + + public getOfferExtraData(offerId: number): ClubGiftData + { + if(!offerId) return null; + + return this._giftData.get(offerId); + } + + + public get giftData(): Map + { + return this._giftData; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/ClubGiftSelectedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/ClubGiftSelectedParser.ts new file mode 100644 index 0000000..176ea13 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/ClubGiftSelectedParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CatalogPageMessageProductData } from './CatalogPageMessageProductData'; + +export class ClubGiftSelectedParser implements IMessageParser +{ + private _productCode: string; + private _products: CatalogPageMessageProductData[]; + + public flush(): boolean + { + this._productCode = null; + this._products = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._productCode = wrapper.readString(); + + let count = wrapper.readInt(); + + while(count > 0) + { + this._products.push(new CatalogPageMessageProductData(wrapper)); + + count--; + } + + return true; + } + + public get productCode(): string + { + return this._productCode; + } + + public get products(): CatalogPageMessageProductData[] + { + return this._products; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/ClubOfferData.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/ClubOfferData.ts new file mode 100644 index 0000000..89498e2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/ClubOfferData.ts @@ -0,0 +1,105 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class ClubOfferData +{ + private _offerId: number; + private _productCode: string; + private _priceCredits: number; + private _priceActivityPoints: number; + private _priceActivityPointsType: number; + private _vip: boolean; + private _months: number; + private _extraDays: number; + private _daysLeftAfterPurchase: number; + private _year: number; + private _month: number; + private _day: number; + private _giftable: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this._offerId = wrapper.readInt(); + this._productCode = wrapper.readString(); + + wrapper.readBoolean(); + + this._priceCredits = wrapper.readInt(); + this._priceActivityPoints = wrapper.readInt(); + this._priceActivityPointsType = wrapper.readInt(); + this._vip = wrapper.readBoolean(); + this._months = wrapper.readInt(); + this._extraDays = wrapper.readInt(); + this._giftable = wrapper.readBoolean(); + this._daysLeftAfterPurchase = wrapper.readInt(); + this._year = wrapper.readInt(); + this._month = wrapper.readInt(); + this._day = wrapper.readInt(); + } + + public get offerId(): number + { + return this._offerId; + } + + public get productCode(): string + { + return this._productCode; + } + + public get priceCredits(): number + { + return this._priceCredits; + } + + public get priceActivityPoints(): number + { + return this._priceActivityPoints; + } + + public get priceActivityPointsType(): number + { + return this._priceActivityPointsType; + } + + public get vip(): boolean + { + return this._vip; + } + + public get months(): number + { + return this._months; + } + + public get extraDays(): number + { + return this._extraDays; + } + + public get daysLeftAfterPurchase(): number + { + return this._daysLeftAfterPurchase; + } + + public get year(): number + { + return this._year; + } + + public get month(): number + { + return this._month; + } + + public get day(): number + { + return this._day; + } + + public get giftable(): boolean + { + return this._giftable; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/ClubOfferExtendData.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/ClubOfferExtendData.ts new file mode 100644 index 0000000..1d6710e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/ClubOfferExtendData.ts @@ -0,0 +1,50 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { ClubOfferData } from './ClubOfferData'; + +export class ClubOfferExtendData extends ClubOfferData +{ + private _originalPrice: number; + private _originalActivityPointPrice: number; + private _originalActivityPointType: number; + private _subscriptionDaysLeft: number; + + constructor(wrapper: IMessageDataWrapper) + { + super(wrapper); + + this._originalPrice = wrapper.readInt(); + this._originalActivityPointPrice = wrapper.readInt(); + this._originalActivityPointType = wrapper.readInt(); + this._subscriptionDaysLeft = wrapper.readInt(); + } + + public get originalPrice(): number + { + return this._originalPrice * this.months; + } + + public get originalActivityPointPrice(): number + { + return this._originalActivityPointPrice * this.months; + } + + public get originalActivityPointType(): number + { + return this._originalActivityPointType; + } + + public get discountCreditAmount(): number + { + return (this._originalPrice * this.months) - this.priceCredits; + } + + public get discountActivityPointAmount(): number + { + return (this.originalActivityPointPrice * this.months) - this.priceActivityPoints; + } + + public get subscriptionDaysLeft(): number + { + return this._subscriptionDaysLeft; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/DirectSMSClubBuyAvailableMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/DirectSMSClubBuyAvailableMessageParser.ts new file mode 100644 index 0000000..c812d76 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/DirectSMSClubBuyAvailableMessageParser.ts @@ -0,0 +1,53 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class DirectSMSClubBuyAvailableMessageParser implements IMessageParser +{ + private _available: boolean; + private _pricePointUrl: string; + private _market: string; + private _lengthInDays: number; + + public flush(): boolean + { + this._available = false; + this._pricePointUrl = null; + this._market = null; + this._lengthInDays = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._pricePointUrl = wrapper.readString(); + + if(this._pricePointUrl !== '') this._available = true; + + this._market = wrapper.readString(); + this._lengthInDays = wrapper.readInt(); + + return true; + } + + public get available(): boolean + { + return this._available; + } + + public get pricePointUrl(): string + { + return this._pricePointUrl; + } + + public get market(): string + { + return this._market; + } + + public get lengthInDays(): number + { + return this._lengthInDays; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/FireworkChargeData.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/FireworkChargeData.ts new file mode 100644 index 0000000..4ba17b3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/FireworkChargeData.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class FireworkChargeData +{ + private _stuffId: number; + private _charges: number; + private _SafeStr_6935: number; + private _SafeStr_6936: number; + private _SafeStr_6518: number; + private _SafeStr_7875: number; + + constructor(wrapper: IMessageDataWrapper) + { + this._stuffId = wrapper.readInt(); + this._charges = wrapper.readInt(); + this._SafeStr_6935 = wrapper.readInt(); + this._SafeStr_6936 = wrapper.readInt(); + this._SafeStr_6518 = wrapper.readInt(); + this._SafeStr_7875 = wrapper.readInt(); + } + + public get stuffId(): number + { + return this._stuffId; + } + + public get charges(): number + { + return this._charges; + } + + public get _SafeStr_5946(): number + { + return this._SafeStr_6935; + } + + public get _SafeStr_5944(): number + { + return this._SafeStr_6936; + } + + public get _SafeStr_7876(): number + { + return this._SafeStr_7875; + } + + public get _SafeStr_5945(): number + { + return this._SafeStr_6518; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/FireworkChargeDataParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/FireworkChargeDataParser.ts new file mode 100644 index 0000000..e3d4be6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/FireworkChargeDataParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { FireworkChargeData } from './FireworkChargeData'; + +export class FireworkChargeDataParser implements IMessageParser +{ + private _fireworkChargeData: FireworkChargeData; + + public flush(): boolean + { + this._fireworkChargeData = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._fireworkChargeData = new FireworkChargeData(wrapper); + + return true; + } + + public get fireworkChargeData(): FireworkChargeData + { + return this._fireworkChargeData; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/FrontPageItem.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/FrontPageItem.ts new file mode 100644 index 0000000..6b471e0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/FrontPageItem.ts @@ -0,0 +1,109 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { GetTickerTime } from '../../../../../pixi-proxy'; + +export class FrontPageItem +{ + public static ITEM_CATALOGUE_PAGE: number = 0; + public static ITEM_PRODUCT_OFFER: number = 1; + public static ITEM_IAP: number = 2; + + private _type: number; + private _position: number; + private _itemName: string; + private _itemPromoImage: string; + private _catalogPageLocation: string; + private _productCode: string; + private _productOfferId: number; + private _expirationTime: number; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._type = -1; + this._position = null; + this._itemName = null; + this._itemPromoImage = null; + this._catalogPageLocation = null; + this._productCode = null; + this._productOfferId = 0; + this._expirationTime = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._position = wrapper.readInt(); + this._itemName = wrapper.readString(); + this._itemPromoImage = wrapper.readString(); + this._type = wrapper.readInt(); + + switch(this._type) + { + case FrontPageItem.ITEM_CATALOGUE_PAGE: + this._catalogPageLocation = wrapper.readString(); + break; + case FrontPageItem.ITEM_PRODUCT_OFFER: + this._productOfferId = wrapper.readInt(); + break; + case FrontPageItem.ITEM_IAP: + this._productCode = wrapper.readString(); + break; + } + + const time = wrapper.readInt(); + + this._expirationTime = ((time > 0) ? ((time * 1000) + GetTickerTime()) : 0); + + return true; + } + + public get type(): number + { + return this._type; + } + + public get position(): number + { + return this._position; + } + + public get itemName(): string + { + return this._itemName; + } + + public get itemPromoImage(): string + { + return this._itemPromoImage; + } + + public get catalogPageLocation(): string + { + return this._catalogPageLocation; + } + + public get productCode(): string + { + return this._productCode; + } + + public get productOfferId(): number + { + return this._productOfferId; + } + + public get expirationTime(): number + { + return this._expirationTime; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/GiftReceiverNotFoundParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/GiftReceiverNotFoundParser.ts new file mode 100644 index 0000000..4ca147d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/GiftReceiverNotFoundParser.ts @@ -0,0 +1,20 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GiftReceiverNotFoundParser implements IMessageParser +{ + + public flush(): boolean + { + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } + + +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/GiftWrappingConfigurationParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/GiftWrappingConfigurationParser.ts new file mode 100644 index 0000000..085c601 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/GiftWrappingConfigurationParser.ts @@ -0,0 +1,105 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GiftWrappingConfigurationParser implements IMessageParser +{ + private _isEnabled: boolean = false; + private _price: number = null; + private _giftWrappers: number[] = null; + private _boxTypes: number[] = null; + private _ribbonTypes: number[] = null; + private _giftFurnis: number[] = null; + + public flush(): boolean + { + this._boxTypes = null; + this._giftFurnis = null; + this._giftWrappers = null; + this._ribbonTypes = null; + this._isEnabled = null; + this._price = null; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + const giftWrappers = []; + const boxTypes = []; + const ribbonTypes = []; + const giftFurnis = []; + this._isEnabled = wrapper.readBoolean(); + // hotel.gifts.special.price + this._price = wrapper.readInt(); + + + let _local_3 = wrapper.readInt(); + + let i = 0; + while(i < _local_3) + { + giftWrappers.push(wrapper.readInt()); + i++; + } + + _local_3 = wrapper.readInt(); + i = 0; + while(i < _local_3) + { + boxTypes.push(wrapper.readInt()); + i++; + } + + _local_3 = wrapper.readInt(); + i = 0; + while(i < _local_3) + { + ribbonTypes.push(wrapper.readInt()); + i++; + } + + _local_3 = wrapper.readInt(); + i = 0; + while(i < _local_3) + { + giftFurnis.push(wrapper.readInt()); + i++; + } + + this._giftWrappers = giftWrappers; + this._ribbonTypes = ribbonTypes; + this._giftFurnis = giftFurnis; + this._boxTypes = boxTypes; + return true; + } + + public get giftWrappers(): number[] + { + return this._giftWrappers; + } + + public get ribbonTypes(): number[] + { + return this._ribbonTypes; + } + + public get giftFurnis(): number[] + { + return this._giftFurnis; + } + + public get boxTypes(): number[] + { + return this._boxTypes; + } + + public get isEnabled(): boolean + { + return this._isEnabled; + } + + public get price(): number + { + return this._price; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/HabboClubExtendOfferMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/HabboClubExtendOfferMessageParser.ts new file mode 100644 index 0000000..e3a5684 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/HabboClubExtendOfferMessageParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { ClubOfferExtendData } from './ClubOfferExtendData'; + +export class HabboClubExtendOfferMessageParser implements IMessageParser +{ + private _offer: ClubOfferExtendData; + + public flush(): boolean + { + this._offer = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._offer = new ClubOfferExtendData(wrapper); + + return true; + } + + public get offer(): ClubOfferExtendData + { + return this._offer; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/HabboClubOffersMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/HabboClubOffersMessageParser.ts new file mode 100644 index 0000000..6aabdf3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/HabboClubOffersMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { ClubOfferData } from './ClubOfferData'; + +export class HabboClubOffersMessageParser implements IMessageParser +{ + private _offers: ClubOfferData[]; + + public flush(): boolean + { + this._offers = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalOffers = wrapper.readInt(); + + while(totalOffers > 0) + { + this._offers.push(new ClubOfferData(wrapper)); + + totalOffers--; + } + + return true; + } + + public get offers(): ClubOfferData[] + { + return this._offers; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/INodeData.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/INodeData.ts new file mode 100644 index 0000000..2c201e9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/INodeData.ts @@ -0,0 +1,10 @@ +export interface INodeData +{ + visible: boolean; + icon: number; + pageId: number; + pageName: string; + localization: string; + children: INodeData[]; + offerIds: number[]; +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/IsOfferGiftableMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/IsOfferGiftableMessageParser.ts new file mode 100644 index 0000000..a3588cb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/IsOfferGiftableMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class IsOfferGiftableMessageParser implements IMessageParser +{ + private _offerId: number; + private _isGiftable: boolean; + + public flush(): boolean + { + this._offerId = 0; + this._isGiftable = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._offerId = wrapper.readInt(); + this._isGiftable = wrapper.readBoolean(); + + return true; + } + + public get offerId(): number + { + return this._offerId; + } + + public get isGiftable(): boolean + { + return this._isGiftable; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/LimitedEditionSoldOutParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/LimitedEditionSoldOutParser.ts new file mode 100644 index 0000000..4b4e3a8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/LimitedEditionSoldOutParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class LimitedEditionSoldOutParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/LimitedOfferAppearingNextMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/LimitedOfferAppearingNextMessageParser.ts new file mode 100644 index 0000000..8baa509 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/LimitedOfferAppearingNextMessageParser.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class LimitedOfferAppearingNextMessageParser implements IMessageParser +{ + private _appearsInSeconds: number; + private _pageId: number; + private _offerId: number; + private _productType: string; + + public flush(): boolean + { + this._appearsInSeconds = -1; + this._pageId = -1; + this._offerId = -1; + this._productType = ''; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._appearsInSeconds = wrapper.readInt(); + this._pageId = wrapper.readInt(); + this._offerId = wrapper.readInt(); + this._productType = wrapper.readString(); + + return true; + } + + public get appearsInSeconds(): number + { + return this._appearsInSeconds; + } + + public get pageId(): number + { + return this._pageId; + } + + public get offerId(): number + { + return this._offerId; + } + + public get productType(): string + { + return this._productType; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/NodeData.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/NodeData.ts new file mode 100644 index 0000000..ba441eb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/NodeData.ts @@ -0,0 +1,99 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class NodeData +{ + private _visible: boolean; + private _icon: number; + private _pageId: number; + private _pageName: string; + private _localization: string; + private _children: NodeData[]; + private _offerIds: number[]; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._visible = false; + this._icon = 0; + this._pageId = -1; + this._pageName = null; + this._localization = null; + this._children = []; + this._offerIds = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._visible = wrapper.readBoolean(); + this._icon = wrapper.readInt(); + this._pageId = wrapper.readInt(); + this._pageName = wrapper.readString(); + this._localization = wrapper.readString(); + + let totalOffers = wrapper.readInt(); + + while(totalOffers > 0) + { + this._offerIds.push(wrapper.readInt()); + + totalOffers--; + } + + let totalChildren = wrapper.readInt(); + + while(totalChildren > 0) + { + this._children.push(new NodeData(wrapper)); + + totalChildren--; + } + + return true; + } + + public get visible(): boolean + { + return this._visible; + } + + public get icon(): number + { + return this._icon; + } + + public get pageId(): number + { + return this._pageId; + } + + public get pageName(): string + { + return this._pageName; + } + + public get localization(): string + { + return this._localization; + } + + public get children(): NodeData[] + { + return this._children; + } + + public get offerIds(): number[] + { + return this._offerIds; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/NotEnoughBalanceMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/NotEnoughBalanceMessageParser.ts new file mode 100644 index 0000000..69a6ac5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/NotEnoughBalanceMessageParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class NotEnoughBalanceMessageParser implements IMessageParser +{ + private _notEnoughCredits: boolean = false; + private _notEnoughActivityPoints: boolean = false; + private _activityPointType: number = 0; + + public flush(): boolean + { + this._notEnoughCredits = false; + this._notEnoughActivityPoints = false; + this._activityPointType = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._notEnoughCredits = wrapper.readBoolean(); + this._notEnoughActivityPoints = wrapper.readBoolean(); + + if(wrapper.bytesAvailable) this._activityPointType = wrapper.readInt(); + + return true; + } + + public get notEnoughCredits(): boolean + { + return this._notEnoughCredits; + } + + public get notEnoughActivityPoints(): boolean + { + return this._notEnoughActivityPoints; + } + + public get activityPointType(): number + { + return this._activityPointType; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/ProductOfferMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/ProductOfferMessageParser.ts new file mode 100644 index 0000000..c920ba6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/ProductOfferMessageParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CatalogPageMessageOfferData } from './CatalogPageMessageOfferData'; + +export class ProductOfferMessageParser implements IMessageParser +{ + private _offer: CatalogPageMessageOfferData; + + public flush(): boolean + { + this._offer = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._offer = new CatalogPageMessageOfferData(wrapper); + + return true; + } + + public get offer(): CatalogPageMessageOfferData + { + return this._offer; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/PurchaseErrorMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/PurchaseErrorMessageParser.ts new file mode 100644 index 0000000..a09a23c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/PurchaseErrorMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class PurchaseErrorMessageParser implements IMessageParser +{ + private _code: number; + + public flush(): boolean + { + this._code = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._code = wrapper.readInt(); + + return true; + } + + public get code(): number + { + return this._code; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/PurchaseNotAllowedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/PurchaseNotAllowedMessageParser.ts new file mode 100644 index 0000000..e47268f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/PurchaseNotAllowedMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class PurchaseNotAllowedMessageParser implements IMessageParser +{ + private _code: number; + + public flush(): boolean + { + this._code = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._code = wrapper.readInt(); + + return true; + } + + public get code(): number + { + return this._code; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/PurchaseOKMessageOfferData.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/PurchaseOKMessageOfferData.ts new file mode 100644 index 0000000..16bb49b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/PurchaseOKMessageOfferData.ts @@ -0,0 +1,117 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { CatalogPageMessageProductData } from './CatalogPageMessageProductData'; + +export class PurchaseOKMessageOfferData +{ + private _offerId: number; + private _localizationId: string; + private _rent: boolean; + private _priceCredits: number; + private _priceActivityPoints: number; + private _priceActivityPointsType: number; + private _clubLevel: number; + private _giftable: boolean; + private _bundlePurchaseAllowed: boolean; + private _products: CatalogPageMessageProductData[]; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._offerId = -1; + this._localizationId = null; + this._rent = false; + this._priceCredits = 0; + this._priceActivityPoints = 0; + this._priceActivityPointsType = 0; + this._clubLevel = 0; + this._giftable = false; + this._bundlePurchaseAllowed = false; + this._products = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._offerId = wrapper.readInt(); + this._localizationId = wrapper.readString(); + this._rent = wrapper.readBoolean(); + this._priceCredits = wrapper.readInt(); + this._priceActivityPoints = wrapper.readInt(); + this._priceActivityPointsType = wrapper.readInt(); + this._giftable = wrapper.readBoolean(); + + let totalProducts = wrapper.readInt(); + + while(totalProducts > 0) + { + this._products.push(new CatalogPageMessageProductData(wrapper)); + + totalProducts--; + } + + this._clubLevel = wrapper.readInt(); + this._bundlePurchaseAllowed = wrapper.readBoolean(); + + return true; + } + + public get offerId(): number + { + return this._offerId; + } + + public get localizationId(): string + { + return this._localizationId; + } + + public get rent(): boolean + { + return this._rent; + } + + public get priceCredits(): number + { + return this._priceCredits; + } + + public get priceActivityPoints(): number + { + return this._priceActivityPoints; + } + + public get priceActivityPointsType(): number + { + return this._priceActivityPointsType; + } + + public get clubLevel(): number + { + return this._clubLevel; + } + + public get giftable(): boolean + { + return this._giftable; + } + + public get bundlePurchaseAllowed(): boolean + { + return this._bundlePurchaseAllowed; + } + + public get products(): CatalogPageMessageProductData[] + { + return this._products; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/PurchaseOKMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/PurchaseOKMessageParser.ts new file mode 100644 index 0000000..99690c9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/PurchaseOKMessageParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { PurchaseOKMessageOfferData } from './PurchaseOKMessageOfferData'; + +export class PurchaseOKMessageParser implements IMessageParser +{ + private _offer: PurchaseOKMessageOfferData; + + public flush(): boolean + { + this._offer = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._offer = new PurchaseOKMessageOfferData(wrapper); + + return true; + } + + public get offer(): PurchaseOKMessageOfferData + { + return this._offer; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/RoomAdPurchaseInfoEventParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/RoomAdPurchaseInfoEventParser.ts new file mode 100644 index 0000000..227d56d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/RoomAdPurchaseInfoEventParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { RoomEntryData } from '../user'; + +export class RoomAdPurchaseInfoEventParser implements IMessageParser +{ + private _isVip: boolean; + private _rooms: RoomEntryData[]; + + public flush(): boolean + { + this._isVip = false; + this._rooms = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._isVip = wrapper.readBoolean(); + + let count = wrapper.readInt(); + + while(count > 0) + { + this._rooms.push(new RoomEntryData(wrapper.readInt(), wrapper.readString(), wrapper.readBoolean())); + + count--; + } + + return true; + } + + public get isVip(): boolean + { + return this._isVip; + } + + public get rooms(): RoomEntryData[] + { + return this._rooms; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/SeasonalCalendarDailyOfferMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/SeasonalCalendarDailyOfferMessageParser.ts new file mode 100644 index 0000000..67370a3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/SeasonalCalendarDailyOfferMessageParser.ts @@ -0,0 +1,36 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CatalogPageMessageOfferData } from './CatalogPageMessageOfferData'; + +export class SeasonalCalendarDailyOfferMessageParser implements IMessageParser +{ + private _pageId: number; + private _data: CatalogPageMessageOfferData; + + public flush(): boolean + { + this._pageId = -1; + this._data = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._pageId = wrapper.readInt(); + this._data = new CatalogPageMessageOfferData(wrapper); + + return true; + } + + public get pageId(): number + { + return this._pageId; + } + + public get data(): CatalogPageMessageOfferData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/SellablePetPaletteData.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/SellablePetPaletteData.ts new file mode 100644 index 0000000..cc2dfde --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/SellablePetPaletteData.ts @@ -0,0 +1,67 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class SellablePetPaletteData +{ + private _type: number; + private _breedId: number; + private _paletteId: number; + private _sellable: boolean; + private _rare: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._type = -1; + this._breedId = -1; + this._paletteId = -1; + this._sellable = false; + this._rare = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._type = wrapper.readInt(); + this._breedId = wrapper.readInt(); + this._paletteId = wrapper.readInt(); + this._sellable = wrapper.readBoolean(); + this._rare = wrapper.readBoolean(); + + return true; + } + + public get type(): number + { + return this._type; + } + + public get breedId(): number + { + return this._breedId; + } + + public get paletteId(): number + { + return this._paletteId; + } + + public get sellable(): boolean + { + return this._sellable; + } + + public get rare(): boolean + { + return this._rare; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/SellablePetPalettesParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/SellablePetPalettesParser.ts new file mode 100644 index 0000000..64b0afa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/SellablePetPalettesParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { SellablePetPaletteData } from './SellablePetPaletteData'; + +export class SellablePetPalettesParser implements IMessageParser +{ + private _productCode: string; + private _palettes: SellablePetPaletteData[]; + + public flush(): boolean + { + this._productCode = ''; + this._palettes = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._productCode = wrapper.readString(); + + let totalPalettes = wrapper.readInt(); + + while(totalPalettes > 0) + { + this._palettes.push(new SellablePetPaletteData(wrapper)); + + totalPalettes--; + } + + return true; + } + + public get productCode(): string + { + return this._productCode; + } + + public get palettes(): SellablePetPaletteData[] + { + return this._palettes; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/TargetedOfferData.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/TargetedOfferData.ts new file mode 100644 index 0000000..feaaea3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/TargetedOfferData.ts @@ -0,0 +1,153 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class TargetedOfferData +{ + protected _id: number; + protected _identifier: string; + protected _type: number; + protected _title: string; + protected _description: string; + protected _imageUrl: string; + protected _iconImageUrl: string; + protected _productCode: string; + protected _purchaseLimit: number; + protected _expirationTime: number; + protected _priceInCredits: number; + protected _priceInActivityPoints: number; + protected _activityPointType: number; + protected _subProductCodes: string[]; + protected _trackingState: number; + + constructor(wrapper: IMessageDataWrapper) + { + this._trackingState = wrapper.readInt(); + this._id = wrapper.readInt(); + this._identifier = wrapper.readString(); + this._productCode = wrapper.readString(); + this._priceInCredits = wrapper.readInt(); + this._priceInActivityPoints = wrapper.readInt(); + this._activityPointType = wrapper.readInt(); + this._purchaseLimit = wrapper.readInt(); + + const time = wrapper.readInt(); + this._expirationTime = ((time > 0) ? ((time * 1000) + Date.now()) : 0); + + this._title = wrapper.readString(); + this._description = wrapper.readString(); + this._imageUrl = wrapper.readString(); + this._iconImageUrl = wrapper.readString(); + this._type = wrapper.readInt(); + this._subProductCodes = []; + + let count = wrapper.readInt(); + + while(count > 0) + { + this._subProductCodes.push(wrapper.readString()); + + count--; + } + return this; + } + + public populate(offerData: TargetedOfferData) + { + if(!offerData) return; + + this._id = offerData.id; + this._identifier = offerData.identifier; + this._type = offerData.type; + this._title = offerData.title; + this._description = offerData.description; + this._imageUrl = offerData.imageUrl; + this._iconImageUrl = offerData.iconImageUrl; + this._productCode = offerData.productCode; + this._purchaseLimit = offerData.purchaseLimit; + this._expirationTime = offerData.expirationTime; + this._priceInCredits = offerData.priceInCredits; + this._priceInActivityPoints = offerData.priceInActivityPoints; + this._activityPointType = offerData.activityPointType; + this._subProductCodes = offerData.subProductCodes; + this._trackingState = offerData.trackingState; + } + + public purchase(k: number): void + { + this._purchaseLimit = (this._purchaseLimit - k); + } + + public get id(): number + { + return this._id; + } + + public get identifier(): string + { + return this._identifier; + } + + public get type(): number + { + return this._type; + } + + public get title(): string + { + return this._title; + } + + public get description(): string + { + return this._description; + } + + public get imageUrl(): string + { + return this._imageUrl; + } + + public get iconImageUrl(): string + { + return this._iconImageUrl; + } + + public get productCode(): string + { + return this._productCode; + } + + public get purchaseLimit(): number + { + return this._purchaseLimit; + } + + public get expirationTime(): number + { + return this._expirationTime; + } + + public get priceInCredits(): number + { + return this._priceInCredits; + } + + public get priceInActivityPoints(): number + { + return this._priceInActivityPoints; + } + + public get activityPointType(): number + { + return this._activityPointType; + } + + public get subProductCodes(): string[] + { + return this._subProductCodes; + } + + public get trackingState(): number + { + return this._trackingState; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/TargetedOfferNotFoundParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/TargetedOfferNotFoundParser.ts new file mode 100644 index 0000000..c072a1e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/TargetedOfferNotFoundParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class TargetedOfferNotFoundParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/TargetedOfferParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/TargetedOfferParser.ts new file mode 100644 index 0000000..5b0f447 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/TargetedOfferParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { TargetedOfferData } from './TargetedOfferData'; + +export class TargetedOfferParser implements IMessageParser +{ + private _data: TargetedOfferData; + + public flush(): boolean + { + this._data = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._data = new TargetedOfferData(wrapper); + + return true; + } + + public get data(): TargetedOfferData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/VoucherRedeemErrorMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/VoucherRedeemErrorMessageParser.ts new file mode 100644 index 0000000..84f871a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/VoucherRedeemErrorMessageParser.ts @@ -0,0 +1,26 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class VoucherRedeemErrorMessageParser implements IMessageParser +{ + private _errorCode: string = ''; + + public flush(): boolean + { + this._errorCode = ''; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._errorCode = wrapper.readString(); + + return true; + } + + public get errorCode(): string + { + return this._errorCode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/VoucherRedeemOkMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/VoucherRedeemOkMessageParser.ts new file mode 100644 index 0000000..c82e8fd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/VoucherRedeemOkMessageParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class VoucherRedeemOkMessageParser implements IMessageParser +{ + private _productName: string = ''; + private _productDescription: string = ''; + + public flush(): boolean + { + this._productDescription = ''; + this._productName = ''; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._productDescription = wrapper.readString(); + this._productName = wrapper.readString(); + + return true; + } + + public get productName(): string + { + return this._productName; + } + + public get productDescription(): string + { + return this._productDescription; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/catalog/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/catalog/index.ts new file mode 100644 index 0000000..6225fef --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/catalog/index.ts @@ -0,0 +1,46 @@ +export * from './BonusRareInfoMessageParser'; +export * from './BuildersClubFurniCountMessageParser'; +export * from './BuildersClubSubscriptionStatusMessageParser'; +export * from './BundleDiscountRuleset'; +export * from './BundleDiscountRulesetMessageParser'; +export * from './CatalogIndexMessageParser'; +export * from './CatalogLocalizationData'; +export * from './CatalogPageExpirationParser'; +export * from './CatalogPageMessageOfferData'; +export * from './CatalogPageMessageParser'; +export * from './CatalogPageMessageProductData'; +export * from './CatalogPageWithEarliestExpiryMessageParser'; +export * from './CatalogPublishedMessageParser'; +export * from './ClubGiftData'; +export * from './ClubGiftInfoParser'; +export * from './ClubGiftSelectedParser'; +export * from './ClubOfferData'; +export * from './ClubOfferExtendData'; +export * from './DirectSMSClubBuyAvailableMessageParser'; +export * from './FireworkChargeData'; +export * from './FireworkChargeDataParser'; +export * from './FrontPageItem'; +export * from './GiftReceiverNotFoundParser'; +export * from './GiftWrappingConfigurationParser'; +export * from './HabboClubExtendOfferMessageParser'; +export * from './HabboClubOffersMessageParser'; +export * from './INodeData'; +export * from './IsOfferGiftableMessageParser'; +export * from './LimitedEditionSoldOutParser'; +export * from './LimitedOfferAppearingNextMessageParser'; +export * from './NodeData'; +export * from './NotEnoughBalanceMessageParser'; +export * from './ProductOfferMessageParser'; +export * from './PurchaseErrorMessageParser'; +export * from './PurchaseNotAllowedMessageParser'; +export * from './PurchaseOKMessageOfferData'; +export * from './PurchaseOKMessageParser'; +export * from './RoomAdPurchaseInfoEventParser'; +export * from './SeasonalCalendarDailyOfferMessageParser'; +export * from './SellablePetPaletteData'; +export * from './SellablePetPalettesParser'; +export * from './TargetedOfferData'; +export * from './TargetedOfferNotFoundParser'; +export * from './TargetedOfferParser'; +export * from './VoucherRedeemErrorMessageParser'; +export * from './VoucherRedeemOkMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/client/ClientPingParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/client/ClientPingParser.ts new file mode 100644 index 0000000..f8dbc6c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/client/ClientPingParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ClientPingParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/client/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/client/index.ts new file mode 100644 index 0000000..129f672 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/client/index.ts @@ -0,0 +1 @@ +export * from './ClientPingParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/competition/CompetitionEntrySubmitResultMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/competition/CompetitionEntrySubmitResultMessageParser.ts new file mode 100644 index 0000000..815b682 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/competition/CompetitionEntrySubmitResultMessageParser.ts @@ -0,0 +1,83 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CompetitionEntrySubmitResultMessageParser implements IMessageParser +{ + public static SUBMITTED: number = 0; + public static ASK_FOR_SUBMIT: number = 1; + public static ASK_FOR_CONFIRM: number = 2; + public static PREREQUISITES_NOT_MET: number = 3; + public static ROOM_DOOR_NOT_OPEN: number = 4; + public static ROOM_TOO_OLD: number = 5; + public static ASK_FOR_ACCEPT_RULES: number = 6; + + private _goalId: number; + private _goalCode: string; + private _result: number; + private _requiredFurnis: string[]; + private _missingFurnis: { [index: string]: string }; + + public flush(): boolean + { + this._goalId = 0; + this._goalCode = null; + this._result = 0; + this._requiredFurnis = null; + this._missingFurnis = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._goalId = wrapper.readInt(); + this._goalCode = wrapper.readString(); + this._result = wrapper.readInt(); + this._requiredFurnis = []; + + let count = wrapper.readInt(); + + while(count > 0) + { + this._requiredFurnis.push(wrapper.readString()); + + count--; + } + + + count = wrapper.readInt(); + + while(count > 0) + { + this._missingFurnis[wrapper.readString()] = ''; + + count--; + } + + return true; + } + + public get goalId(): number + { + return this._goalId; + } + + public get goalCode(): string + { + return this._goalCode; + } + + public get result(): number + { + return this._result; + } + + public get requiredFurnis(): string[] + { + return this._requiredFurnis; + } + + public isMissing(name: string): boolean + { + return !!this._missingFurnis[name]; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/competition/CompetitionVotingInfoMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/competition/CompetitionVotingInfoMessageParser.ts new file mode 100644 index 0000000..56aaa4a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/competition/CompetitionVotingInfoMessageParser.ts @@ -0,0 +1,55 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CompetitionVotingInfoResult } from './CompetitionVotingInfoResult'; + +export class CompetitionVotingInfoMessageParser implements IMessageParser +{ + private _goalId: number; + private _goalCode: string; + private _resultCode: number; + private _votesRemaining: number; + + public flush(): boolean + { + this._goalId = 0; + this._goalCode = null; + this._resultCode = 0; + this._votesRemaining = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._goalId = wrapper.readInt(); + this._goalCode = wrapper.readString(); + this._resultCode = wrapper.readInt(); + this._votesRemaining = wrapper.readInt(); + + return true; + } + + public get goalId(): number + { + return this._goalId; + } + + public get goalCode(): string + { + return this._goalCode; + } + + public get isVotingAllowedForUser(): boolean + { + return (this._resultCode === CompetitionVotingInfoResult.ALLOWED); + } + + public get votesRemaining(): number + { + return this._votesRemaining; + } + + public get resultCode(): number + { + return this._resultCode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/competition/CompetitionVotingInfoResult.ts b/submodules/renderer/src/nitro/communication/messages/parser/competition/CompetitionVotingInfoResult.ts new file mode 100644 index 0000000..119f9b5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/competition/CompetitionVotingInfoResult.ts @@ -0,0 +1,6 @@ +export class CompetitionVotingInfoResult +{ + public static ALLOWED: number = 0; + public static REQUIRED_PERK_MISSING: number = 1; + public static REQUIRED_BADGE_MISSING: number = 2; +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/competition/CurrentTimingCodeMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/competition/CurrentTimingCodeMessageParser.ts new file mode 100644 index 0000000..1ff3007 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/competition/CurrentTimingCodeMessageParser.ts @@ -0,0 +1,33 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CurrentTimingCodeMessageParser implements IMessageParser +{ + private _schedulingStr: string; + private _code: string; + + public flush(): boolean + { + this._schedulingStr = null; + this._code = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._schedulingStr = wrapper.readString(); + this._code = wrapper.readString(); + + return true; + } + + public get schedulingStr(): string + { + return this._schedulingStr; + } + + public get code(): string + { + return this._code; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/competition/IsUserPartOfCompetitionMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/competition/IsUserPartOfCompetitionMessageParser.ts new file mode 100644 index 0000000..d8a0e1f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/competition/IsUserPartOfCompetitionMessageParser.ts @@ -0,0 +1,33 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class IsUserPartOfCompetitionMessageParser implements IMessageParser +{ + private _isPartOf: boolean; + private _targetId: number; + + public flush(): boolean + { + this._isPartOf = false; + this._targetId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._isPartOf = wrapper.readBoolean(); + this._targetId = wrapper.readInt(); + + return true; + } + + public get isPartOf(): boolean + { + return this._isPartOf; + } + + public get targetId(): number + { + return this._targetId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/competition/NoOwnedRoomsAlertMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/competition/NoOwnedRoomsAlertMessageParser.ts new file mode 100644 index 0000000..db00fec --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/competition/NoOwnedRoomsAlertMessageParser.ts @@ -0,0 +1,14 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class NoOwnedRoomsAlertMessageParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/competition/SecondsUntilMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/competition/SecondsUntilMessageParser.ts new file mode 100644 index 0000000..ed4b84c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/competition/SecondsUntilMessageParser.ts @@ -0,0 +1,33 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class SecondsUntilMessageParser implements IMessageParser +{ + private _timeStr: string; + private _secondsUntil: number; + + public flush(): boolean + { + this._timeStr = null; + this._secondsUntil = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._timeStr = wrapper.readString(); + this._secondsUntil = wrapper.readInt(); + + return true; + } + + public get timeStr(): string + { + return this._timeStr; + } + + public get secondsUntil(): number + { + return this._secondsUntil; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/competition/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/competition/index.ts new file mode 100644 index 0000000..674fda0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/competition/index.ts @@ -0,0 +1,7 @@ +export * from './CompetitionEntrySubmitResultMessageParser'; +export * from './CompetitionVotingInfoMessageParser'; +export * from './CompetitionVotingInfoResult'; +export * from './CurrentTimingCodeMessageParser'; +export * from './IsUserPartOfCompetitionMessageParser'; +export * from './NoOwnedRoomsAlertMessageParser'; +export * from './SecondsUntilMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftableProductsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftableProductsMessageParser.ts new file mode 100644 index 0000000..8839698 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftableProductsMessageParser.ts @@ -0,0 +1,52 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CraftingResultObjectParser } from './CraftingResultObjectParser'; + +export class CraftableProductsMessageParser implements IMessageParser +{ + private _recipes: CraftingResultObjectParser[]; + private _ingredients: string[]; + + constructor() + { + this._recipes = []; + this._ingredients = []; + } + + public flush(): boolean + { + this._recipes = []; + this._ingredients = []; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + const craftingResultCount = wrapper.readInt(); + for(let i = 0; i < craftingResultCount; i++) + { + this._recipes.push(new CraftingResultObjectParser(wrapper)); + } + const ingredientCount = wrapper.readInt(); + for(let i = 0; i < ingredientCount; i++) + { + this._ingredients.push(wrapper.readString()); + } + return true; + } + + public get recipes(): CraftingResultObjectParser[] + { + return this._recipes; + } + + public get ingredients(): string[] + { + return this._ingredients; + } + + public isActive(): boolean + { + return (this._recipes.length > 0) || (this._ingredients.length > 0); + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftingRecipeIngredientParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftingRecipeIngredientParser.ts new file mode 100644 index 0000000..90a967c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftingRecipeIngredientParser.ts @@ -0,0 +1,23 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class CraftingRecipeIngredientParser +{ + private _count: number; + private _itemName: string; + + constructor(wrapper: IMessageDataWrapper) + { + this._count = wrapper.readInt(); + this._itemName = wrapper.readString(); + } + + public get count(): number + { + return this._count; + } + + public get itemName(): string + { + return this._itemName; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftingRecipeMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftingRecipeMessageParser.ts new file mode 100644 index 0000000..5f77fc1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftingRecipeMessageParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CraftingRecipeIngredientParser } from './CraftingRecipeIngredientParser'; + +export class CraftingRecipeMessageParser implements IMessageParser +{ + private _ingredients: CraftingRecipeIngredientParser[]; + + constructor() + { + this._ingredients = []; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + const ingredientCount = wrapper.readInt(); + for(let i = 0; i < ingredientCount; i++) + { + this._ingredients.push(new CraftingRecipeIngredientParser(wrapper)); + } + return true; + } + + public flush(): boolean + { + this._ingredients = []; + return true; + } + + public get ingredients(): CraftingRecipeIngredientParser[] + { + return this._ingredients; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftingRecipesAvailableMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftingRecipesAvailableMessageParser.ts new file mode 100644 index 0000000..7b15bcd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftingRecipesAvailableMessageParser.ts @@ -0,0 +1,32 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CraftingRecipesAvailableMessageParser implements IMessageParser +{ + private _hasRecipes: boolean; + private _count: number; + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + this._count = wrapper.readInt(); + this._hasRecipes = wrapper.readBoolean(); + return true; + } + + public flush(): boolean + { + this._count = 0; + this._hasRecipes = false; + return true; + } + + public get count(): number + { + return this._count; + } + + public get hasRecipes(): boolean + { + return this._hasRecipes; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftingResultMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftingResultMessageParser.ts new file mode 100644 index 0000000..01d4297 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftingResultMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CraftingResultObjectParser } from './CraftingResultObjectParser'; + +export class CraftingResultMessageParser implements IMessageParser +{ + private _success: boolean; + private _result: CraftingResultObjectParser; + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + this._success = wrapper.readBoolean(); + if(this._success) + { + this._result = new CraftingResultObjectParser(wrapper); + } + return true; + } + + public flush(): boolean + { + this._success = false; + return true; + } + + public get success(): boolean + { + return this._success; + } + + public get result(): CraftingResultObjectParser + { + return this._result; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftingResultObjectParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftingResultObjectParser.ts new file mode 100644 index 0000000..50c149c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/crafting/CraftingResultObjectParser.ts @@ -0,0 +1,23 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class CraftingResultObjectParser +{ + private _recipeName: string; + private _itemName: string; + + constructor(wrapper: IMessageDataWrapper) + { + this._recipeName = wrapper.readString(); + this._itemName = wrapper.readString(); + } + + public get recipeName(): string + { + return this._recipeName; + } + + public get itemName(): string + { + return this._itemName; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/crafting/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/crafting/index.ts new file mode 100644 index 0000000..d0dc5ee --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/crafting/index.ts @@ -0,0 +1,6 @@ +export * from './CraftableProductsMessageParser'; +export * from './CraftingRecipeIngredientParser'; +export * from './CraftingRecipeMessageParser'; +export * from './CraftingRecipesAvailableMessageParser'; +export * from './CraftingResultMessageParser'; +export * from './CraftingResultObjectParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/desktop/DesktopViewParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/desktop/DesktopViewParser.ts new file mode 100644 index 0000000..97e00a2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/desktop/DesktopViewParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class DesktopViewParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/desktop/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/desktop/index.ts new file mode 100644 index 0000000..442a303 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/desktop/index.ts @@ -0,0 +1 @@ +export * from './DesktopViewParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/AcceptFriendFailureData.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/AcceptFriendFailureData.ts new file mode 100644 index 0000000..8963b60 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/AcceptFriendFailureData.ts @@ -0,0 +1,25 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class AcceptFriendFailerData +{ + private _senderId: number; + private _errorCode: number; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this._senderId = wrapper.readInt(); + this._errorCode = wrapper.readInt(); + } + + public get senderId(): number + { + return this._senderId; + } + + public get errorCode(): number + { + return this._errorCode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/AcceptFriendResultParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/AcceptFriendResultParser.ts new file mode 100644 index 0000000..7201a28 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/AcceptFriendResultParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { AcceptFriendFailerData } from './AcceptFriendFailureData'; + +export class AcceptFriendResultParser implements IMessageParser +{ + private _failuers: AcceptFriendFailerData[]; + + public flush(): boolean + { + this._failuers = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalFailures = wrapper.readInt(); + + while(totalFailures > 0) + { + this._failuers.push(new AcceptFriendFailerData(wrapper)); + + totalFailures--; + } + + return true; + } + + public get failures(): AcceptFriendFailerData[] + { + return this._failuers; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FindFriendsProcessResultParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FindFriendsProcessResultParser.ts new file mode 100644 index 0000000..b424786 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FindFriendsProcessResultParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class FindFriendsProcessResultParser implements IMessageParser +{ + private _success: boolean; + + public flush(): boolean + { + this._success = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._success = wrapper.readBoolean(); + + return true; + } + + public get success(): boolean + { + return this._success; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FollowFriendFailedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FollowFriendFailedParser.ts new file mode 100644 index 0000000..8971024 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FollowFriendFailedParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class FollowFriendFailedParser implements IMessageParser +{ + private _errorCode: number; + + public flush(): boolean + { + this._errorCode = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._errorCode = wrapper.readInt(); + + return true; + } + + public get errorCode(): number + { + return this._errorCode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendCategoryData.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendCategoryData.ts new file mode 100644 index 0000000..a68b98c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendCategoryData.ts @@ -0,0 +1,25 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class FriendCategoryData +{ + private _id: number; + private _name: string; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this._id = wrapper.readInt(); + this._name = wrapper.readString(); + } + + public get id(): number + { + return this._id; + } + + public get name(): string + { + return this._name; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendListFragmentMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendListFragmentMessageParser.ts new file mode 100644 index 0000000..55c3ee6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendListFragmentMessageParser.ts @@ -0,0 +1,52 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { FriendParser } from './FriendParser'; + +export class FriendListFragmentParser implements IMessageParser +{ + private _totalFragments: number; + private _fragmentNumber: number; + private _fragment: FriendParser[]; + + public flush(): boolean + { + this._totalFragments = 0; + this._fragmentNumber = 0; + this._fragment = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._totalFragments = wrapper.readInt(); + this._fragmentNumber = wrapper.readInt(); + + let totalFriends = wrapper.readInt(); + + while(totalFriends > 0) + { + this._fragment.push(new FriendParser(wrapper)); + + totalFriends--; + } + + return true; + } + + public get totalFragments(): number + { + return this._totalFragments; + } + + public get fragmentNumber(): number + { + return this._fragmentNumber; + } + + public get fragment(): FriendParser[] + { + return this._fragment; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendListUpdateParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendListUpdateParser.ts new file mode 100644 index 0000000..e97c251 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendListUpdateParser.ts @@ -0,0 +1,81 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { FriendCategoryData } from './FriendCategoryData'; +import { FriendParser } from './FriendParser'; + +export class FriendListUpdateParser implements IMessageParser +{ + private _categories: FriendCategoryData[]; + private _removedFriendIds: number[]; + private _addedFriends: FriendParser[]; + private _updatedFriends: FriendParser[]; + + public flush(): boolean + { + this._categories = []; + this._removedFriendIds = []; + this._addedFriends = []; + this._updatedFriends = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalCategories = wrapper.readInt(); + + while(totalCategories > 0) + { + this._categories.push(new FriendCategoryData(wrapper)); + + totalCategories--; + } + + let totalUpdates = wrapper.readInt(); + + while(totalUpdates > 0) + { + const type = wrapper.readInt(); + + if(type === -1) + { + this._removedFriendIds.push(wrapper.readInt()); + } + + else if(type === 0) + { + this._updatedFriends.push(new FriendParser(wrapper)); + } + + else if(type === 1) + { + this._addedFriends.push(new FriendParser(wrapper)); + } + + totalUpdates--; + } + + return true; + } + + public get categories(): FriendCategoryData[] + { + return this._categories; + } + + public get removedFriendIds(): number[] + { + return this._removedFriendIds; + } + + public get addedFriends(): FriendParser[] + { + return this._addedFriends; + } + + public get updatedFriends(): FriendParser[] + { + return this._updatedFriends; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendNotificationParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendNotificationParser.ts new file mode 100644 index 0000000..4441a78 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendNotificationParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class FriendNotificationParser implements IMessageParser +{ + private _typeCode: number; + private _avatarId: number; + private _message: string; + + public flush(): boolean + { + this._typeCode = -1; + this._avatarId = 0; + this._message = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._typeCode = wrapper.readInt(); + this._avatarId = wrapper.readInt(); + this._message = wrapper.readString(); + + return true; + } + + public get typeCode(): number + { + return this._typeCode; + } + + public get avatarId(): number + { + return this._avatarId; + } + + public get message(): string + { + return this._message; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendParser.ts new file mode 100644 index 0000000..be7f1ce --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendParser.ts @@ -0,0 +1,109 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class FriendParser +{ + private _id: number; + private _name: string; + private _gender: number; + private _online: boolean; + private _followingAllowed: boolean; + private _figure: string; + private _categoryId: number; + private _motto: string; + private _realName: string; + private _lastAccess: string; + private _persistedMessageUser: boolean; + private _vipMember: boolean; + private _pocketHabboUser: boolean; + private _relationshipStatus: number; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this._id = wrapper.readInt(); + this._name = wrapper.readString(); + this._gender = wrapper.readInt(); + this._online = wrapper.readBoolean(); + this._followingAllowed = wrapper.readBoolean(); + this._figure = wrapper.readString(); + this._categoryId = wrapper.readInt(); + this._motto = wrapper.readString(); + this._realName = wrapper.readString(); + this._lastAccess = wrapper.readString(); + this._persistedMessageUser = wrapper.readBoolean(); + this._vipMember = wrapper.readBoolean(); + this._pocketHabboUser = wrapper.readBoolean(); + this._relationshipStatus = wrapper.readShort(); + } + + public get id(): number + { + return this._id; + } + + public get name(): string + { + return this._name; + } + + public get gender(): number + { + return this._gender; + } + + public get online(): boolean + { + return this._online; + } + + public get followingAllowed(): boolean + { + return this._followingAllowed; + } + + public get figure(): string + { + return this._figure; + } + + public get categoryId(): number + { + return this._categoryId; + } + + public get motto(): string + { + return this._motto; + } + + public get lastAccess(): string + { + return this._lastAccess; + } + + public get realName(): string + { + return this._realName; + } + + public get persistedMessageUser(): boolean + { + return this._persistedMessageUser; + } + + public get vipMember(): boolean + { + return this._vipMember; + } + + public get pocketHabboUser(): boolean + { + return this._pocketHabboUser; + } + + public get relationshipStatus(): number + { + return this._relationshipStatus; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendRequestData.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendRequestData.ts new file mode 100644 index 0000000..7601cec --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendRequestData.ts @@ -0,0 +1,39 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class FriendRequestData +{ + private _requestId: number; + private _requesterName: string; + private _requesterUserId: number; + private _figureString: string; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this._requestId = wrapper.readInt(); + this._requesterName = wrapper.readString(); + this._figureString = wrapper.readString(); + this._requesterUserId = this._requestId; + } + + public get requestId(): number + { + return this._requestId; + } + + public get requesterName(): string + { + return this._requesterName; + } + + public get requesterUserId(): number + { + return this._requesterUserId; + } + + public get figureString(): string + { + return this._figureString; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendRequestsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendRequestsParser.ts new file mode 100644 index 0000000..58c9a59 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/FriendRequestsParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { FriendRequestData } from './FriendRequestData'; + +export class FriendRequestsParser implements IMessageParser +{ + private _totalRequests: number; + private _requests: FriendRequestData[]; + + public flush(): boolean + { + this._totalRequests = 0; + this._requests = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._totalRequests = wrapper.readInt(); + + let totalRequests = wrapper.readInt(); + + while(totalRequests > 0) + { + this._requests.push(new FriendRequestData(wrapper)); + + totalRequests--; + } + + return true; + } + + public get totalRequests(): number + { + return this._totalRequests; + } + + public get requests(): FriendRequestData[] + { + return this._requests; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/HabboSearchResultData.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/HabboSearchResultData.ts new file mode 100644 index 0000000..272fe20 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/HabboSearchResultData.ts @@ -0,0 +1,76 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class HabboSearchResultData +{ + private _avatarId: number; + private _avatarName: string; + private _avatarMotto: string; + private _isAvatarOnline: boolean; + private _canFollow: boolean; + private _avatarGender: number; + private _avatarFigure: string; + private _lastOnlineData: string; + private _realName: string; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this._avatarId = wrapper.readInt(); + this._avatarName = wrapper.readString(); + this._avatarMotto = wrapper.readString(); + this._isAvatarOnline = wrapper.readBoolean(); + this._canFollow = wrapper.readBoolean(); + + this._lastOnlineData = wrapper.readString(); // this was not assigned to anything on original packet + + this._avatarGender = wrapper.readInt(); + this._avatarFigure = wrapper.readString(); + this._realName = wrapper.readString(); + } + + public get avatarId(): number + { + return this._avatarId; + } + + public get avatarName(): string + { + return this._avatarName; + } + + public get avatarMotto(): string + { + return this._avatarMotto; + } + + public get isAvatarOnline(): boolean + { + return this._isAvatarOnline; + } + + public get canFollow(): boolean + { + return this._canFollow; + } + + public get avatarGender(): number + { + return this._avatarGender; + } + + public get avatarFigure(): string + { + return this._avatarFigure; + } + + public get lastOnlineData(): string + { + return this._lastOnlineData; + } + + public get realName(): string + { + return this._realName; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/HabboSearchResultParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/HabboSearchResultParser.ts new file mode 100644 index 0000000..6de6001 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/HabboSearchResultParser.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { HabboSearchResultData } from './HabboSearchResultData'; + +export class HabboSearchResultParser implements IMessageParser +{ + private _friends: HabboSearchResultData[]; + private _others: HabboSearchResultData[]; + + public flush(): boolean + { + this._friends = []; + this._others = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalFriends = wrapper.readInt(); + + while(totalFriends > 0) + { + this._friends.push(new HabboSearchResultData(wrapper)); + + totalFriends--; + } + + let totalOthers = wrapper.readInt(); + + while(totalOthers > 0) + { + this._others.push(new HabboSearchResultData(wrapper)); + + totalOthers--; + } + + return true; + } + + public get friends(): HabboSearchResultData[] + { + return this._friends; + } + + public get others(): HabboSearchResultData[] + { + return this._others; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/InstantMessageErrorParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/InstantMessageErrorParser.ts new file mode 100644 index 0000000..928c3c8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/InstantMessageErrorParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class InstantMessageErrorParser implements IMessageParser +{ + private _errorCode: number; + private _userId: number; + private _message: string; + + public flush(): boolean + { + this._errorCode = 0; + this._userId = 0; + this._message = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._errorCode = wrapper.readInt(); + this._userId = wrapper.readInt(); + this._message = wrapper.readString(); + + return true; + } + + public get errorCode(): number + { + return this._errorCode; + } + + public get userId(): number + { + return this._userId; + } + + public get message(): string + { + return this._message; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/MessageErrorParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/MessageErrorParser.ts new file mode 100644 index 0000000..f114411 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/MessageErrorParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class MessageErrorParser implements IMessageParser +{ + private _clientMessageId: number; + private _errorCode: number; + + public flush(): boolean + { + this._clientMessageId = 0; + this._errorCode = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._clientMessageId = wrapper.readInt(); + this._errorCode = wrapper.readInt(); + + return true; + } + + public get clientMessageId(): number + { + return this._clientMessageId; + } + + public get errorCode(): number + { + return this._errorCode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/MessengerInitParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/MessengerInitParser.ts new file mode 100644 index 0000000..9abfb30 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/MessengerInitParser.ts @@ -0,0 +1,59 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { FriendCategoryData } from './FriendCategoryData'; + +export class MessengerInitParser implements IMessageParser +{ + private _userFriendLimit: number; + private _normalFriendLimit: number; + private _extendedFriendLimit: number; + private _categories: FriendCategoryData[]; + + public flush(): boolean + { + this._userFriendLimit = 0; + this._normalFriendLimit = 0; + this._extendedFriendLimit = 0; + this._categories = []; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._userFriendLimit = wrapper.readInt(); + this._normalFriendLimit = wrapper.readInt(); + this._extendedFriendLimit = wrapper.readInt(); + + let totalCategories = wrapper.readInt(); + + while(totalCategories > 0) + { + this._categories.push(new FriendCategoryData(wrapper)); + + totalCategories--; + } + + return true; + } + + public get userFriendLimit(): number + { + return this._userFriendLimit; + } + + public get normalFriendLimit(): number + { + return this._normalFriendLimit; + } + + public get extendedFriendLimit(): number + { + return this._extendedFriendLimit; + } + + public get categories(): FriendCategoryData[] + { + return this._categories; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/MiniMailNewMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/MiniMailNewMessageParser.ts new file mode 100644 index 0000000..bbaa647 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/MiniMailNewMessageParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class MiniMailNewMessageParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/MiniMailUnreadCountParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/MiniMailUnreadCountParser.ts new file mode 100644 index 0000000..f5c722b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/MiniMailUnreadCountParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class MiniMailUnreadCountParser implements IMessageParser +{ + private _count: number; + + public flush(): boolean + { + this._count = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._count = wrapper.readInt(); + + return true; + } + + public get count(): number + { + return this._count; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/NewConsoleMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/NewConsoleMessageParser.ts new file mode 100644 index 0000000..030ba17 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/NewConsoleMessageParser.ts @@ -0,0 +1,55 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class NewConsoleMessageParser implements IMessageParser +{ + private _senderId: number; + private _messageText: string; + private _secondsSinceSent: number; + private _extraData: string; + + public flush(): boolean + { + this._senderId = 0; + this._messageText = null; + this._secondsSinceSent = 0; + this._extraData = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._senderId = wrapper.readInt(); + this._messageText = wrapper.readString(); + this._secondsSinceSent = wrapper.readInt(); + + if(wrapper.bytesAvailable) + { + this._extraData = wrapper.readString(); + } + + return true; + } + + public get senderId(): number + { + return this._senderId; + } + + public get messageText(): string + { + return this._messageText; + } + + public get secondsSinceSent(): number + { + return this._secondsSinceSent; + } + + public get extraData(): string + { + return this._extraData; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/NewFriendRequestMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/NewFriendRequestMessageParser.ts new file mode 100644 index 0000000..8e51bc8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/NewFriendRequestMessageParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { FriendRequestData } from './FriendRequestData'; + +export class NewFriendRequestParser implements IMessageParser +{ + private _request: FriendRequestData; + + public flush(): boolean + { + this._request = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._request = new FriendRequestData(wrapper); + + return true; + } + + public get request(): FriendRequestData + { + return this._request; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/RoomInviteErrorParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/RoomInviteErrorParser.ts new file mode 100644 index 0000000..3f4dc13 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/RoomInviteErrorParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RoomInviteErrorParser implements IMessageParser +{ + private _errorCode: number; + private _failedRecipients: number[]; + + public flush(): boolean + { + this._errorCode = 0; + this._failedRecipients = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._errorCode = wrapper.readInt(); + + let totalFailed = wrapper.readInt(); + + while(totalFailed > 0) + { + this._failedRecipients.push(wrapper.readInt()); + + totalFailed--; + } + + return true; + } + + public get errorCode(): number + { + return this._errorCode; + } + + public get failedRecipients(): number[] + { + return this._failedRecipients; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/RoomInviteMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/RoomInviteMessageParser.ts new file mode 100644 index 0000000..849312a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/RoomInviteMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RoomInviteParser implements IMessageParser +{ + private _senderId: number; + private _messageText: string; + + public flush(): boolean + { + this._senderId = 0; + this._messageText = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._senderId = wrapper.readInt(); + this._messageText = wrapper.readString(); + + return true; + } + + public get senderId(): number + { + return this._senderId; + } + + public get messageText(): string + { + return this._messageText; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/friendlist/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/index.ts new file mode 100644 index 0000000..6542588 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/friendlist/index.ts @@ -0,0 +1,22 @@ +export * from './AcceptFriendFailureData'; +export * from './AcceptFriendResultParser'; +export * from './FindFriendsProcessResultParser'; +export * from './FollowFriendFailedParser'; +export * from './FriendCategoryData'; +export * from './FriendListFragmentMessageParser'; +export * from './FriendListUpdateParser'; +export * from './FriendNotificationParser'; +export * from './FriendParser'; +export * from './FriendRequestData'; +export * from './FriendRequestsParser'; +export * from './HabboSearchResultData'; +export * from './HabboSearchResultParser'; +export * from './InstantMessageErrorParser'; +export * from './MessageErrorParser'; +export * from './MessengerInitParser'; +export * from './MiniMailNewMessageParser'; +export * from './MiniMailUnreadCountParser'; +export * from './NewConsoleMessageParser'; +export * from './NewFriendRequestMessageParser'; +export * from './RoomInviteErrorParser'; +export * from './RoomInviteMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2AccountGameStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2AccountGameStatusMessageParser.ts new file mode 100644 index 0000000..8e51f22 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2AccountGameStatusMessageParser.ts @@ -0,0 +1,45 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class Game2AccountGameStatusMessageParser implements IMessageParser +{ + private _gameTypeId:number; + private _freeGamesLeft:number; + private _gamesPlayedTotal:number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._gameTypeId = wrapper.readInt(); + this._freeGamesLeft = wrapper.readInt(); + this._gamesPlayedTotal = wrapper.readInt(); + + return true; + } + + public get gameTypeId():number + { + return this._gameTypeId; + } + + public get freeGamesLeft():number + { + return this._freeGamesLeft; + } + + public get gamesPlayedTotal():number + { + return this._gamesPlayedTotal; + } + + public get hasUnlimitedGames():boolean + { + return this._freeGamesLeft == -1; + } + +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2GameDirectoryStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2GameDirectoryStatusMessageParser.ts new file mode 100644 index 0000000..24a598e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2GameDirectoryStatusMessageParser.ts @@ -0,0 +1,61 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class Game2GameDirectoryStatusMessageParser implements IMessageParser +{ + public static readonly STATUS_OK: number = 0; + public static readonly STATUS_FAILED_REASON_UNKNOWN: number = 1; + public static readonly STATUS_FAILED_REASON_GAME_DIRECTORY_IS_NOT_AVAILABLE: number = 2; + public static readonly STATUS_FAILED_REASON_HOTEL_IS_CLOSED: number = 3; + + private _status: number; + private _blockLength: number; + private _gamesPlayed: number; + private _freeGamesLeft: number; + + public flush(): boolean + { + this._status = -1; + this._blockLength = -1; + this._gamesPlayed = -1; + this._freeGamesLeft = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._status = wrapper.readInt(); + this._blockLength = wrapper.readInt(); + this._gamesPlayed = wrapper.readInt(); + this._freeGamesLeft = wrapper.readInt(); + + return true; + } + + public get status(): number + { + return this._status; + } + + public get blockLength(): number + { + return this._blockLength; + } + + public get gamesPlayed(): number + { + return this._gamesPlayed; + } + + public get freeGamesLeft(): number + { + return this._freeGamesLeft; + } + + public get hasUnlimitedGames(): boolean + { + return this._freeGamesLeft == -1; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2InArenaQueueMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2InArenaQueueMessageParser.ts new file mode 100644 index 0000000..ce44bcf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2InArenaQueueMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class Game2InArenaQueueMessageParser implements IMessageParser +{ + private _position: number; + + public flush(): boolean + { + this._position = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._position = wrapper.readInt(); + + return true; + } + + public get position(): number + { + return this._position; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2JoiningGameFailedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2JoiningGameFailedMessageParser.ts new file mode 100644 index 0000000..9f9f3c6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2JoiningGameFailedMessageParser.ts @@ -0,0 +1,36 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class Game2JoiningGameFailedMessageParser implements IMessageParser +{ + public static readonly KICKED: number = 1; + public static readonly DUPLICATE_MACHINEID: number = 2; + public static readonly INVITATION_REQUIRED: number = 3; + public static readonly NO_SPACE_IN_TEAM: number = 4; + public static readonly TEAM_NOT_FOUND: number = 5; + public static readonly USER_HAS_ACTIVE_INSTANCE: number = 6; + public static readonly USER_HAS_PENDING_INSTANCE_REQUEST: number = 7; + public static readonly USER_HAS_NO_FREE_GAMES_LEFT: number = 8; + + private _reason: number; + + public flush(): boolean + { + this._reason = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._reason = wrapper.readInt(); + + return true; + } + + public get reason(): number + { + return this._reason; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2StartingGameFailedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2StartingGameFailedMessageParser.ts new file mode 100644 index 0000000..01ca141 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2StartingGameFailedMessageParser.ts @@ -0,0 +1,30 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class Game2StartingGameFailedMessageParser implements IMessageParser +{ + public static readonly NOT_ENOUGH_PLAYERS: number = 1; + public static readonly GAME_HAS_NO_OWNER: number = 2; + + private _reason: number; + + public flush(): boolean + { + this._reason = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._reason = wrapper.readInt(); + + return true; + } + + public get reason(): number + { + return this._reason; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2StopCounterMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2StopCounterMessageParser.ts new file mode 100644 index 0000000..397394a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2StopCounterMessageParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class Game2StopCounterMessageParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2UserLeftGameMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2UserLeftGameMessageParser.ts new file mode 100644 index 0000000..ab3dbbc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/Game2UserLeftGameMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class Game2UserLeftGameMessageParser implements IMessageParser +{ + private _userId: number; + + public flush(): boolean + { + this._userId = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._userId = wrapper.readInt(); + + return true; + } + + public get userId():number + { + return this._userId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/directory/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/index.ts new file mode 100644 index 0000000..917ffbb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/directory/index.ts @@ -0,0 +1,7 @@ +export * from './Game2AccountGameStatusMessageParser'; +export * from './Game2GameDirectoryStatusMessageParser'; +export * from './Game2InArenaQueueMessageParser'; +export * from './Game2JoiningGameFailedMessageParser'; +export * from './Game2StartingGameFailedMessageParser'; +export * from './Game2StopCounterMessageParser'; +export * from './Game2UserLeftGameMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/index.ts new file mode 100644 index 0000000..779f388 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/index.ts @@ -0,0 +1,3 @@ +export * from './directory'; +export * from './lobby'; +export * from './score'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/AchievementResolutionCompletedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/AchievementResolutionCompletedMessageParser.ts new file mode 100644 index 0000000..1f8881c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/AchievementResolutionCompletedMessageParser.ts @@ -0,0 +1,32 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class AchievementResolutionCompletedMessageParser implements IMessageParser +{ + private _stuffCode:string; + private _badgeCode:string; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._stuffCode = wrapper.readString(); + this._badgeCode = wrapper.readString(); + + return true; + } + + public get stuffCode():string + { + return this._stuffCode; + } + + public get badgeCode():string + { + return this._badgeCode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/AchievementResolutionProgressMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/AchievementResolutionProgressMessageParser.ts new file mode 100644 index 0000000..8682a1e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/AchievementResolutionProgressMessageParser.ts @@ -0,0 +1,66 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class AchievementResolutionProgressMessageParser implements IMessageParser +{ + private _stuffId:number; + private _achievementId:number; + private _requiredLevelBadgeCode:string; + private _userProgress:number; + private _totalProgress:number; + private _endTime:number; + + public flush(): boolean + { + this._stuffId = -1; + this._achievementId = 0; + this._requiredLevelBadgeCode = ''; + this._userProgress = 0; + this._totalProgress = 0; + this._endTime = 0; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._stuffId = wrapper.readInt(); + this._achievementId = wrapper.readInt(); + this._requiredLevelBadgeCode = wrapper.readString(); + this._userProgress = wrapper.readInt(); + this._totalProgress = wrapper.readInt(); + this._endTime = wrapper.readInt(); + + return true; + } + + public get stuffId():number + { + return this._stuffId; + } + + public get achievementId():number + { + return this._achievementId; + } + + public get requiredLevelBadgeCode():string + { + return this._requiredLevelBadgeCode; + } + + public get userProgress():number + { + return this._userProgress; + } + + public get totalProgress():number + { + return this._totalProgress; + } + + public get endTime():number + { + return this._endTime; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/AchievementResolutionsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/AchievementResolutionsMessageParser.ts new file mode 100644 index 0000000..c036b17 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/AchievementResolutionsMessageParser.ts @@ -0,0 +1,46 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { AchievementResolutionData } from '../../inventory'; + +export class AchievementResolutionsMessageParser implements IMessageParser +{ + private _stuffId:number; + private _achievements:AchievementResolutionData[]; + private _endTime:number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._stuffId = wrapper.readInt(); + const count = wrapper.readInt(); + let _local_3 = 0; + while(_local_3 < count) + { + this._achievements.push(new AchievementResolutionData(wrapper)); + _local_3++; + } + this._endTime = wrapper.readInt(); + + return true; + } + + public get stuffId():number + { + return this._stuffId; + } + + public get achievements():AchievementResolutionData[] + { + return this._achievements; + } + + public get endTime():number + { + return this._endTime; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameAchievementData.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameAchievementData.ts new file mode 100644 index 0000000..6fbd040 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameAchievementData.ts @@ -0,0 +1,35 @@ +export class GameAchievementData +{ + private _gameTypeId:number; + private _achievementId:number; + private _achievementName:string; + private _levels:number; + + constructor(gameTypeId:number, achievementId:number, achievementName:string, levels:number) + { + this._gameTypeId = gameTypeId; + this._achievementId = achievementId; + this._achievementName = achievementName; + this._levels = levels; + } + + public get gameTypeId():number + { + return this._gameTypeId; + } + + public get achievementId():number + { + return this._achievementId; + } + + public get achievementName():string + { + return this._achievementName; + } + + public get levels():number + { + return this._levels; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameAchievementsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameAchievementsMessageParser.ts new file mode 100644 index 0000000..bbf5492 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameAchievementsMessageParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { GameAchievementData } from './GameAchievementData'; + +export class GameAchievementsMessageParser implements IMessageParser +{ + private _achievements:GameAchievementData[]; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._achievements = []; + const count = wrapper.readInt(); + let _local_3 = 0; + while(_local_3 < count) + { + const gameTypeId = wrapper.readInt(); + const achievementCount = wrapper.readInt(); + let _local_6 = 0; + while(_local_6 < achievementCount) + { + const achievementId = wrapper.readInt(); + const achievementName = wrapper.readString(); + const levels = wrapper.readInt(); + this._achievements.push(new GameAchievementData(gameTypeId, achievementId, achievementName, levels)); + _local_6++; + } + _local_3++; + } + + return true; + } + + public get achievements():GameAchievementData[] + { + return this._achievements; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameConfigurationData.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameConfigurationData.ts new file mode 100644 index 0000000..4bf7e87 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameConfigurationData.ts @@ -0,0 +1,49 @@ +export class GameConfigurationData +{ + private _gameId:number; + private _gameNameId:string; + private _bgColor:number; + private _textColor:number; + private _assetUrl:string; + private _supportUrl:string; + + constructor(gameId:number, gameNameId:string, bgColor:number, textColor:number, assetUrl:string, supportUrl:string) + { + this._gameId = gameId; + this._gameNameId = gameNameId; + this._bgColor = bgColor; + this._textColor = textColor; + this._assetUrl = assetUrl; + this._supportUrl = supportUrl; + } + + public get gameId():number + { + return this._gameId; + } + + public get gameNameId():string + { + return this._gameNameId; + } + + public get bgColor():number + { + return this._bgColor; + } + + public get textColor():number + { + return this._textColor; + } + + public get assetUrl():string + { + return this._assetUrl; + } + + public get supportUrl():string + { + return this._supportUrl; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameInviteMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameInviteMessageParser.ts new file mode 100644 index 0000000..ddc751b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameInviteMessageParser.ts @@ -0,0 +1,32 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class GameInviteMessageParser implements IMessageParser +{ + private _gameTypeId:number; + private _inviterId:number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._gameTypeId = wrapper.readInt(); + this._inviterId = wrapper.readInt(); + + return true; + } + + public get gameTypeId():number + { + return this._gameTypeId; + } + + public get inviterId():number + { + return this._inviterId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameListMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameListMessageParser.ts new file mode 100644 index 0000000..ac3005b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameListMessageParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { GameConfigurationData } from './GameConfigurationData'; + +export class GameListMessageParser implements IMessageParser +{ + private _games:GameConfigurationData[]; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._games = []; + + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + const gameId = wrapper.readInt(); + const gameNameId = wrapper.readString(); + const _local_6 = wrapper.readString(); + let bgColor = parseInt(_local_6, 16); + bgColor = (bgColor | 0xFF000000); + const _local_8 = wrapper.readString(); + let textColor = parseInt(_local_8, 16); + textColor = (textColor | 0xFF000000); + const assetUrl = wrapper.readString(); + const supportUrl = wrapper.readString(); + this._games.push(new GameConfigurationData(gameId, gameNameId, bgColor, textColor, assetUrl, supportUrl)); + } + + return true; + } + + public get games(): GameConfigurationData[] + { + return this._games; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameStatusMessageParser.ts new file mode 100644 index 0000000..6fdc873 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/GameStatusMessageParser.ts @@ -0,0 +1,40 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class GameStatusMessageParser implements IMessageParser +{ + private static readonly OK = 0; + private static readonly MAINTENANCE = 1; + + private _gameTypeId:number; + private _status:number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._gameTypeId = wrapper.readInt(); + this._status = wrapper.readInt(); + + return true; + } + + public get gameTypeId():number + { + return this._gameTypeId; + } + + public get isOk():boolean + { + return this._status == GameStatusMessageParser.OK; + } + + public get isInMaintenance():boolean + { + return this._status == GameStatusMessageParser.MAINTENANCE; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/JoinedQueueMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/JoinedQueueMessageParser.ts new file mode 100644 index 0000000..cac12cc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/JoinedQueueMessageParser.ts @@ -0,0 +1,25 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class JoinedQueueMessageParser implements IMessageParser +{ + private _gameTypeId:number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._gameTypeId = wrapper.readInt(); + + return true; + } + + public get gameTypeId():number + { + return this._gameTypeId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/JoiningQueueFailedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/JoiningQueueFailedMessageParser.ts new file mode 100644 index 0000000..e45dcf8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/JoiningQueueFailedMessageParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class JoiningQueueFailedMessageParser implements IMessageParser +{ + public static readonly DUPLICATE_MACHINEID = 1; + + private _gameTypeId:number; + private _reason:number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._gameTypeId = wrapper.readInt(); + this._reason = wrapper.readInt(); + + return true; + } + + public get gameTypeId():number + { + return this._gameTypeId; + } + + public get reason():number + { + return this._reason; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/LeftQueueMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/LeftQueueMessageParser.ts new file mode 100644 index 0000000..3b2f580 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/LeftQueueMessageParser.ts @@ -0,0 +1,25 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class LeftQueueMessageParser implements IMessageParser +{ + private _gameTypeId:number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._gameTypeId = wrapper.readInt(); + + return true; + } + + public get gameTypeId():number + { + return this._gameTypeId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/LoadGameMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/LoadGameMessageParser.ts new file mode 100644 index 0000000..ac48c12 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/LoadGameMessageParser.ts @@ -0,0 +1,88 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class LoadGameMessageParser implements IMessageParser +{ + private _gameTypeId:number; + private _url:string; + private _quality:string; + private _scaleMode:string; + private _frameRate:number; + private _minMajorVersion:number; + private _minMinorVersion:number; + private _params:Map; + private _gameClientId:string; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._gameTypeId = wrapper.readInt(); + this._gameClientId = wrapper.readString(); + this._url = wrapper.readString(); + this._quality = wrapper.readString(); + this._scaleMode = wrapper.readString(); + this._frameRate = wrapper.readInt(); + this._minMajorVersion = wrapper.readInt(); + this._minMinorVersion = wrapper.readInt(); + this._params = new Map(); + const count = wrapper.readInt(); + let _local_3 = 0; + while(_local_3 < count) + { + this._params.set(wrapper.readString(), wrapper.readString()); + _local_3++; + } + + return true; + } + + public get gameTypeId():number + { + return this._gameTypeId; + } + + public get url():string + { + return this._url; + } + + public get quality():string + { + return this._quality; + } + + public get scaleMode():string + { + return this._scaleMode; + } + + public get frameRate():number + { + return this._frameRate; + } + + public get minMajorVersion():number + { + return this._minMajorVersion; + } + + public get minMinorVersion():number + { + return this._minMinorVersion; + } + + public get params():Map + { + return this._params; + } + + public get gameClientId():string + { + return this._gameClientId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/LoadGameUrlParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/LoadGameUrlParser.ts new file mode 100644 index 0000000..bc1b364 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/LoadGameUrlParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class LoadGameUrlParser implements IMessageParser +{ + private _gameTypeId: number; + private _url: string; + private _gameClientId: string; + + public flush(): boolean + { + this._gameTypeId = 0; + this._url = null; + this._gameClientId = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._gameTypeId = wrapper.readInt(); + this._gameClientId = wrapper.readString(); + this._url = wrapper.readString(); + + return true; + } + + public get gameTypeId(): number + { + return this._gameTypeId; + } + + public get url(): string + { + return this._url; + } + + public get gameClientId(): string + { + return this._gameClientId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/UnloadGameMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/UnloadGameMessageParser.ts new file mode 100644 index 0000000..94a4d79 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/UnloadGameMessageParser.ts @@ -0,0 +1,32 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class UnloadGameMessageParser implements IMessageParser +{ + private _gameTypeId:number; + private _gameClientId:string; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._gameTypeId = wrapper.readInt(); + this._gameClientId = wrapper.readString(); + + return true; + } + + public get gameTypeId():number + { + return this._gameTypeId; + } + + public get gameClientId():string + { + return this._gameClientId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/UserGameAchievementsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/UserGameAchievementsMessageParser.ts new file mode 100644 index 0000000..99094da --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/UserGameAchievementsMessageParser.ts @@ -0,0 +1,21 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class UserGameAchievementsMessageParser implements IMessageParser +{ + + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + + + return true; + } + +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/index.ts new file mode 100644 index 0000000..847d309 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/lobby/index.ts @@ -0,0 +1,16 @@ +export * from './AchievementResolutionCompletedMessageParser'; +export * from './AchievementResolutionProgressMessageParser'; +export * from './AchievementResolutionsMessageParser'; +export * from './GameAchievementData'; +export * from './GameAchievementsMessageParser'; +export * from './GameConfigurationData'; +export * from './GameInviteMessageParser'; +export * from './GameListMessageParser'; +export * from './GameStatusMessageParser'; +export * from './JoinedQueueMessageParser'; +export * from './JoiningQueueFailedMessageParser'; +export * from './LeftQueueMessageParser'; +export * from './LoadGameMessageParser'; +export * from './LoadGameUrlParser'; +export * from './UnloadGameMessageParser'; +export * from './UserGameAchievementsMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/score/Game2WeeklyLeaderboardParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/score/Game2WeeklyLeaderboardParser.ts new file mode 100644 index 0000000..3c4624e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/score/Game2WeeklyLeaderboardParser.ts @@ -0,0 +1,59 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class Game2WeeklyLeaderboardParser implements IMessageParser +{ + private _year: number; + private _week: number; + private _maxOffset: number; + private _currentOffset: number; + private _minutesUntilReset: number; + + public flush(): boolean + { + this._year = -1; + this._week = -1; + this._maxOffset = -1; + this._currentOffset = -1; + this._minutesUntilReset = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._year = wrapper.readInt(); + this._week = wrapper.readInt(); + this._maxOffset = wrapper.readInt(); + this._currentOffset = wrapper.readInt(); + this._minutesUntilReset = wrapper.readInt(); + + return true; + } + + public get year(): number + { + return this._year; + } + + public get week(): number + { + return this._week; + } + + public get maxOffset(): number + { + return this._maxOffset; + } + + public get currentOffset(): number + { + return this._currentOffset; + } + + public get minutesUntilReset(): number + { + return this._minutesUntilReset; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/score/GameRewardWinnerEntry.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/score/GameRewardWinnerEntry.ts new file mode 100644 index 0000000..5af54fd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/score/GameRewardWinnerEntry.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper } from '../../../../../../api'; + +export class GameRewardWinnerEntry +{ + private _name: string; + private _figure: string; + private _gender: string; + private _rank: number; + private _score: number; + + constructor(wrapper: IMessageDataWrapper) + { + this._name = wrapper.readString(); + this._figure = wrapper.readString(); + this._gender = wrapper.readString(); + this._rank = wrapper.readInt(); + this._score = wrapper.readInt(); + } + + public get name(): string + { + return this._name; + } + + public get figure(): string + { + return this._figure; + } + + public get gender(): string + { + return this._gender; + } + + public get rank(): number + { + return this._rank; + } + + public get score(): number + { + return this._score; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/score/LeaderboardEntry.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/score/LeaderboardEntry.ts new file mode 100644 index 0000000..54ac5cb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/score/LeaderboardEntry.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper } from '../../../../../../api'; + +export class LeaderboardEntry +{ + private _userId:number; + private _score:number; + private _rank:number; + private _name:string; + private _figure:string; + private _gender:string; + + constructor(k:IMessageDataWrapper) + { + this._userId = k.readInt(); + this._score = k.readInt(); + this._rank = k.readInt(); + this._name = k.readString(); + this._figure = k.readString(); + this._gender = k.readString(); + } + + public get userId():number + { + return this._userId; + } + + public get score():number + { + return this._score; + } + + public get rank():number + { + return this._rank; + } + + public get figure():string + { + return this._figure; + } + + public get gender():string + { + return this._gender; + } + + public get name():string + { + return this._name; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/score/WeeklyGameRewardParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/score/WeeklyGameRewardParser.ts new file mode 100644 index 0000000..2734354 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/score/WeeklyGameRewardParser.ts @@ -0,0 +1,59 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { CatalogPageMessageProductData } from '../../catalog'; + +export class WeeklyGameRewardParser implements IMessageParser +{ + private _gameTypeId: number; + private _products: CatalogPageMessageProductData[]; + private _minutesUntilNextWeek: number; + private _rewardingOn: boolean; + + public flush(): boolean + { + this._gameTypeId = -1; + this._products = []; + this._minutesUntilNextWeek = 0; + this._rewardingOn = true; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._gameTypeId = wrapper.readInt(); + let totalProducts: number = wrapper.readInt(); + + while(totalProducts > 0) + { + this._products.push(new CatalogPageMessageProductData(wrapper)); + totalProducts--; + } + + this._minutesUntilNextWeek = wrapper.readInt(); + this._rewardingOn = wrapper.readBoolean(); + + return true; + } + + public get gameTypeId(): number + { + return this._gameTypeId; + } + + public get products(): CatalogPageMessageProductData[] + { + return this._products; + } + + public get minutesUntilNextWeek(): number + { + return this._minutesUntilNextWeek; + } + + public get rewardingOn(): boolean + { + return this._rewardingOn; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/score/WeeklyGameRewardWinnersParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/score/WeeklyGameRewardWinnersParser.ts new file mode 100644 index 0000000..704437e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/score/WeeklyGameRewardWinnersParser.ts @@ -0,0 +1,42 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { GameRewardWinnerEntry } from './GameRewardWinnerEntry'; + +export class WeeklyGameRewardWinnersParser implements IMessageParser +{ + private _gameTypeId: number; + private _winners: GameRewardWinnerEntry[]; + + public flush(): boolean + { + this._gameTypeId = -1; + this._winners = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._gameTypeId = wrapper.readInt(); + let totalWinners: number = wrapper.readInt(); + + while(totalWinners > 0) + { + this._winners.push(new GameRewardWinnerEntry(wrapper)); + totalWinners--; + } + + return true; + } + + public get gameTypeId(): number + { + return this._gameTypeId; + } + + public get winners(): GameRewardWinnerEntry[] + { + return this._winners; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/game/score/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/game/score/index.ts new file mode 100644 index 0000000..1ba2ce8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/game/score/index.ts @@ -0,0 +1,5 @@ +export * from './Game2WeeklyLeaderboardParser'; +export * from './GameRewardWinnerEntry'; +export * from './LeaderboardEntry'; +export * from './WeeklyGameRewardParser'; +export * from './WeeklyGameRewardWinnersParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/generic/GenericErrorParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/generic/GenericErrorParser.ts new file mode 100644 index 0000000..cf6bae1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/generic/GenericErrorParser.ts @@ -0,0 +1,26 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GenericErrorParser implements IMessageParser +{ + private _errorCode: number; + + public flush(): boolean + { + this._errorCode = 0; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._errorCode = wrapper.readInt(); + + return true; + } + + public get errorCode(): number + { + return this._errorCode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/generic/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/generic/index.ts new file mode 100644 index 0000000..4e395b3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/generic/index.ts @@ -0,0 +1 @@ +export * from './GenericErrorParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/gifts/PhoneCollectionStateParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/gifts/PhoneCollectionStateParser.ts new file mode 100644 index 0000000..71a1b83 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/gifts/PhoneCollectionStateParser.ts @@ -0,0 +1,41 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class PhoneCollectionStateParser implements IMessageParser +{ + private _phoneStatusCode: number; + private _collectionStatusCode: number; + private _millisecondsToAllowProcessReset: number; + + public flush(): boolean + { + this._phoneStatusCode = -1; + this._millisecondsToAllowProcessReset = -1; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._phoneStatusCode = wrapper.readInt(); + this._collectionStatusCode = wrapper.readInt(); + this._millisecondsToAllowProcessReset = wrapper.readInt(); + + return true; + } + + public get phoneStatusCode(): number + { + return this._phoneStatusCode; + } + + public get collectionStatusCode(): number + { + return this._collectionStatusCode; + } + + public get millisecondsToAllowProcessReset(): number + { + return this._millisecondsToAllowProcessReset; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/gifts/TryPhoneNumberResultParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/gifts/TryPhoneNumberResultParser.ts new file mode 100644 index 0000000..0743c22 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/gifts/TryPhoneNumberResultParser.ts @@ -0,0 +1,33 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class TryPhoneNumberResultParser implements IMessageParser +{ + private _resultCode: number; + private _millisToAllowProcessReset: number; + + public flush(): boolean + { + this._resultCode = -1; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._resultCode = wrapper.readInt(); + this._millisToAllowProcessReset = wrapper.readInt(); + + return true; + } + + public get resultCode(): number + { + return this._resultCode; + } + + public get millisToAllowProcessReset(): number + { + return this._millisToAllowProcessReset; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/gifts/TryVerificationCodeResultParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/gifts/TryVerificationCodeResultParser.ts new file mode 100644 index 0000000..98b83dc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/gifts/TryVerificationCodeResultParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class TryVerificationCodeResultParser implements IMessageParser +{ + private _resultCode: number; + private _millisecondsToAllowProcessReset: number; + + public flush(): boolean + { + this._resultCode = -1; + this._millisecondsToAllowProcessReset = -1; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._resultCode = wrapper.readInt(); + this._millisecondsToAllowProcessReset = wrapper.readInt(); + + return true; + } + + public get resultCode(): number + { + return this._resultCode; + } + + public get millisToAllowProcessReset(): number + { + return this._millisecondsToAllowProcessReset; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/gifts/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/gifts/index.ts new file mode 100644 index 0000000..19357a7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/gifts/index.ts @@ -0,0 +1,3 @@ +export * from './PhoneCollectionStateParser'; +export * from './TryPhoneNumberResultParser'; +export * from './TryVerificationCodeResultParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/group/GroupBadgePartsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/group/GroupBadgePartsParser.ts new file mode 100644 index 0000000..b416022 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/group/GroupBadgePartsParser.ts @@ -0,0 +1,109 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GroupBadgePartsParser implements IMessageParser +{ + private _bases: Map; + private _symbols: Map; + private _partColors: Map; + private _colorsA: Map; + private _colorsB: Map; + + flush(): boolean + { + this._bases = new Map(); + this._symbols = new Map(); + this._partColors = new Map(); + this._colorsA = new Map(); + this._colorsB = new Map(); + + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let basesCount = wrapper.readInt(); + + while(basesCount > 0) + { + const id = wrapper.readInt(); + const valueA = wrapper.readString(); + const valueB = wrapper.readString(); + + this._bases.set(id, [valueA, valueB]); + basesCount--; + } + + let symbolsCount = wrapper.readInt(); + + while(symbolsCount > 0) + { + const id = wrapper.readInt(); + const valueA = wrapper.readString(); + const valueB = wrapper.readString(); + + this._symbols.set(id, [valueA, valueB]); + symbolsCount--; + } + + let partColorsCount = wrapper.readInt(); + + while(partColorsCount > 0) + { + const id = wrapper.readInt(); + const color = wrapper.readString(); + + this._partColors.set(id, color); + partColorsCount--; + } + + let colorsACount = wrapper.readInt(); + + while(colorsACount > 0) + { + const id = wrapper.readInt(); + const color = wrapper.readString(); + + this._colorsA.set(id, color); + colorsACount--; + } + + let colorsBCount = wrapper.readInt(); + + while(colorsBCount > 0) + { + const id = wrapper.readInt(); + const color = wrapper.readString(); + + this._colorsB.set(id, color); + colorsBCount--; + } + return true; + } + + public get bases(): Map + { + return this._bases; + } + + public get symbols(): Map + { + return this._symbols; + } + + public get partColors(): Map + { + return this._partColors; + } + + public get colorsA(): Map + { + return this._colorsA; + } + + public get colorsB(): Map + { + return this._colorsB; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/group/GroupBuyDataParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/group/GroupBuyDataParser.ts new file mode 100644 index 0000000..5ae44b4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/group/GroupBuyDataParser.ts @@ -0,0 +1,45 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GroupBuyDataParser implements IMessageParser +{ + private _groupCost: number; + private _availableRooms: Map; + + flush(): boolean + { + this._groupCost = 0; + this._availableRooms = new Map(); + + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._groupCost = wrapper.readInt(); + let availableRoomsCount = wrapper.readInt(); + + while(availableRoomsCount > 0) + { + const roomId = wrapper.readInt(); + const roomName = wrapper.readString(); + wrapper.readBoolean(); + + this._availableRooms.set(roomId, roomName); + + availableRoomsCount--; + } + return true; + } + + public get groupCost(): number + { + return this._groupCost; + } + + public get availableRooms(): Map + { + return this._availableRooms; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/group/GroupConfirmMemberRemoveParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/group/GroupConfirmMemberRemoveParser.ts new file mode 100644 index 0000000..58db6e0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/group/GroupConfirmMemberRemoveParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GroupConfirmMemberRemoveParser implements IMessageParser +{ + private _userId: number; + private _furnitureCount: number; + + flush(): boolean + { + this._userId = 0; + this._furnitureCount = 0; + + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._userId = wrapper.readInt(); + this._furnitureCount = wrapper.readInt(); + + return true; + } + + public get userId(): number + { + return this._userId; + } + + public get furnitureCount(): number + { + return this._furnitureCount; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/group/GroupInformationParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/group/GroupInformationParser.ts new file mode 100644 index 0000000..8a2dbb0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/group/GroupInformationParser.ts @@ -0,0 +1,156 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GroupInformationParser implements IMessageParser +{ + private _id: number; + private _type: number; + private _title: string; + private _description: string; + private _badge: string; + private _roomId: number; + private _roomName: string; + private _membershipType: number; + private _membersCount: number; + private _isFavorite: boolean; + private _createdAt: string; + private _isOwner: boolean; + private _isAdmin: boolean; + private _ownerName: string; + private _flag: boolean; + private _canMembersDecorate: boolean; + private _pendingRequestsCount: number; + + public flush(): boolean + { + this._id = 0; + this._type = 0; + this._title = null; + this._description = null; + this._badge = null; + this._roomId = 0; + this._roomName = null; + this._membershipType = 0; + this._membersCount = 0; + this._isFavorite = false; + this._createdAt = null; + this._isOwner = false; + this._isAdmin = false; + this._ownerName = null; + this._flag = false; + this._canMembersDecorate = false; + this._pendingRequestsCount = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._id = wrapper.readInt(); + wrapper.readBoolean(); + this._type = wrapper.readInt(); + this._title = wrapper.readString(); + this._description = wrapper.readString(); + this._badge = wrapper.readString(); + this._roomId = wrapper.readInt(); + this._roomName = wrapper.readString(); + this._membershipType = wrapper.readInt(); + this._membersCount = wrapper.readInt(); + this._isFavorite = wrapper.readBoolean(); + this._createdAt = wrapper.readString(); + this._isOwner = wrapper.readBoolean(); + this._isAdmin = wrapper.readBoolean(); + this._ownerName = wrapper.readString(); + this._flag = wrapper.readBoolean(); + this._canMembersDecorate = wrapper.readBoolean(); + this._pendingRequestsCount = wrapper.readInt(); + + return true; + } + + public get id(): number + { + return this._id; + } + + public get type(): number + { + return this._type; + } + + public get title(): string + { + return this._title; + } + + public get description(): string + { + return this._description; + } + + public get badge(): string + { + return this._badge; + } + + public get roomId(): number + { + return this._roomId; + } + + public get roomName(): string + { + return this._roomName; + } + + public get membershipType(): number + { + return this._membershipType; + } + + public get membersCount(): number + { + return this._membersCount; + } + + public get isFavorite(): boolean + { + return this._isFavorite; + } + + public get createdAt(): string + { + return this._createdAt; + } + + public get isOwner(): boolean + { + return this._isOwner; + } + + public get isAdmin(): boolean + { + return this._isAdmin; + } + + public get ownerName(): string + { + return this._ownerName; + } + + public get flag(): boolean + { + return this._flag; + } + + public get canMembersDecorate(): boolean + { + return this._canMembersDecorate; + } + + public get pendingRequestsCount(): number + { + return this._pendingRequestsCount; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/group/GroupMembersParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/group/GroupMembersParser.ts new file mode 100644 index 0000000..c25db11 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/group/GroupMembersParser.ts @@ -0,0 +1,116 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { GroupMemberParser } from './utils'; + +export class GroupMembersParser implements IMessageParser +{ + private _groupId: number; + private _groupTitle: string; + private _roomId: number; + private _badge: string; + private _totalMembersCount: number; + private _result: GroupMemberParser[]; + private _admin: boolean; + private _pageSize: number; + private _pageIndex: number; + private _level: number; + private _query: string; + + public flush(): boolean + { + this._groupId = 0; + this._groupTitle = null; + this._roomId = 0; + this._badge = null; + this._totalMembersCount = 0; + this._result = []; + this._admin = false; + this._pageSize = 0; + this._pageIndex = 0; + this._level = 0; + this._query = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._groupId = wrapper.readInt(); + this._groupTitle = wrapper.readString(); + this._roomId = wrapper.readInt(); + this._badge = wrapper.readString(); + this._totalMembersCount = wrapper.readInt(); + + let resultCount = wrapper.readInt(); + + while(resultCount > 0) + { + this._result.push(new GroupMemberParser(wrapper)); + + resultCount--; + } + + this._admin = wrapper.readBoolean(); + this._pageSize = wrapper.readInt(); + this._pageIndex = wrapper.readInt(); + this._level = wrapper.readInt(); + this._query = wrapper.readString(); + + return true; + } + + public get groupId(): number + { + return this._groupId; + } + public get groupTitle(): string + { + return this._groupTitle; + } + + public get roomId(): number + { + return this._roomId; + } + + public get badge(): string + { + return this._badge; + } + + public get totalMembersCount(): number + { + return this._totalMembersCount; + } + + public get result(): GroupMemberParser[] + { + return this._result; + } + + public get admin(): boolean + { + return this._admin; + } + + public get pageSize(): number + { + return this._pageSize; + } + + public get pageIndex(): number + { + return this._pageIndex; + } + + public get level(): number + { + return this._level; + } + + public get query(): string + { + return this._query; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/group/GroupPurchasedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/group/GroupPurchasedParser.ts new file mode 100644 index 0000000..98e7dea --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/group/GroupPurchasedParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GroupPurchasedParser implements IMessageParser +{ + private _roomId: number; + private _groupId: number; + + flush(): boolean + { + this._roomId = 0; + this._groupId = 0; + + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + this._groupId = wrapper.readInt(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get guildId(): number + { + return this._groupId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/group/GroupSettingsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/group/GroupSettingsParser.ts new file mode 100644 index 0000000..ceb6576 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/group/GroupSettingsParser.ts @@ -0,0 +1,149 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { GroupDataBadgePart } from './utils'; + +export class GroupSettingsParser implements IMessageParser +{ + private _roomId: number; + private _roomName: string; + private _id: number; + private _title: string; + private _description: string; + private _colorA: number; + private _colorB: number; + private _state: number; + private _canMembersDecorate: boolean; + private _badgeParts: Map; + private _badgeCode: string; + private _membersCount: number; + + public flush(): boolean + { + this._roomId = 0; + this._roomName = null; + this._id = 0; + this._title = null; + this._description = null; + this._colorA = 0; + this._colorB = 0; + this._state = 0; + this._canMembersDecorate = false; + this._badgeParts = new Map(); + this._badgeCode = null; + this._membersCount = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + const hasRoomData = wrapper.readInt(); + + if(hasRoomData === 1) + { + this._roomId = wrapper.readInt(); + this._roomName = wrapper.readString(); + wrapper.readBoolean(); + } + + wrapper.readBoolean(); + + this._id = wrapper.readInt(); + this._title = wrapper.readString(); + this._description = wrapper.readString(); + + wrapper.readInt(); + + this._colorA = wrapper.readInt(); + this._colorB = wrapper.readInt(); + this._state = wrapper.readInt(); + this._canMembersDecorate = wrapper.readInt() === 0; + + wrapper.readBoolean(); + wrapper.readString(); + + const badgePartsCount = wrapper.readInt(); + + for(let i = 0; i < badgePartsCount; i++) + { + const part = new GroupDataBadgePart(i === 0); + + part.key = wrapper.readInt(); + part.color = wrapper.readInt(); + part.position = wrapper.readInt(); + + if(part.key === 0) + { + part.position = 4; + } + + this._badgeParts.set(i, part); + } + + this._badgeCode = wrapper.readString(); + this._membersCount = wrapper.readInt(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get roomName(): string + { + return this._roomName; + } + + public get id(): number + { + return this._id; + } + + public get title(): string + { + return this._title; + } + + public get description(): string + { + return this._description; + } + + public get colorA(): number + { + return this._colorA; + } + + public get colorB(): number + { + return this._colorB; + } + + public get state(): number + { + return this._state; + } + + public get canMembersDecorate(): boolean + { + return this._canMembersDecorate; + } + + public get badgeParts(): Map + { + return this._badgeParts; + } + + public get badgeCode(): string + { + return this._badgeCode; + } + + public get membersCount(): number + { + return this._membersCount; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/group/HabboGroupDeactivatedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/group/HabboGroupDeactivatedMessageParser.ts new file mode 100644 index 0000000..b60f3dd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/group/HabboGroupDeactivatedMessageParser.ts @@ -0,0 +1,23 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class HabboGroupDeactivatedMessageParser implements IMessageParser +{ + private _groupId: number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._groupId = wrapper.readInt(); + + return true; + } + + public get groupId(): number + { + return this._groupId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/group/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/group/index.ts new file mode 100644 index 0000000..1b24da1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/group/index.ts @@ -0,0 +1,9 @@ +export * from './GroupBadgePartsParser'; +export * from './GroupBuyDataParser'; +export * from './GroupConfirmMemberRemoveParser'; +export * from './GroupInformationParser'; +export * from './GroupMembersParser'; +export * from './GroupPurchasedParser'; +export * from './GroupSettingsParser'; +export * from './HabboGroupDeactivatedMessageParser'; +export * from './utils'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/group/utils/GroupDataBadgePart.ts b/submodules/renderer/src/nitro/communication/messages/parser/group/utils/GroupDataBadgePart.ts new file mode 100644 index 0000000..7ebdb58 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/group/utils/GroupDataBadgePart.ts @@ -0,0 +1,22 @@ +export class GroupDataBadgePart +{ + public isBase: boolean; + public key: number; + public color: number; + public position: number; + + constructor(isBase: boolean) + { + this.isBase = isBase; + this.key = 0; + this.color = 0; + this.position = 4; + } + + public get code(): string + { + if(this.key === 0) return null; + + return (this.isBase ? 'b' : 's') + (this.key < 100 ? '0' : '') + (this.key < 10 ? '0' : '') + this.key + (this.color < 10 ? '0' : '') + this.color + this.position; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/group/utils/GroupMemberParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/group/utils/GroupMemberParser.ts new file mode 100644 index 0000000..9ebb980 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/group/utils/GroupMemberParser.ts @@ -0,0 +1,76 @@ +import { IMessageDataWrapper } from '../../../../../../api'; + +export class GroupRank +{ + public static readonly OWNER: number = 0; + public static readonly ADMIN: number = 1; + public static readonly MEMBER: number = 2; + public static readonly REQUESTED: number = 3; + public static readonly DELETED: number = 4; +} + +export class GroupMemberParser +{ + private _rank: number; + private _id: number; + private _name: string; + private _figure: string; + private _joinedAt: string; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._rank = -1; + this._id = 0; + this._name = null; + this._figure = null; + this._joinedAt = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._rank = wrapper.readInt(); + this._id = wrapper.readInt(); + this._name = wrapper.readString(); + this._figure = wrapper.readString(); + this._joinedAt = wrapper.readString(); + + return true; + } + + public get id(): number + { + return this._id; + } + + public get name(): string + { + return this._name; + } + + public get figure(): string + { + return this._figure; + } + + public get rank(): number + { + return this._rank; + } + + public get joinedAt(): string + { + return this._joinedAt; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/group/utils/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/group/utils/index.ts new file mode 100644 index 0000000..62a121b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/group/utils/index.ts @@ -0,0 +1,2 @@ +export * from './GroupDataBadgePart'; +export * from './GroupMemberParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/groupforums/ExtendedForumData.ts b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/ExtendedForumData.ts new file mode 100644 index 0000000..903d78d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/ExtendedForumData.ts @@ -0,0 +1,118 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { ForumData } from './ForumData'; + +export class ExtendedForumData extends ForumData +{ + private _readPermissions: number; + private _postMessagePermissions: number; + private _postThreadPermissions: number; + private _moderatePermissions: number; + private _readPermissionError: string; + private _postMessagePermissionError: string; + private _postThreadPermissionError: string; + private _moderatePermissionError: string; + private _reportPermissionError: string; + private _canChangeSettings: boolean; + private _isStaff: boolean; + + public static parse(wrapper: IMessageDataWrapper): ExtendedForumData + { + const extendedForumData: ExtendedForumData = new ExtendedForumData(); + + ForumData.fillFromMessage(extendedForumData, wrapper); + + extendedForumData._readPermissions = wrapper.readInt(); + extendedForumData._postMessagePermissions = wrapper.readInt(); + extendedForumData._postThreadPermissions = wrapper.readInt(); + extendedForumData._moderatePermissions = wrapper.readInt(); + extendedForumData._readPermissionError = wrapper.readString(); + extendedForumData._postMessagePermissionError = wrapper.readString(); + extendedForumData._postThreadPermissionError = wrapper.readString(); + extendedForumData._moderatePermissionError = wrapper.readString(); + extendedForumData._reportPermissionError = wrapper.readString(); + extendedForumData._canChangeSettings = wrapper.readBoolean(); + extendedForumData._isStaff = wrapper.readBoolean(); + + return extendedForumData; + } + + public get readPermissions(): number + { + return this._readPermissions; + } + + public get postMessagePermissions(): number + { + return this._postMessagePermissions; + } + + public get postThreadPermissions(): number + { + return this._postThreadPermissions; + } + + public get moderatePermissions(): number + { + return this._moderatePermissions; + } + + public get hasReadPermissionError(): boolean + { + return (this._readPermissionError.length === 0); + } + + public get canReport(): boolean + { + return true; + } + + public get hasPostMessagePermissionError(): boolean + { + return (this._postMessagePermissionError.length === 0); + } + + public get hasPostThreadPermissionError(): boolean + { + return (this._postThreadPermissionError.length === 0); + } + + public get hasModeratePermissionError(): boolean + { + return (this._moderatePermissionError.length === 0); + } + + public get canChangeSettings(): boolean + { + return this._canChangeSettings; + } + + public get isStaf(): boolean + { + return this._isStaff; + } + + public get readPermissionError(): string + { + return this._readPermissionError; + } + + public get postMessagePermissionError(): string + { + return this._postMessagePermissionError; + } + + public get postThreadPermissionError(): string + { + return this._postThreadPermissionError; + } + + public get moderatePermissionError(): string + { + return this._moderatePermissionError; + } + + public get reportPermissionError(): string + { + return this._reportPermissionError; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/groupforums/ForumData.ts b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/ForumData.ts new file mode 100644 index 0000000..02b9610 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/ForumData.ts @@ -0,0 +1,135 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { GuildForumThread } from './GuildForumThread'; + +export class ForumData +{ + private _groupId: number; + private _name: string; + private _description: string; + private _icon: string; + private _totalThreads: number; + private _leaderboardScore: number; + private _totalMessages: number; + private _unreadMessages: number; + private _lastMessageId: number; + private _lastMessageAuthorId: number; + private _lastMessageAuthorName: string; + private _lastMessageTimeAsSecondsAgo: number; + + public static parse(wrapper: IMessageDataWrapper): ForumData + { + return this.fillFromMessage(new ForumData(), wrapper); + } + + protected static fillFromMessage(data: ForumData, wrapper: IMessageDataWrapper): ForumData + { + data._groupId = wrapper.readInt(); + data._name = wrapper.readString(); + data._description = wrapper.readString(); + data._icon = wrapper.readString(); + data._totalThreads = wrapper.readInt(); + data._leaderboardScore = wrapper.readInt(); + data._totalMessages = wrapper.readInt(); + data._unreadMessages = wrapper.readInt(); + data._lastMessageId = wrapper.readInt(); + data._lastMessageAuthorId = wrapper.readInt(); + data._lastMessageAuthorName = wrapper.readString(); + data._lastMessageTimeAsSecondsAgo = wrapper.readInt(); + + return data; + } + + public get groupId(): number + { + return this._groupId; + } + + public get name(): string + { + return this._name; + } + + public get description(): string + { + return this._description; + } + + public get icon(): string + { + return this._icon; + } + + public get totalThreads(): number + { + return this._totalThreads; + } + + public get leaderboardScore(): number + { + return this._leaderboardScore; + } + + public get totalMessages(): number + { + return this._totalMessages; + } + + public get unreadMessages(): number + { + return this._unreadMessages; + } + + public get lastMessageId(): number + { + return this._lastMessageId; + } + + public get lastMessageAuthorId(): number + { + return this._lastMessageAuthorId; + } + + public get lastMessageAuthorName(): string + { + return this._lastMessageAuthorName; + } + + public get lastMessageTimeAsSecondsAgo(): number + { + return this._lastMessageTimeAsSecondsAgo; + } + + public updateFrom(forum: ForumData): void + { + this._totalThreads = forum._totalThreads; + this._totalMessages = forum._totalMessages; + this._unreadMessages = forum._unreadMessages; + this._lastMessageAuthorId = forum._lastMessageAuthorId; + this._lastMessageAuthorName = forum._lastMessageAuthorName; + this._lastMessageId = forum._lastMessageId; + this._lastMessageTimeAsSecondsAgo = forum._lastMessageTimeAsSecondsAgo; + } + + public get lastReadMessageId(): number + { + return (this._totalMessages - this._unreadMessages); + } + + public set lastReadMessageId(k: number) + { + this._unreadMessages = (this._totalMessages - k); + + if(this._unreadMessages < 0) this._unreadMessages = 0; + } + + public addNewThread(thread: GuildForumThread): void + { + this._lastMessageAuthorId = thread.lastUserId; + this._lastMessageAuthorName = thread.lastUserName; + this._lastMessageId = thread.lastMessageId; + this._lastMessageTimeAsSecondsAgo = thread.lastCommentTime; + this._totalThreads++; + this._totalMessages++; + this._unreadMessages = 0; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/groupforums/ForumDataMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/ForumDataMessageParser.ts new file mode 100644 index 0000000..a53d951 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/ForumDataMessageParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { ExtendedForumData } from './ExtendedForumData'; + +export class ForumDataMessageParser implements IMessageParser +{ + private _extendedForumData: ExtendedForumData; + + public flush(): boolean + { + this._extendedForumData = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._extendedForumData = ExtendedForumData.parse(wrapper); + + return true; + } + + public get extendedForumData(): ExtendedForumData + { + return this._extendedForumData; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/groupforums/GetForumsListMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/GetForumsListMessageParser.ts new file mode 100644 index 0000000..980f0cf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/GetForumsListMessageParser.ts @@ -0,0 +1,69 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { ForumData } from './ForumData'; + +export class GetForumsListMessageParser implements IMessageParser +{ + private _listCode: number; + private _totalAmount: number; + private _startIndex: number; + private _amount: number; + private _forums: ForumData[]; + + public flush(): boolean + { + this._listCode = -1; + this._totalAmount = 0; + this._startIndex = -1; + this._amount = 0; + this._forums = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._listCode = wrapper.readInt(); + this._totalAmount = wrapper.readInt(); + this._startIndex = wrapper.readInt(); + this._amount = wrapper.readInt(); + this._forums = []; + + let i = 0; + + while(i < this._amount) + { + this._forums.push(ForumData.parse(wrapper)); + + i++; + } + + return true; + } + + public get listCode(): number + { + return this._listCode; + } + + public get totalAmount(): number + { + return this._totalAmount; + } + + public get startIndex(): number + { + return this._startIndex; + } + + public get amount(): number + { + return this._amount; + } + + public get forums(): ForumData[] + { + return this._forums; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/groupforums/GuildForumThread.ts b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/GuildForumThread.ts new file mode 100644 index 0000000..d6299ef --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/GuildForumThread.ts @@ -0,0 +1,217 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class GuildForumThread +{ + private _threadId: number; + private _authorId: number; + private _authorName: string; + private _creationTimeAsSecondsAgo: number; + private _header: string; + private _totalMessages: number; + private _unreadMessagesCount: number; + private _lastMessageId: number; + private _lastUserId: number; + private _lastUserName: string; + private _lastCommentTime: number; + private _state: number; + private _adminId: number; + private _adminName: string; + private _adminOperationTimeAsSecondsAgo: number; + private _isPinned: boolean; + private _isLocked: boolean; + + public static parse(wrapper: IMessageDataWrapper): GuildForumThread + { + const thread = new GuildForumThread(); + + thread._threadId = wrapper.readInt(); + thread._authorId = wrapper.readInt(); + thread._authorName = wrapper.readString(); + thread._header = wrapper.readString(); + thread._isPinned = wrapper.readBoolean(); + thread._isLocked = wrapper.readBoolean(); + thread._creationTimeAsSecondsAgo = wrapper.readInt(); + thread._totalMessages = wrapper.readInt(); + thread._unreadMessagesCount = wrapper.readInt(); + thread._lastMessageId = wrapper.readInt(); + thread._lastUserId = wrapper.readInt(); + thread._lastUserName = wrapper.readString(); + thread._lastCommentTime = wrapper.readInt(); + thread._state = wrapper.readByte(); + thread._adminId = wrapper.readInt(); + thread._adminName = wrapper.readString(); + thread._adminOperationTimeAsSecondsAgo = wrapper.readInt(); + + return thread; + } + + public get adminOperationTimeAsSecondsAgo(): number + { + return this._adminOperationTimeAsSecondsAgo; + } + + public set adminOperationTimeAsSecondsAgo(k: number) + { + this._adminOperationTimeAsSecondsAgo = k; + } + + public get lastCommentTime(): number + { + return this._lastCommentTime; + } + + public set lastCommentTime(time: number) + { + this._lastCommentTime = time; + } + + public get threadId(): number + { + return this._threadId; + } + + public set threadId(id: number) + { + this._threadId = id; + } + + public get authorId(): number + { + return this._authorId; + } + + public set authorId(id: number) + { + this._authorId = id; + } + + public get authorName(): string + { + return this._authorName; + } + + public set authorName(name: string) + { + this._authorName = name; + } + + public get creationTimeAsSecondsAgo(): number + { + return this._creationTimeAsSecondsAgo; + } + + public set creationTimeAsSecondsAgo(time: number) + { + this._creationTimeAsSecondsAgo = time; + } + + public get header(): string + { + return this._header; + } + + public set header(header: string) + { + this._header = header; + } + + public get lastMessageId(): number + { + return this._lastMessageId; + } + + public set lastMessageId(id: number) + { + this._lastMessageId = id; + } + + public get lastUserId(): number + { + return this._lastUserId; + } + + public set lastUserId(id: number) + { + this._lastUserId = id; + } + + public get lastUserName(): string + { + return this._lastUserName; + } + + public set lastUserName(name: string) + { + this._lastUserName = name; + } + + public get totalMessages(): number + { + return this._totalMessages; + } + + public set totalMessages(total: number) + { + this._totalMessages = total; + } + + public get unreadMessagesCount(): number + { + return this._unreadMessagesCount; + } + + public set unreadMessagesCount(count: number) + { + this._unreadMessagesCount = count; + } + + public get state(): number + { + return this._state; + } + + public set state(state: number) + { + this._state = state; + } + + public get adminId(): number + { + return this._adminId; + } + + public set adminId(id: number) + { + this._adminId = id; + } + + public get adminName(): string + { + return this._adminName; + } + + public set adminName(name: string) + { + this._adminName = name; + } + + public get isPinned(): boolean + { + return this._isPinned; + } + + public set isPinned(k: boolean) + { + this._isPinned = k; + } + + public get isLocked(): boolean + { + return this._isLocked; + } + + public set isLocked(flag: boolean) + { + this._isLocked = flag; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/groupforums/GuildForumThreadsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/GuildForumThreadsParser.ts new file mode 100644 index 0000000..ac3dcf7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/GuildForumThreadsParser.ts @@ -0,0 +1,61 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { GuildForumThread } from './GuildForumThread'; + +export class GuildForumThreadsParser implements IMessageParser +{ + private _groupId: number; + private _startIndex: number; + private _amount: number; + private _threads: GuildForumThread[]; + + public flush(): boolean + { + this._groupId = -1; + this._startIndex = -1; + this._amount = 0; + this._threads = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._groupId = wrapper.readInt(); + this._startIndex = wrapper.readInt(); + this._amount = wrapper.readInt(); + this._threads = []; + + let i = 0; + + while(i < this._amount) + { + this._threads.push(GuildForumThread.parse(wrapper)); + + i++; + } + + return true; + } + + public get groupId(): number + { + return this._groupId; + } + + public get startIndex(): number + { + return this._startIndex; + } + + public get amount(): number + { + return this._amount; + } + + public get threads(): GuildForumThread[] + { + return this._threads; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/groupforums/MessageData.ts b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/MessageData.ts new file mode 100644 index 0000000..28609fa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/MessageData.ts @@ -0,0 +1,179 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class MessageData +{ + private _groupId: number; + private _messageId: number; + private _messageIndex: number; + private _authorId: number; + private _threadId: number; + private _creationTime: number; + private _messageText: string; + private _authorName: string; + private _authorFigure: string; + private _state: number; + private _adminId: number; + private _adminName: string; + private _adminOperationTimeAsSeccondsAgo: number; + private _authorPostCount: number; + + public static parse(wrapper: IMessageDataWrapper): MessageData + { + const messageData = new MessageData(); + + messageData._messageId = wrapper.readInt(); + messageData._messageIndex = wrapper.readInt(); + messageData._authorId = wrapper.readInt(); + messageData._authorName = wrapper.readString(); + messageData._authorFigure = wrapper.readString(); + messageData._creationTime = wrapper.readInt(); + messageData._messageText = wrapper.readString(); + messageData._state = wrapper.readByte(); + messageData._adminId = wrapper.readInt(); + messageData._adminName = wrapper.readString(); + messageData._adminOperationTimeAsSeccondsAgo = wrapper.readInt(); + messageData._authorPostCount = wrapper.readInt(); + + return messageData; + } + + public get state(): number + { + return this._state; + } + + public set state(state: number) + { + this._state = state; + } + + public get adminId(): number + { + return this._adminId; + } + + public set adminId(id: number) + { + this._adminId = id; + } + + public get adminName(): string + { + return this._adminName; + } + + public set adminName(name: string) + { + this._adminName = name; + } + + public get adminOperationTimeAsSeccondsAgo(): number + { + return this._adminOperationTimeAsSeccondsAgo; + } + + public set adminOperationTimeAsSeccondsAgo(time: number) + { + this._adminOperationTimeAsSeccondsAgo = time; + } + + public get messageId(): number + { + return this._messageId; + } + + public set messageId(id: number) + { + this._messageId = id; + } + + public get creationTime(): number + { + return this._creationTime; + } + + public set creationTime(time: number) + { + this._creationTime = time; + } + + public get authorName(): string + { + return this._authorName; + } + + public set authorName(name: string) + { + this._authorName = name; + } + + public get authorFigure(): string + { + return this._authorFigure; + } + + public set authorFigure(figure: string) + { + this._authorFigure = figure; + } + + public get threadId(): number + { + return this._threadId; + } + + public set threadId(id: number) + { + this._threadId = id; + } + + public get messageIndex(): number + { + return this._messageIndex; + } + + public set messageIndex(index: number) + { + this._messageIndex = index; + } + + public set groupID(id: number) + { + this._groupId = id; + } + + public get groupId(): number + { + return this._groupId; + } + + public get authorId(): number + { + return this._authorId; + } + + public set authorId(id: number) + { + this._authorId = id; + } + + public get messageText(): string + { + return this._messageText; + } + + public set messageText(text: string) + { + this._messageText = text; + } + + public get authorPostCount(): number + { + return this._authorPostCount; + } + + public set authorPostCount(count: number) + { + this._authorPostCount = count; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/groupforums/PostMessageMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/PostMessageMessageParser.ts new file mode 100644 index 0000000..67dda7b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/PostMessageMessageParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { MessageData } from './MessageData'; + +export class PostMessageMessageParser implements IMessageParser +{ + private _groupId: number; + private _threadId: number; + private _message: MessageData; + + public flush(): boolean + { + this._groupId = -1; + this._threadId = -1; + this._message = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._groupId = wrapper.readInt(); + this._threadId = wrapper.readInt(); + this._message = MessageData.parse(wrapper); + + return true; + } + + public get groupId(): number + { + return this._groupId; + } + + public get threadId(): number + { + return this._threadId; + } + + public get message(): MessageData + { + return this._message; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/groupforums/PostThreadMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/PostThreadMessageParser.ts new file mode 100644 index 0000000..8393ab9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/PostThreadMessageParser.ts @@ -0,0 +1,36 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { GuildForumThread } from './GuildForumThread'; + +export class PostThreadMessageParser implements IMessageParser +{ + private _groupId: number; + private _thread: GuildForumThread; + + public flush(): boolean + { + this._groupId = -1; + this._thread = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._groupId = wrapper.readInt(); + this._thread = GuildForumThread.parse(wrapper); + + return true; + } + + public get groupId(): number + { + return this._groupId; + } + + public get thread(): GuildForumThread + { + return this._thread; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/groupforums/ThreadMessagesMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/ThreadMessagesMessageParser.ts new file mode 100644 index 0000000..fe0e017 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/ThreadMessagesMessageParser.ts @@ -0,0 +1,74 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { MessageData } from './MessageData'; + +export class ThreadMessagesMessageParser implements IMessageParser +{ + private _groupId: number; + private _threadId: number; + private _startIndex: number; + private _amount: number; + private _messages: MessageData[]; + + public flush(): boolean + { + this._groupId = -1; + this._threadId = -1; + this._startIndex = -1; + this._amount = 0; + this._messages = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._groupId = wrapper.readInt(); + this._threadId = wrapper.readInt(); + this._startIndex = wrapper.readInt(); + this._amount = wrapper.readInt(); + this._messages = []; + + let i = 0; + + while(i < this._amount) + { + const message = MessageData.parse(wrapper); + + message.groupID = this._groupId; + message.threadId = this._threadId; + + this._messages.push(message); + + i++; + } + + return true; + } + + public get groupId(): number + { + return this._groupId; + } + + public get threadId(): number + { + return this._threadId; + } + + public get startIndex(): number + { + return this._startIndex; + } + + public get amount(): number + { + return this._amount; + } + + public get messages(): MessageData[] + { + return this._messages; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/groupforums/UnreadForumsCountMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/UnreadForumsCountMessageParser.ts new file mode 100644 index 0000000..87447b8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/UnreadForumsCountMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class UnreadForumsCountMessageParser implements IMessageParser +{ + private _count: number; + + public flush(): boolean + { + this._count = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._count = wrapper.readInt(); + + return true; + } + + public get count(): number + { + return this._count; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/groupforums/UpdateMessageMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/UpdateMessageMessageParser.ts new file mode 100644 index 0000000..5bbb046 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/UpdateMessageMessageParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { MessageData } from './MessageData'; + +export class UpdateMessageMessageParser implements IMessageParser +{ + private _groupId: number; + private _threadId: number; + private _message: MessageData; + + public flush(): boolean + { + this._groupId = -1; + this._threadId = -1; + this._message = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._groupId = wrapper.readInt(); + this._threadId = wrapper.readInt(); + this._message = MessageData.parse(wrapper); + + return true; + } + + public get groupId(): number + { + return this._groupId; + } + + public get threadId(): number + { + return this._threadId; + } + + public get message(): MessageData + { + return this._message; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/groupforums/UpdateThreadMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/UpdateThreadMessageParser.ts new file mode 100644 index 0000000..f2d798e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/UpdateThreadMessageParser.ts @@ -0,0 +1,36 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { GuildForumThread } from './GuildForumThread'; + +export class UpdateThreadMessageParser implements IMessageParser +{ + private _groupId: number; + private _thread: GuildForumThread; + + public flush(): boolean + { + this._groupId = -1; + this._thread = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._groupId = wrapper.readInt(); + this._thread = GuildForumThread.parse(wrapper); + + return true; + } + + public get groupId(): number + { + return this._groupId; + } + + public get thread(): GuildForumThread + { + return this._thread; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/groupforums/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/index.ts new file mode 100644 index 0000000..6f07091 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/groupforums/index.ts @@ -0,0 +1,13 @@ +export * from './ExtendedForumData'; +export * from './ForumData'; +export * from './ForumDataMessageParser'; +export * from './GetForumsListMessageParser'; +export * from './GuildForumThread'; +export * from './GuildForumThreadsParser'; +export * from './MessageData'; +export * from './PostMessageMessageParser'; +export * from './PostThreadMessageParser'; +export * from './ThreadMessagesMessageParser'; +export * from './UnreadForumsCountMessageParser'; +export * from './UpdateMessageMessageParser'; +export * from './UpdateThreadMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/handshake/CompleteDiffieHandshakeParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/handshake/CompleteDiffieHandshakeParser.ts new file mode 100644 index 0000000..31a1a00 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/handshake/CompleteDiffieHandshakeParser.ts @@ -0,0 +1,36 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CompleteDiffieHandshakeParser implements IMessageParser +{ + private _encryptedPublicKey: string = null; + private _serverClientEncryption: boolean = false; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._encryptedPublicKey = wrapper.readString(); + + if(wrapper.bytesAvailable) + { + this._serverClientEncryption = wrapper.readBoolean(); + } + + return true; + } + + public get encryptedPublicKey(): string + { + return this._encryptedPublicKey; + } + + public get serverClientEncryption(): boolean + { + return this._serverClientEncryption; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/handshake/DisconnectReasonParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/handshake/DisconnectReasonParser.ts new file mode 100644 index 0000000..a9b5a63 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/handshake/DisconnectReasonParser.ts @@ -0,0 +1,32 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class DisconnectReasonParser implements IMessageParser +{ + private _reason: number; + + public flush(): boolean + { + this._reason = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._reason = 0; + + if(wrapper.bytesAvailable) + { + this._reason = wrapper.readInt(); + } + + return true; + } + + public get reason(): number + { + return this._reason; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/handshake/IdentityAccountsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/handshake/IdentityAccountsParser.ts new file mode 100644 index 0000000..dc63257 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/handshake/IdentityAccountsParser.ts @@ -0,0 +1,39 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class IdentityAccountsParser implements IMessageParser +{ + private _accounts: Map; + + public flush(): boolean + { + if(this._accounts) + { + this._accounts = new Map(); + } + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._accounts = new Map(); + + let totalCount = wrapper.readInt(); + + while(totalCount > 0) + { + this._accounts.set(wrapper.readInt(), wrapper.readString()); + + totalCount--; + } + + return true; + } + + public get accounts(): Map + { + return this._accounts; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/handshake/InitDiffieHandshakeParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/handshake/InitDiffieHandshakeParser.ts new file mode 100644 index 0000000..db31f81 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/handshake/InitDiffieHandshakeParser.ts @@ -0,0 +1,32 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class InitDiffieHandshakeParser implements IMessageParser +{ + private _encryptedPrime: string; + private _encryptedGenerator: string; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._encryptedPrime = wrapper.readString(); + this._encryptedGenerator = wrapper.readString(); + + return true; + } + + public get encryptedPrime(): string + { + return this._encryptedPrime; + } + + public get encryptedGenerator(): string + { + return this._encryptedGenerator; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/handshake/NoobnessLevelMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/handshake/NoobnessLevelMessageParser.ts new file mode 100644 index 0000000..05be0d8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/handshake/NoobnessLevelMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class NoobnessLevelMessageParser implements IMessageParser +{ + private _noobnessLevel: number; + + public flush(): boolean + { + this._noobnessLevel = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._noobnessLevel = wrapper.readInt(); + + return true; + } + + public get noobnessLevel(): number + { + return this._noobnessLevel; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/handshake/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/handshake/index.ts new file mode 100644 index 0000000..786e98b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/handshake/index.ts @@ -0,0 +1,5 @@ +export * from './CompleteDiffieHandshakeParser'; +export * from './DisconnectReasonParser'; +export * from './IdentityAccountsParser'; +export * from './InitDiffieHandshakeParser'; +export * from './NoobnessLevelMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/CallForHelpDisabledNotifyMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/CallForHelpDisabledNotifyMessageParser.ts new file mode 100644 index 0000000..f7b1591 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/CallForHelpDisabledNotifyMessageParser.ts @@ -0,0 +1,25 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CallForHelpDisabledNotifyMessageParser implements IMessageParser +{ + private _infoUrl: string; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._infoUrl = wrapper.readString(); + + return true; + } + + public get infoUrl(): string + { + return this._infoUrl; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/CallForHelpPendingCallsDeletedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/CallForHelpPendingCallsDeletedMessageParser.ts new file mode 100644 index 0000000..dad37e4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/CallForHelpPendingCallsDeletedMessageParser.ts @@ -0,0 +1,14 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CallForHelpPendingCallsDeletedMessageParser implements IMessageParser +{ + flush(): boolean + { + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/CallForHelpPendingCallsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/CallForHelpPendingCallsMessageParser.ts new file mode 100644 index 0000000..76415a4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/CallForHelpPendingCallsMessageParser.ts @@ -0,0 +1,46 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CallForHelpPendingCallsMessageParser implements IMessageParser +{ + private _calls: ICall[]; + + flush(): boolean + { + this._calls = []; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._calls = []; + + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + const callId = wrapper.readString(); + const timestamp = wrapper.readString(); + const message = wrapper.readString(); + + this._calls.push({ callId: callId, timeStamp: timestamp, message: message }); + } + return true; + } + + public get pendingCalls(): ICall[] + { + return this._calls; + } + + public get count(): number + { + return this._calls.length; + } +} + +export interface ICall +{ + callId: string; + timeStamp: string; + message: string; +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/CallForHelpReplyMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/CallForHelpReplyMessageParser.ts new file mode 100644 index 0000000..2096576 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/CallForHelpReplyMessageParser.ts @@ -0,0 +1,23 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CallForHelpReplyMessageParser implements IMessageParser +{ + private _message: string; + + flush(): boolean + { + this._message = null; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._message = wrapper.readString(); + return true; + } + + public get message(): string + { + return this._message; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/CallForHelpResultMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/CallForHelpResultMessageParser.ts new file mode 100644 index 0000000..964f929 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/CallForHelpResultMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CallForHelpResultMessageParser implements IMessageParser +{ + private _resultType: number; + private _messageText: string; + + public flush(): boolean + { + this._resultType = 0; + this._messageText = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._resultType = wrapper.readInt(); + this._messageText = wrapper.readString(); + + return true; + } + + public get resultType(): number + { + return this._resultType; + } + + public get messageText(): string + { + return this._messageText; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/ChatReviewSessionDetachedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/ChatReviewSessionDetachedMessageParser.ts new file mode 100644 index 0000000..8a9fb59 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/ChatReviewSessionDetachedMessageParser.ts @@ -0,0 +1,15 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ChatReviewSessionDetachedMessageParser implements IMessageParser +{ + flush(): boolean + { + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + return true; + } + +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/ChatReviewSessionOfferedToGuideMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/ChatReviewSessionOfferedToGuideMessageParser.ts new file mode 100644 index 0000000..ee39853 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/ChatReviewSessionOfferedToGuideMessageParser.ts @@ -0,0 +1,23 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ChatReviewSessionOfferedToGuideMessageParser implements IMessageParser +{ + private _acceptanceTimeout: number; + + flush(): boolean + { + this._acceptanceTimeout = -1; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._acceptanceTimeout = wrapper.readInt(); + return true; + } + + public get acceptanceTimeout(): number + { + return this._acceptanceTimeout; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/ChatReviewSessionResultsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/ChatReviewSessionResultsMessageParser.ts new file mode 100644 index 0000000..4369e93 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/ChatReviewSessionResultsMessageParser.ts @@ -0,0 +1,47 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ChatReviewSessionResultsMessageParser implements IMessageParser +{ + private _winningVoteCode: number; + private _ownVoteCode: number; + private _finalStatus: number[]; + + flush(): boolean + { + this._winningVoteCode = -1; + this._ownVoteCode = -1; + this._finalStatus = null; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._finalStatus = []; + this._winningVoteCode = wrapper.readInt(); + this._ownVoteCode = wrapper.readInt(); + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + this._finalStatus.push(wrapper.readInt()); + } + + return true; + } + + public get winningVoteCode(): number + { + return this._winningVoteCode; + } + + public get ownVoteCode(): number + { + return this._ownVoteCode; + } + + public get finalStatus(): number[] + { + return this._finalStatus; + } + +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/ChatReviewSessionStartedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/ChatReviewSessionStartedMessageParser.ts new file mode 100644 index 0000000..bdb83b6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/ChatReviewSessionStartedMessageParser.ts @@ -0,0 +1,29 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ChatReviewSessionStartedMessageParser implements IMessageParser +{ + private _votingTimeout: number; + private _chatRecord: string; + + flush(): boolean + { + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._votingTimeout = wrapper.readInt(); + this._chatRecord = wrapper.readString(); + return true; + } + + public get votingTimeout(): number + { + return this._votingTimeout; + } + + public get chatRecord(): string + { + return this._chatRecord; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/ChatReviewSessionVotingStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/ChatReviewSessionVotingStatusMessageParser.ts new file mode 100644 index 0000000..190674d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/ChatReviewSessionVotingStatusMessageParser.ts @@ -0,0 +1,38 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ChatReviewSessionVotingStatusMessageParser implements IMessageParser +{ + public static readonly AWAITING_VOTE = 0; + public static readonly VOTED_OK = 1; + public static readonly VOTED_BAD = 2; + public static readonly VOTED_VERY_BAD = 3; + public static readonly NO_VOTE = 4; + public static readonly FINDING_NEW_VOTER = 5; + + private _status: number[]; + + flush(): boolean + { + this._status = null; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._status = []; + + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + this._status.push(wrapper.readInt()); + } + + return true; + } + + public get status(): number[] + { + return this._status; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/GuideOnDutyStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideOnDutyStatusMessageParser.ts new file mode 100644 index 0000000..8da445a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideOnDutyStatusMessageParser.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GuideOnDutyStatusMessageParser implements IMessageParser +{ + private _onDuty: boolean; + private _guidesOnDuty: number; + private _helpersOnDuty: number; + private _guardiansOnDuty: number; + + public flush(): boolean + { + this._onDuty = false; + this._guidesOnDuty = 0; + this._helpersOnDuty = 0; + this._guardiansOnDuty = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._onDuty = wrapper.readBoolean(); + this._guidesOnDuty = wrapper.readInt(); + this._helpersOnDuty = wrapper.readInt(); + this._guardiansOnDuty = wrapper.readInt(); + + return true; + } + + public get onDuty(): boolean + { + return this._onDuty; + } + + public get guidesOnDuty(): number + { + return this._guidesOnDuty; + } + + public get helpersOnDuty(): number + { + return this._helpersOnDuty; + } + + public get guardiansOnDuty(): number + { + return this._guardiansOnDuty; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/GuideReportingStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideReportingStatusMessageParser.ts new file mode 100644 index 0000000..78cdd7d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideReportingStatusMessageParser.ts @@ -0,0 +1,49 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { PendingGuideTicketData } from './PendingGuideTicketData'; + +export class GuideReportingStatusMessageParser implements IMessageParser +{ + public static readonly GUIDE_REPORTING_STATUS_OK: number = 0; + public static readonly GUIDE_REPORTING_STATUS_PENDING_TICKET: number = 1; + public static readonly GUIDE_REPORTING_STATUS_ABUSIVE: number = 2; + public static readonly GUIDE_REPORTING_STATUS_REPORTING_TOO_QUICKLY: number = 3; + + private _statusCode: number; + private _pendingTicket: PendingGuideTicketData; + + public flush(): boolean + { + this._statusCode = 0; + this._pendingTicket = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._statusCode = wrapper.readInt(); + this._pendingTicket = new PendingGuideTicketData( + wrapper.readInt(), + wrapper.readInt(), + wrapper.readBoolean(), + wrapper.readString(), + wrapper.readString(), + wrapper.readString(), + wrapper.readString() + ); + + return true; + } + + public get statusCode(): number + { + return this._statusCode; + } + + public get pendingTicket(): PendingGuideTicketData + { + return this._pendingTicket; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionAttachedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionAttachedMessageParser.ts new file mode 100644 index 0000000..e09f4b9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionAttachedMessageParser.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GuideSessionAttachedMessageParser implements IMessageParser +{ + private _asGuide: boolean; + private _helpRequestType: number; + private _helpRequestDescription: string; + private _roleSpecificWaitTime: number; + + public flush(): boolean + { + this._asGuide = false; + this._helpRequestType = 0; + this._helpRequestDescription = null; + this._roleSpecificWaitTime = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._asGuide = wrapper.readBoolean(); + this._helpRequestType = wrapper.readInt(); + this._helpRequestDescription = wrapper.readString(); + this._roleSpecificWaitTime = wrapper.readInt(); + + return true; + } + + public get asGuide(): boolean + { + return this._asGuide; + } + + public get helpRequestType(): number + { + return this._helpRequestType; + } + + public get helpRequestDescription(): string + { + return this._helpRequestDescription; + } + + public get roleSpecificWaitTime(): number + { + return this._roleSpecificWaitTime; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionDetachedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionDetachedMessageParser.ts new file mode 100644 index 0000000..cb6f934 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionDetachedMessageParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GuideSessionDetachedMessageParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionEndedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionEndedMessageParser.ts new file mode 100644 index 0000000..0e54654 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionEndedMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GuideSessionEndedMessageParser implements IMessageParser +{ + private _endReason: number; + + public flush(): boolean + { + this._endReason = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._endReason = wrapper.readInt(); + + return true; + } + + public get endReason(): number + { + return this._endReason; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionErrorMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionErrorMessageParser.ts new file mode 100644 index 0000000..d23cc35 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionErrorMessageParser.ts @@ -0,0 +1,33 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GuideSessionErrorMessageParser implements IMessageParser +{ + public static readonly ERROR_GENERIC: number = 0; + public static readonly ERROR_GUIDES_REJECT: number = 1; + public static readonly ERROR_NOT_ENOUGH_GUIDES: number = 2; + public static readonly ERROR_NOT_ENOUGH_VOTES: number = 3; + public static readonly ERROR_NO_CHATLOG_FOUND: number = 4; + + private _errorCode: number; + + public flush(): boolean + { + this._errorCode = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._errorCode = wrapper.readInt(); + + return true; + } + + public get errorCode(): number + { + return this._errorCode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionInvitedToGuideRoomMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionInvitedToGuideRoomMessageParser.ts new file mode 100644 index 0000000..2f14e83 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionInvitedToGuideRoomMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GuideSessionInvitedToGuideRoomMessageParser implements IMessageParser +{ + private _roomId: number; + private _roomName: string; + + public flush(): boolean + { + this._roomId = 0; + this._roomName = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + this._roomName = wrapper.readString(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get roomName(): string + { + return this._roomName; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionMessageMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionMessageMessageParser.ts new file mode 100644 index 0000000..c69e261 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionMessageMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GuideSessionMessageMessageParser implements IMessageParser +{ + private _chatMessage: string; + private _senderId: number; + + public flush(): boolean + { + this._chatMessage = null; + this._senderId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._chatMessage = wrapper.readString(); + this._senderId = wrapper.readInt(); + + return true; + } + + public get chatMessage(): string + { + return this._chatMessage; + } + + public get senderId(): number + { + return this._senderId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionPartnerIsTypingMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionPartnerIsTypingMessageParser.ts new file mode 100644 index 0000000..59848d2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionPartnerIsTypingMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GuideSessionPartnerIsTypingMessageParser implements IMessageParser +{ + private _isTyping: boolean; + + public flush(): boolean + { + this._isTyping = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._isTyping = wrapper.readBoolean(); + + return true; + } + + public get isTyping(): boolean + { + return this._isTyping; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionRequesterRoomMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionRequesterRoomMessageParser.ts new file mode 100644 index 0000000..c1bb232 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionRequesterRoomMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GuideSessionRequesterRoomMessageParser implements IMessageParser +{ + private _requesterRoomId: number; + + public flush(): boolean + { + this._requesterRoomId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._requesterRoomId = wrapper.readInt(); + + return true; + } + + public get requesterRoomId(): number + { + return this._requesterRoomId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionStartedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionStartedMessageParser.ts new file mode 100644 index 0000000..b0dac74 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideSessionStartedMessageParser.ts @@ -0,0 +1,67 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GuideSessionStartedMessageParser implements IMessageParser +{ + private _requesterUserId: number; + private _requesterName: string; + private _requesterFigure: string; + private _guideUserId: number; + private _guideName: string; + private _guideFigure: string; + + public flush(): boolean + { + this._requesterUserId = 0; + this._requesterName = null; + this._requesterFigure = null; + this._guideUserId = 0; + this._guideName = null; + this._guideFigure = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._requesterUserId = wrapper.readInt(); + this._requesterName = wrapper.readString(); + this._requesterFigure = wrapper.readString(); + this._guideUserId = wrapper.readInt(); + this._guideName = wrapper.readString(); + this._guideFigure = wrapper.readString(); + + return true; + } + + public get requesterUserId(): number + { + return this._requesterUserId; + } + + public get requesterName(): string + { + return this._requesterName; + } + + public get requesterFigure(): string + { + return this._requesterFigure; + } + + public get guideUserId(): number + { + return this._guideUserId; + } + + public get guideName(): string + { + return this._guideName; + } + + public get guideFigure(): string + { + return this._guideFigure; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/GuideTicketCreationResultMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideTicketCreationResultMessageParser.ts new file mode 100644 index 0000000..8671368 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideTicketCreationResultMessageParser.ts @@ -0,0 +1,32 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GuideTicketCreationResultMessageParser implements IMessageParser +{ + public static readonly CREATION_RESULT_OK: number = 0; + public static readonly CREATION_RESULT_UNABLE_TO_REPORT: number = 1; + public static readonly CREATION_RESULT_NO_CHATLOG_FOUND: number = 2; + public static readonly CREATION_RESULT_BULLY_ALREADY_REPORTED: number = 3; + + private _result: number; + + public flush(): boolean + { + this._result = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._result = wrapper.readInt(); + + return true; + } + + public get result(): number + { + return this._result; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/GuideTicketResolutionMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideTicketResolutionMessageParser.ts new file mode 100644 index 0000000..338a510 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/GuideTicketResolutionMessageParser.ts @@ -0,0 +1,31 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GuideTicketResolutionMessageParser implements IMessageParser +{ + public static readonly RESOLUTION_GUARDIANS_TOOK_ACTION: number = 0; + public static readonly RESOLUTION_FORWARDED_TO_MODERATORS: number = 1; + public static readonly RESOLUTION_REPORTER_IS_ABUSIVE: number = 2; + + private _resolution: number; + + public flush(): boolean + { + this._resolution = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._resolution = wrapper.readInt(); + + return true; + } + + public get resolution(): number + { + return this._resolution; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/HotelMergeNameChangeParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/HotelMergeNameChangeParser.ts new file mode 100644 index 0000000..5695bab --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/HotelMergeNameChangeParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class HotelMergeNameChangeParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/IssueCloseNotificationMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/IssueCloseNotificationMessageParser.ts new file mode 100644 index 0000000..eb78dbb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/IssueCloseNotificationMessageParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class IssueCloseNotificationMessageParser implements IMessageParser +{ + private _closeReason: number; + private _messageText: string; + + public flush(): boolean + { + this._closeReason = 0; + this._messageText = ''; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._closeReason = wrapper.readInt(); + this._messageText = wrapper.readString(); + + return true; + } + + public get closeReason(): number + { + return this._closeReason; + } + + public get messageText(): string + { + return this._messageText; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/PendingGuideTicketData.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/PendingGuideTicketData.ts new file mode 100644 index 0000000..fa592e8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/PendingGuideTicketData.ts @@ -0,0 +1,91 @@ +export class PendingGuideTicketData +{ + private _type: number; + private _secondsAgo: number; + private _isGuide: boolean; + private _otherPartyName: string; + private _otherPartyFigure: string; + private _description: string; + private _roomName: string; + + constructor(type: number, secondsAgo: number, isGuide: boolean, otherPartyName: string, otherPartyFigure: string, description: string, roomName: string) + { + this._type = type; + this._secondsAgo = secondsAgo; + this._isGuide = isGuide; + this._otherPartyName = otherPartyName; + this._otherPartyFigure = otherPartyFigure; + this._description = description; + this._roomName = roomName; + } + + public get type(): number + { + return this._type; + } + + public set type(value: number) + { + this._type = value; + } + + public get secondsAgo(): number + { + return this._secondsAgo; + } + + public set secondsAgo(value: number) + { + this._secondsAgo = value; + } + + public get isGuide(): boolean + { + return this._isGuide; + } + + public set isGuide(value: boolean) + { + this._isGuide = value; + } + + public get otherPartyName(): string + { + return this._otherPartyName; + } + + public set otherPartyName(value: string) + { + this._otherPartyName = value; + } + + public get otherPartyFigure(): string + { + return this._otherPartyFigure; + } + + public set otherPartyFigure(value: string) + { + this._otherPartyFigure = value; + } + + public get description(): string + { + return this._description; + } + + public set description(value: string) + { + this._description = value; + } + + public get roomName(): string + { + return this._roomName; + } + + public set roomName(value: string) + { + this._roomName = value; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/QuizDataMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/QuizDataMessageParser.ts new file mode 100644 index 0000000..695d75a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/QuizDataMessageParser.ts @@ -0,0 +1,40 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class QuizDataMessageParser implements IMessageParser +{ + private _quizCode: string; + private _questionIds: number[]; + + public flush(): boolean + { + this._quizCode = null; + this._questionIds = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._quizCode = wrapper.readString(); + + const size = wrapper.readInt(); + + this._questionIds = []; + + for(let i = 0; i < size; i++) this._questionIds.push(wrapper.readInt()); + + return true; + } + + public get quizCode(): string + { + return this._quizCode; + } + + public get questionIds(): number[] + { + return this._questionIds; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/QuizResultsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/QuizResultsMessageParser.ts new file mode 100644 index 0000000..9be2524 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/QuizResultsMessageParser.ts @@ -0,0 +1,40 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class QuizResultsMessageParser implements IMessageParser +{ + private _quizCode: string; + private _questionIdsForWrongAnswers: number[]; + + public flush(): boolean + { + this._quizCode = null; + this._questionIdsForWrongAnswers = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._quizCode = wrapper.readString(); + + const size = wrapper.readInt(); + + this._questionIdsForWrongAnswers = []; + + for(let i = 0; i < size; i++) this._questionIdsForWrongAnswers.push(wrapper.readInt()); + + return true; + } + + public get quizCode(): string + { + return this._quizCode; + } + + public get questionIdsForWrongAnswers(): number[] + { + return this._questionIdsForWrongAnswers; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/help/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/help/index.ts new file mode 100644 index 0000000..684885f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/help/index.ts @@ -0,0 +1,28 @@ +export * from './CallForHelpDisabledNotifyMessageParser'; +export * from './CallForHelpPendingCallsDeletedMessageParser'; +export * from './CallForHelpPendingCallsMessageParser'; +export * from './CallForHelpReplyMessageParser'; +export * from './CallForHelpResultMessageParser'; +export * from './ChatReviewSessionDetachedMessageParser'; +export * from './ChatReviewSessionOfferedToGuideMessageParser'; +export * from './ChatReviewSessionResultsMessageParser'; +export * from './ChatReviewSessionStartedMessageParser'; +export * from './ChatReviewSessionVotingStatusMessageParser'; +export * from './GuideOnDutyStatusMessageParser'; +export * from './GuideReportingStatusMessageParser'; +export * from './GuideSessionAttachedMessageParser'; +export * from './GuideSessionDetachedMessageParser'; +export * from './GuideSessionEndedMessageParser'; +export * from './GuideSessionErrorMessageParser'; +export * from './GuideSessionInvitedToGuideRoomMessageParser'; +export * from './GuideSessionMessageMessageParser'; +export * from './GuideSessionPartnerIsTypingMessageParser'; +export * from './GuideSessionRequesterRoomMessageParser'; +export * from './GuideSessionStartedMessageParser'; +export * from './GuideTicketCreationResultMessageParser'; +export * from './GuideTicketResolutionMessageParser'; +export * from './HotelMergeNameChangeParser'; +export * from './IssueCloseNotificationMessageParser'; +export * from './PendingGuideTicketData'; +export * from './QuizDataMessageParser'; +export * from './QuizResultsMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/index.ts new file mode 100644 index 0000000..afc1ff2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/index.ts @@ -0,0 +1,76 @@ +export * from './advertisement'; +export * from './availability'; +export * from './avatar'; +export * from './bots'; +export * from './callforhelp'; +export * from './camera'; +export * from './campaign'; +export * from './catalog'; +export * from './client'; +export * from './competition'; +export * from './crafting'; +export * from './desktop'; +export * from './friendlist'; +export * from './game'; +export * from './game/directory'; +export * from './game/lobby'; +export * from './game/score'; +export * from './generic'; +export * from './gifts'; +export * from './group'; +export * from './group/utils'; +export * from './groupforums'; +export * from './handshake'; +export * from './help'; +export * from './inventory'; +export * from './inventory/achievements'; +export * from './inventory/avatareffect'; +export * from './inventory/badges'; +export * from './inventory/clothing'; +export * from './inventory/furniture'; +export * from './inventory/pets'; +export * from './inventory/purse'; +export * from './inventory/trading'; +export * from './landingview'; +export * from './landingview/votes'; +export * from './marketplace'; +export * from './moderation'; +export * from './mysterybox'; +export * from './navigator'; +export * from './navigator/utils'; +export * from './notifications'; +export * from './perk'; +export * from './perk/common'; +export * from './pet'; +export * from './poll'; +export * from './quest'; +export * from './recycler'; +export * from './room'; +export * from './room/access'; +export * from './room/access/doorbell'; +export * from './room/access/rights'; +export * from './room/bots'; +export * from './room/data'; +export * from './room/engine'; +export * from './room/furniture'; +export * from './room/furniture/floor'; +export * from './room/furniture/wall'; +export * from './room/furniture/youtube'; +export * from './room/mapping'; +export * from './room/pet'; +export * from './room/session'; +export * from './room/unit'; +export * from './room/unit/chat'; +export * from './roomevents'; +export * from './roomsettings'; +export * from './security'; +export * from './sound'; +export * from './talent'; +export * from './user'; +export * from './user/access'; +export * from './user/data'; +export * from './user/inventory'; +export * from './user/inventory/currency'; +export * from './user/inventory/subscription'; +export * from './user/wardrobe'; +export * from './userclassification'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/AchievementData.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/AchievementData.ts new file mode 100644 index 0000000..aab6fb4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/AchievementData.ts @@ -0,0 +1,156 @@ +import { IMessageDataWrapper } from '../../../../../../api'; + +export class AchievementData +{ + public static DISPLAY_METHOD_OBSOLETE: number = -1; + public static DISPLAY_METHOD_SHOW_LEVEL_PROGRESS: number = 0; + public static DISPLAY_METHOD_NEVER_SHOW_PROGRESS: number = 1; + public static DISPLAY_METHOD_SHOW_TOTAL_PROGRESS: number = 2; + + private _achievementId: number; + private _level: number; + private _badgeId: string; + private _scoreAtStartOfLevel: number; + private _scoreLimit: number; + private _levelRewardPoints: number; + private _levelRewardPointType: number; + private _currentPoints: number; + private _finalLevel: boolean; + private _category: string; + private _subCategory: string; + private _levelCount: number; + private _displayMethod: number; + + private _unseen: number = 0; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_parser'); + + this._achievementId = wrapper.readInt(); + this._level = wrapper.readInt(); + this._badgeId = wrapper.readString(); + this._scoreAtStartOfLevel = wrapper.readInt(); + this._scoreLimit = Math.max(1, wrapper.readInt()); + this._levelRewardPoints = wrapper.readInt(); + this._levelRewardPointType = wrapper.readInt(); + this._currentPoints = wrapper.readInt(); + this._finalLevel = wrapper.readBoolean(); + this._category = wrapper.readString(); + this._subCategory = wrapper.readString(); + this._levelCount = wrapper.readInt(); + this._displayMethod = wrapper.readInt(); + } + + public get achievementId(): number + { + return this._achievementId; + } + + public get badgeId(): string + { + return this._badgeId; + } + + public get level(): number + { + return this._level; + } + + public get scoreAtStartOfLevel(): number + { + return this._scoreAtStartOfLevel; + } + + public get scoreLimit(): number + { + return (this._scoreLimit - this._scoreAtStartOfLevel); + } + + public get levelRewardPoints(): number + { + return this._levelRewardPoints; + } + + public get levelRewardPointType(): number + { + return this._levelRewardPointType; + } + + public get currentPoints(): number + { + return (this._currentPoints - this._scoreAtStartOfLevel); + } + + public get finalLevel(): boolean + { + return this._finalLevel; + } + + public get category(): string + { + return this._category; + } + + public get subCategory(): string + { + return this._subCategory; + } + + public get levelCount(): number + { + return this._levelCount; + } + + public get firstLevelAchieved(): boolean + { + return (this._level > 1) || (this._finalLevel); + } + + public setMaxProgress(): void + { + this._currentPoints = this._scoreLimit; + } + + public get displayMethod(): number + { + return this._displayMethod; + } + + public get progress(): number + { + return this._currentPoints; + } + + public get toNextProgress(): number + { + return this._scoreLimit; + } + + public set unseen(unseen: number) + { + this._unseen = unseen; + } + + public get unseen(): number + { + return this._unseen; + } + + public reset(badge: AchievementData) + { + this._achievementId = badge._achievementId; + this._level = badge._level; + this._badgeId = badge._badgeId; + this._scoreAtStartOfLevel = badge._scoreAtStartOfLevel; + this._scoreLimit = badge._scoreLimit; + this._levelRewardPoints = badge._levelRewardPoints; + this._levelRewardPointType = badge._levelRewardPointType; + this._currentPoints = badge._currentPoints; + this._finalLevel = badge._finalLevel; + this._category = badge.category; + this._subCategory = badge._subCategory; + this._levelCount = badge._levelCount; + this._displayMethod = badge._displayMethod; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/AchievementParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/AchievementParser.ts new file mode 100644 index 0000000..3122823 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/AchievementParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { AchievementData } from './AchievementData'; + +export class AchievementParser implements IMessageParser +{ + private _achievement: AchievementData; + + public flush(): boolean + { + this._achievement = null; + + return true; + } + + public parse(k: IMessageDataWrapper): boolean + { + if(!k) return false; + + this._achievement = new AchievementData(k); + + return true; + } + + public get achievement(): AchievementData + { + return this._achievement; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/AchievementResolutionData.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/AchievementResolutionData.ts new file mode 100644 index 0000000..9cbd5f1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/AchievementResolutionData.ts @@ -0,0 +1,59 @@ +import { IMessageDataWrapper } from '../../../../../../api'; + +export class AchievementResolutionData +{ + public static STATE_SELECTABLE: number = 0; + + private _achievementId: number; + private _level: number; + private _badgeId: string; + private _requiredLevel: number; + private _state: number; + + constructor(wrapper: IMessageDataWrapper) + { + this._achievementId = wrapper.readInt(); + this._level = wrapper.readInt(); + this._badgeId = wrapper.readString(); + this._requiredLevel = wrapper.readInt(); + this._state = wrapper.readInt(); + } + + public dispose(): void + { + this._achievementId = 0; + this._level = 0; + this._badgeId = ''; + this._requiredLevel = 0; + } + + public get achievementId(): number + { + return this._achievementId; + } + + public get level(): number + { + return this._level; + } + + public get badgeId(): string + { + return this._badgeId; + } + + public get requiredLevel(): number + { + return this._requiredLevel; + } + + public get enabled(): boolean + { + return (this._state === AchievementResolutionData.STATE_SELECTABLE); + } + + public get state(): number + { + return this._state; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/AchievementsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/AchievementsParser.ts new file mode 100644 index 0000000..ececb39 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/AchievementsParser.ts @@ -0,0 +1,46 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { AchievementData } from './AchievementData'; + +export class AchievementsParser implements IMessageParser +{ + private _achievements: AchievementData[]; + private _defaultCategory: string; + + public flush(): boolean + { + this._achievements = []; + this._defaultCategory = null; + + return true; + } + + public parse(k: IMessageDataWrapper): boolean + { + if(!k) return false; + + this._achievements = []; + + let totalCount = k.readInt(); + + while(totalCount > 0) + { + this._achievements.push(new AchievementData(k)); + + totalCount--; + } + + this._defaultCategory = k.readString(); + + return true; + } + + public get achievements(): AchievementData[] + { + return this._achievements; + } + + public get defaultCategory(): string + { + return this._defaultCategory; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/AchievementsScoreParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/AchievementsScoreParser.ts new file mode 100644 index 0000000..ddf4a9b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/AchievementsScoreParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class AchievementsScoreParser implements IMessageParser +{ + private _score: number; + + public flush(): boolean + { + this._score = 0; + + return true; + } + + public parse(k: IMessageDataWrapper): boolean + { + if(!k) return false; + + this._score = k.readInt(); + + return true; + } + + public get score(): number + { + return this._score; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/index.ts new file mode 100644 index 0000000..3b5ad93 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/achievements/index.ts @@ -0,0 +1,5 @@ +export * from './AchievementData'; +export * from './AchievementParser'; +export * from './AchievementResolutionData'; +export * from './AchievementsParser'; +export * from './AchievementsScoreParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffect.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffect.ts new file mode 100644 index 0000000..e4b8f21 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffect.ts @@ -0,0 +1,69 @@ +export class AvatarEffect +{ + private _type: number; + private _subType: number; + private _duration: number; + private _inactiveEffectsInInventory: number; + private _secondsLeftIfActive: number; + private _permanent: boolean; + + public get type(): number + { + return this._type; + } + + public set type(k: number) + { + this._type = k; + } + + public get subType(): number + { + return this._subType; + } + + public set subType(k: number) + { + this._subType = k; + } + + public get duration(): number + { + return this._duration; + } + + public set duration(k: number) + { + this._duration = k; + } + + public get inactiveEffectsInInventory(): number + { + return this._inactiveEffectsInInventory; + } + + public set inactiveEffectsInInventory(k: number) + { + this._inactiveEffectsInInventory = k; + } + + public get secondsLeftIfActive(): number + { + return this._secondsLeftIfActive; + } + + public set secondsLeftIfActive(k: number) + { + this._secondsLeftIfActive = k; + } + + public get isPermanent(): boolean + { + return this._permanent; + } + + public set isPermanent(k: boolean) + { + this._permanent = k; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectActivatedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectActivatedParser.ts new file mode 100644 index 0000000..6e84a84 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectActivatedParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class AvatarEffectActivatedParser implements IMessageParser +{ + private _type: number; + private _duration: number; + private _isPermanent: boolean; + + public flush(): boolean + { + this._type = 0; + this._duration = 0; + this._isPermanent = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._type = wrapper.readInt(); + this._duration = wrapper.readInt(); + this._isPermanent = wrapper.readBoolean(); + + return true; + } + + public get type(): number + { + return this._type; + } + + public get duration(): number + { + return this._duration; + } + + public get isPermanent(): boolean + { + return this._isPermanent; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectAddedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectAddedParser.ts new file mode 100644 index 0000000..32bb0af --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectAddedParser.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class AvatarEffectAddedParser implements IMessageParser +{ + private _type: number; + private _subType: number; + private _duration: number; + private _permanent: boolean; + + public flush(): boolean + { + this._type = 0; + this._subType = 0; + this._duration = 0; + this._permanent = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._type = wrapper.readInt(); + this._subType = wrapper.readInt(); + this._duration = wrapper.readInt(); + this._permanent = wrapper.readBoolean(); + + return true; + } + + public get type(): number + { + return this._type; + } + + public get subType(): number + { + return this._subType; + } + + public get duration(): number + { + return this._duration; + } + + public get isPermanent(): boolean + { + return this._permanent; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectExpiredParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectExpiredParser.ts new file mode 100644 index 0000000..1773082 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectExpiredParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class AvatarEffectExpiredParser implements IMessageParser +{ + private _type: number; + + public flush(): boolean + { + this._type = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._type = wrapper.readInt(); + + return true; + } + + public get type(): number + { + return this._type; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectSelectedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectSelectedParser.ts new file mode 100644 index 0000000..bc24b0f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectSelectedParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class AvatarEffectSelectedParser implements IMessageParser +{ + private _type: number; + + public flush(): boolean + { + this._type = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._type = wrapper.readInt(); + + return true; + } + + public get type(): number + { + return this._type; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectsParser.ts new file mode 100644 index 0000000..e3364f4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/AvatarEffectsParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { AvatarEffect } from './AvatarEffect'; + +export class AvatarEffectsParser implements IMessageParser +{ + private _effects: AvatarEffect[]; + + public flush(): boolean + { + this._effects = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalEffects = wrapper.readInt(); + + while(totalEffects > 0) + { + const effect = new AvatarEffect(); + + effect.type = wrapper.readInt(); + effect.subType = wrapper.readInt(); + effect.duration = wrapper.readInt(); + effect.inactiveEffectsInInventory = wrapper.readInt(); + effect.secondsLeftIfActive = wrapper.readInt(); + effect.isPermanent = wrapper.readBoolean(); + + this._effects.push(effect); + + totalEffects--; + } + + return true; + } + + public get effects(): AvatarEffect[] + { + return this._effects; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/index.ts new file mode 100644 index 0000000..ff677c4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/avatareffect/index.ts @@ -0,0 +1,6 @@ +export * from './AvatarEffect'; +export * from './AvatarEffectActivatedParser'; +export * from './AvatarEffectAddedParser'; +export * from './AvatarEffectExpiredParser'; +export * from './AvatarEffectSelectedParser'; +export * from './AvatarEffectsParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/BadgeAndPointLimit.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/BadgeAndPointLimit.ts new file mode 100644 index 0000000..65dcad4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/BadgeAndPointLimit.ts @@ -0,0 +1,25 @@ +import { IMessageDataWrapper } from '../../../../../../api'; + +export class BadgeAndPointLimit +{ + private _badgeId: string; + private _limit: number; + + constructor(k: string, _arg_2: IMessageDataWrapper) + { + if(!_arg_2) throw new Error('invalid_parser'); + + this._badgeId = (('ACH_' + k) + _arg_2.readInt()); + this._limit = _arg_2.readInt(); + } + + public get badgeId(): string + { + return this._badgeId; + } + + public get limit(): number + { + return this._limit; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/BadgePointLimitsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/BadgePointLimitsParser.ts new file mode 100644 index 0000000..3dac378 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/BadgePointLimitsParser.ts @@ -0,0 +1,45 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { BadgeAndPointLimit } from './BadgeAndPointLimit'; + +export class BadgePointLimitsParser implements IMessageParser +{ + private _data: BadgeAndPointLimit[]; + + public flush(): boolean + { + this._data = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let _local_2 = wrapper.readInt(); + + while(_local_2 > 0) + { + const _local_4 = wrapper.readString(); + const _local_5 = wrapper.readInt(); + + let _local_6 = 0; + + while(_local_6 < _local_5) + { + this._data.push(new BadgeAndPointLimit(_local_4, wrapper)); + + _local_6++; + } + + _local_2--; + } + + return true; + } + + public get data(): BadgeAndPointLimit[] + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/BadgeReceivedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/BadgeReceivedParser.ts new file mode 100644 index 0000000..a967211 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/BadgeReceivedParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class BadgeReceivedParser implements IMessageParser +{ + private _badgeId: number; + private _badgeCode: string; + + public flush(): boolean + { + this._badgeId = 0; + this._badgeCode = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._badgeId = wrapper.readInt(); + this._badgeCode = wrapper.readString(); + + return true; + } + + public get badgeId(): number + { + return this._badgeId; + } + + public get badgeCode(): string + { + return this._badgeCode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/BadgesParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/BadgesParser.ts new file mode 100644 index 0000000..9b3f093 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/BadgesParser.ts @@ -0,0 +1,68 @@ +import { AdvancedMap, IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class BadgesParser implements IMessageParser +{ + private _allBadgeCodes: string[]; + private _activeBadgeCodes: string[]; + private _badgeIds: IAdvancedMap; + + public flush(): boolean + { + this._allBadgeCodes = []; + this._activeBadgeCodes = null; + this._badgeIds = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._allBadgeCodes = []; + this._activeBadgeCodes = []; + this._badgeIds = new AdvancedMap(); + + let count = wrapper.readInt(); + + while(count > 0) + { + const badgeId = wrapper.readInt(); + const badgeCode = wrapper.readString(); + + this._badgeIds.add(badgeCode, badgeId); + + this._allBadgeCodes.push(badgeCode); + + count--; + } + + count = wrapper.readInt(); + + while(count > 0) + { + const badgeSlot = wrapper.readInt(); + const badgeCode = wrapper.readString(); + + this._activeBadgeCodes.push(badgeCode); + + count--; + } + + return true; + } + + public getBadgeId(code: string): number + { + return this._badgeIds.getValue(code); + } + public getAllBadgeCodes(): string[] + { + return this._allBadgeCodes; + } + + public getActiveBadgeCodes(): string[] + { + return this._activeBadgeCodes; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/IsBadgeRequestFulfilledParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/IsBadgeRequestFulfilledParser.ts new file mode 100644 index 0000000..3bd6eb2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/IsBadgeRequestFulfilledParser.ts @@ -0,0 +1,32 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class IsBadgeRequestFulfilledParser implements IMessageParser +{ + private _requestCode: string; + private _fulfilled: boolean; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._requestCode = wrapper.readString(); + this._fulfilled = wrapper.readBoolean(); + + return true; + } + + public get requestCode(): string + { + return this._requestCode; + } + + public get fulfilled(): boolean + { + return this._fulfilled; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/index.ts new file mode 100644 index 0000000..5ba1686 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/badges/index.ts @@ -0,0 +1,5 @@ +export * from './BadgeAndPointLimit'; +export * from './BadgePointLimitsParser'; +export * from './BadgeReceivedParser'; +export * from './BadgesParser'; +export * from './IsBadgeRequestFulfilledParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/clothing/FigureSetIdsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/clothing/FigureSetIdsMessageParser.ts new file mode 100644 index 0000000..b3bbbc5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/clothing/FigureSetIdsMessageParser.ts @@ -0,0 +1,50 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class FigureSetIdsMessageParser implements IMessageParser +{ + private _figureSetIds: number[]; + private _boundFurnitureNames: string[]; + + public flush(): boolean + { + this._figureSetIds = []; + this._boundFurnitureNames = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalSetIds = wrapper.readInt(); + + while(totalSetIds > 0) + { + this._figureSetIds.push(wrapper.readInt()); + + totalSetIds--; + } + + let totalFurnitureNames = wrapper.readInt(); + + while(totalFurnitureNames > 0) + { + this._boundFurnitureNames.push(wrapper.readString()); + + totalFurnitureNames--; + } + + return true; + } + + public get figureSetIds(): number[] + { + return this._figureSetIds; + } + + public get boundsFurnitureNames(): string[] + { + return this._boundFurnitureNames; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/clothing/_Str_8728.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/clothing/_Str_8728.ts new file mode 100644 index 0000000..d3da666 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/clothing/_Str_8728.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class _Str_8728 implements IMessageParser +{ + private _itemId: number; + + public flush(): boolean + { + this._itemId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemId = wrapper.readInt(); + + return true; + } + + public get itemId(): number + { + return this._itemId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/clothing/_Str_9021.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/clothing/_Str_9021.ts new file mode 100644 index 0000000..44f2a59 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/clothing/_Str_9021.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class _Str_9021 implements IMessageParser +{ + private _itemId: number; + + public flush(): boolean + { + this._itemId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemId = wrapper.readInt(); + + return true; + } + + public get itemId(): number + { + return this._itemId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/clothing/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/clothing/index.ts new file mode 100644 index 0000000..72484f0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/clothing/index.ts @@ -0,0 +1,3 @@ +export * from './FigureSetIdsMessageParser'; +export * from './_Str_8728'; +export * from './_Str_9021'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListAddOrUpdateParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListAddOrUpdateParser.ts new file mode 100644 index 0000000..1042971 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListAddOrUpdateParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { FurnitureListItemParser } from './FurnitureListItemParser'; + +export class FurnitureListAddOrUpdateParser implements IMessageParser +{ + private _items: FurnitureListItemParser[]; + + public flush(): boolean + { + this._items = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._items.push(new FurnitureListItemParser(wrapper)); + + return true; + } + + public get items(): FurnitureListItemParser[] + { + return this._items; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListInvalidateParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListInvalidateParser.ts new file mode 100644 index 0000000..4d67e1c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListInvalidateParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class FurnitureListInvalidateParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListItemParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListItemParser.ts new file mode 100644 index 0000000..1f4900c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListItemParser.ts @@ -0,0 +1,218 @@ +import { IMessageDataWrapper, IObjectData } from '../../../../../../api'; +import { GetTickerTime } from '../../../../../../pixi-proxy'; +import { FurnitureDataParser } from '../../room'; +import { IFurnitureItemData } from './IFurnitureItemData'; + +export class FurnitureListItemParser implements IFurnitureItemData +{ + private static WALL_ITEM: string = 'I'; + private static FLOOR_ITEM: string = 'S'; + + private _rentable: boolean; + private _itemId: number; + private _furniType: string; + private _ref: number; + private _spriteId: number; + private _category: number; + private _stuffData: IObjectData; + private _isGroupable: boolean; + private _isRecyclable: boolean; + private _tradable: boolean; + private _sellable: boolean; + private _secondsToExpiration: number; + private _extra: number; + private _flatId: number; + private _isWallItem: boolean; + private _hasRentPeriodStarted: boolean; + private _expirationTimeStamp: number; + private _slotId: string; + private _songId: number; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._rentable = false; + this._itemId = 0; + this._furniType = null; + this._ref = 0; + this._spriteId = 0; + this._category = 0; + this._stuffData = null; + this._isGroupable = false; + this._isRecyclable = false; + this._tradable = false; + this._sellable = false; + this._secondsToExpiration = 0; + this._extra = 0; + this._flatId = 0; + this._isWallItem = false; + this._hasRentPeriodStarted = false; + this._expirationTimeStamp = 0; + this._slotId = ''; + this._songId = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemId = wrapper.readInt(); + this._furniType = wrapper.readString(); + this._ref = wrapper.readInt(); + this._spriteId = wrapper.readInt(); + this._category = wrapper.readInt(); + this._stuffData = FurnitureDataParser.parseObjectData(wrapper); + this._isRecyclable = wrapper.readBoolean(); + this._tradable = wrapper.readBoolean(); + this._isGroupable = wrapper.readBoolean(); + this._sellable = wrapper.readBoolean(); + this._secondsToExpiration = wrapper.readInt(); + this._expirationTimeStamp = GetTickerTime(); + + if(this.secondsToExpiration > -1) + { + this._rentable = true; + } + else + { + this._rentable = false; + this._secondsToExpiration = -1; + } + + this._hasRentPeriodStarted = wrapper.readBoolean(); + this._flatId = wrapper.readInt(); + this._isWallItem = (this._furniType === FurnitureListItemParser.WALL_ITEM); + + if(this._furniType === FurnitureListItemParser.FLOOR_ITEM) + { + this._slotId = wrapper.readString(); + this._extra = wrapper.readInt(); + } + + return true; + } + + public get itemId(): number + { + return this._itemId; + } + + public get furniType(): string + { + return this._furniType; + } + + public get ref(): number + { + return this._ref; + } + + public get spriteId(): number + { + return this._spriteId; + } + + public get category(): number + { + return this._category; + } + + public get stuffData(): IObjectData + { + return this._stuffData; + } + + public get isGroupable(): boolean + { + return this._isGroupable; + } + + public get isRecycleable(): boolean + { + return this._isRecyclable; + } + + public get tradable(): boolean + { + return this._tradable; + } + + public get sellable(): boolean + { + return this._sellable; + } + + public get secondsToExpiration(): number + { + return this._secondsToExpiration; + } + + public get flatId(): number + { + return this._flatId; + } + + public get slotId(): string + { + return this._slotId; + } + + public get songId(): number + { + return this._songId; + } + + public get extra(): number + { + return this._extra; + } + + public get rentable(): boolean + { + return this._rentable; + } + + public get isWallItem(): boolean + { + return this._isWallItem; + } + + public get hasRentPeriodStarted(): boolean + { + return this._hasRentPeriodStarted; + } + + public get expirationTimeStamp(): number + { + return this._expirationTimeStamp; + } + + public get creationDay(): number + { + return 0; + } + + public get creationMonth(): number + { + return 0; + } + + public get creationYear(): number + { + return 0; + } + + public get isExternalImageFurni(): boolean + { + return !(this._furniType.indexOf('external_image') === -1); + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListParser.ts new file mode 100644 index 0000000..c986119 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListParser.ts @@ -0,0 +1,54 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { FurnitureListItemParser } from './FurnitureListItemParser'; + +export class FurnitureListParser implements IMessageParser +{ + private _totalFragments: number; + private _fragmentNumber: number; + private _fragment: Map; + + public flush(): boolean + { + this._totalFragments = 0; + this._fragmentNumber = 0; + this._fragment = new Map(); + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._totalFragments = wrapper.readInt(); + this._fragmentNumber = wrapper.readInt(); + + let totalItems = wrapper.readInt(); + + while(totalItems > 0) + { + const item = new FurnitureListItemParser(wrapper); + + if(item) this._fragment.set(item.itemId, item); + + totalItems--; + } + + return true; + } + + public get totalFragments(): number + { + return this._totalFragments; + } + + public get fragmentNumber(): number + { + return this._fragmentNumber; + } + + public get fragment(): Map + { + return this._fragment; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListRemovedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListRemovedParser.ts new file mode 100644 index 0000000..310b6cf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurnitureListRemovedParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class FurnitureListRemovedParser implements IMessageParser +{ + private _itemId: number; + + public flush(): boolean + { + this._itemId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemId = wrapper.readInt(); + + return true; + } + + public get itemId(): number + { + return this._itemId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurniturePostItPlacedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurniturePostItPlacedParser.ts new file mode 100644 index 0000000..7fffc3a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/FurniturePostItPlacedParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class FurniturePostItPlacedParser implements IMessageParser +{ + private _itemId: number; + private _itemsLeft: number; + + public flush(): boolean + { + this._itemId = 0; + this._itemsLeft = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemId = wrapper.readInt(); + this._itemsLeft = wrapper.readInt(); + + return true; + } + + public get itemId(): number + { + return this._itemId; + } + + public get itemsLeft(): number + { + return this._itemsLeft; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/IFurnitureItemData.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/IFurnitureItemData.ts new file mode 100644 index 0000000..ccde1b7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/IFurnitureItemData.ts @@ -0,0 +1,28 @@ +import { IObjectData } from '../../../../../../api'; + +export interface IFurnitureItemData +{ + itemId: number; + furniType: string; + ref: number; + spriteId: number; + category: number; + stuffData: IObjectData; + isGroupable: boolean; + isRecycleable: boolean; + tradable: boolean; + sellable: boolean; + secondsToExpiration: number; + flatId: number; + slotId: string; + songId: number; + extra: number; + rentable: boolean; + isWallItem: boolean; + hasRentPeriodStarted: boolean; + expirationTimeStamp: number; + creationDay: number; + creationMonth: number; + creationYear: number; + isExternalImageFurni: boolean; +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/PresentOpenedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/PresentOpenedMessageParser.ts new file mode 100644 index 0000000..472733b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/PresentOpenedMessageParser.ts @@ -0,0 +1,70 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class PresentOpenedMessageParser implements IMessageParser +{ + private _itemType: string; + private _classId: number; + private _productCode: string; + private _placedItemId: number; + private _placedItemType: string; + private _placedInRoom: boolean; + private _petFigureString: string; + + public flush(): boolean + { + this._itemType = ''; + this._classId = 0; + this._productCode = ''; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemType = wrapper.readString(); + this._classId = wrapper.readInt(); + this._productCode = wrapper.readString(); + this._placedItemId = wrapper.readInt(); + this._placedItemType = wrapper.readString(); + this._placedInRoom = wrapper.readBoolean(); + this._petFigureString = wrapper.readString(); + return true; + } + + public get itemType(): string + { + return this._itemType; + } + + public get classId(): number + { + return this._classId; + } + + public get productCode(): string + { + return this._productCode; + } + + public get placedItemId(): number + { + return this._placedItemId; + } + + public get placedItemType(): string + { + return this._placedItemType; + } + + public get placedInRoom(): boolean + { + return this._placedInRoom; + } + + public get petFigureString(): string + { + return this._petFigureString; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/index.ts new file mode 100644 index 0000000..a56120a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/furniture/index.ts @@ -0,0 +1,8 @@ +export * from './FurnitureListAddOrUpdateParser'; +export * from './FurnitureListInvalidateParser'; +export * from './FurnitureListItemParser'; +export * from './FurnitureListParser'; +export * from './FurnitureListRemovedParser'; +export * from './FurniturePostItPlacedParser'; +export * from './IFurnitureItemData'; +export * from './PresentOpenedMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/index.ts new file mode 100644 index 0000000..01f6a81 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/index.ts @@ -0,0 +1,8 @@ +export * from './achievements'; +export * from './avatareffect'; +export * from './badges'; +export * from './clothing'; +export * from './furniture'; +export * from './pets'; +export * from './purse'; +export * from './trading'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/ConfirmBreedingRequestParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/ConfirmBreedingRequestParser.ts new file mode 100644 index 0000000..0f1b9f2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/ConfirmBreedingRequestParser.ts @@ -0,0 +1,81 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { BreedingPetInfo, RarityCategoryData } from '../../room'; + +export class ConfirmBreedingRequestParser implements IMessageParser +{ + private _nestId: number; + private _pet1: BreedingPetInfo; + private _pet2: BreedingPetInfo; + private _rarityCategories: RarityCategoryData[]; + private _resultPetType: number; + + public flush(): boolean + { + this._nestId = 0; + + if(this._pet1) + { + this._pet1.dispose(); + this._pet1 = null; + } + + if(this._pet2) + { + this._pet2.dispose(); + this._pet2 = null; + } + + for(const k of this._rarityCategories) k && k.dispose(); + + this._rarityCategories = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._nestId = wrapper.readInt(); + this._pet1 = new BreedingPetInfo(wrapper); + this._pet2 = new BreedingPetInfo(wrapper); + + let totalCount = wrapper.readInt(); + + while(totalCount > 0) + { + this._rarityCategories.push(new RarityCategoryData(wrapper)); + + totalCount--; + } + + this._resultPetType = wrapper.readInt(); + + return true; + } + + public get nestId(): number + { + return this._nestId; + } + + public get pet1(): BreedingPetInfo + { + return this._pet1; + } + + public get pet2(): BreedingPetInfo + { + return this._pet2; + } + + public get rarityCategories(): RarityCategoryData[] + { + return this._rarityCategories; + } + + public get resultPetType(): number + { + return this._resultPetType; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/ConfirmBreedingResultParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/ConfirmBreedingResultParser.ts new file mode 100644 index 0000000..4111e1c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/ConfirmBreedingResultParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class ConfirmBreedingResultParser implements IMessageParser +{ + private _breedingNestStuffId: number; + private _result: number; + + public flush(): boolean + { + this._breedingNestStuffId = 0; + this._result = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._breedingNestStuffId = wrapper.readInt(); + this._result = wrapper.readInt(); + + return true; + } + + public get breedingNestStuffId(): number + { + return this._breedingNestStuffId; + } + + public get result(): number + { + return this._result; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/GoToBreedingNestFailureParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/GoToBreedingNestFailureParser.ts new file mode 100644 index 0000000..3fbc2e5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/GoToBreedingNestFailureParser.ts @@ -0,0 +1,25 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class GoToBreedingNestFailureParser implements IMessageParser +{ + public static PET_TOO_TIRED_TO_BREED: number = 6; + + private _reason: number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._reason = wrapper.readInt(); + + return true; + } + + public get reason(): number + { + return this._reason; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/NestBreedingSuccessParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/NestBreedingSuccessParser.ts new file mode 100644 index 0000000..04403b8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/NestBreedingSuccessParser.ts @@ -0,0 +1,33 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class NestBreedingSuccessParser implements IMessageParser +{ + private _rarityCategory: number; + private _petId: number; + + public flush(): boolean + { + this._petId = -1; + this._rarityCategory = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._petId = wrapper.readInt(); + this._rarityCategory = wrapper.readInt(); + + return true; + } + + public get rarityCategory(): number + { + return this._rarityCategory; + } + + public get petId(): number + { + return this._petId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetAddedToInventoryParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetAddedToInventoryParser.ts new file mode 100644 index 0000000..61dec4d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetAddedToInventoryParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { PetData } from './PetData'; + +export class PetAddedToInventoryParser implements IMessageParser +{ + private _pet: PetData; + private _boughtAsGift: boolean; + + public flush(): boolean + { + this._pet = null; + this._boughtAsGift = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._pet = new PetData(wrapper); + this._boughtAsGift = wrapper.readBoolean(); + + return true; + } + + public get pet(): PetData + { + return this._pet; + } + + public get boughtAsGift(): boolean + { + return this._boughtAsGift; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetBreedingMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetBreedingMessageParser.ts new file mode 100644 index 0000000..21c3b72 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetBreedingMessageParser.ts @@ -0,0 +1,47 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class PetBreedingMessageParser implements IMessageParser +{ + public static STATE_CANCEL: number = 1; + public static STATE_ACCEPT: number = 2; + public static STATE_REQUEST: number = 3; + + private _state: number; + private _ownPetId: number; + private _otherPetId: number; + + public flush(): boolean + { + this._state = 0; + this._ownPetId = 0; + this._otherPetId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._state = wrapper.readInt(); + this._ownPetId = wrapper.readInt(); + this._otherPetId = wrapper.readInt(); + + return true; + } + + public get state(): number + { + return this._state; + } + + public get ownPetId(): number + { + return this._ownPetId; + } + + public get otherPetId(): number + { + return this._otherPetId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetData.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetData.ts new file mode 100644 index 0000000..2d014e0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetData.ts @@ -0,0 +1,70 @@ +import { IMessageDataWrapper } from '../../../../../../api'; +import { PetFigureDataParser } from './PetFigureDataParser'; + +export class PetData +{ + private _id: number; + private _name: string; + private _figureData: PetFigureDataParser; + private _level: number; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this._id = wrapper.readInt(); + this._name = wrapper.readString(); + this._figureData = new PetFigureDataParser(wrapper); + this._level = wrapper.readInt(); + } + + public get id(): number + { + return this._id; + } + + public get name(): string + { + return this._name; + } + + public get typeId(): number + { + return this._figureData.typeId; + } + + public get paletteId(): number + { + return this._figureData.paletteId; + } + + public get color(): string + { + return this._figureData.color; + } + + public get breedId(): number + { + return this._figureData.breedId; + } + + public get customPartCount(): number + { + return this._figureData.custompartCount; + } + + public get figureString(): string + { + return this._figureData.figuredata; + } + + public get figureData(): PetFigureDataParser + { + return this._figureData; + } + + public get level(): number + { + return this._level; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetFigureDataParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetFigureDataParser.ts new file mode 100644 index 0000000..4a8a248 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetFigureDataParser.ts @@ -0,0 +1,73 @@ +import { IMessageDataWrapper, IPetFigureData } from '../../../../../../api'; + +export class PetFigureDataParser implements IPetFigureData +{ + private _typeId: number; + private _paletteId: number; + private _color: string; + private _breedId: number; + private _customPartCount: number; + private _customParts: number[]; + + constructor(wrapper: IMessageDataWrapper) + { + this._typeId = wrapper.readInt(); + this._paletteId = wrapper.readInt(); + this._color = wrapper.readString(); + this._breedId = wrapper.readInt(); + this._customParts = []; + this._customPartCount = wrapper.readInt(); + + let i = 0; + + while(i < this._customPartCount) + { + this._customParts.push(wrapper.readInt()); + this._customParts.push(wrapper.readInt()); + this._customParts.push(wrapper.readInt()); + + i++; + } + } + + public get typeId(): number + { + return this._typeId; + } + + public get paletteId(): number + { + return this._paletteId; + } + + public get color(): string + { + return this._color; + } + + public get breedId(): number + { + return this._breedId; + } + + public get figuredata(): string + { + let figure = ((((this.typeId + ' ') + this.paletteId) + ' ') + this.color); + + figure = (figure + (' ' + this.custompartCount)); + + for(const _local_2 of this.customParts) figure = (figure + (' ' + _local_2)); + + return figure; + } + + public get customParts(): number[] + { + return this._customParts; + } + + public get custompartCount(): number + { + return this._customPartCount; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetInventoryParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetInventoryParser.ts new file mode 100644 index 0000000..f37f72c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetInventoryParser.ts @@ -0,0 +1,52 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { PetData } from './PetData'; + +export class PetInventoryParser implements IMessageParser +{ + protected _totalFragments: number; + protected _fragmentNumber: number; + private _fragment: Map; + + public flush(): boolean + { + this._fragment = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._totalFragments = wrapper.readInt(); + this._fragmentNumber = wrapper.readInt(); + + let totalCount: number = wrapper.readInt(); + + this._fragment = new Map(); + + while(totalCount > 0) + { + const petData = new PetData(wrapper); + + this._fragment.set(petData.id, petData); + + totalCount--; + } + + return true; + } + + public get totalFragments(): number + { + return this._totalFragments; + } + + public get fragmentNumber(): number + { + return this._fragmentNumber; + } + + public get fragment(): Map + { + return this._fragment; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetReceivedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetReceivedMessageParser.ts new file mode 100644 index 0000000..8daa91f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetReceivedMessageParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { PetData } from './PetData'; + +export class PetReceivedMessageParser implements IMessageParser +{ + private _boughtAsGift: boolean; + private _pet: PetData; + + public flush(): boolean + { + this._boughtAsGift = false; + this._pet = null; + + return true; + } + + public parse(k: IMessageDataWrapper): boolean + { + this._boughtAsGift = k.readBoolean(); + this._pet = new PetData(k); + + return true; + } + + public get boughtAsGift(): boolean + { + return this._boughtAsGift; + } + + public get pet(): PetData + { + return this._pet; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetRemovedFromInventoryParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetRemovedFromInventoryParser.ts new file mode 100644 index 0000000..6ca8291 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/PetRemovedFromInventoryParser.ts @@ -0,0 +1,25 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class PetRemovedFromInventoryParser implements IMessageParser +{ + private _petId: number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._petId = wrapper.readInt(); + + return true; + } + + public get petId(): number + { + return this._petId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/index.ts new file mode 100644 index 0000000..a69532a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/pets/index.ts @@ -0,0 +1,11 @@ +export * from './ConfirmBreedingRequestParser'; +export * from './ConfirmBreedingResultParser'; +export * from './GoToBreedingNestFailureParser'; +export * from './NestBreedingSuccessParser'; +export * from './PetAddedToInventoryParser'; +export * from './PetBreedingMessageParser'; +export * from './PetData'; +export * from './PetFigureDataParser'; +export * from './PetInventoryParser'; +export * from './PetReceivedMessageParser'; +export * from './PetRemovedFromInventoryParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/purse/UserCreditsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/purse/UserCreditsMessageParser.ts new file mode 100644 index 0000000..7aafca2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/purse/UserCreditsMessageParser.ts @@ -0,0 +1,25 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class UserCreditsMessageParser implements IMessageParser +{ + private _balance: number; + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._balance = parseFloat(wrapper.readString()); + + return true; + } + + public flush(): boolean + { + return true; + } + + public get balance(): number + { + return this._balance; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/purse/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/purse/index.ts new file mode 100644 index 0000000..720991a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/purse/index.ts @@ -0,0 +1 @@ +export * from './UserCreditsMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/ItemDataStructure.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/ItemDataStructure.ts new file mode 100644 index 0000000..b653c3e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/ItemDataStructure.ts @@ -0,0 +1,162 @@ +import { IMessageDataWrapper, IObjectData } from '../../../../../../api'; +import { GetTickerTime } from '../../../../../../pixi-proxy'; +import { FurnitureDataParser } from '../../room'; +import { IFurnitureItemData } from '../furniture'; + +export class ItemDataStructure implements IFurnitureItemData +{ + private _expirationTimeStamp: number; + private _isWallItem: boolean; + private _itemId: number; + private _furniType: string; + private _ref: number; + private _spriteId: number; + private _category: number; + private _stuffData: IObjectData; + private _extra: number; + private _secondsToExpiration: number; + private _creationDay: number; + private _creationMonth: number; + private _creationYear: number; + private _isGroupable: boolean; + private _songId: number; + private _flatId: number; + private _rentable: boolean; + private _hasRentPeriodStarted: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + this._itemId = wrapper.readInt(); + this._furniType = wrapper.readString().toUpperCase(); + this._ref = wrapper.readInt(); + this._spriteId = wrapper.readInt(); + this._category = wrapper.readInt(); + this._isGroupable = wrapper.readBoolean(); + this._stuffData = FurnitureDataParser.parseObjectData(wrapper); + this._secondsToExpiration = -1; + this._expirationTimeStamp = GetTickerTime(); + this._hasRentPeriodStarted = false; + this._creationDay = wrapper.readInt(); + this._creationMonth = wrapper.readInt(); + this._creationYear = wrapper.readInt(); + this._extra = ((this.furniType === 'S') ? wrapper.readInt() : -1); + this._flatId = -1; + this._rentable = false; + this._isWallItem = (this._furniType === 'I'); + } + + public get itemId(): number + { + return this._itemId; + } + + public get furniType(): string + { + return this._furniType; + } + + public get ref(): number + { + return this._ref; + } + + public get spriteId(): number + { + return this._spriteId; + } + + public get category(): number + { + return this._category; + } + + public get stuffData(): IObjectData + { + return this._stuffData; + } + + public get extra(): number + { + return this._extra; + } + + public get secondsToExpiration(): number + { + return this._secondsToExpiration; + } + + public get creationDay(): number + { + return this._creationDay; + } + + public get creationMonth(): number + { + return this._creationMonth; + } + + public get creationYear(): number + { + return this._creationYear; + } + + public get isGroupable(): boolean + { + return this._isGroupable; + } + + public get songId(): number + { + return this._extra; + } + + public get flatId(): number + { + return this._flatId; + } + + public get rentable(): boolean + { + return this._rentable; + } + + public get isWallItem(): boolean + { + return this._isWallItem; + } + + public get hasRentPeriodStarted(): boolean + { + return this._hasRentPeriodStarted; + } + + public get expirationTimeStamp(): number + { + return this._expirationTimeStamp; + } + + public get isRecycleable(): boolean + { + return true; + } + + public get tradable(): boolean + { + return true; + } + + public get sellable(): boolean + { + return true; + } + + public get slotId(): string + { + return null; + } + + public get isExternalImageFurni(): boolean + { + return (this._furniType.indexOf('external_image') !== -1); + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingAcceptParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingAcceptParser.ts new file mode 100644 index 0000000..89fbae2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingAcceptParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class TradingAcceptParser implements IMessageParser +{ + private _userID: number; + private _userAccepts: boolean; + + public flush(): boolean + { + this._userID = -1; + this._userAccepts = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._userID = wrapper.readInt(); + this._userAccepts = (wrapper.readInt() > 0); + + return true; + } + + public get userID(): number + { + return this._userID; + } + + public get userAccepts(): boolean + { + return this._userAccepts; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingCloseParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingCloseParser.ts new file mode 100644 index 0000000..3fb2322 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingCloseParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class TradingCloseParser implements IMessageParser +{ + public static ERROR_WHILE_COMMIT: number = 1; + + private _userId: number; + private _reason: number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._userId = wrapper.readInt(); + this._reason = wrapper.readInt(); + + return true; + } + + public get userID(): number + { + return this._userId; + } + + public get reason(): number + { + return this._reason; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingCompletedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingCompletedParser.ts new file mode 100644 index 0000000..bb3e99d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingCompletedParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class TradingCompletedParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingConfirmationParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingConfirmationParser.ts new file mode 100644 index 0000000..86657e4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingConfirmationParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class TradingConfirmationParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingListItemParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingListItemParser.ts new file mode 100644 index 0000000..b0a1857 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingListItemParser.ts @@ -0,0 +1,105 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { ItemDataStructure } from './ItemDataStructure'; + +export class TradingListItemParser implements IMessageParser +{ + private _firstUserID: number; + private _firstUserItemArray: ItemDataStructure[]; + private _firstUserNumItems: number; + private _firstUserNumCredits: number; + private _secondUserID: number; + private _secondUserItemArray: ItemDataStructure[]; + private _secondUserNumItems: number; + private _secondUserNumCredits: number; + + public flush(): boolean + { + this._firstUserID = -1; + this._firstUserItemArray = null; + this._firstUserNumItems = 0; + this._firstUserNumCredits = 0; + this._secondUserID = -1; + this._secondUserItemArray = null; + this._secondUserNumItems = 0; + this._secondUserNumCredits = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._firstUserID = wrapper.readInt(); + this._firstUserItemArray = []; + + if(!this.parseItems(wrapper, this._firstUserItemArray)) return false; + + this._firstUserNumItems = wrapper.readInt(); + this._firstUserNumCredits = wrapper.readInt(); + + this._secondUserID = wrapper.readInt(); + this._secondUserItemArray = []; + + if(!this.parseItems(wrapper, this._secondUserItemArray)) return false; + + this._secondUserNumItems = wrapper.readInt(); + this._secondUserNumCredits = wrapper.readInt(); + + return true; + } + + private parseItems(k: IMessageDataWrapper, itemArray: ItemDataStructure[]): boolean + { + let count = k.readInt(); + + while(count > 0) + { + itemArray.push(new ItemDataStructure(k)); + + count--; + } + + return true; + } + + public get firstUserID(): number + { + return this._firstUserID; + } + + public get firstUserItemArray(): ItemDataStructure[] + { + return this._firstUserItemArray; + } + + public get firstUserNumItems(): number + { + return this._firstUserNumItems; + } + + public get firstUserNumCredits(): number + { + return this._firstUserNumCredits; + } + + public get secondUserID(): number + { + return this._secondUserID; + } + + public get secondUserItemArray(): ItemDataStructure[] + { + return this._secondUserItemArray; + } + + public get secondUserNumItems(): number + { + return this._secondUserNumItems; + } + + public get secondUserNumCredits(): number + { + return this._secondUserNumCredits; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingNoSuchItemParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingNoSuchItemParser.ts new file mode 100644 index 0000000..876a825 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingNoSuchItemParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class TradingNoSuchItemParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingNotOpenParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingNotOpenParser.ts new file mode 100644 index 0000000..07082a5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingNotOpenParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class TradingNotOpenParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingOpenFailedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingOpenFailedParser.ts new file mode 100644 index 0000000..f28af5d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingOpenFailedParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class TradingOpenFailedParser implements IMessageParser +{ + public static REASON_YOU_ARE_ALREADY_TRADING: number = 7; + public static REASON_OTHER_USER_ALREADY_TRADING: number = 8; + + private _reason: number; + private _otherUserName: string; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._reason = wrapper.readInt(); + this._otherUserName = wrapper.readString(); + + return true; + } + + public get reason(): number + { + return this._reason; + } + + public get otherUserName(): string + { + return this._otherUserName; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingOpenParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingOpenParser.ts new file mode 100644 index 0000000..0717cce --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingOpenParser.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class TradingOpenParser implements IMessageParser +{ + private _userId: number; + private _userCanTrade: boolean; + private _otherUserId: number; + private _otherUserCanTrade: boolean; + + public flush(): boolean + { + this._userId = -1; + this._userCanTrade = false; + this._otherUserId = -1; + this._otherUserCanTrade = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._userId = wrapper.readInt(); + this._userCanTrade = (wrapper.readInt() === 1); + this._otherUserId = wrapper.readInt(); + this._otherUserCanTrade = (wrapper.readInt() === 1); + + return true; + } + + public get userID(): number + { + return this._userId; + } + + public get userCanTrade(): boolean + { + return this._userCanTrade; + } + + public get otherUserID(): number + { + return this._otherUserId; + } + + public get otherUserCanTrade(): boolean + { + return this._otherUserCanTrade; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingOtherNotAllowedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingOtherNotAllowedParser.ts new file mode 100644 index 0000000..8db36da --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingOtherNotAllowedParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class TradingOtherNotAllowedParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingYouAreNotAllowedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingYouAreNotAllowedParser.ts new file mode 100644 index 0000000..854dc72 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/TradingYouAreNotAllowedParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class TradingYouAreNotAllowedParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/index.ts new file mode 100644 index 0000000..cc51bb9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/inventory/trading/index.ts @@ -0,0 +1,12 @@ +export * from './ItemDataStructure'; +export * from './TradingAcceptParser'; +export * from './TradingCloseParser'; +export * from './TradingCompletedParser'; +export * from './TradingConfirmationParser'; +export * from './TradingListItemParser'; +export * from './TradingNoSuchItemParser'; +export * from './TradingNotOpenParser'; +export * from './TradingOpenFailedParser'; +export * from './TradingOpenParser'; +export * from './TradingOtherNotAllowedParser'; +export * from './TradingYouAreNotAllowedParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/landingview/PromoArticleData.ts b/submodules/renderer/src/nitro/communication/messages/parser/landingview/PromoArticleData.ts new file mode 100644 index 0000000..088569c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/landingview/PromoArticleData.ts @@ -0,0 +1,62 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class PromoArticleData +{ + public static readonly LINK_TYPE_URL = 0; + public static readonly LINK_TYPE_INTERNAL = 1; + public static readonly LINK_TYPE_NO_LINK = 2; + + private _id: number; + private _title: string; + private _bodyText: string; + private _buttonText: string; + private _linkType: number; + private _linkContent: string; + private _imageUrl: string; + + constructor(k: IMessageDataWrapper) + { + this._id = k.readInt(); + this._title = k.readString(); + this._bodyText = k.readString(); + this._buttonText = k.readString(); + this._linkType = k.readInt(); + this._linkContent = k.readString(); + this._imageUrl = k.readString(); + } + + public get id(): number + { + return this._id; + } + + public get title(): string + { + return this._title; + } + + public get bodyText(): string + { + return this._bodyText; + } + + public get buttonText(): string + { + return this._buttonText; + } + + public get linkType(): number + { + return this._linkType; + } + + public get linkContent(): string + { + return this._linkContent; + } + + public get imageUrl(): string + { + return this._imageUrl; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/landingview/PromoArticlesMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/landingview/PromoArticlesMessageParser.ts new file mode 100644 index 0000000..d430b46 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/landingview/PromoArticlesMessageParser.ts @@ -0,0 +1,32 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { PromoArticleData } from './PromoArticleData'; + +export class PromoArticlesMessageParser implements IMessageParser +{ + private _articles: PromoArticleData[]; + + public flush(): boolean + { + this._articles = []; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + this._articles.push(new PromoArticleData(wrapper)); + } + + return true; + } + + public get articles(): PromoArticleData[] + { + return this._articles; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/landingview/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/landingview/index.ts new file mode 100644 index 0000000..2d3eae4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/landingview/index.ts @@ -0,0 +1,3 @@ +export * from './PromoArticleData'; +export * from './PromoArticlesMessageParser'; +export * from './votes'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/landingview/votes/CommunityVoteReceivedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/landingview/votes/CommunityVoteReceivedParser.ts new file mode 100644 index 0000000..4c3a8d1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/landingview/votes/CommunityVoteReceivedParser.ts @@ -0,0 +1,23 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class CommunityVoteReceivedParser implements IMessageParser +{ + private _acknowledged: boolean; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + this._acknowledged = wrapper.readBoolean(); + return true; + } + + public get acknowledged(): boolean + { + return this._acknowledged; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/landingview/votes/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/landingview/votes/index.ts new file mode 100644 index 0000000..4a0e00f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/landingview/votes/index.ts @@ -0,0 +1 @@ +export * from './CommunityVoteReceivedParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceBuyOfferResultParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceBuyOfferResultParser.ts new file mode 100644 index 0000000..7ca6931 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceBuyOfferResultParser.ts @@ -0,0 +1,50 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class MarketplaceBuyOfferResultParser implements IMessageParser +{ + private _result: number; + private _newOfferId: number; + private _newPrice: number; + private _requestedOfferId: number; + + public flush(): boolean + { + this._newOfferId = -1; + this._newPrice = 0; + this._requestedOfferId = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._result = wrapper.readInt(); + this._newOfferId = wrapper.readInt(); + this._newPrice = wrapper.readInt(); + this._requestedOfferId = wrapper.readInt(); + + return true; + } + + public get result(): number + { + return this._result; + } + + public get offerId(): number + { + return this._newOfferId; + } + + public get newPrice(): number + { + return this._newPrice; + } + + public get requestedOfferId(): number + { + return this._requestedOfferId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceCanMakeOfferResultParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceCanMakeOfferResultParser.ts new file mode 100644 index 0000000..375f0bc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceCanMakeOfferResultParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class MarketplaceCanMakeOfferResultParser implements IMessageParser +{ + private _tokenCount: number; + private _result: number; + + public flush(): boolean + { + this._tokenCount = 0; + this._result = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._result = wrapper.readInt(); + this._tokenCount = wrapper.readInt(); + + return true; + } + + public get tokenCount(): number + { + return this._tokenCount; + } + + public get resultCode(): number + { + return this._result; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceCancelOfferResultParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceCancelOfferResultParser.ts new file mode 100644 index 0000000..5891af3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceCancelOfferResultParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class MarketplaceCancelOfferResultParser implements IMessageParser +{ + private _offerId: number; + private _success: boolean; + + public flush(): boolean + { + this._offerId = 0; + this._success = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._offerId = wrapper.readInt(); + this._success = wrapper.readBoolean(); + + return true; + } + + public get offerId(): number + { + return this._offerId; + } + + public get success(): boolean + { + return this._success; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceConfigurationMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceConfigurationMessageParser.ts new file mode 100644 index 0000000..5d4b125 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceConfigurationMessageParser.ts @@ -0,0 +1,83 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class MarketplaceConfigurationMessageParser implements IMessageParser +{ + private _enabled: boolean; + private _commission: number; + private _credits: number; + private _advertisements: number; + private _maximumPrice: number; + private _minimumPrice: number; + private _offerTime: number; + private _displayTime: number; + + public flush(): boolean + { + this._enabled = false; + this._commission = 0; + this._credits = 0; + this._advertisements = 0; + this._maximumPrice = 0; + this._minimumPrice = 0; + this._offerTime = 0; + this._displayTime = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._enabled = wrapper.readBoolean(); + this._commission = wrapper.readInt(); + this._credits = wrapper.readInt(); + this._advertisements = wrapper.readInt(); + this._minimumPrice = wrapper.readInt(); + this._maximumPrice = wrapper.readInt(); + this._offerTime = wrapper.readInt(); + this._displayTime = wrapper.readInt(); + + return true; + } + + public get enabled(): boolean + { + return this._enabled; + } + + public get commission(): number + { + return this._commission; + } + + public get credits(): number + { + return this._credits; + } + + public get advertisements(): number + { + return this._advertisements; + } + + public get minimumPrice(): number + { + return this._minimumPrice; + } + + public get maximumPrice(): number + { + return this._maximumPrice; + } + + public get offerTime(): number + { + return this._offerTime; + } + + public get displayTime(): number + { + return this._displayTime; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceItemPostedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceItemPostedParser.ts new file mode 100644 index 0000000..e8c42d0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceItemPostedParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class MarketplaceMakeOfferResultParser implements IMessageParser +{ + private _result: number; + + public flush(): boolean + { + this._result = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._result = wrapper.readInt(); + + return true; + } + + public get result(): number + { + return this._result; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceItemStatsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceItemStatsParser.ts new file mode 100644 index 0000000..81e230a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceItemStatsParser.ts @@ -0,0 +1,92 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class MarketplaceItemStatsParser implements IMessageParser +{ + private _averagePrice: number; + private _currentOfferCount: number; + private _historyLength: number; + private _dayOffsets: number[]; + private _averagePrices: number[]; + private _soldAmounts: number[]; + private _furniTypeId: number; + private _furniCategoryId: number; + + public flush(): boolean + { + this._averagePrice = 0; + this._currentOfferCount = 0; + this._historyLength = 0; + this._dayOffsets = []; + this._averagePrices = []; + this._soldAmounts = []; + this._furniTypeId = 0; + this._furniCategoryId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._averagePrice = wrapper.readInt(); + this._currentOfferCount = wrapper.readInt(); + this._historyLength = wrapper.readInt(); + + let count = wrapper.readInt(); + + while(count > 0) + { + this._dayOffsets.push(wrapper.readInt()); + this._averagePrices.push(wrapper.readInt()); + this._soldAmounts.push(wrapper.readInt()); + + count--; + } + + this._furniCategoryId = wrapper.readInt(); + this._furniTypeId = wrapper.readInt(); + + return true; + } + + public get averagePrice(): number + { + return this._averagePrice; + } + + public get offerCount(): number + { + return this._currentOfferCount; + } + + public get historyLength(): number + { + return this._historyLength; + } + + public get dayOffsets(): number[] + { + return this._dayOffsets; + } + + public get averagePrices(): number[] + { + return this._averagePrices; + } + + public get soldAmounts(): number[] + { + return this._soldAmounts; + } + + public get furniTypeId(): number + { + return this._furniTypeId; + } + + public get furniCategoryId(): number + { + return this._furniCategoryId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceOffer.ts b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceOffer.ts new file mode 100644 index 0000000..bd38dad --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceOffer.ts @@ -0,0 +1,84 @@ +import { IObjectData } from '../../../../../api'; + +export class MarketplaceOffer +{ + private readonly _offerId: number; + private readonly _furniId: number; + private readonly _furniType: number; + private readonly _extraData: string; + private readonly _stuffData: IObjectData; + private readonly _price: number; + private readonly _status: number; + private readonly _timeLeftMinutes: number = -1; + private readonly _averagePrice: number; + private readonly _offerCount: number; + + constructor(offerId: number, furniId: number, furniType: number, extraData: string, stuffData: IObjectData, price: number, status: number, timeLeftMinutes: number, averagePrice: number, offerCount: number = -1) + { + this._offerId = offerId; + this._furniId = furniId; + this._furniType = furniType; + this._extraData = extraData; + this._stuffData = stuffData; + this._price = price; + this._status = status; + this._timeLeftMinutes = timeLeftMinutes; + this._averagePrice = averagePrice; + this._offerCount = offerCount; + } + + public get offerId(): number + { + return this._offerId; + } + + public get furniId(): number + { + return this._furniId; + } + + public get furniType(): number + { + return this._furniType; + } + + public get extraData(): string + { + return this._extraData; + } + + public get stuffData(): IObjectData + { + return this._stuffData; + } + + public get price(): number + { + return this._price; + } + + public get status(): number + { + return this._status; + } + + public get timeLeftMinutes(): number + { + return this._timeLeftMinutes; + } + + public get averagePrice(): number + { + return this._averagePrice; + } + + public get offerCount(): number + { + return this._offerCount; + } + + public get isUniqueLimitedItem(): boolean + { + return (!(this.stuffData == null)) && (this.stuffData.uniqueSeries > 0); + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceOfferData.ts b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceOfferData.ts new file mode 100644 index 0000000..287df48 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceOfferData.ts @@ -0,0 +1,128 @@ +import { IObjectData } from '../../../../../api'; + +export class MarketplaceOfferData +{ + public static TYPE_LANDSCAPE: number = 1; + public static TYPE_FLOOR: number = 2; + + private _offerId: number; + private _furniId: number; + private _furniType: number; + private _extraData: string; + private _stuffData: IObjectData; + private _price: number; + private _averagePrice: number; + private _imageCallback: number; + private _status: number; + private _timeLeftMinutes: number = -1; + private _offerCount: number; + private _image: string; + + constructor(offerId: number, furniId: number, furniType: number, extraData: string, stuffData: IObjectData, price: number, status: number, averagePrice: number, offerCount: number = -1) + { + this._offerId = offerId; + this._furniId = furniId; + this._furniType = furniType; + this._extraData = extraData; + this._stuffData = stuffData; + this._price = price; + this._status = status; + this._averagePrice = averagePrice; + this._offerCount = offerCount; + } + + public get offerId(): number + { + return this._offerId; + } + + public set offerId(offerId: number) + { + this._offerId = offerId; + } + + public get furniId(): number + { + return this._furniId; + } + + public get furniType(): number + { + return this._furniType; + } + + public get extraData(): string + { + return this._extraData; + } + + public get stuffData(): IObjectData + { + return this._stuffData; + } + + public get price(): number + { + return this._price; + } + + public set price(price: number) + { + this._price = price; + } + + public get averagePrice(): number + { + return this._averagePrice; + } + + public get image(): string + { + return this._image; + } + + public set image(image: string) + { + this._image = image; + } + + public get imageCallback(): number + { + return this._imageCallback; + } + + public set imageCallback(callback: number) + { + this._imageCallback = callback; + } + + public get status(): number + { + return this._status; + } + + public get timeLeftMinutes(): number + { + return this._timeLeftMinutes; + } + + public set timeLeftMinutes(minutes: number) + { + this._timeLeftMinutes = minutes; + } + + public get offerCount(): number + { + return this._offerCount; + } + + public set offerCount(count: number) + { + this._offerCount = count; + } + + public get isUniqueLimitedItem(): boolean + { + return (this.stuffData && (this.stuffData.uniqueSeries > 0)); + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceOffersParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceOffersParser.ts new file mode 100644 index 0000000..133ba03 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceOffersParser.ts @@ -0,0 +1,89 @@ +import { IMessageDataWrapper, IMessageParser, IObjectData, LegacyDataType, ObjectDataFactory } from '../../../../../api'; +import { FurnitureDataParser } from '../room'; +import { MarketplaceOffer } from './MarketplaceOffer'; + +export class MarketplaceOffersParser implements IMessageParser +{ + private static FURNITYPE_STUFF: number = 1; + private static FURNITYPE_WALL: number = 2; + private static FAKE_FURNITYPE_UNIQUE: number = 3; + + private readonly MAX_LIST_LENGTH = 500; + + private _offers: MarketplaceOffer[]; + private _totalItemsFound: number; + + public flush(): boolean + { + this._offers = []; + this._totalItemsFound = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + const count = wrapper.readInt(); + + let i = 0; + + while(i < count) + { + const offerId = wrapper.readInt(); + const status = wrapper.readInt(); + let furniType = wrapper.readInt(); + + let furniId = -1; + let extraData = ''; + let stuffData: IObjectData = null; + + if(furniType === MarketplaceOffersParser.FURNITYPE_STUFF) + { + furniId = wrapper.readInt(); + stuffData = FurnitureDataParser.parseObjectData(wrapper); + } + + else if(furniType === MarketplaceOffersParser.FURNITYPE_WALL) + { + furniId = wrapper.readInt(); + extraData = wrapper.readString(); + } + + else if(furniType == MarketplaceOffersParser.FAKE_FURNITYPE_UNIQUE) + { + furniId = wrapper.readInt(); + stuffData = ObjectDataFactory.getData(LegacyDataType.FORMAT_KEY); + stuffData.uniqueNumber = wrapper.readInt(); + stuffData.uniqueSeries = wrapper.readInt(); + furniType = MarketplaceOffersParser.FURNITYPE_STUFF; + } + + const price = wrapper.readInt(); + const timeLeftMinutes = wrapper.readInt(); + const averagePrice = wrapper.readInt(); + const offerCount = wrapper.readInt(); + + const offerItem = new MarketplaceOffer(offerId, furniId, furniType, extraData, stuffData, price, status, timeLeftMinutes, averagePrice, offerCount); + + if(i < this.MAX_LIST_LENGTH) this._offers.push(offerItem); + + i++; + } + + this._totalItemsFound = wrapper.readInt(); + + return true; + } + + public get offers(): MarketplaceOffer[] + { + return this._offers; + } + + public get totalItemsFound(): number + { + return this._totalItemsFound; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceOwnOffersParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceOwnOffersParser.ts new file mode 100644 index 0000000..60fd422 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/MarketplaceOwnOffersParser.ts @@ -0,0 +1,88 @@ +import { IMessageDataWrapper, IMessageParser, IObjectData, LegacyDataType, ObjectDataFactory } from '../../../../../api'; +import { MarketplaceOffer } from './MarketplaceOffer'; + +export class MarketplaceOwnOffersParser implements IMessageParser +{ + private static MAX_LIST_LENGTH = 500; + private _offers: MarketplaceOffer[]; + private _creditsWaiting: number; + + + public flush(): boolean + { + this._offers = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._offers = []; + this._creditsWaiting = wrapper.readInt(); // SoldPriceTotal + + const offerCount = wrapper.readInt(); + for(let i = 0; i < offerCount; i++) + { + const offerId = wrapper.readInt(); + const status = wrapper.readInt(); + let furniType = wrapper.readInt(); + + let furniId; + let extraData; + let stuffData: IObjectData; + if(furniType == 1) + { + furniId = wrapper.readInt(); + stuffData = this.getStuffData(wrapper); + } + else + { + if(furniType == 2) + { + furniId = wrapper.readInt(); + extraData = wrapper.readString(); + } + else if(furniType == 3) + { + furniId = wrapper.readInt(); + stuffData = ObjectDataFactory.getData(LegacyDataType.FORMAT_KEY); + stuffData.uniqueNumber = wrapper.readInt(); + stuffData.uniqueSeries = wrapper.readInt(); + furniType = 1; + } + } + + const price = wrapper.readInt(); + const local9 = wrapper.readInt(); + const local10 = wrapper.readInt(); + const local13 = new MarketplaceOffer(offerId, furniId, furniType, extraData, stuffData, price, status, local9, local10); + + if(i < MarketplaceOwnOffersParser.MAX_LIST_LENGTH) + { + this._offers.push(local13); + } + } + + return true; + } + + public get offers(): MarketplaceOffer[] + { + return this._offers; + } + + public get creditsWaiting(): number + { + return this._creditsWaiting; + } + + private getStuffData(wrapper: IMessageDataWrapper): IObjectData + { + const local2 = wrapper.readInt(); + const local3 = ObjectDataFactory.getData(local2); + local3.parseWrapper(wrapper); + return local3; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/marketplace/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/index.ts new file mode 100644 index 0000000..3b77f7e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/marketplace/index.ts @@ -0,0 +1,10 @@ +export * from './MarketplaceBuyOfferResultParser'; +export * from './MarketplaceCancelOfferResultParser'; +export * from './MarketplaceCanMakeOfferResultParser'; +export * from './MarketplaceConfigurationMessageParser'; +export * from './MarketplaceItemPostedParser'; +export * from './MarketplaceItemStatsParser'; +export * from './MarketplaceOffer'; +export * from './MarketplaceOfferData'; +export * from './MarketplaceOffersParser'; +export * from './MarketplaceOwnOffersParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/CfhChatlogData.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/CfhChatlogData.ts new file mode 100644 index 0000000..b9cc8bd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/CfhChatlogData.ts @@ -0,0 +1,45 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { ChatRecordData } from './ChatRecordData'; + +export class CfhChatlogData +{ + private _issueId: number; + private _callerUserId: number; + private _reportedUserId: number; + private _chatRecordId: number; + private _chatRecord: ChatRecordData; + + constructor(k: IMessageDataWrapper) + { + this._issueId = k.readInt(); + this._callerUserId = k.readInt(); + this._reportedUserId = k.readInt(); + this._chatRecordId = k.readInt(); + this._chatRecord = new ChatRecordData(k); + } + + public get issueId(): number + { + return this._issueId; + } + + public get callerUserId(): number + { + return this._callerUserId; + } + + public get reportedUserId(): number + { + return this._reportedUserId; + } + + public get chatRecordId(): number + { + return this._chatRecordId; + } + + public get chatRecord(): ChatRecordData + { + return this._chatRecord; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/CfhChatlogMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/CfhChatlogMessageParser.ts new file mode 100644 index 0000000..40edaac --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/CfhChatlogMessageParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CfhChatlogData } from './CfhChatlogData'; + +export class CfhChatlogMessageParser implements IMessageParser +{ + private _data: CfhChatlogData; + + public flush(): boolean + { + this._data = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._data = new CfhChatlogData(wrapper); + + return true; + } + + public get data(): CfhChatlogData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/ChatRecordData.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ChatRecordData.ts new file mode 100644 index 0000000..e4c1e4d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ChatRecordData.ts @@ -0,0 +1,110 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { ChatlineData } from './ChatlineData'; + +export class ChatRecordData +{ + public static readonly TYPE_SIMPLE = 0; + public static readonly TYPE_ROOM_CHAT = 1; + public static readonly TYPE_IM_SESSION = 2; + public static readonly TYPE_DISCUSSION_THREAD = 3; + public static readonly TYPE_DISCUSSION_MESSAGE = 4; + public static readonly TYPE_SELFIE = 5; + public static readonly TYPE_PHOTO = 6; + + private _recordType: number; + private _context: Map; + private _chatlog: ChatlineData[]; + + constructor(wrapper: IMessageDataWrapper) + { + this._context = new Map(); + this._chatlog = []; + + this._recordType = wrapper.readByte(); + const contextCount = wrapper.readShort(); + + for(let i = 0; i < contextCount; i++) + { + const key = wrapper.readString(); + const type = wrapper.readByte(); + + switch(type) + { + case 0: + this._context.set(key, wrapper.readBoolean()); + break; + case 1: + this._context.set(key, wrapper.readInt()); + break; + case 2: + this._context.set(key, wrapper.readString()); + break; + default: + throw new Error('Unknown data type ' + type); + } + } + + const chatCount = wrapper.readShort(); + + for(let i = 0; i < chatCount; i++) + { + const timestamp = wrapper.readString(); + const habboId = wrapper.readInt(); + const username = wrapper.readString(); + const message = wrapper.readString(); + const hasHighlighting = wrapper.readBoolean(); + + this._chatlog.push(new ChatlineData(timestamp, habboId, username, message, hasHighlighting)); + } + } + + public get recordType(): number + { + return this._recordType; + } + + public get context(): Map + { + return this._context; + } + + public get chatlog(): ChatlineData[] + { + return this._chatlog; + } + + public get roomId(): number + { + return this.getInt('roomId'); + } + + public get roomName(): string + { + return this._context.get('roomName') as string; + } + + public get groupId(): number + { + return this.getInt('groupId'); + } + + public get threadId(): number + { + return this.getInt('threadId'); + } + + public get messageId(): number + { + return this.getInt('messageId'); + } + + private getInt(k: string): number + { + const value = this._context.get(k); + if(!value) + { + return 0; + } + return value as number; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/ChatlineData.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ChatlineData.ts new file mode 100644 index 0000000..32432b7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ChatlineData.ts @@ -0,0 +1,42 @@ +export class ChatlineData +{ + private readonly _timestamp: string; + private readonly _habboId: number; + private readonly _username: string; + private readonly _message: string; + private readonly _hasHighlighting: boolean; + + constructor(timestamp: string, habboId: number, username: string, message: string, hasHighlighting: boolean) + { + this._timestamp = timestamp; + this._habboId = habboId; + this._username = username; + this._message = message; + this._hasHighlighting = hasHighlighting; + } + + public get timestamp(): string + { + return this._timestamp; + } + + public get userId(): number + { + return this._habboId; + } + + public get userName(): string + { + return this._username; + } + + public get message(): string + { + return this._message; + } + + public get hasHighlighting(): boolean + { + return this._hasHighlighting; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/INamed.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/INamed.ts new file mode 100644 index 0000000..3a74243 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/INamed.ts @@ -0,0 +1,4 @@ +export interface INamed +{ + name: string; +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/IssueDeletedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/IssueDeletedMessageParser.ts new file mode 100644 index 0000000..0471b09 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/IssueDeletedMessageParser.ts @@ -0,0 +1,22 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class IssueDeletedMessageParser implements IMessageParser +{ + private _issueId: number; + + public flush(): boolean + { + return true; + } + + public parse(k: IMessageDataWrapper): boolean + { + this._issueId = parseInt(k.readString()); + return true; + } + + public get issueId(): number + { + return this._issueId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/IssueInfoMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/IssueInfoMessageParser.ts new file mode 100644 index 0000000..766095a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/IssueInfoMessageParser.ts @@ -0,0 +1,52 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { IssueMessageData } from './IssueMessageData'; +import { PatternMatchData } from './PatternMatchData'; + +export class IssueInfoMessageParser implements IMessageParser +{ + private _issueData: IssueMessageData; + + + public get issueData(): IssueMessageData + { + return this._issueData; + } + + public flush(): boolean + { + this._issueData = null; + return true; + } + + public parse(k: IMessageDataWrapper): boolean + { + const issueId: number = k.readInt(); + const state: number = k.readInt(); + const categoryId: number = k.readInt(); + const reportedCategoryId: number = k.readInt(); + const issueAgeInMs: number = k.readInt(); + const priority: number = k.readInt(); + const groupingId: number = k.readInt(); + const reporterUserId: number = k.readInt(); + const reporterUsername: string = k.readString(); + const reportedUserId: number = k.readInt(); + const reportedUsername: string = k.readString(); + const pickerUserId: number = k.readInt(); + const pickerUsername: string = k.readString(); + const message: string = k.readString(); + const chatRecordId: number = k.readInt(); + + const patternsCount: number = k.readInt(); + const patterns: PatternMatchData[] = []; + + for(let i = 0; i < patternsCount; i++) + { + patterns.push(new PatternMatchData(k)); + } + + this._issueData = new IssueMessageData(issueId, state, categoryId, reportedCategoryId, issueAgeInMs, + priority, groupingId, reporterUserId, reporterUsername, reportedUserId, reportedUsername, + pickerUserId, pickerUsername, message, chatRecordId, patterns); + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/IssueMessageData.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/IssueMessageData.ts new file mode 100644 index 0000000..0d78ee5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/IssueMessageData.ts @@ -0,0 +1,163 @@ +import { GetTickerTime } from '../../../../../pixi-proxy'; +import { PatternMatchData } from './PatternMatchData'; + +export class IssueMessageData +{ + public static STATE_OPEN: number = 1; + public static STATE_PICKED: number = 2; + public static STATE_CLOSED: number = 3; + + private _issueId: number; + private _state: number; + private _categoryId: number; + private _reportedCategoryId: number; + private _issueAgeInMilliseconds: number; + private _priority: number; + private _groupingId: number; + private _reporterUserId: number; + private _reporterUserName: string; + private _reportedUserId: number; + private _reportedUserName: string; + private _pickerUserId: number; + private _pickerUserName: string; + private _message: string; + private _chatRecordId: number; + private _patterns: PatternMatchData[]; + private _disposed: boolean = false; + private _creationTimeInMilliseconds: number; + + constructor(issueId: number, state: number, categoryId: number, reportedCategoryId: number, + issueAgeinMs: number, priority: number, groupingId: number, reporterUserId: number, reporterUsername: string, + reportedUserId: number, reportedUsername: string, pickerUserId: number, pickerUsername: string, message: string, + chatRecordId: number, patterns: PatternMatchData[]) + { + this._issueId = issueId; + this._state = state; + this._categoryId = categoryId; + this._reportedCategoryId = reportedCategoryId; + this._issueAgeInMilliseconds = issueAgeinMs; + this._priority = priority; + this._groupingId = groupingId; + this._reporterUserId = reporterUserId; + this._reporterUserName = reporterUsername; + this._reportedUserId = reportedUserId; + this._reportedUserName = reportedUsername; + this._pickerUserId = pickerUserId; + this._pickerUserName = pickerUsername; + this._message = message; + this._chatRecordId = chatRecordId; + this._patterns = patterns; + this._creationTimeInMilliseconds = GetTickerTime(); //getTimer() + } + + public get issueId(): number + { + return this._issueId; + } + + public get state(): number + { + return this._state; + } + + public get categoryId(): number + { + return this._categoryId; + } + + public get reportedCategoryId(): number + { + return this._reportedCategoryId; + } + + public get issueAgeInMilliseconds(): number + { + return this._issueAgeInMilliseconds; + } + + public get priority(): number + { + return this._priority; + } + + public get groupingId(): number + { + return this._groupingId; + } + + public get reporterUserId(): number + { + return this._reporterUserId; + } + + public get reporterUserName(): string + { + return this._reporterUserName; + } + + public get reportedUserId(): number + { + return this._reportedUserId; + } + + public get reportedUserName(): string + { + return this._reportedUserName; + } + + public get pickerUserId(): number + { + return this._pickerUserId; + } + + public get pickerUserName(): string + { + return this._pickerUserName; + } + + public get message(): string + { + return this._message; + } + + public get chatRecordId(): number + { + return this._chatRecordId; + } + + public get patterns(): PatternMatchData[] + { + return this._patterns; + } + + public dispose(): void + { + + if(this.disposed) + { + return; + } + for(const k of this._patterns) + { + k.dispose(); + } + this._patterns = []; + this._disposed = true; + } + + public get disposed(): boolean + { + return this._disposed; + } + + public getOpenTime(k: number): string + { + const _local_2: number = (((this._issueAgeInMilliseconds + k) - this._creationTimeInMilliseconds) / 1000); + const _local_3: number = (_local_2 / 60); + const _local_4: number = (_local_3 % 60); + const _local_5: number = (_local_3 / 60); + const _local_6: string = (((_local_4 < 10) ? '0' : '') + _local_4); + const _local_7: string = (((_local_5 < 10) ? '0' : '') + _local_5); + return (_local_7 + ':') + _local_6; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/IssuePickFailedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/IssuePickFailedMessageParser.ts new file mode 100644 index 0000000..1c81cb4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/IssuePickFailedMessageParser.ts @@ -0,0 +1,50 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { IssueMessageData } from './IssueMessageData'; + +export class IssuePickFailedMessageParser implements IMessageParser +{ + private _issues: IssueMessageData[]; + private _retryEnabled: boolean; + private _retryCount: number; + + public flush(): boolean + { + this._issues = null; + return true; + } + + public parse(k: IMessageDataWrapper): boolean + { + this._issues = []; + + const count = k.readInt(); + + for(let i = 0; i < count; i++) + { + const _local_4 = k.readInt(); + const _local_5 = k.readInt(); + const _local_6 = k.readString(); + const _local_7 = new IssueMessageData(_local_4, 0, 0, 0, 0, 0, 0, 0, null, 0, null, _local_5, _local_6, null, 0, []); + this._issues.push(_local_7); + } + + this._retryEnabled = k.readBoolean(); + this._retryCount = k.readInt(); + return true; + } + + public get issues(): IssueMessageData[] + { + return this._issues; + } + + public get retryEnabled(): boolean + { + return this._retryEnabled; + } + + public get retryCount(): number + { + return this._retryCount; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModRoomData.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModRoomData.ts new file mode 100644 index 0000000..1c67e2c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModRoomData.ts @@ -0,0 +1,64 @@ +import { IDisposable, IMessageDataWrapper } from '../../../../../api'; + +export class ModRoomData implements IDisposable +{ + private _exists: boolean; + private _name: string; + private _desc: string; + private _tags: string[]; + private _disposed: boolean; + + constructor(k: IMessageDataWrapper) + { + this._tags = []; + this._exists = k.readBoolean(); + if(!this.exists) + { + return; + } + this._name = k.readString(); + this._desc = k.readString(); + + const tagCount = k.readInt(); + + for(let i = 0; i < tagCount; i++) + { + this._tags.push(k.readString()); + } + } + + public get name(): string + { + return this._name; + } + + public get desc(): string + { + return this._desc; + } + + public get tags(): string[] + { + return this._tags; + } + + public get exists(): boolean + { + return this._exists; + } + + public get disposed(): boolean + { + return this._disposed; + } + + public dispose(): void + { + if(this._disposed) + { + return; + } + this._disposed = true; + this._tags = null; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModerationCautionParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModerationCautionParser.ts new file mode 100644 index 0000000..a30bdea --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModerationCautionParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ModerationCautionParser implements IMessageParser +{ + private _message: string; + private _url: string; + + public flush(): boolean + { + this._message = ''; + this._url = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._message = wrapper.readString(); + this._url = wrapper.readString(); + + return true; + } + + public get message(): string + { + return this._message; + } + + public get url(): string + { + return this._url; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorActionResultMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorActionResultMessageParser.ts new file mode 100644 index 0000000..8d1079f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorActionResultMessageParser.ts @@ -0,0 +1,32 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ModeratorActionResultMessageParser implements IMessageParser +{ + private _userId: number; + private _success: boolean; + + public flush(): boolean + { + this._userId = -1; + this._success = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._userId = wrapper.readInt(); + this._success = wrapper.readBoolean(); + return true; + } + + public get userId(): number + { + return this._userId; + } + + public get success(): boolean + { + return this._success; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorInitData.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorInitData.ts new file mode 100644 index 0000000..cd90b59 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorInitData.ts @@ -0,0 +1,138 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { IssueInfoMessageParser } from './IssueInfoMessageParser'; +import { IssueMessageData } from './IssueMessageData'; + +export class ModeratorInitData +{ + private _messageTemplates: string[]; + private _roomMessageTemplates: string[]; + private _issues: IssueMessageData[]; + private _cfhPermission: boolean; + private _chatlogsPermission: boolean; + private _alertPermission: boolean; + private _kickPermission: boolean; + private _banPermission: boolean; + private _roomAlertPermission: boolean; + private _roomKickPermission: boolean; + + private _disposed: boolean = false; + + constructor(wrapper: IMessageDataWrapper) + { + const local2 = new IssueInfoMessageParser(); + this._issues = []; + this._messageTemplates = []; + this._roomMessageTemplates = []; + + let local3 = wrapper.readInt(); + let i = 0; + while(i < local3) + { + if(local2.parse(wrapper)) + { + this._issues.push(local2.issueData); + } + i++; + } + + local3 = wrapper.readInt(); + i = 0; + while(i < local3) + { + this._messageTemplates.push(wrapper.readString()); + i++; + } + + local3 = wrapper.readInt(); + i = 0; + while(i < local3) + { + wrapper.readString(); + i++; + } + + this._cfhPermission = wrapper.readBoolean(); + this._chatlogsPermission = wrapper.readBoolean(); + this._alertPermission = wrapper.readBoolean(); + this._kickPermission = wrapper.readBoolean(); + this._banPermission = wrapper.readBoolean(); + this._roomAlertPermission = wrapper.readBoolean(); + this._roomKickPermission = wrapper.readBoolean(); + local3 = wrapper.readInt(); + i = 0; + while(i < local3) + { + this._roomMessageTemplates.push(wrapper.readString()); + i++; + } + + + } + public dispose(): void + { + if(this._disposed) + { + return; + } + this._disposed = true; + this._messageTemplates = null; + this._roomMessageTemplates = null; + this._issues = null; + } + + public get disposed(): boolean + { + return this._disposed; + } + + public get messageTemplates(): string[] + { + return this._messageTemplates; + } + + public get roomMessageTemplates(): string[] + { + return this._roomMessageTemplates; + } + + public get issues(): IssueMessageData[] + { + return this._issues; + } + + public get cfhPermission(): boolean + { + return this._cfhPermission; + } + + public get chatlogsPermission(): boolean + { + return this._chatlogsPermission; + } + + public get alertPermission(): boolean + { + return this._alertPermission; + } + + public get kickPermission(): boolean + { + return this._kickPermission; + } + + public get banPermission(): boolean + { + return this._banPermission; + } + + public get roomAlertPermission(): boolean + { + return this._roomAlertPermission; + } + + public get roomKickPermission(): boolean + { + return this._roomKickPermission; + } + +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorInitMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorInitMessageParser.ts new file mode 100644 index 0000000..3ed8090 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorInitMessageParser.ts @@ -0,0 +1,23 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { ModeratorInitData } from './ModeratorInitData'; + +export class ModeratorInitMessageParser implements IMessageParser +{ + private _data: ModeratorInitData = null; + public flush(): boolean + { + this._data = null; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._data = new ModeratorInitData(wrapper); + return true; + } + + public get data(): ModeratorInitData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorMessageParser.ts new file mode 100644 index 0000000..8a1b087 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ModeratorMessageParser implements IMessageParser +{ + private _message: string; + private _url: string; + + public flush(): boolean + { + this._message = ''; + this._url = ''; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._message = wrapper.readString(); + this._url = wrapper.readString(); + + return true; + } + + public get message(): string + { + return this._message; + } + + public get url(): string + { + return this._url; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorRoomInfoMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorRoomInfoMessageParser.ts new file mode 100644 index 0000000..93e55a5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorRoomInfoMessageParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { RoomModerationData } from './RoomModerationData'; + +export class ModeratorRoomInfoMessageParser implements IMessageParser +{ + private _data: RoomModerationData; + + public flush(): boolean + { + this._data = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._data = new RoomModerationData(wrapper); + + return true; + } + + public get data(): RoomModerationData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorToolPreferencesMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorToolPreferencesMessageParser.ts new file mode 100644 index 0000000..daade99 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorToolPreferencesMessageParser.ts @@ -0,0 +1,47 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ModeratorToolPreferencesMessageParser implements IMessageParser +{ + private _windowX: number; + private _windowY: number; + private _windowWidth: number; + private _windowHeight: number; + + public flush(): boolean + { + this._windowX = 0; + this._windowY = 0; + this._windowWidth = 0; + this._windowHeight = 0; + return true; + } + + public parse(k: IMessageDataWrapper): boolean + { + this._windowX = k.readInt(); + this._windowY = k.readInt(); + this._windowWidth = k.readInt(); + this._windowHeight = k.readInt(); + return true; + } + + public get windowX(): number + { + return this._windowX; + } + + public get windowY(): number + { + return this._windowY; + } + + public get windowWidth(): number + { + return this._windowWidth; + } + + public get windowHeight(): number + { + return this._windowHeight; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorUserInfoData.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorUserInfoData.ts new file mode 100644 index 0000000..c195921 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorUserInfoData.ts @@ -0,0 +1,145 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class ModeratorUserInfoData +{ + private _userId: number; + private _userName: string; + private _registrationAgeInMinutes: number; + private _minutesSinceLastLogin: number; + private _online: boolean; + private _cfhCount: number; + private _abusiveCfhCount: number; + private _cautionCount: number; + private _banCount: number; + private _tradingLockCount: number; + private _tradingExpiryDate: string; + private _lastPurchaseDate: string; + private _identityId: number; + private _identityRelatedBanCount: number; + private _primaryEmailAddress: string; + private _figure: string; + private _userClassification: string; + private _lastSanctionTime: string = ''; + private _sanctionAgeHours: number = 0; + + constructor(wrapper: IMessageDataWrapper) + { + this._userId = wrapper.readInt(); + this._userName = wrapper.readString(); + this._figure = wrapper.readString(); + this._registrationAgeInMinutes = wrapper.readInt(); + this._minutesSinceLastLogin = wrapper.readInt(); + this._online = wrapper.readBoolean(); + this._cfhCount = wrapper.readInt(); + this._abusiveCfhCount = wrapper.readInt(); + this._cautionCount = wrapper.readInt(); + this._banCount = wrapper.readInt(); + this._tradingLockCount = wrapper.readInt(); + this._tradingExpiryDate = wrapper.readString(); + this._lastPurchaseDate = wrapper.readString(); + this._identityId = wrapper.readInt(); + this._identityRelatedBanCount = wrapper.readInt(); + this._primaryEmailAddress = wrapper.readString(); + this._userClassification = wrapper.readString(); + if(wrapper.bytesAvailable) + { + this._lastSanctionTime = wrapper.readString(); + this._sanctionAgeHours = wrapper.readInt(); + } + } + + public get userId(): number + { + return this._userId; + } + + public get userName(): string + { + return this._userName; + } + + public get figure(): string + { + return this._figure; + } + + public get registrationAgeInMinutes(): number + { + return this._registrationAgeInMinutes; + } + + public get minutesSinceLastLogin(): number + { + return this._minutesSinceLastLogin; + } + + public get online(): boolean + { + return this._online; + } + + public get cfhCount(): number + { + return this._cfhCount; + } + + public get abusiveCfhCount(): number + { + return this._abusiveCfhCount; + } + + public get cautionCount(): number + { + return this._cautionCount; + } + + public get banCount(): number + { + return this._banCount; + } + + public get tradingLockCount(): number + { + return this._tradingLockCount; + } + + public get tradingExpiryDate(): string + { + return this._tradingExpiryDate; + } + + public get lastPurchaseDate(): string + { + return this._lastPurchaseDate; + } + + public get identityId(): number + { + return this._identityId; + } + + public get identityRelatedBanCount(): number + { + return this._identityRelatedBanCount; + } + + public get primaryEmailAddress(): string + { + return this._primaryEmailAddress; + } + + public get userClassification(): string + { + return this._userClassification; + } + + public get lastSanctionTime(): string + { + return this._lastSanctionTime; + } + + public get sanctionAgeHours(): number + { + return this._sanctionAgeHours; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorUserInfoMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorUserInfoMessageParser.ts new file mode 100644 index 0000000..ae12786 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/ModeratorUserInfoMessageParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { ModeratorUserInfoData } from './ModeratorUserInfoData'; + +export class ModeratorUserInfoMessageParser implements IMessageParser +{ + private _data: ModeratorUserInfoData; + + public flush(): boolean + { + this._data = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._data = new ModeratorUserInfoData(wrapper); + + return true; + } + + public get data(): ModeratorUserInfoData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/PatternMatchData.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/PatternMatchData.ts new file mode 100644 index 0000000..de99ee2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/PatternMatchData.ts @@ -0,0 +1,44 @@ +import { IDisposable, IMessageDataWrapper } from '../../../../../api'; + +export class PatternMatchData implements IDisposable +{ + private _pattern: string; + private _startIndex: number; + private _endIndex: number; + private _disposed: boolean = false; + + constructor(k: IMessageDataWrapper) + { + this._pattern = k.readString(); + this._startIndex = k.readInt(); + this._endIndex = k.readInt(); + } + + public dispose(): void + { + this._disposed = true; + this._pattern = ''; + this._startIndex = -1; + this._endIndex = -1; + } + + public get disposed(): boolean + { + return this._disposed; + } + + public get pattern(): string + { + return this._pattern; + } + + public get startIndex(): number + { + return this._startIndex; + } + + public get endIndex(): number + { + return this._endIndex; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/RoomChatlogMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/RoomChatlogMessageParser.ts new file mode 100644 index 0000000..9bdc58c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/RoomChatlogMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { ChatRecordData } from './ChatRecordData'; + +export class RoomChatlogMessageParser implements IMessageParser +{ + private _data: ChatRecordData; + + public flush(): boolean + { + this._data = null; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._data = new ChatRecordData(wrapper); + + return true; + } + + public get data(): ChatRecordData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/RoomModerationData.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/RoomModerationData.ts new file mode 100644 index 0000000..5c194cf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/RoomModerationData.ts @@ -0,0 +1,72 @@ +import { IDisposable, IMessageDataWrapper } from '../../../../../api'; +import { ModRoomData } from './ModRoomData'; + +export class RoomModerationData implements IDisposable +{ + private _flatId: number; + private _userCount: number; + private _ownerInRoom: boolean; + private _ownerId: number; + private _ownerName: string; + private _room: ModRoomData; + private _disposed: boolean; + + constructor(k: IMessageDataWrapper) + { + this._flatId = k.readInt(); + this._userCount = k.readInt(); + this._ownerInRoom = k.readBoolean(); + this._ownerId = k.readInt(); + this._ownerName = k.readString(); + this._room = new ModRoomData(k); + } + + public get flatId(): number + { + return this._flatId; + } + + public get userCount(): number + { + return this._userCount; + } + + public get ownerInRoom(): boolean + { + return this._ownerInRoom; + } + + public get ownerId(): number + { + return this._ownerId; + } + + public get ownerName(): string + { + return this._ownerName; + } + + public get room(): ModRoomData + { + return this._room; + } + + public get disposed(): boolean + { + return this._disposed; + } + + public dispose(): void + { + if(this._disposed) + { + return; + } + this._disposed = true; + if(this._room != null) + { + this._room.dispose(); + this._room = null; + } + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/RoomVisitData.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/RoomVisitData.ts new file mode 100644 index 0000000..f97d792 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/RoomVisitData.ts @@ -0,0 +1,37 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class RoomVisitData +{ + private _roomId: number; + private _roomName: string; + private _enterHour: number; + private _enterMinute: number; + + constructor(k: IMessageDataWrapper) + { + this._roomId = k.readInt(); + this._roomName = k.readString(); + this._enterHour = k.readInt(); + this._enterMinute = k.readInt(); + } + + public get roomId(): number + { + return this._roomId; + } + + public get roomName(): string + { + return this._roomName; + } + + public get enterHour(): number + { + return this._enterHour; + } + + public get enterMinute(): number + { + return this._enterMinute; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/RoomVisitsData.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/RoomVisitsData.ts new file mode 100644 index 0000000..7fd873c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/RoomVisitsData.ts @@ -0,0 +1,38 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { RoomVisitData } from './RoomVisitData'; + +export class RoomVisitsData +{ + private _userId: number; + private _userName: string; + private _rooms: RoomVisitData[]; + + constructor(k: IMessageDataWrapper) + { + this._rooms = []; + this._userId = k.readInt(); + this._userName = k.readString(); + const _local_2 = k.readInt(); + let _local_3 = 0; + while(_local_3 < _local_2) + { + this._rooms.push(new RoomVisitData(k)); + _local_3++; + } + } + + public get userId(): number + { + return this._userId; + } + + public get userName(): string + { + return this._userName; + } + + public get rooms(): RoomVisitData[] + { + return this._rooms; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/RoomVisitsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/RoomVisitsMessageParser.ts new file mode 100644 index 0000000..1d7f011 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/RoomVisitsMessageParser.ts @@ -0,0 +1,23 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { RoomVisitsData } from './RoomVisitsData'; + +export class RoomVisitsMessageParser implements IMessageParser +{ + private _data: RoomVisitsData; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._data = new RoomVisitsData(wrapper); + return true; + } + + public get data(): RoomVisitsData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/UserBannedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/UserBannedMessageParser.ts new file mode 100644 index 0000000..e799c35 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/UserBannedMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class UserBannedMessageParser implements IMessageParser +{ + private _message: string; + + public flush(): boolean + { + this._message = ''; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._message = wrapper.readString(); + + return true; + } + + public get message(): string + { + return this._message; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/UserChatlogData.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/UserChatlogData.ts new file mode 100644 index 0000000..52b2124 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/UserChatlogData.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { ChatRecordData } from './ChatRecordData'; + +export class UserChatlogData +{ + private _userId: number; + private _username: string; + private _roomChatlogs: ChatRecordData[] = []; + + constructor(wrapper: IMessageDataWrapper) + { + this._userId = wrapper.readInt(); + this._username = wrapper.readString(); + const size = wrapper.readInt(); + for(let i = 0; i < size; i++) + { + this._roomChatlogs.push(new ChatRecordData(wrapper)); + } + } + + public get userId(): number + { + return this._userId; + } + + public get username(): string + { + return this._username; + } + + public get roomChatlogs(): ChatRecordData[] + { + return this._roomChatlogs; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/UserChatlogMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/UserChatlogMessageParser.ts new file mode 100644 index 0000000..efff372 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/UserChatlogMessageParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { UserChatlogData } from './UserChatlogData'; + +export class UserChatlogMessageParser implements IMessageParser +{ + private _data: UserChatlogData; + + public flush(): boolean + { + this._data = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._data = new UserChatlogData(wrapper); + + return true; + } + + public get data(): UserChatlogData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/moderation/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/moderation/index.ts new file mode 100644 index 0000000..4d7d3a3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/moderation/index.ts @@ -0,0 +1,28 @@ +export * from './CfhChatlogData'; +export * from './CfhChatlogMessageParser'; +export * from './ChatlineData'; +export * from './ChatRecordData'; +export * from './INamed'; +export * from './IssueDeletedMessageParser'; +export * from './IssueInfoMessageParser'; +export * from './IssueMessageData'; +export * from './IssuePickFailedMessageParser'; +export * from './ModerationCautionParser'; +export * from './ModeratorActionResultMessageParser'; +export * from './ModeratorInitData'; +export * from './ModeratorInitMessageParser'; +export * from './ModeratorMessageParser'; +export * from './ModeratorRoomInfoMessageParser'; +export * from './ModeratorToolPreferencesMessageParser'; +export * from './ModeratorUserInfoData'; +export * from './ModeratorUserInfoMessageParser'; +export * from './ModRoomData'; +export * from './PatternMatchData'; +export * from './RoomChatlogMessageParser'; +export * from './RoomModerationData'; +export * from './RoomVisitData'; +export * from './RoomVisitsData'; +export * from './RoomVisitsMessageParser'; +export * from './UserBannedMessageParser'; +export * from './UserChatlogData'; +export * from './UserChatlogMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/mysterybox/CancelMysteryBoxWaitMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/mysterybox/CancelMysteryBoxWaitMessageParser.ts new file mode 100644 index 0000000..c9ae530 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/mysterybox/CancelMysteryBoxWaitMessageParser.ts @@ -0,0 +1,21 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CancelMysteryBoxWaitMessageParser implements IMessageParser +{ + + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + + + return true; + } + +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/mysterybox/GotMysteryBoxPrizeMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/mysterybox/GotMysteryBoxPrizeMessageParser.ts new file mode 100644 index 0000000..ab7b058 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/mysterybox/GotMysteryBoxPrizeMessageParser.ts @@ -0,0 +1,33 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GotMysteryBoxPrizeMessageParser implements IMessageParser +{ + private _contentType:string; + private _classId:number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._contentType = wrapper.readString(); + this._classId = wrapper.readInt(); + + return true; + } + + public get contentType():string + { + return this._contentType; + } + + public get classId():number + { + return this._classId; + } + +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/mysterybox/MysteryBoxKeysParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/mysterybox/MysteryBoxKeysParser.ts new file mode 100644 index 0000000..f6e89c2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/mysterybox/MysteryBoxKeysParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class MysteryBoxKeysParser implements IMessageParser +{ + private _boxColor: string; + private _keyColor: string; + + public flush(): boolean + { + this._boxColor = null; + this._keyColor = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._boxColor = wrapper.readString(); + this._keyColor = wrapper.readString(); + + return true; + } + + public get boxColor(): string + { + return this._boxColor; + } + + public get keyColor(): string + { + return this._keyColor; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/mysterybox/ShowMysteryBoxWaitMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/mysterybox/ShowMysteryBoxWaitMessageParser.ts new file mode 100644 index 0000000..db8b5c7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/mysterybox/ShowMysteryBoxWaitMessageParser.ts @@ -0,0 +1,21 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ShowMysteryBoxWaitMessageParser implements IMessageParser +{ + + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + + + return true; + } + +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/mysterybox/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/mysterybox/index.ts new file mode 100644 index 0000000..8a3c165 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/mysterybox/index.ts @@ -0,0 +1,4 @@ +export * from './CancelMysteryBoxWaitMessageParser'; +export * from './GotMysteryBoxPrizeMessageParser'; +export * from './MysteryBoxKeysParser'; +export * from './ShowMysteryBoxWaitMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/CanCreateRoomEventParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/CanCreateRoomEventParser.ts new file mode 100644 index 0000000..df78ecf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/CanCreateRoomEventParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CanCreateRoomEventParser implements IMessageParser +{ + private _canCreate: boolean; + private _errorCode: number; + + public flush(): boolean + { + this._canCreate = false; + this._errorCode = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._canCreate = wrapper.readBoolean(); + this._errorCode = wrapper.readInt(); + + return true; + } + + public get canCreate(): boolean + { + return this._canCreate; + } + + public get errorCode(): number + { + return this._errorCode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/CanCreateRoomMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/CanCreateRoomMessageParser.ts new file mode 100644 index 0000000..e5c00c5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/CanCreateRoomMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class CanCreateRoomMessageParser implements IMessageParser +{ + public static readonly CREATION_ALLOWED = 0; + public static readonly ROOM_LIMIT_REACHED = 1; + + private _resultCode: number; + private _roomLimit: number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._resultCode = wrapper.readInt(); + this._roomLimit = wrapper.readInt(); + + return true; + } + + public get resultCode(): number + { + return this._resultCode; + } + + public get roomLimit(): number + { + return this._roomLimit; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/CategoriesWithVisitorCountParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/CategoriesWithVisitorCountParser.ts new file mode 100644 index 0000000..5f7a45a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/CategoriesWithVisitorCountParser.ts @@ -0,0 +1,26 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CategoriesWithVisitorCountData } from './utils'; + +export class CategoriesWithVisitorCountParser implements IMessageParser +{ + private _data: CategoriesWithVisitorCountData; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._data = new CategoriesWithVisitorCountData(wrapper); + + return true; + } + + public get data(): CategoriesWithVisitorCountData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/CompetitionRoomsDataMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/CompetitionRoomsDataMessageParser.ts new file mode 100644 index 0000000..d824d14 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/CompetitionRoomsDataMessageParser.ts @@ -0,0 +1,26 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CompetitionRoomsData } from './utils'; + +export class CompetitionRoomsDataMessageParser implements IMessageParser +{ + private _data: CompetitionRoomsData; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._data = new CompetitionRoomsData(wrapper); + + return true; + } + + public get data(): CompetitionRoomsData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/ConvertedRoomIdMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/ConvertedRoomIdMessageParser.ts new file mode 100644 index 0000000..2519c0b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/ConvertedRoomIdMessageParser.ts @@ -0,0 +1,32 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ConvertedRoomIdMessageParser implements IMessageParser +{ + private _globalId: string; + private _convertedId: number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._globalId = wrapper.readString(); + this._convertedId = wrapper.readInt(); + + return true; + } + + public get globalId(): string + { + return this._globalId; + } + + public get convertedId(): number + { + return this._convertedId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/DoorbellMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/DoorbellMessageParser.ts new file mode 100644 index 0000000..ae6b87b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/DoorbellMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class DoorbellMessageParser implements IMessageParser +{ + private _userName: string; + + public flush(): boolean + { + this._userName = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._userName = wrapper.readString(); + + return true; + } + + public get userName(): string + { + return this._userName; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/FavouriteChangedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/FavouriteChangedMessageParser.ts new file mode 100644 index 0000000..392ca24 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/FavouriteChangedMessageParser.ts @@ -0,0 +1,32 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class FavouriteChangedMessageParser implements IMessageParser +{ + private _flatId: number; + private _added: boolean; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._flatId = wrapper.readInt(); + this._added = wrapper.readBoolean(); + + return true; + } + + public get flatId(): number + { + return this._flatId; + } + + public get added(): boolean + { + return this._added; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/FavouritesMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/FavouritesMessageParser.ts new file mode 100644 index 0000000..f84cb2d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/FavouritesMessageParser.ts @@ -0,0 +1,39 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class FavouritesMessageParser implements IMessageParser +{ + private _limit: number; + private _favouriteRoomIds: number[]; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._favouriteRoomIds = []; + this._limit = wrapper.readInt(); + + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + this._favouriteRoomIds.push(wrapper.readInt()); + } + + return true; + } + + public get limit(): number + { + return this._limit; + } + + public get favoriteRoomIds(): number[] + { + return this._favouriteRoomIds; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/FlatAccessDeniedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/FlatAccessDeniedMessageParser.ts new file mode 100644 index 0000000..e46f537 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/FlatAccessDeniedMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class FlatAccessDeniedMessageParser implements IMessageParser +{ + private _userName: string; + + public flush(): boolean + { + this._userName = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._userName = wrapper.readString(); + + return true; + } + + public get userName(): string + { + return this._userName; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/FlatCreatedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/FlatCreatedMessageParser.ts new file mode 100644 index 0000000..718f1b6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/FlatCreatedMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class FlatCreatedMessageParser implements IMessageParser +{ + private _roomId: number; + private _roomName: string; + + public flush(): boolean + { + this._roomId = -1; + this._roomName = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + this._roomName = wrapper.readString(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get roomName(): string + { + return this._roomName; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/GetGuestRoomResultMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/GetGuestRoomResultMessageParser.ts new file mode 100644 index 0000000..8ae0c1f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/GetGuestRoomResultMessageParser.ts @@ -0,0 +1,79 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { RoomDataParser } from '../room'; +import { RoomChatSettings, RoomModerationSettings } from '../roomsettings'; + +export class GetGuestRoomResultMessageParser implements IMessageParser +{ + private _roomEnter: boolean; + private _roomForward: boolean; + private _data: RoomDataParser; + private _staffPick: boolean; + private _isGroupMember: boolean; + private _moderation: RoomModerationSettings; + private _chat: RoomChatSettings; + + public flush(): boolean + { + this._roomEnter = false; + this._roomForward = false; + this._data = null; + this._staffPick = false; + this._isGroupMember = false; + this._moderation = null; + this._chat = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomEnter = wrapper.readBoolean(); + this._data = new RoomDataParser(wrapper); + this._roomForward = wrapper.readBoolean(); + this._staffPick = wrapper.readBoolean(); + this._isGroupMember = wrapper.readBoolean(); + this.data.allInRoomMuted = wrapper.readBoolean(); + this._moderation = new RoomModerationSettings(wrapper); + this.data.canMute = wrapper.readBoolean(); + this._chat = new RoomChatSettings(wrapper); + + return true; + } + + public get roomEnter(): boolean + { + return this._roomEnter; + } + + public get roomForward(): boolean + { + return this._roomForward; + } + + public get data(): RoomDataParser + { + return this._data; + } + + public get staffPick(): boolean + { + return this._staffPick; + } + + public get isGroupMember(): boolean + { + return this._isGroupMember; + } + + public get moderation(): RoomModerationSettings + { + return this._moderation; + } + + public get chat(): RoomChatSettings + { + return this._chat; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/GuestRoomSearchResultMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/GuestRoomSearchResultMessageParser.ts new file mode 100644 index 0000000..7d7c902 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/GuestRoomSearchResultMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { GuestRoomSearchResultData } from './utils'; + +export class GuestRoomSearchResultMessageParser implements IMessageParser +{ + _data: GuestRoomSearchResultData; + + public flush(): boolean + { + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._data = new GuestRoomSearchResultData(wrapper); + + return true; + } + + public get data(): GuestRoomSearchResultData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorCategoryDataParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorCategoryDataParser.ts new file mode 100644 index 0000000..2d1b48f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorCategoryDataParser.ts @@ -0,0 +1,83 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class NavigatorCategoryDataParser +{ + private _id: number; + private _name: string; + private _visible: boolean; + private _automatic: boolean; + private _automaticCategoryKey: string; + private _globalCategoryKey: string; + private _staffOnly: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._id = -1; + this._name = null; + this._visible = false; + this._automatic = false; + this._automaticCategoryKey = null; + this._globalCategoryKey = null; + this._staffOnly = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._id = wrapper.readInt(); + this._name = wrapper.readString(); + this._visible = wrapper.readBoolean(); + this._automatic = wrapper.readBoolean(); + this._automaticCategoryKey = wrapper.readString(); + this._globalCategoryKey = wrapper.readString(); + this._staffOnly = wrapper.readBoolean(); + + return true; + } + + public get id(): number + { + return this._id; + } + + public get name(): string + { + return this._name; + } + + public get visible(): boolean + { + return this._visible; + } + + public get automatic(): boolean + { + return this._automatic; + } + + public get automaticCategoryKey(): string + { + return this._automaticCategoryKey; + } + + public get globalCategoryKey(): string + { + return this._globalCategoryKey; + } + + public get staffOnly(): boolean + { + return this._staffOnly; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorCollapsedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorCollapsedParser.ts new file mode 100644 index 0000000..ce06cf0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorCollapsedParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class NavigatorCollapsedParser implements IMessageParser +{ + private _categories: string[]; + + public flush(): boolean + { + this._categories = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalCategories = wrapper.readInt(); + + while(totalCategories > 0) + { + this._categories.push(wrapper.readString()); + + totalCategories--; + } + + return true; + } + + public get categories(): string[] + { + return this._categories; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorEventCategoryDataParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorEventCategoryDataParser.ts new file mode 100644 index 0000000..5beacfe --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorEventCategoryDataParser.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class NavigatorEventCategoryDataParser +{ + private _id: number; + private _name: string; + private _visible: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._id = -1; + this._name = null; + this._visible = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._id = wrapper.readInt(); + this._name = wrapper.readString(); + this._visible = wrapper.readBoolean(); + + return true; + } + + public get id(): number + { + return this._id; + } + + public get name(): string + { + return this._name; + } + + public get visible(): boolean + { + return this._visible; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorHomeRoomParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorHomeRoomParser.ts new file mode 100644 index 0000000..a3efe53 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorHomeRoomParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class NavigatorHomeRoomParser implements IMessageParser +{ + private _homeRoomId: number; + private _roomIdToEnter: number; + + public flush(): boolean + { + this._homeRoomId = -1; + this._roomIdToEnter = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._homeRoomId = wrapper.readInt(); + this._roomIdToEnter = wrapper.readInt(); + + return true; + } + + public get homeRoomId(): number + { + return this._homeRoomId; + } + + public get roomIdToEnter(): number + { + return this._roomIdToEnter; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorLiftedDataParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorLiftedDataParser.ts new file mode 100644 index 0000000..9c6b469 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorLiftedDataParser.ts @@ -0,0 +1,59 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class NavigatorLiftedDataParser +{ + private _roomId: number; + private _areaId: number; + private _image: string; + private _caption: string; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._roomId = -1; + this._areaId = -1; + this._image = null; + this._caption = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + this._areaId = wrapper.readInt(); + this._image = wrapper.readString(); + this._caption = wrapper.readString(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get areaId(): number + { + return this._areaId; + } + + public get image(): string + { + return this._image; + } + + public get caption(): string + { + return this._caption; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorLiftedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorLiftedParser.ts new file mode 100644 index 0000000..2e5fed6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorLiftedParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { NavigatorLiftedDataParser } from './NavigatorLiftedDataParser'; + +export class NavigatorLiftedParser implements IMessageParser +{ + private _rooms: NavigatorLiftedDataParser[]; + + public flush(): boolean + { + this._rooms = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalRooms = wrapper.readInt(); + + while(totalRooms > 0) + { + this._rooms.push(new NavigatorLiftedDataParser(wrapper)); + + totalRooms--; + } + + return true; + } + + public get rooms(): NavigatorLiftedDataParser[] + { + return this._rooms; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorMetadataParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorMetadataParser.ts new file mode 100644 index 0000000..ab16960 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorMetadataParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { NavigatorTopLevelContext } from './utils'; + +export class NavigatorMetadataParser implements IMessageParser +{ + private _topLevelContexts: NavigatorTopLevelContext[]; + + public flush(): boolean + { + this._topLevelContexts = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalContexts = wrapper.readInt(); + + while(totalContexts > 0) + { + this._topLevelContexts.push(new NavigatorTopLevelContext(wrapper)); + + totalContexts--; + } + + return true; + } + + public get topLevelContexts(): NavigatorTopLevelContext[] + { + return this._topLevelContexts; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorOpenRoomCreatorParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorOpenRoomCreatorParser.ts new file mode 100644 index 0000000..dcfc6bc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorOpenRoomCreatorParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class NavigatorOpenRoomCreatorParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorSearchParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorSearchParser.ts new file mode 100644 index 0000000..c0ae4a0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorSearchParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { NavigatorSearchResultSet } from './utils'; + +export class NavigatorSearchParser implements IMessageParser +{ + private _result: NavigatorSearchResultSet; + + public flush(): boolean + { + this._result = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._result = new NavigatorSearchResultSet(wrapper); + + return true; + } + + public get result(): NavigatorSearchResultSet + { + return this._result; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorSearchesParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorSearchesParser.ts new file mode 100644 index 0000000..0fcb4f8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorSearchesParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { NavigatorSavedSearch } from './utils'; + +export class NavigatorSearchesParser implements IMessageParser +{ + private _searches: NavigatorSavedSearch[]; + + public flush(): boolean + { + this._searches = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalSearches = wrapper.readInt(); + + while(totalSearches > 0) + { + this._searches.push(new NavigatorSavedSearch(wrapper)); + + totalSearches--; + } + + return true; + } + + public get searches(): NavigatorSavedSearch[] + { + return this._searches; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorSettingsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorSettingsParser.ts new file mode 100644 index 0000000..66eac4c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/NavigatorSettingsParser.ts @@ -0,0 +1,67 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class NavigatorSettingsParser implements IMessageParser +{ + private _windowX: number; + private _windowY: number; + private _windowWidth: number; + private _windowHeight: number; + private _leftPanelHidden: boolean; + private _resultsMode: number; + + public flush(): boolean + { + this._windowX = 0; + this._windowY = 0; + this._windowWidth = 0; + this._windowHeight = 0; + this._leftPanelHidden = false; + this._resultsMode = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._windowX = wrapper.readInt(); + this._windowY = wrapper.readInt(); + this._windowWidth = wrapper.readInt(); + this._windowHeight = wrapper.readInt(); + this._leftPanelHidden = wrapper.readBoolean(); + this._resultsMode = wrapper.readInt(); + + return true; + } + + public get windowX(): number + { + return this._windowX; + } + + public get windowY(): number + { + return this._windowY; + } + + public get windowWidth(): number + { + return this._windowWidth; + } + + public get windowHeight(): number + { + return this._windowHeight; + } + + public get leftPanelHidden(): boolean + { + return this._leftPanelHidden; + } + + public get resultsMode(): number + { + return this._resultsMode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/PopularRoomTagsData.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/PopularRoomTagsData.ts new file mode 100644 index 0000000..af7b7a9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/PopularRoomTagsData.ts @@ -0,0 +1,46 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { PopularTagData } from './PopularTagData'; + +export class PopularRoomTagsData +{ + private _tags: PopularTagData[]; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._tags = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._tags = []; + + const totalTags = wrapper.readInt(); + + let total = 0; + + while(total < totalTags) + { + this._tags.push(new PopularTagData(wrapper)); + total++; + } + + return true; + } + + public get tags(): PopularTagData[] + { + return this._tags; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/PopularRoomTagsResultMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/PopularRoomTagsResultMessageParser.ts new file mode 100644 index 0000000..e804929 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/PopularRoomTagsResultMessageParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { PopularRoomTagsData } from './PopularRoomTagsData'; + +export class PopularRoomTagsResultMessageParser implements IMessageParser +{ + private _data: PopularRoomTagsData; + + public flush(): boolean + { + this._data = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._data = new PopularRoomTagsData(wrapper); + + return true; + } + + public get data(): PopularRoomTagsData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/PopularTagData.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/PopularTagData.ts new file mode 100644 index 0000000..ce4e64e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/PopularTagData.ts @@ -0,0 +1,23 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class PopularTagData +{ + private _tagName: string; + private _userCount: number; + + constructor(wrapper: IMessageDataWrapper) + { + this._tagName = wrapper.readString(); + this._userCount = wrapper.readInt(); + } + + public get tagName(): string + { + return this._tagName; + } + + public get userCount(): number + { + return this._userCount; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/RoomEventCancelMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/RoomEventCancelMessageParser.ts new file mode 100644 index 0000000..69b2e79 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/RoomEventCancelMessageParser.ts @@ -0,0 +1,15 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RoomEventCancelMessageParser implements IMessageParser +{ + flush(): boolean + { + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + return true; + } + +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/RoomEventMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/RoomEventMessageParser.ts new file mode 100644 index 0000000..beebfa7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/RoomEventMessageParser.ts @@ -0,0 +1,23 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { RoomEventData } from './utils'; + +export class RoomEventMessageParser implements IMessageParser +{ + private _data: RoomEventData; + + flush(): boolean + { + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._data = new RoomEventData(wrapper); + return true; + } + + public get data(): RoomEventData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/RoomFilterSettingsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/RoomFilterSettingsMessageParser.ts new file mode 100644 index 0000000..5b09553 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/RoomFilterSettingsMessageParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RoomFilterSettingsMessageParser implements IMessageParser +{ + private _words: string[]; + + public flush(): boolean + { + this._words = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalWords = wrapper.readInt(); + + while(totalWords > 0) + { + this._words.push(wrapper.readString()); + + totalWords--; + } + + return true; + } + + public get words(): string[] + { + return this._words; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/RoomSettingsUpdatedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/RoomSettingsUpdatedParser.ts new file mode 100644 index 0000000..1cc7401 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/RoomSettingsUpdatedParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RoomSettingsUpdatedParser implements IMessageParser +{ + private _roomId: number; + + public flush(): boolean + { + this._roomId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/RoomThumbnailUpdateResultMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/RoomThumbnailUpdateResultMessageParser.ts new file mode 100644 index 0000000..de427bb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/RoomThumbnailUpdateResultMessageParser.ts @@ -0,0 +1,30 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RoomThumbnailUpdateResultMessageParser implements IMessageParser +{ + private _flatId: number; + private _resultCode: number; + + flush(): boolean + { + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._flatId = wrapper.readInt(); + this._resultCode = wrapper.readInt(); + return true; + } + + public get flatId(): number + { + return this._flatId; + } + + public get resultCode(): number + { + return this._resultCode; + } + +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/UserEventCatsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/UserEventCatsMessageParser.ts new file mode 100644 index 0000000..5d86669 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/UserEventCatsMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { NavigatorEventCategoryDataParser } from './NavigatorEventCategoryDataParser'; + +export class UserEventCatsMessageParser implements IMessageParser +{ + private _categories: NavigatorEventCategoryDataParser[]; + + public flush(): boolean + { + this._categories = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalCategories = wrapper.readInt(); + + while(totalCategories > 0) + { + this._categories.push(new NavigatorEventCategoryDataParser(wrapper)); + + totalCategories--; + } + + return true; + } + + public get categories(): NavigatorEventCategoryDataParser[] + { + return this._categories; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/UserFlatCatsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/UserFlatCatsMessageParser.ts new file mode 100644 index 0000000..821bf2d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/UserFlatCatsMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { NavigatorCategoryDataParser } from './NavigatorCategoryDataParser'; + +export class UserFlatCatsMessageParser implements IMessageParser +{ + private _categories: NavigatorCategoryDataParser[]; + + public flush(): boolean + { + this._categories = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalCategories = wrapper.readInt(); + + while(totalCategories > 0) + { + this._categories.push(new NavigatorCategoryDataParser(wrapper)); + + totalCategories--; + } + + return true; + } + + public get categories(): NavigatorCategoryDataParser[] + { + return this._categories; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/index.ts new file mode 100644 index 0000000..e4b0bc8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/index.ts @@ -0,0 +1,34 @@ +export * from './CanCreateRoomEventParser'; +export * from './CanCreateRoomMessageParser'; +export * from './CategoriesWithVisitorCountParser'; +export * from './CompetitionRoomsDataMessageParser'; +export * from './ConvertedRoomIdMessageParser'; +export * from './DoorbellMessageParser'; +export * from './FavouriteChangedMessageParser'; +export * from './FavouritesMessageParser'; +export * from './FlatAccessDeniedMessageParser'; +export * from './FlatCreatedMessageParser'; +export * from './GetGuestRoomResultMessageParser'; +export * from './GuestRoomSearchResultMessageParser'; +export * from './NavigatorCategoryDataParser'; +export * from './NavigatorCollapsedParser'; +export * from './NavigatorEventCategoryDataParser'; +export * from './NavigatorHomeRoomParser'; +export * from './NavigatorLiftedDataParser'; +export * from './NavigatorLiftedParser'; +export * from './NavigatorMetadataParser'; +export * from './NavigatorOpenRoomCreatorParser'; +export * from './NavigatorSearchesParser'; +export * from './NavigatorSearchParser'; +export * from './NavigatorSettingsParser'; +export * from './PopularRoomTagsData'; +export * from './PopularRoomTagsResultMessageParser'; +export * from './PopularTagData'; +export * from './RoomEventCancelMessageParser'; +export * from './RoomEventMessageParser'; +export * from './RoomFilterSettingsMessageParser'; +export * from './RoomSettingsUpdatedParser'; +export * from './RoomThumbnailUpdateResultMessageParser'; +export * from './UserEventCatsMessageParser'; +export * from './UserFlatCatsMessageParser'; +export * from './utils'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/CategoriesWithVisitorCountData.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/CategoriesWithVisitorCountData.ts new file mode 100644 index 0000000..741a2c3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/CategoriesWithVisitorCountData.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper } from '../../../../../../api'; + +export class CategoriesWithVisitorCountData +{ + private _categoryToCurrentUserCountMap: Map; + private _categoryToMaxUserCountMap: Map; + + constructor(k: IMessageDataWrapper) + { + this._categoryToCurrentUserCountMap = new Map(); + this._categoryToMaxUserCountMap = new Map(); + + const count = k.readInt(); + + for(let i = 0; i < count; i++) + { + const _local_4 = k.readInt(); + const _local_5 = k.readInt(); + const _local_6 = k.readInt(); + this._categoryToCurrentUserCountMap.set(_local_4, _local_5); + this._categoryToMaxUserCountMap.set(_local_4, _local_6); + } + } + + public get categoryToCurrentUserCountMap(): Map + { + return this._categoryToCurrentUserCountMap; + } + + public get categoryToMaxUserCountMap(): Map + { + return this._categoryToMaxUserCountMap; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/CompetitionRoomsData.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/CompetitionRoomsData.ts new file mode 100644 index 0000000..e5bbdef --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/CompetitionRoomsData.ts @@ -0,0 +1,36 @@ +import { IMessageDataWrapper } from '../../../../../../api'; + +export class CompetitionRoomsData +{ + private _goalId: number; + private _pageIndex: number; + private _pageCount: number; + + constructor(k: IMessageDataWrapper, _arg_2: number = 0, _arg_3: number = 0) + { + this._goalId = _arg_2; + this._pageIndex = _arg_3; + + if(k) + { + this._goalId = k.readInt(); + this._pageIndex = k.readInt(); + this._pageCount = k.readInt(); + } + } + + public get goalId(): number + { + return this._goalId; + } + + public get pageIndex(): number + { + return this._pageIndex; + } + + public get pageCount(): number + { + return this._pageCount; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/GuestRoomSearchResultData.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/GuestRoomSearchResultData.ts new file mode 100644 index 0000000..a8b4955 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/GuestRoomSearchResultData.ts @@ -0,0 +1,76 @@ +import { IMessageDataWrapper } from '../../../../../../api'; +import { RoomDataParser } from '../../room'; +import { OfficialRoomEntryData } from './OfficialRoomEntryData'; + +export class GuestRoomSearchResultData +{ + private _searchType: number; + private _searchParam: string; + private _rooms: RoomDataParser[]; + private _ad: OfficialRoomEntryData; + private _disposed: boolean; + + constructor(k: IMessageDataWrapper) + { + this._rooms = []; + this._searchType = k.readInt(); + this._searchParam = k.readString(); + const count = k.readInt(); + for(let i = 0; i < count; i++) + { + this._rooms.push(new RoomDataParser(k)); + } + const hasAdditional = k.readBoolean(); + if(hasAdditional) + { + this._ad = new OfficialRoomEntryData(k); + } + } + + public dispose(): void + { + if(this._disposed) + { + return; + } + this._disposed = true; + if(this._rooms != null) + { + for(const k of this._rooms) + { + k.flush(); + } + } + if(this._ad != null) + { + this._ad.dispose(); + this._ad = null; + } + this._rooms = null; + } + + public get disposed(): boolean + { + return this._disposed; + } + + public get searchType(): number + { + return this._searchType; + } + + public get searchParam(): string + { + return this._searchParam; + } + + public get rooms(): RoomDataParser[] + { + return this._rooms; + } + + public get ad(): OfficialRoomEntryData + { + return this._ad; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/NavigatorSavedSearch.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/NavigatorSavedSearch.ts new file mode 100644 index 0000000..e954f8b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/NavigatorSavedSearch.ts @@ -0,0 +1,59 @@ +import { IMessageDataWrapper } from '../../../../../../api'; + +export class NavigatorSavedSearch +{ + private _id: number; + private _code: string; + private _filter: string; + private _localization: string; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._id = -1; + this._code = null; + this._filter = null; + this._localization = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._id = wrapper.readInt(); + this._code = wrapper.readString(); + this._filter = wrapper.readString(); + this._localization = wrapper.readString(); + + return true; + } + + public get id(): number + { + return this._id; + } + + public get code(): string + { + return this._code; + } + + public get filter(): string + { + return this._filter; + } + + public get localization(): string + { + return this._localization; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/NavigatorSearchResultList.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/NavigatorSearchResultList.ts new file mode 100644 index 0000000..baddfa8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/NavigatorSearchResultList.ts @@ -0,0 +1,84 @@ +import { IMessageDataWrapper } from '../../../../../../api'; +import { RoomDataParser } from '../../room'; + +export class NavigatorSearchResultList +{ + private _code: string; + private _data: string; + private _action: number; + private _closed: boolean; + private _mode: number; + private _rooms: RoomDataParser[]; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._code = null; + this._data = null; + this._action = -1; + this._closed = false; + this._mode = -1; + this._rooms = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._code = wrapper.readString(); + this._data = wrapper.readString(); + this._action = wrapper.readInt(); + this._closed = wrapper.readBoolean(); + this._mode = wrapper.readInt(); + + let totalRooms = wrapper.readInt(); + + while(totalRooms > 0) + { + this._rooms.push(new RoomDataParser(wrapper)); + + totalRooms--; + } + + return true; + } + + public get code(): string + { + return this._code; + } + + public get data(): string + { + return this._data; + } + + public get action(): number + { + return this._action; + } + + public get closed(): boolean + { + return this._closed; + } + + public get mode(): number + { + return this._mode; + } + + public get rooms(): RoomDataParser[] + { + return this._rooms; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/NavigatorSearchResultSet.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/NavigatorSearchResultSet.ts new file mode 100644 index 0000000..297f617 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/NavigatorSearchResultSet.ts @@ -0,0 +1,60 @@ +import { IMessageDataWrapper } from '../../../../../../api'; +import { NavigatorSearchResultList } from './NavigatorSearchResultList'; + +export class NavigatorSearchResultSet +{ + private _code: string; + private _data: string; + private _results: NavigatorSearchResultList[]; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._code = null; + this._data = null; + this._results = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._code = wrapper.readString(); + this._data = wrapper.readString(); + + let totalResults = wrapper.readInt(); + + while(totalResults > 0) + { + this._results.push(new NavigatorSearchResultList(wrapper)); + + totalResults--; + } + + return true; + } + + public get code(): string + { + return this._code; + } + + public get data(): string + { + return this._data; + } + + public get results(): NavigatorSearchResultList[] + { + return this._results; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/NavigatorTopLevelContext.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/NavigatorTopLevelContext.ts new file mode 100644 index 0000000..92a81b0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/NavigatorTopLevelContext.ts @@ -0,0 +1,52 @@ +import { IMessageDataWrapper } from '../../../../../../api'; +import { NavigatorSavedSearch } from './NavigatorSavedSearch'; + +export class NavigatorTopLevelContext +{ + private _code: string; + private _savedSearches: NavigatorSavedSearch[]; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._code = null; + this._savedSearches = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._code = wrapper.readString(); + + let totalSavedSearches = wrapper.readInt(); + + while(totalSavedSearches > 0) + { + this._savedSearches.push(new NavigatorSavedSearch(wrapper)); + + totalSavedSearches--; + } + + return true; + } + + public get code(): string + { + return this._code; + } + + public get savedSearches(): NavigatorSavedSearch[] + { + return this._savedSearches; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/OfficialRoomEntryData.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/OfficialRoomEntryData.ts new file mode 100644 index 0000000..bbaa75d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/OfficialRoomEntryData.ts @@ -0,0 +1,148 @@ +import { IMessageDataWrapper } from '../../../../../../api'; +import { RoomDataParser } from '../../room'; + +export class OfficialRoomEntryData +{ + public static readonly TYPE_TAG = 1; + public static readonly TYPE_GUEST_ROOM = 2; + public static readonly TYPE_FOLDER = 4; + + private _index: number; + private _popupCaption: string; + private _popupDesc: string; + private _showDetails: boolean; + private _picText: string; + private _picRef: string; + private _folderId: number; + private _userCount: number; + private _type: number; + private _tag: string; + private _guestRoomData: RoomDataParser; + private _open: boolean; + private _disposed: boolean; + + constructor(k: IMessageDataWrapper) + { + this._index = k.readInt(); + this._popupCaption = k.readString(); + this._popupDesc = k.readString(); + this._showDetails = k.readInt() == 1; + this._picText = k.readString(); + this._picRef = k.readString(); + this._folderId = k.readInt(); + this._userCount = k.readInt(); + this._type = k.readInt(); + if(this._type == OfficialRoomEntryData.TYPE_TAG) + { + this._tag = k.readString(); + } + else + { + if(this._type == OfficialRoomEntryData.TYPE_GUEST_ROOM) + { + this._guestRoomData = new RoomDataParser(k); + } + else + { + this._open = k.readBoolean(); + } + } + } + + public dispose(): void + { + if(this._disposed) + { + return; + } + this._disposed = true; + if(this._guestRoomData != null) + { + this._guestRoomData.flush(); + this._guestRoomData = null; + } + } + + public get disposed(): boolean + { + return this._disposed; + } + + public get type(): number + { + return this._type; + } + + public get index(): number + { + return this._index; + } + + public get popupCaption(): string + { + return this._popupCaption; + } + + public get popupDesc(): string + { + return this._popupDesc; + } + + public get showDetails(): boolean + { + return this._showDetails; + } + + public get picText(): string + { + return this._picText; + } + + public get picRef(): string + { + return this._picRef; + } + + public get folderId(): number + { + return this._folderId; + } + + public get tag(): string + { + return this._tag; + } + + public get userCount(): number + { + return this._userCount; + } + + public get guestRoomData(): RoomDataParser + { + return this._guestRoomData; + } + + public get open(): boolean + { + return this._open; + } + + public toggleOpen(): void + { + this._open = !this._open; + } + + public get maxUsers(): number + { + if(this.type == OfficialRoomEntryData.TYPE_TAG) + { + return 0; + } + if(this.type == OfficialRoomEntryData.TYPE_GUEST_ROOM) + { + return this._guestRoomData.maxUserCount; + } + return 0; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/RoomEventData.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/RoomEventData.ts new file mode 100644 index 0000000..70a3c5e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/RoomEventData.ts @@ -0,0 +1,104 @@ +import { IMessageDataWrapper } from '../../../../../../api'; + +export class RoomEventData +{ + private _adId: number; + private _ownerAvatarId: number; + private _ownerAvatarName: string; + private _flatId: number; + private _categoryId: number; + private _eventType: number; + private _eventName: string; + private _eventDescription: string; + private _creationTime: string; + private _expirationDate: Date; + private _disposed: boolean; + + constructor(k: IMessageDataWrapper) + { + this._adId = k.readInt(); + this._ownerAvatarId = k.readInt(); + this._ownerAvatarName = k.readString(); + this._flatId = k.readInt(); + this._eventType = k.readInt(); + this._eventName = k.readString(); + this._eventDescription = k.readString(); + const _local_2 = k.readInt(); + const _local_3 = k.readInt(); + const _local_4: Date = new Date(); + let _local_5 = _local_4.getTime(); + const _local_6 = ((_local_2 * 60) * 1000); + _local_5 = (_local_5 - _local_6); + const _local_7: Date = new Date(_local_5); + this._creationTime = ((((((((_local_7.getDate() + '-') + _local_7.getMonth()) + '-') + _local_7.getFullYear()) + ' ') + _local_7.getHours()) + ':') + _local_7.getMinutes()); + let _local_8 = _local_4.getTime(); + const _local_9 = ((_local_3 * 60) * 1000); + _local_8 = (_local_8 + _local_9); + this._expirationDate = new Date(_local_8); + this._categoryId = k.readInt(); + } + + public dispose(): void + { + if(this._disposed) + { + return; + } + this._disposed = true; + } + + public get disposed(): boolean + { + return this._disposed; + } + + public get adId(): number + { + return this._adId; + } + + public get ownerAvatarId(): number + { + return this._ownerAvatarId; + } + + public get ownerAvatarName(): string + { + return this._ownerAvatarName; + } + + public get flatId(): number + { + return this._flatId; + } + + public get categoryId(): number + { + return this._categoryId; + } + + public get eventType(): number + { + return this._eventType; + } + + public get eventName(): string + { + return this._eventName; + } + + public get eventDescription(): string + { + return this._eventDescription; + } + + public get creationTime(): string + { + return this._creationTime; + } + + public get expirationDate(): Date + { + return this._expirationDate; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/index.ts new file mode 100644 index 0000000..7b9f182 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/navigator/utils/index.ts @@ -0,0 +1,9 @@ +export * from './CategoriesWithVisitorCountData'; +export * from './CompetitionRoomsData'; +export * from './GuestRoomSearchResultData'; +export * from './NavigatorSavedSearch'; +export * from './NavigatorSearchResultList'; +export * from './NavigatorSearchResultSet'; +export * from './NavigatorTopLevelContext'; +export * from './OfficialRoomEntryData'; +export * from './RoomEventData'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/AchievementLevelUpData.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/AchievementLevelUpData.ts new file mode 100644 index 0000000..46be626 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/AchievementLevelUpData.ts @@ -0,0 +1,93 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class AchievementLevelUpData +{ + private _type: number; + private _level: number; + private _points: number; + private _levelRewardPoints: number; + private _levelRewardPointType: number; + private _bonusPoints: number; + private _badgeId: number; + private _badgeCode: string = ''; + private _removedBadgeCode: string = ''; + private _achievementID: number; + private _category: string; + private _showDialogToUser: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + this._type = wrapper.readInt(); + this._level = wrapper.readInt(); + this._badgeId = wrapper.readInt(); + this._badgeCode = wrapper.readString(); + this._points = wrapper.readInt(); + this._levelRewardPoints = wrapper.readInt(); + this._levelRewardPointType = wrapper.readInt(); + this._bonusPoints = wrapper.readInt(); + this._achievementID = wrapper.readInt(); + this._removedBadgeCode = wrapper.readString(); + this._category = wrapper.readString(); + this._showDialogToUser = wrapper.readBoolean(); + } + + public get type(): number + { + return this._type; + } + + public get level(): number + { + return this._level; + } + + public get points(): number + { + return this._points; + } + + public get levelRewardPoints(): number + { + return this._levelRewardPoints; + } + + public get levelRewardPointType(): number + { + return this._levelRewardPointType; + } + + public get bonusPoints(): number + { + return this._bonusPoints; + } + + public get badgeId(): number + { + return this._badgeId; + } + + public get badgeCode(): string + { + return this._badgeCode; + } + + public get removedBadgeCode(): string + { + return this._removedBadgeCode; + } + + public get achievementID(): number + { + return this._achievementID; + } + + public get category(): string + { + return this._category; + } + + public get showDialogToUser(): boolean + { + return this._showDialogToUser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/AchievementNotificationMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/AchievementNotificationMessageParser.ts new file mode 100644 index 0000000..ec5939e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/AchievementNotificationMessageParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { AchievementLevelUpData } from './AchievementLevelUpData'; + +export class AchievementNotificationMessageParser implements IMessageParser +{ + private _data: AchievementLevelUpData; + + public flush(): boolean + { + this._data = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._data = new AchievementLevelUpData(wrapper); + + return true; + } + + public get data(): AchievementLevelUpData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/ActivityPointNotificationParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/ActivityPointNotificationParser.ts new file mode 100644 index 0000000..d060c1c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/ActivityPointNotificationParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ActivityPointNotificationParser implements IMessageParser +{ + private _amount: number; + private _amountChanged: number; + private _type: number; + + public flush(): boolean + { + this._amount = 0; + this._amountChanged = 0; + this._type = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._amount = wrapper.readInt(); + this._amountChanged = wrapper.readInt(); + this._type = wrapper.readInt(); + + return true; + } + + public get amount(): number + { + return this._amount; + } + + public get amountChanged(): number + { + return this._amountChanged; + } + + public get type(): number + { + return this._type; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/BotErrorEventParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/BotErrorEventParser.ts new file mode 100644 index 0000000..32b452a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/BotErrorEventParser.ts @@ -0,0 +1,26 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class BotErrorEventParser implements IMessageParser +{ + private _errorCode: number; + + public flush(): boolean + { + this._errorCode = -1; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._errorCode = wrapper.readInt(); + + return true; + } + + public get errorCode(): number + { + return this._errorCode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/ClubGiftNotificationParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/ClubGiftNotificationParser.ts new file mode 100644 index 0000000..1b637f6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/ClubGiftNotificationParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ClubGiftNotificationParser implements IMessageParser +{ + private _numGifts: number; + + public flush(): boolean + { + this._numGifts = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._numGifts = wrapper.readInt(); + + return true; + } + + public get numGifts(): number + { + return this._numGifts; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/ConnectionErrorMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/ConnectionErrorMessageParser.ts new file mode 100644 index 0000000..3fcd7b7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/ConnectionErrorMessageParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ConnectionErrorMessageParser implements IMessageParser +{ + private _errorCode: number; + private _messageId: number; + private _timestamp: string; + + public flush(): boolean + { + this._errorCode = 0; + this._messageId = 0; + this._timestamp = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._messageId = wrapper.readInt(); + this._errorCode = wrapper.readInt(); + this._timestamp = wrapper.readString(); + + return true; + } + + public get errorCode(): number + { + return this._errorCode; + } + + public get messageId(): number + { + return this._messageId; + } + + public get timestamp(): string + { + return this._timestamp; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/ElementPointerMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/ElementPointerMessageParser.ts new file mode 100644 index 0000000..a7a9656 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/ElementPointerMessageParser.ts @@ -0,0 +1,26 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ElementPointerMessageParser implements IMessageParser +{ + private _key: string; + + public flush(): boolean + { + this._key = null; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._key = wrapper.readString(); + + return true; + } + + public get key(): string + { + return this._key; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/HabboBroadcastMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/HabboBroadcastMessageParser.ts new file mode 100644 index 0000000..511c575 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/HabboBroadcastMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class HabboBroadcastMessageParser implements IMessageParser +{ + private _message: string; + + public flush(): boolean + { + this._message = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._message = wrapper.readString(); + + return true; + } + + public get message(): string + { + return this._message; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/HotelWillShutdownParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/HotelWillShutdownParser.ts new file mode 100644 index 0000000..5e0464e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/HotelWillShutdownParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class HotelWillShutdownParser implements IMessageParser +{ + private _minutes: number; + + public flush(): boolean + { + this._minutes = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._minutes = wrapper.readInt(); + + return true; + } + + public get minutes(): number + { + return this._minutes; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/InfoFeedEnableMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/InfoFeedEnableMessageParser.ts new file mode 100644 index 0000000..eead5cf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/InfoFeedEnableMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class InfoFeedEnableMessageParser implements IMessageParser +{ + private _enabled: boolean; + + public flush(): boolean + { + this._enabled = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._enabled = wrapper.readBoolean(); + + return true; + } + + public get enabled(): boolean + { + return this._enabled; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/MOTDNotificationParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/MOTDNotificationParser.ts new file mode 100644 index 0000000..dd3e60e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/MOTDNotificationParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class MOTDNotificationParser implements IMessageParser +{ + private _messages: string[]; + + public flush(): boolean + { + this._messages = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalMessages = wrapper.readInt(); + + while(totalMessages > 0) + { + this._messages.push(wrapper.readString()); + + totalMessages--; + } + + return true; + } + + public get messages(): string[] + { + return this._messages; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/NotificationDialogMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/NotificationDialogMessageParser.ts new file mode 100644 index 0000000..ebc5863 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/NotificationDialogMessageParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class NotificationDialogMessageParser implements IMessageParser +{ + private _type: string; + private _parameters: Map; + + public flush(): boolean + { + this._type = null; + this._parameters = new Map(); + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._type = wrapper.readString(); + + let totalParameters = wrapper.readInt(); + + while(totalParameters > 0) + { + this._parameters.set(wrapper.readString(), wrapper.readString()); + + totalParameters--; + } + + return true; + } + + public get type(): string + { + return this._type; + } + + public get parameters(): Map + { + return this._parameters; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/OfferRewardDeliveredMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/OfferRewardDeliveredMessageParser.ts new file mode 100644 index 0000000..75182ed --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/OfferRewardDeliveredMessageParser.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class OfferRewardDeliveredMessageParser implements IMessageParser +{ + private _contentType: string; + private _classId: number; + private _name: string; + private _description: string; + + public flush(): boolean + { + this._contentType = null; + this._classId = 0; + this._name = null; + this._description = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._contentType = wrapper.readString(); + this._classId = wrapper.readInt(); + this._name = wrapper.readString(); + this._description = wrapper.readString(); + + return true; + } + + public get contentType(): string + { + return this._contentType; + } + + public get classId(): number + { + return this._classId; + } + + public get name(): string + { + return this._name; + } + + public get description(): string + { + return this._description; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/PetLevelNotificationParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/PetLevelNotificationParser.ts new file mode 100644 index 0000000..735ec0a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/PetLevelNotificationParser.ts @@ -0,0 +1,52 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { PetFigureDataParser } from '../inventory'; + +export class PetLevelNotificationParser implements IMessageParser +{ + private _petId: number; + private _petName: string; + private _level: number; + private _figureData: PetFigureDataParser; + + public flush(): boolean + { + this._petId = -1; + this._petName = null; + this._level = 0; + this._figureData = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._petId = wrapper.readInt(); + this._petName = wrapper.readString(); + this._level = wrapper.readInt(); + this._figureData = new PetFigureDataParser(wrapper); + + return true; + } + + public get petId(): number + { + return this._petId; + } + + public get petName(): string + { + return this._petName; + } + + public get level(): number + { + return this._level; + } + + public get figureData(): PetFigureDataParser + { + return this._figureData; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/PetPlacingErrorEventParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/PetPlacingErrorEventParser.ts new file mode 100644 index 0000000..83c641d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/PetPlacingErrorEventParser.ts @@ -0,0 +1,26 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class PetPlacingErrorEventParser implements IMessageParser +{ + private _errorCode: number; + + public flush(): boolean + { + this._errorCode = -1; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._errorCode = wrapper.readInt(); + + return true; + } + + public get errorCode(): number + { + return this._errorCode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/RestoreClientMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/RestoreClientMessageParser.ts new file mode 100644 index 0000000..aa0c315 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/RestoreClientMessageParser.ts @@ -0,0 +1,14 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RestoreClientMessageParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/SimpleAlertMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/SimpleAlertMessageParser.ts new file mode 100644 index 0000000..6847168 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/SimpleAlertMessageParser.ts @@ -0,0 +1,37 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class SimpleAlertMessageParser implements IMessageParser +{ + private _alertMessage: string; + private _titleMessage: string; + + public flush(): boolean + { + this._alertMessage = null; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._alertMessage = wrapper.readString(); + + if(wrapper.bytesAvailable) + { + this._titleMessage = wrapper.readString(); + } + + return true; + } + + public get alertMessage(): string + { + return this._alertMessage; + } + + public get titleMessage(): string + { + return this._titleMessage; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/UnseenItemsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/UnseenItemsParser.ts new file mode 100644 index 0000000..9d4b8d5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/UnseenItemsParser.ts @@ -0,0 +1,51 @@ +import { AdvancedMap, IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class UnseenItemsParser implements IMessageParser +{ + private _items: IAdvancedMap; + + public flush(): boolean + { + this._items = new AdvancedMap(); + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalUnseen = wrapper.readInt(); + + while(totalUnseen > 0) + { + const category = wrapper.readInt(); + + let totalItems = wrapper.readInt(); + const itemIds: number[] = []; + + while(totalItems > 0) + { + itemIds.push(wrapper.readInt()); + + totalItems--; + } + + this._items.add(category, itemIds); + + totalUnseen--; + } + + return true; + } + + public getItemsByCategory(category: number): number[] + { + return this._items.getValue(category); + } + + public get categories(): number[] + { + return this._items.getKeys(); + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/notifications/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/notifications/index.ts new file mode 100644 index 0000000..d22f38f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/notifications/index.ts @@ -0,0 +1,18 @@ +export * from './AchievementLevelUpData'; +export * from './AchievementNotificationMessageParser'; +export * from './ActivityPointNotificationParser'; +export * from './BotErrorEventParser'; +export * from './ClubGiftNotificationParser'; +export * from './ConnectionErrorMessageParser'; +export * from './ElementPointerMessageParser'; +export * from './HabboBroadcastMessageParser'; +export * from './HotelWillShutdownParser'; +export * from './InfoFeedEnableMessageParser'; +export * from './MOTDNotificationParser'; +export * from './NotificationDialogMessageParser'; +export * from './OfferRewardDeliveredMessageParser'; +export * from './PetLevelNotificationParser'; +export * from './PetPlacingErrorEventParser'; +export * from './RestoreClientMessageParser'; +export * from './SimpleAlertMessageParser'; +export * from './UnseenItemsParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/nux/NewUserExperienceGiftOfferMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/nux/NewUserExperienceGiftOfferMessageParser.ts new file mode 100644 index 0000000..07c48d9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/nux/NewUserExperienceGiftOfferMessageParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { NewUserExperienceGiftOptions } from '../../incoming/nux'; + +export class NewUserExperienceGiftOfferMessageParser implements IMessageParser +{ + private _giftOptions: NewUserExperienceGiftOptions[]; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + const count = wrapper.readInt(); + this._giftOptions = []; + let index = 0; + + while(index < count) + { + this._giftOptions.push(new NewUserExperienceGiftOptions(wrapper)); + index++; + } + + return true; + } + + public get giftOptions(): NewUserExperienceGiftOptions[] + { + return this._giftOptions; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/nux/NewUserExperienceNotCompleteParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/nux/NewUserExperienceNotCompleteParser.ts new file mode 100644 index 0000000..3a267ca --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/nux/NewUserExperienceNotCompleteParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class NewUserExperienceNotCompleteParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/nux/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/nux/index.ts new file mode 100644 index 0000000..0ebcd05 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/nux/index.ts @@ -0,0 +1,2 @@ +export * from './NewUserExperienceGiftOfferMessageParser'; +export * from './NewUserExperienceNotCompleteParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/perk/PerkAllowancesMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/perk/PerkAllowancesMessageParser.ts new file mode 100644 index 0000000..aa35dfb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/perk/PerkAllowancesMessageParser.ts @@ -0,0 +1,52 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { PerkData } from './common'; + +export class PerkAllowancesMessageParser implements IMessageParser +{ + private _perks: PerkData[]; + + public flush(): boolean + { + this._perks = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._perks = []; + + const size: number = wrapper.readInt(); + + for(let i = 0; i < size; i++) this._perks.push(new PerkData( + wrapper.readString(), + wrapper.readString(), + wrapper.readBoolean() + )); + + return true; + } + + public isAllowed(perkCode: string): boolean + { + let allowed = false; + + for(const perk of this._perks) + { + if(perk.code === perkCode) + { + allowed = perk.isAllowed; + break; + } + } + + return allowed; + } + + public get perks(): PerkData[] + { + return this._perks; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/perk/common/PerkData.ts b/submodules/renderer/src/nitro/communication/messages/parser/perk/common/PerkData.ts new file mode 100644 index 0000000..61ef542 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/perk/common/PerkData.ts @@ -0,0 +1,28 @@ +export class PerkData +{ + private _code: string; + private _errorMessage: string; + private _isAllowed: boolean; + + constructor(code: string, errorMessage: string, isAllowed: boolean) + { + this._code = code; + this._errorMessage = errorMessage; + this._isAllowed = isAllowed; + } + + public get code(): string + { + return this._code; + } + + public get errorMessage(): string + { + return this._errorMessage; + } + + public get isAllowed(): boolean + { + return this._isAllowed; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/perk/common/PerkEnum.ts b/submodules/renderer/src/nitro/communication/messages/parser/perk/common/PerkEnum.ts new file mode 100644 index 0000000..454eee9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/perk/common/PerkEnum.ts @@ -0,0 +1,15 @@ +export class PerkEnum +{ + public static USE_GUIDE_TOOL: string = 'USE_GUIDE_TOOL'; + public static GIVE_GUIDE_TOUR: string = 'GIVE_GUIDE_TOUR'; + public static JUDGE_CHAT_REVIEWS: string = 'JUDGE_CHAT_REVIEWS'; + public static VOTE_IN_COMPETITIONS: string = 'VOTE_IN_COMPETITIONS'; + public static CALL_ON_HELPERS: string = 'CALL_ON_HELPERS'; + public static CITIZEN: string = 'CITIZEN'; + public static TRADE: string = 'TRADE'; + public static HEIGHTMAP_EDITOR_BETA: string = 'HEIGHTMAP_EDITOR_BETA'; + public static BUILDER_AT_WORK: string = 'BUILDER_AT_WORK'; + public static NAVIGATOR_ROOM_THUMBNAIL_CAMERA: string = 'NAVIGATOR_ROOM_THUMBNAIL_CAMERA'; + public static CAMERA: string = 'CAMERA'; + public static MOUSE_ZOOM: string = 'MOUSE_ZOOM'; +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/perk/common/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/perk/common/index.ts new file mode 100644 index 0000000..a617073 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/perk/common/index.ts @@ -0,0 +1,2 @@ +export * from './PerkData'; +export * from './PerkEnum'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/perk/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/perk/index.ts new file mode 100644 index 0000000..598feef --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/perk/index.ts @@ -0,0 +1,2 @@ +export * from './common'; +export * from './PerkAllowancesMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/pet/OpenPetPackageRequestedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/pet/OpenPetPackageRequestedMessageParser.ts new file mode 100644 index 0000000..d3844c6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/pet/OpenPetPackageRequestedMessageParser.ts @@ -0,0 +1,37 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { PetFigureData } from '../../../../avatar'; + +export class OpenPetPackageRequestedMessageParser implements IMessageParser +{ + private _objectId: number; + private _figureData: PetFigureData; + + flush(): boolean + { + this._objectId = -1; + this._figureData = null; + + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._objectId = wrapper.readInt(); + + if(!wrapper.bytesAvailable) return true; + + this._figureData = new PetFigureData(wrapper.readString()); + + return true; + } + + public get objectId(): number + { + return this._objectId; + } + + public get figureData(): PetFigureData + { + return this._figureData; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/pet/OpenPetPackageResultMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/pet/OpenPetPackageResultMessageParser.ts new file mode 100644 index 0000000..2bdcea9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/pet/OpenPetPackageResultMessageParser.ts @@ -0,0 +1,41 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class OpenPetPackageResultMessageParser implements IMessageParser +{ + private _objectId: number; + private _nameValidationStatus: number; + private _nameValidationInfo: string; + + flush(): boolean + { + this._objectId = 0; + this._nameValidationStatus = 0; + this._nameValidationInfo = null; + + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._objectId = wrapper.readInt(); + this._nameValidationStatus = wrapper.readInt(); + this._nameValidationInfo = wrapper.readString(); + + return true; + } + + public get objectId(): number + { + return this._objectId; + } + + public get nameValidationStatus(): number + { + return this._nameValidationStatus; + } + + public get nameValidationInfo(): string + { + return this._nameValidationInfo; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/pet/PetLevelUpdateMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/pet/PetLevelUpdateMessageParser.ts new file mode 100644 index 0000000..1002249 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/pet/PetLevelUpdateMessageParser.ts @@ -0,0 +1,41 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class PetLevelUpdateMessageParser implements IMessageParser +{ + private _roomIndex: number; + private _petId: number; + private _level: number; + + flush(): boolean + { + this._roomIndex = -1; + this._petId = -1; + this._level = -1; + + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._roomIndex = wrapper.readInt(); + this._petId = wrapper.readInt(); + this._level = wrapper.readInt(); + + return true; + } + + public get roomIndex(): number + { + return this._roomIndex; + } + + public get petId(): number + { + return this._petId; + } + + public get level(): number + { + return this._level; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/pet/PetScratchFailedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/pet/PetScratchFailedMessageParser.ts new file mode 100644 index 0000000..aa7722f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/pet/PetScratchFailedMessageParser.ts @@ -0,0 +1,33 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class PetScratchFailedMessageParser implements IMessageParser +{ + private _currentAge: number; + private _requiredAge: number; + + flush(): boolean + { + this._currentAge = -1; + this._requiredAge = -1; + + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._currentAge = wrapper.readInt(); + this._requiredAge = wrapper.readInt(); + + return true; + } + + public get currentAge(): number + { + return this._currentAge; + } + + public get requiredAge(): number + { + return this._requiredAge; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/pet/PetTrainingMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/pet/PetTrainingMessageParser.ts new file mode 100644 index 0000000..489d0b7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/pet/PetTrainingMessageParser.ts @@ -0,0 +1,57 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class PetTrainingMessageParser implements IMessageParser +{ + private _petId: number; + private _commands: number[]; + private _enabledCommands: number[]; + + flush(): boolean + { + this._petId = -1; + this._commands = []; + this._enabledCommands = []; + + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._petId = wrapper.readInt(); + + let commands = wrapper.readInt(); + + while(commands > 0) + { + this._commands.push(wrapper.readInt()); + + commands--; + } + + let enabledCommands = wrapper.readInt(); + + while(enabledCommands > 0) + { + this._enabledCommands.push(wrapper.readInt()); + + enabledCommands--; + } + + return true; + } + + public get petId(): number + { + return this._petId; + } + + public get commands(): number[] + { + return this._commands; + } + + public get enabledCommands(): number[] + { + return this._enabledCommands; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/pet/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/pet/index.ts new file mode 100644 index 0000000..41e89ca --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/pet/index.ts @@ -0,0 +1,5 @@ +export * from './OpenPetPackageRequestedMessageParser'; +export * from './OpenPetPackageResultMessageParser'; +export * from './PetLevelUpdateMessageParser'; +export * from './PetScratchFailedMessageParser'; +export * from './PetTrainingMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/poll/PollChoice.ts b/submodules/renderer/src/nitro/communication/messages/parser/poll/PollChoice.ts new file mode 100644 index 0000000..7720b13 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/poll/PollChoice.ts @@ -0,0 +1,45 @@ +import { IPollChoice } from '../../../../../api'; + +export class PollChoice implements IPollChoice +{ + private _value: string; + private _choiceText: string; + private _choiceType: number; + + constructor(value: string, choiceText: string, choiceType: number) + { + this._value = value; + this._choiceText = choiceText; + this._choiceType = choiceType; + } + + public get value(): string + { + return this._value; + } + + public set value(value: string) + { + this._value = value; + } + + public get choiceText(): string + { + return this._choiceText; + } + + public set choiceText(choiceText: string) + { + this._choiceText = choiceText; + } + + public get choiceType(): number + { + return this._choiceType; + } + + public set choiceType(choiceType: number) + { + this._choiceType = choiceType; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/poll/PollContentsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/poll/PollContentsParser.ts new file mode 100644 index 0000000..1240dde --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/poll/PollContentsParser.ts @@ -0,0 +1,98 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { PollChoice } from './PollChoice'; +import { PollQuestion } from './PollQuestion'; + +export class PollContentsParser implements IMessageParser +{ + private _id = -1; + private _startMessage = ''; + private _endMessage = ''; + private _numQuestions = 0; + private _questionArray: PollQuestion[] = []; + private _npsPoll = false; + + flush(): boolean + { + this._id = -1; + this._startMessage = ''; + this._endMessage = ''; + this._numQuestions = 0; + this._questionArray = []; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._id = wrapper.readInt(); + this._startMessage = wrapper.readString(); + this._endMessage = wrapper.readString(); + this._numQuestions = wrapper.readInt(); + + for(let i = 0; i < this._numQuestions; i++) + { + const question = this.parsePollQuestion(wrapper); + const childrenCount = wrapper.readInt(); + + for(let j = 0; j < childrenCount; j++) + { + question.children.push(this.parsePollQuestion(wrapper)); + } + + this._questionArray.push(question); + } + + this._npsPoll = wrapper.readBoolean(); + return true; + } + + private parsePollQuestion(k: IMessageDataWrapper): PollQuestion + { + const pollQuestion = new PollQuestion(); + pollQuestion.questionId = k.readInt(); + pollQuestion.sortOrder = k.readInt(); + pollQuestion.questionType = k.readInt(); + pollQuestion.questionText = k.readString(); + pollQuestion.questionCategory = k.readInt(); + pollQuestion.questionAnswerType = k.readInt(); + pollQuestion.questionAnswerCount = k.readInt(); + if(((pollQuestion.questionType == 1) || (pollQuestion.questionType == 2))) + { + for(let i = 0; i < pollQuestion.questionAnswerCount; i++) + { + pollQuestion.questionChoices.push(new PollChoice(k.readString(), k.readString(), k.readInt())); + } + } + return pollQuestion; + } + + public get id(): number + { + return this._id; + } + + public get startMessage(): string + { + return this._startMessage; + } + + public get endMessage(): string + { + return this._endMessage; + } + + public get numQuestions(): number + { + return this._numQuestions; + } + + public get questionArray(): PollQuestion[] + { + return this._questionArray; + } + + public get npsPoll(): boolean + { + return this._npsPoll; + } + +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/poll/PollErrorParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/poll/PollErrorParser.ts new file mode 100644 index 0000000..72bde35 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/poll/PollErrorParser.ts @@ -0,0 +1,14 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class PollErrorParser implements IMessageParser +{ + flush(): boolean + { + throw true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/poll/PollOfferParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/poll/PollOfferParser.ts new file mode 100644 index 0000000..959248e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/poll/PollOfferParser.ts @@ -0,0 +1,46 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class PollOfferParser implements IMessageParser +{ + private _id = -1; + private _type = ''; + private _headline = ''; + private _summary = ''; + + flush(): boolean + { + this._id = -1; + this._type = ''; + this._summary = ''; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._id = wrapper.readInt(); + this._type = wrapper.readString(); + this._headline = wrapper.readString(); + this._summary = wrapper.readString(); + return true; + } + + public get id(): number + { + return this._id; + } + + public get type(): string + { + return this._type; + } + + public get headline(): string + { + return this._headline; + } + + public get summary(): string + { + return this._summary; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/poll/PollQuestion.ts b/submodules/renderer/src/nitro/communication/messages/parser/poll/PollQuestion.ts new file mode 100644 index 0000000..b38579e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/poll/PollQuestion.ts @@ -0,0 +1,111 @@ +import { IPollQuestion } from '../../../../../api'; +import { PollChoice } from './PollChoice'; + +export class PollQuestion implements IPollQuestion +{ + private _questionId: number; + private _questionType: number; + private _sortOrder: number; + private _questionCategory: number; + private _questionText: string; + private _questionAnswerType: number; + private _questionAnswerCount: number; + private _children: PollQuestion[]; + private _questionChoices: PollChoice[]; + + constructor() + { + this._children = []; + this._questionChoices = []; + } + + public get questionId(): number + { + return this._questionId; + } + + public set questionId(questionId: number) + { + this._questionId = questionId; + } + + public get questionType(): number + { + return this._questionType; + } + + public set questionType(questionType: number) + { + this._questionType = questionType; + } + + public get sortOrder(): number + { + return this._sortOrder; + } + + public set sortOrder(sortOrder: number) + { + this._sortOrder = sortOrder; + } + + public get questionText(): string + { + return this._questionText; + } + + public set questionText(questionText: string) + { + this._questionText = questionText; + } + + public get questionCategory(): number + { + return this._questionCategory; + } + + public set questionCategory(questionCategory: number) + { + this._questionCategory = questionCategory; + } + + public get questionAnswerType(): number + { + return this._questionAnswerType; + } + + public set questionAnswerType(answerType: number) + { + this._questionAnswerType = answerType; + } + + public get questionAnswerCount(): number + { + return this._questionAnswerCount; + } + + public set questionAnswerCount(k: number) + { + this._questionAnswerCount = k; + } + + public get children(): PollQuestion[] + { + return this._children; + } + + public set children(children: PollQuestion[]) + { + this._children = children; + } + + public get questionChoices(): PollChoice[] + { + return this._questionChoices; + } + + public set questionChoices(k: PollChoice[]) + { + this._questionChoices = k; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/poll/QuestionAnsweredParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/poll/QuestionAnsweredParser.ts new file mode 100644 index 0000000..326ef19 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/poll/QuestionAnsweredParser.ts @@ -0,0 +1,49 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class QuestionAnsweredParser implements IMessageParser +{ + private _userId: number; + private _value: string; + private _answerCounts: Map; + + flush(): boolean + { + this._userId = -1; + this._value = ''; + this._answerCounts = null; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._userId = wrapper.readInt(); + this._value = wrapper.readString(); + this._answerCounts = new Map(); + + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + const key = wrapper.readString(); + const value = wrapper.readInt(); + this._answerCounts.set(key, value); + } + return true; + } + + public get userId(): number + { + return this._userId; + } + + public get value(): string + { + return this._value; + } + + public get answerCounts(): Map + { + return this._answerCounts; + } + +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/poll/QuestionFinishedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/poll/QuestionFinishedParser.ts new file mode 100644 index 0000000..01b1026 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/poll/QuestionFinishedParser.ts @@ -0,0 +1,39 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class QuestionFinishedParser implements IMessageParser +{ + private _questionId: number; + private _answerCounts: Map; + + flush(): boolean + { + this._questionId = -1; + this._answerCounts = null; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._questionId = wrapper.readInt(); + this._answerCounts = new Map(); + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + const key = wrapper.readString(); + const value = wrapper.readInt(); + this._answerCounts.set(key, value); + } + return true; + } + + public get questionId(): number + { + return this._questionId; + } + + public get answerCounts(): Map + { + return this._answerCounts; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/poll/QuestionParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/poll/QuestionParser.ts new file mode 100644 index 0000000..65716fd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/poll/QuestionParser.ts @@ -0,0 +1,77 @@ +import { IMessageDataWrapper, IMessageParser, IQuestion } from '../../../../../api'; + +export class QuestionParser implements IMessageParser +{ + private _pollType: string = null; + private _pollId = -1; + private _questionId = -1; + private _duration = -1; + private _question: IQuestion = null; + + flush(): boolean + { + this._pollType = null; + this._pollId = -1; + this._questionId = -1; + this._duration = -1; + this._question = null; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._pollType = wrapper.readString(); + this._pollId = wrapper.readInt(); + this._questionId = wrapper.readInt(); + this._duration = wrapper.readInt(); + + const questionId = wrapper.readInt(); + const questionNumber = wrapper.readInt(); + const questionType = wrapper.readInt(); + const questionContent = wrapper.readString(); + + this._question = { id: questionId, number: questionNumber, type: questionType, content: questionContent }; + + if(((this._question.type == 1) || (this._question.type == 2))) + { + this._question.selection_min = wrapper.readInt(); + const count = wrapper.readInt(); + this._question.selections = []; + this._question.selection_values = []; + this._question.selection_count = count; + this._question.selection_max = count; + + for(let i = 0; i < count; i++) + { + this._question.selection_values.push(wrapper.readString()); + this._question.selections.push(wrapper.readString()); + } + } + return true; + } + + public get pollType(): string + { + return this._pollType; + } + + public get pollId(): number + { + return this._pollId; + } + + public get questionId(): number + { + return this._questionId; + } + + public get duration(): number + { + return this._duration; + } + + public get question(): IQuestion + { + return this._question; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/poll/RoomPollDataParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/poll/RoomPollDataParser.ts new file mode 100644 index 0000000..ae01017 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/poll/RoomPollDataParser.ts @@ -0,0 +1,41 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RoomPollDataParser implements IMessageParser +{ + private _question: string; + private _choices: string[]; + + flush(): boolean + { + this._question = null; + this._choices = []; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._question = wrapper.readString(); + this._choices = []; + + const totalChoices = wrapper.readInt(); + let total = 0; + + while(total < totalChoices) + { + this._choices.push(wrapper.readString()); + total++; + } + + return true; + } + + public get question(): string + { + return this._question; + } + + public get choices(): string[] + { + return this._choices.slice(); + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/poll/RoomPollResultParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/poll/RoomPollResultParser.ts new file mode 100644 index 0000000..7d3569c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/poll/RoomPollResultParser.ts @@ -0,0 +1,59 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RoomPollResultParser implements IMessageParser +{ + private _question: string; + private _choices: string[]; + private _SafeStr_7651: any[]; + private _SafeStr_7654: number; + + flush(): boolean + { + this._question = null; + this._choices = []; + this._SafeStr_7651 = []; + this._SafeStr_7654 = -1; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._question = wrapper.readString(); + + this._choices = []; + this._SafeStr_7651 = []; + + let totalChoices = wrapper.readInt(); + + while(totalChoices > 0) + { + this._choices.push(wrapper.readString()); + this._SafeStr_7651.push(wrapper.readInt()); + + totalChoices--; + } + this._SafeStr_7654 = wrapper.readInt(); + + return true; + } + + public get question(): string + { + return this._question; + } + + public get choices(): string[] + { + return this._choices; + } + + public get SafeStr_7651(): any[] + { + return this._SafeStr_7651; + } + + public get SafeStr_7654(): number + { + return this._SafeStr_7654; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/poll/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/poll/index.ts new file mode 100644 index 0000000..efe3a4a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/poll/index.ts @@ -0,0 +1,10 @@ +export * from './PollChoice'; +export * from './PollContentsParser'; +export * from './PollErrorParser'; +export * from './PollOfferParser'; +export * from './PollQuestion'; +export * from './QuestionAnsweredParser'; +export * from './QuestionFinishedParser'; +export * from './QuestionParser'; +export * from './RoomPollResultParser'; +export * from './RoomPollDataParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/CommunityGoalData.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/CommunityGoalData.ts new file mode 100644 index 0000000..073ac5b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/CommunityGoalData.ts @@ -0,0 +1,95 @@ +import { IDisposable, IMessageDataWrapper } from '../../../../../api'; + +export class CommunityGoalData implements IDisposable +{ + private _hasGoalExpired: boolean; + private _personalContributionScore: number; + private _personalContributionRank: number; + private _communityTotalScore: number; + private _communityHighestAchievedLevel: number; + private _scoreRemainingUntilNextLevel: number; + private _percentCompletionTowardsNextLevel: number; + private _goalCode: string; + private _timeRemainingInSeconds: number; + private _rewardUserLimits: number[]; + + constructor(wrapper: IMessageDataWrapper) + { + this._rewardUserLimits = []; + this._hasGoalExpired = wrapper.readBoolean(); + this._personalContributionScore = wrapper.readInt(); + this._personalContributionRank = wrapper.readInt(); + this._communityTotalScore = wrapper.readInt(); + this._communityHighestAchievedLevel = wrapper.readInt(); + this._scoreRemainingUntilNextLevel = wrapper.readInt(); + this._percentCompletionTowardsNextLevel = wrapper.readInt(); + this._goalCode = wrapper.readString(); + this._timeRemainingInSeconds = wrapper.readInt(); + + const count = wrapper.readInt(); + for(let i = 0; i < count; i++) + { + this._rewardUserLimits.push(wrapper.readInt()); + } + } + + public dispose(): void + { + this._rewardUserLimits = null; + } + + public get disposed(): boolean + { + return this._rewardUserLimits == null; + } + + public get hasGoalExpired(): boolean + { + return this._hasGoalExpired; + } + + public get personalContributionScore(): number + { + return this._personalContributionScore; + } + + public get personalContributionRank(): number + { + return this._personalContributionRank; + } + + public get communityTotalScore(): number + { + return this._communityTotalScore; + } + + public get communityHighestAchievedLevel(): number + { + return this._communityHighestAchievedLevel; + } + + public get scoreRemainingUntilNextLevel(): number + { + return this._scoreRemainingUntilNextLevel; + } + + public get percentCompletionTowardsNextLevel(): number + { + return this._percentCompletionTowardsNextLevel; + } + + public get timeRemainingInSeconds(): number + { + return this._timeRemainingInSeconds; + } + + public get rewardUserLimits(): number[] + { + return this._rewardUserLimits; + } + + public get goalCode(): string + { + return this._goalCode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/CommunityGoalEarnedPrizesMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/CommunityGoalEarnedPrizesMessageParser.ts new file mode 100644 index 0000000..37c8d87 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/CommunityGoalEarnedPrizesMessageParser.ts @@ -0,0 +1,30 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { PrizeData } from './PrizeData'; + +export class CommunityGoalEarnedPrizesMessageParser implements IMessageParser +{ + private _prizes: PrizeData[]; + + public flush(): boolean + { + this._prizes = []; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + const count = wrapper.readInt(); + for(let i = 0; i < count; i++) + { + this._prizes.push(new PrizeData(wrapper)); + } + return true; + } + + public get prizes(): PrizeData[] + { + return this._prizes; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/CommunityGoalHallOfFameData.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/CommunityGoalHallOfFameData.ts new file mode 100644 index 0000000..b57d637 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/CommunityGoalHallOfFameData.ts @@ -0,0 +1,41 @@ +import { IDisposable, IMessageDataWrapper } from '../../../../../api'; +import { HallOfFameEntryData } from './HallOfFameEntryData'; + +export class CommunityGoalHallOfFameData implements IDisposable +{ + private _goalCode: string; + private _hof: HallOfFameEntryData[]; + + constructor(wrapper: IMessageDataWrapper) + { + this._hof = []; + this._goalCode = wrapper.readString(); + + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + this._hof.push(new HallOfFameEntryData(wrapper)); + } + } + + public dispose(): void + { + this._hof = null; + } + + public get disposed(): boolean + { + return this._hof == null; + } + + public get hof(): HallOfFameEntryData[] + { + return this._hof; + } + + public get goalCode(): string + { + return this._goalCode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/CommunityGoalHallOfFameMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/CommunityGoalHallOfFameMessageParser.ts new file mode 100644 index 0000000..8709709 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/CommunityGoalHallOfFameMessageParser.ts @@ -0,0 +1,26 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CommunityGoalHallOfFameData } from './CommunityGoalHallOfFameData'; + +export class CommunityGoalHallOfFameMessageParser implements IMessageParser +{ + private _data: CommunityGoalHallOfFameData; + + public flush(): boolean + { + this._data = null; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._data = new CommunityGoalHallOfFameData(wrapper); + return true; + } + + public get data(): CommunityGoalHallOfFameData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/CommunityGoalProgressMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/CommunityGoalProgressMessageParser.ts new file mode 100644 index 0000000..6f6d26d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/CommunityGoalProgressMessageParser.ts @@ -0,0 +1,26 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { CommunityGoalData } from './CommunityGoalData'; + +export class CommunityGoalProgressMessageParser implements IMessageParser +{ + private _data: CommunityGoalData; + + public flush(): boolean + { + this._data = null; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._data = new CommunityGoalData(wrapper); + return true; + } + + public get data(): CommunityGoalData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/ConcurrentUsersGoalProgressMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/ConcurrentUsersGoalProgressMessageParser.ts new file mode 100644 index 0000000..d4eb541 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/ConcurrentUsersGoalProgressMessageParser.ts @@ -0,0 +1,41 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ConcurrentUsersGoalProgressMessageParser implements IMessageParser +{ + private _state: number; + private _userCount: number; + private _userCountGoal: number; + + public flush(): boolean + { + this._state = -1; + this._userCount = -1; + this._userCountGoal = -1; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._state = wrapper.readInt(); + this._userCount = wrapper.readInt(); + this._userCountGoal = wrapper.readInt(); + return true; + } + + public get state(): number + { + return this._state; + } + + public get userCount(): number + { + return this._userCount; + } + + public get userCountGoal(): number + { + return this._userCountGoal; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/EpicPopupMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/EpicPopupMessageParser.ts new file mode 100644 index 0000000..a09d84f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/EpicPopupMessageParser.ts @@ -0,0 +1,25 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class EpicPopupMessageParser implements IMessageParser +{ + private _imageUri: string; + + public flush(): boolean + { + this._imageUri = ''; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._imageUri = wrapper.readString(); + return true; + } + + public get imageUri(): string + { + return this._imageUri; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/HallOfFameEntryData.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/HallOfFameEntryData.ts new file mode 100644 index 0000000..e80df1e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/HallOfFameEntryData.ts @@ -0,0 +1,45 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { ILandingPageUserEntry } from './ILandingPageUserEntry'; + +export class HallOfFameEntryData implements ILandingPageUserEntry +{ + private _userId: number; + private _userName: string; + private _figure: string; + private _rank: number; + private _currentScore: number; + + constructor(wrapper: IMessageDataWrapper) + { + this._userId = wrapper.readInt(); + this._userName = wrapper.readString(); + this._figure = wrapper.readString(); + this._rank = wrapper.readInt(); + this._currentScore = wrapper.readInt(); + } + + public get userId(): number + { + return this._userId; + } + + public get userName(): string + { + return this._userName; + } + + public get figure(): string + { + return this._figure; + } + + public get rank(): number + { + return this._rank; + } + + public get currentScore(): number + { + return this._currentScore; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/ILandingPageUserEntry.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/ILandingPageUserEntry.ts new file mode 100644 index 0000000..02362a8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/ILandingPageUserEntry.ts @@ -0,0 +1,6 @@ +export interface ILandingPageUserEntry +{ + userId: number; + userName: string; + figure: string; +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/PrizeData.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/PrizeData.ts new file mode 100644 index 0000000..d3df2cf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/PrizeData.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class PrizeData +{ + private _communityGoalId: number; + private _communityGoalCode: string; + private _userRank: number; + private _rewardCode: string; + private _badge: boolean; + private _localizedName: string; + + constructor(k: IMessageDataWrapper) + { + this._communityGoalId = k.readInt(); + this._communityGoalCode = k.readString(); + this._userRank = k.readInt(); + this._rewardCode = k.readString(); + this._badge = k.readBoolean(); + this._localizedName = k.readString(); + } + + public get communityGoalId(): number + { + return this._communityGoalId; + } + + public get communityGoalCode(): string + { + return this._communityGoalCode; + } + + public get userRank(): number + { + return this._userRank; + } + + public get rewardCode(): string + { + return this._rewardCode; + } + + public get badge(): boolean + { + return this._badge; + } + + public get localizedName(): string + { + return this._localizedName; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestCancelledMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestCancelledMessageParser.ts new file mode 100644 index 0000000..7c29d39 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestCancelledMessageParser.ts @@ -0,0 +1,24 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class QuestCancelledMessageParser implements IMessageParser +{ + private _expired: boolean; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._expired = wrapper.readBoolean(); + return true; + } + + public get expired(): boolean + { + return this._expired; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestCompletedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestCompletedMessageParser.ts new file mode 100644 index 0000000..bdec334 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestCompletedMessageParser.ts @@ -0,0 +1,33 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { QuestMessageData } from './QuestMessageData'; + +export class QuestCompletedMessageParser implements IMessageParser +{ + private _questData: QuestMessageData; + private _showDialog: boolean; + + public flush(): boolean + { + this._questData = null; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._questData = new QuestMessageData(wrapper); + this._showDialog = wrapper.readBoolean(); + return true; + } + + public get questData(): QuestMessageData + { + return this._questData; + } + + public get showDialog(): boolean + { + return this._showDialog; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestDailyMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestDailyMessageParser.ts new file mode 100644 index 0000000..4bb30e3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestDailyMessageParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { QuestMessageData } from './QuestMessageData'; + +export class QuestDailyMessageParser implements IMessageParser +{ + private _quest: QuestMessageData; + private _easyQuestCount: number; + private _hardQuestCount: number; + + public flush(): boolean + { + this._quest = null; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + const _local_2 = wrapper.readBoolean(); + if(_local_2) + { + this._quest = new QuestMessageData(wrapper); + this._easyQuestCount = wrapper.readInt(); + this._hardQuestCount = wrapper.readInt(); + } + return true; + } + + public get quest(): QuestMessageData + { + return this._quest; + } + + public get easyQuestCount(): number + { + return this._easyQuestCount; + } + + public get hardQuestCount(): number + { + return this._hardQuestCount; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestMessageData.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestMessageData.ts new file mode 100644 index 0000000..6151d79 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestMessageData.ts @@ -0,0 +1,186 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class QuestMessageData +{ + private _campaignCode: string; + private _completedQuestsInCampaign: number; + private _questCountInCampaign: number; + private _activityPointType: number; + private _id: number; + private _accepted: boolean; + private _type: string; + private _imageVersion: string; + private _rewardCurrencyAmount: number; + private _localizationCode: string; + private _completedSteps: number; + private _totalSteps: number; + private _waitPeriodSeconds: number; + private _sortOrder: number; + private _catalogPageName: string; + private _chainCode: string; + private _easy: boolean; + private _receiveTime: Date; + + constructor(wrapper: IMessageDataWrapper) + { + this._receiveTime = new Date(); + this._campaignCode = wrapper.readString(); + this._completedQuestsInCampaign = wrapper.readInt(); + this._questCountInCampaign = wrapper.readInt(); + this._activityPointType = wrapper.readInt(); + this._id = wrapper.readInt(); + this._accepted = wrapper.readBoolean(); + this._type = wrapper.readString(); + this._imageVersion = wrapper.readString(); + this._rewardCurrencyAmount = wrapper.readInt(); + this._localizationCode = wrapper.readString(); + this._completedSteps = wrapper.readInt(); + this._totalSteps = wrapper.readInt(); + this._sortOrder = wrapper.readInt(); + this._catalogPageName = wrapper.readString(); + this._chainCode = wrapper.readString(); + this._easy = wrapper.readBoolean(); + } + + public static getCampaignLocalizationKeyForCode(k: string): string + { + return 'quests.' + k; + } + + public get campaignCode(): string + { + return this._campaignCode; + } + + public get localizationCode(): string + { + return this._localizationCode; + } + + public get completedQuestsInCampaign(): number + { + return this._completedQuestsInCampaign; + } + + public get questCountInCampaign(): number + { + return this._questCountInCampaign; + } + + public get activityPointType(): number + { + return this._activityPointType; + } + + public set accepted(k: boolean) + { + this._accepted = k; + } + + public get accepted(): boolean + { + return this._accepted; + } + + public set id(k: number) + { + this._id = k; + } + + public get id(): number + { + return this._id; + } + + public get type(): string + { + return this._type; + } + + public get imageVersion(): string + { + return this._imageVersion; + } + + public get rewardCurrencyAmount(): number + { + return this._rewardCurrencyAmount; + } + + public get completedSteps(): number + { + return this._completedSteps; + } + + public get totalSteps(): number + { + return this._totalSteps; + } + + public get isCompleted(): boolean + { + return this._completedSteps == this._totalSteps; + } + + public set waitPeriodSeconds(k: number) + { + this._waitPeriodSeconds = k; + } + + public get waitPeriodSeconds(): number + { + if(this._waitPeriodSeconds < 1) + { + return 0; + } + const k = new Date(); + const _local_2 = (k.getTime() - this._receiveTime.getTime()); + const _local_3 = Math.max(0, (this._waitPeriodSeconds - Math.floor((_local_2 / 1000)))); + return _local_3; + } + + public getCampaignLocalizationKey(): string + { + return QuestMessageData.getCampaignLocalizationKeyForCode(this.campaignCode); + } + + public getQuestLocalizationKey(): string + { + return (this.getCampaignLocalizationKey() + '.') + this._localizationCode; + } + + public get completedCampaign(): boolean + { + return this._id < 1; + } + + public get lastQuestInCampaign(): boolean + { + return this._completedQuestsInCampaign >= this._questCountInCampaign; + } + + public get receiveTime(): Date + { + return this._receiveTime; + } + + public get sortOrder(): number + { + return this._sortOrder; + } + + public get catalogPageName(): string + { + return this._catalogPageName; + } + + public get chainCode(): string + { + return this._chainCode; + } + + public get easy(): boolean + { + return this._easy; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestMessageParser.ts new file mode 100644 index 0000000..b817950 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestMessageParser.ts @@ -0,0 +1,26 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { QuestMessageData } from './QuestMessageData'; + +export class QuestMessageParser implements IMessageParser +{ + private _quest: QuestMessageData; + + public flush(): boolean + { + this._quest = null; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._quest = new QuestMessageData(wrapper); + return true; + } + + public get quest(): QuestMessageData + { + return this._quest; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestsMessageParser.ts new file mode 100644 index 0000000..aecbd12 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/QuestsMessageParser.ts @@ -0,0 +1,40 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { QuestMessageData } from './QuestMessageData'; + +export class QuestsMessageParser implements IMessageParser +{ + private _quests: QuestMessageData[]; + private _openWindow: boolean; + + + public flush(): boolean + { + this._quests = []; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + this._quests.push(new QuestMessageData(wrapper)); + } + + this._openWindow = wrapper.readBoolean(); + return true; + } + + public get quests(): QuestMessageData[] + { + return this._quests; + } + + public get openWindow(): boolean + { + return this._openWindow; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/SeasonalQuestsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/SeasonalQuestsParser.ts new file mode 100644 index 0000000..d354e2b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/SeasonalQuestsParser.ts @@ -0,0 +1,32 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { QuestMessageData } from './QuestMessageData'; + +export class SeasonalQuestsParser implements IMessageParser +{ + private _quests: QuestMessageData[]; + + public flush(): boolean + { + this._quests = []; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + this._quests.push(new QuestMessageData(wrapper)); + } + + return true; + } + + public get quests(): QuestMessageData[] + { + return this._quests; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/quest/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/quest/index.ts new file mode 100644 index 0000000..1185da4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/quest/index.ts @@ -0,0 +1,17 @@ +export * from './CommunityGoalData'; +export * from './CommunityGoalEarnedPrizesMessageParser'; +export * from './CommunityGoalHallOfFameData'; +export * from './CommunityGoalHallOfFameMessageParser'; +export * from './CommunityGoalProgressMessageParser'; +export * from './ConcurrentUsersGoalProgressMessageParser'; +export * from './EpicPopupMessageParser'; +export * from './HallOfFameEntryData'; +export * from './ILandingPageUserEntry'; +export * from './PrizeData'; +export * from './QuestCancelledMessageParser'; +export * from './QuestCompletedMessageParser'; +export * from './QuestDailyMessageParser'; +export * from './QuestMessageData'; +export * from './QuestMessageParser'; +export * from './QuestsMessageParser'; +export * from './SeasonalQuestsParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/recycler/RecyclerFinishedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/recycler/RecyclerFinishedMessageParser.ts new file mode 100644 index 0000000..80051fe --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/recycler/RecyclerFinishedMessageParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RecyclerFinishedMessageParser implements IMessageParser +{ + private _recyclerFinishedStatus: number; + private _prizeId: number; + + public flush(): boolean + { + this._recyclerFinishedStatus = -1; + this._prizeId = 0; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._recyclerFinishedStatus = wrapper.readInt(); + this._prizeId = wrapper.readInt(); + + return true; + } + + public get recyclerFinishedStatus(): number + { + return this._recyclerFinishedStatus; + } + + public get prizeId(): number + { + return this._prizeId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/recycler/RecyclerStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/recycler/RecyclerStatusMessageParser.ts new file mode 100644 index 0000000..d8fbe86 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/recycler/RecyclerStatusMessageParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RecyclerStatusMessageParser implements IMessageParser +{ + private _recyclerStatus: number; + private _recyclerTimeoutSeconds: number; + + public flush(): boolean + { + this._recyclerStatus = -1; + this._recyclerTimeoutSeconds = 0; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._recyclerStatus = wrapper.readInt(); + this._recyclerTimeoutSeconds = wrapper.readInt(); + + return true; + } + + public get recyclerStatus(): number + { + return this._recyclerStatus; + } + + public get recyclerTimeoutSeconds(): number + { + return this._recyclerTimeoutSeconds; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/recycler/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/recycler/index.ts new file mode 100644 index 0000000..8fbc648 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/recycler/index.ts @@ -0,0 +1,2 @@ +export * from './RecyclerFinishedMessageParser'; +export * from './RecyclerStatusMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/access/CantConnectMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/access/CantConnectMessageParser.ts new file mode 100644 index 0000000..373d3aa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/access/CantConnectMessageParser.ts @@ -0,0 +1,40 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class CantConnectMessageParser implements IMessageParser +{ + public static REASON_FULL: number = 1; + public static REASON_CLOSED: number = 2; + public static REASON_QUEUE_ERROR: number = 3; + public static REASON_BANNED: number = 4; + + private _reason: number; + private _parameter: string; + + public flush(): boolean + { + this._reason = 0; + this._parameter = ''; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._reason = wrapper.readInt(); + this._parameter = wrapper.readString(); + + return true; + } + + public get reason(): number + { + return this._reason; + } + + public get parameter(): string + { + return this._parameter; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/access/RoomEnterParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/access/RoomEnterParser.ts new file mode 100644 index 0000000..f80c2c9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/access/RoomEnterParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomEnterParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/access/RoomFowardParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/access/RoomFowardParser.ts new file mode 100644 index 0000000..7b52322 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/access/RoomFowardParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomFowardParser implements IMessageParser +{ + private _roomId: number; + + public flush(): boolean + { + this._roomId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/access/doorbell/RoomDoorbellAcceptedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/access/doorbell/RoomDoorbellAcceptedParser.ts new file mode 100644 index 0000000..c37222d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/access/doorbell/RoomDoorbellAcceptedParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; + +export class RoomDoorbellAcceptedParser implements IMessageParser +{ + private _userName: string; + + public flush(): boolean + { + this._userName = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._userName = wrapper.readString(); + + return true; + } + + public get userName(): string + { + return this._userName; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/access/doorbell/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/access/doorbell/index.ts new file mode 100644 index 0000000..bc56d17 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/access/doorbell/index.ts @@ -0,0 +1 @@ +export * from './RoomDoorbellAcceptedParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/access/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/access/index.ts new file mode 100644 index 0000000..90158a7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/access/index.ts @@ -0,0 +1,5 @@ +export * from './CantConnectMessageParser'; +export * from './doorbell'; +export * from './rights'; +export * from './RoomEnterParser'; +export * from './RoomFowardParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/access/rights/RoomRightsClearParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/access/rights/RoomRightsClearParser.ts new file mode 100644 index 0000000..2f303c3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/access/rights/RoomRightsClearParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; + +export class RoomRightsClearParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/access/rights/RoomRightsOwnerParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/access/rights/RoomRightsOwnerParser.ts new file mode 100644 index 0000000..3dbb3e3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/access/rights/RoomRightsOwnerParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; + +export class RoomRightsOwnerParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/access/rights/RoomRightsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/access/rights/RoomRightsParser.ts new file mode 100644 index 0000000..852612f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/access/rights/RoomRightsParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser, RoomControllerLevel } from '../../../../../../../api'; + +export class RoomRightsParser implements IMessageParser +{ + private _controllerLevel: number; + + public flush(): boolean + { + this._controllerLevel = RoomControllerLevel.NONE; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._controllerLevel = wrapper.readInt(); + + return true; + } + + public get controllerLevel(): number + { + return this._controllerLevel; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/access/rights/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/access/rights/index.ts new file mode 100644 index 0000000..e5a319d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/access/rights/index.ts @@ -0,0 +1,3 @@ +export * from './RoomRightsClearParser'; +export * from './RoomRightsOwnerParser'; +export * from './RoomRightsParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/bots/BotCommandConfigurationParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/bots/BotCommandConfigurationParser.ts new file mode 100644 index 0000000..0145e75 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/bots/BotCommandConfigurationParser.ts @@ -0,0 +1,42 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class BotCommandConfigurationParser implements IMessageParser +{ + private _botId: number; + private _commandId: number; + private _data: string; + + public flush(): boolean + { + this._botId = -1; + this._commandId = -1; + this._data = ''; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._botId = wrapper.readInt(); + this._commandId = wrapper.readInt(); + this._data = wrapper.readString(); + + return true; + } + + public get botId(): number + { + return this._botId; + } + public get commandId(): number + { + return this._commandId; + } + + public get data(): string + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/bots/BotForceOpenContextMenuParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/bots/BotForceOpenContextMenuParser.ts new file mode 100644 index 0000000..9f72087 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/bots/BotForceOpenContextMenuParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class BotForceOpenContextMenuParser implements IMessageParser +{ + private _botId: number; + + public flush(): boolean + { + this._botId = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._botId = wrapper.readInt(); + + return true; + } + + public get botId(): number + { + return this._botId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/bots/BotSkillData.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/bots/BotSkillData.ts new file mode 100644 index 0000000..5174c00 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/bots/BotSkillData.ts @@ -0,0 +1,23 @@ +import { IMessageDataWrapper } from '../../../../../../api'; + +export class BotSkillData +{ + private _id: number; + private _data: string; + + constructor(wrapper: IMessageDataWrapper) + { + this._id = wrapper.readInt(); + this._data = wrapper.readString(); + } + + public get id(): number + { + return this._id; + } + + public get data(): string + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/bots/BotSkillListUpdateParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/bots/BotSkillListUpdateParser.ts new file mode 100644 index 0000000..e447c6f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/bots/BotSkillListUpdateParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { BotSkillData } from './BotSkillData'; + +export class BotSkillListUpdateParser implements IMessageParser +{ + private _botId: number; + private _skillList: BotSkillData[]; + + public flush(): boolean + { + this._botId = -1; + this._skillList = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._botId = wrapper.readInt(); + + let totalSkills = wrapper.readInt(); + + while(totalSkills > 0) + { + this._skillList.push(new BotSkillData(wrapper)); + + totalSkills--; + } + + return true; + } + + public get botId(): number + { + return this._botId; + } + + public get skillList(): BotSkillData[] + { + return this._skillList; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/bots/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/bots/index.ts new file mode 100644 index 0000000..f9be3fa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/bots/index.ts @@ -0,0 +1,4 @@ +export * from './BotCommandConfigurationParser'; +export * from './BotForceOpenContextMenuParser'; +export * from './BotSkillData'; +export * from './BotSkillListUpdateParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/data/RoomChatSettingsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/data/RoomChatSettingsParser.ts new file mode 100644 index 0000000..2f21e9e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/data/RoomChatSettingsParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { RoomChatSettings } from '../../roomsettings'; + +export class RoomChatSettingsParser implements IMessageParser +{ + private _chat: RoomChatSettings; + + public flush(): boolean + { + this._chat = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._chat = new RoomChatSettings(wrapper); + + return true; + } + + public get chat(): RoomChatSettings + { + return this._chat; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/data/RoomDataParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/data/RoomDataParser.ts new file mode 100644 index 0000000..b84af5f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/data/RoomDataParser.ts @@ -0,0 +1,301 @@ +import { IMessageDataWrapper } from '../../../../../../api'; + +export class RoomDataParser +{ + public static THUMBNAIL_BITMASK = 1; + public static GROUPDATA_BITMASK = 2; + public static ROOMAD_BITMASK = 4; + public static SHOWOWNER_BITMASK = 8; + public static ALLOW_PETS_BITMASK = 16; + public static DISPLAY_ROOMAD_BITMASK = 32; + + public static OPEN_STATE = 0; + public static DOORBELL_STATE = 1; + public static PASSWORD_STATE = 2; + public static INVISIBLE_STATE = 3; + public static NOOB_STATE = 4; + + private _roomId: number; + private _roomName: string; + private _showOwner: boolean; + private _ownerId: number; + private _ownerName: string; + private _doorMode: number; + private _userCount: number; + private _maxUserCount: number; + private _description: string; + private _tradeMode: number; + private _score: number; + private _ranking: number; + private _categoryId: number; + private _totalStars: number; + private _groupId: number; + private _groupName: string; + private _groupBadge: string; + private _tags: string[]; + private _bitMask: number; + private _thumbnail: any; + private _allowPets: boolean; + private _displayAd: boolean; + private _adName: string; + private _adDescription: string; + private _adExpiresIn: number; + private _allInRoomMuted: boolean; + private _canMute: boolean; + + private _officialRoomPicRef: string; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._roomId = 0; + this._roomName = null; + this._ownerId = 0; + this._ownerName = null; + this._doorMode = 0; + this._userCount = 0; + this._maxUserCount = 0; + this._description = null; + this._tradeMode = 2; + this._score = 0; + this._ranking = 0; + this._categoryId = 0; + this._totalStars = 0; + this._groupId = 0; + this._groupName = null; + this._groupBadge = null; + this._tags = []; + this._bitMask = 0; + this._thumbnail = null; + this._allowPets = false; + this._showOwner = true; + this._displayAd = false; + this._adName = null; + this._adDescription = null; + this._adExpiresIn = 0; + this._allInRoomMuted = false; + this._canMute = false; + this._officialRoomPicRef = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + this._roomName = wrapper.readString(); + this._ownerId = wrapper.readInt(); + this._ownerName = wrapper.readString(); + this._doorMode = wrapper.readInt(); + this._userCount = wrapper.readInt(); + this._maxUserCount = wrapper.readInt(); + this._description = wrapper.readString(); + this._tradeMode = wrapper.readInt(); + this._score = wrapper.readInt(); + this._ranking = wrapper.readInt(); + this._categoryId = wrapper.readInt(); + + this.parseTags(wrapper); + + this.parseBitMask(wrapper); + + return true; + } + + private parseTags(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._tags = []; + + let totalTags = wrapper.readInt(); + + while(totalTags > 0) + { + this._tags.push(wrapper.readString()); + + totalTags--; + } + + return true; + } + + private parseBitMask(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._bitMask = wrapper.readInt(); + + if(this._bitMask & RoomDataParser.THUMBNAIL_BITMASK) this._officialRoomPicRef = wrapper.readString(); + + if(this._bitMask & RoomDataParser.GROUPDATA_BITMASK) + { + this._groupId = wrapper.readInt(); + this._groupName = wrapper.readString(); + this._groupBadge = wrapper.readString(); + } + + if(this._bitMask & RoomDataParser.ROOMAD_BITMASK) + { + this._adName = wrapper.readString(); + this._adDescription = wrapper.readString(); + this._adExpiresIn = wrapper.readInt(); + } + + this._showOwner = (this._bitMask & RoomDataParser.SHOWOWNER_BITMASK) > 0; + this._allowPets = (this._bitMask & RoomDataParser.ALLOW_PETS_BITMASK) > 0; + this._displayAd = (this._bitMask & RoomDataParser.DISPLAY_ROOMAD_BITMASK) > 0; + this._thumbnail = null; + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get roomName(): string + { + return this._roomName; + } + + public set roomName(name: string) + { + this._roomName = name; + } + + public get ownerId(): number + { + return this._ownerId; + } + + public get ownerName(): string + { + return this._ownerName; + } + + public get doorMode(): number + { + return this._doorMode; + } + + public get userCount(): number + { + return this._userCount; + } + + public get maxUserCount(): number + { + return this._maxUserCount; + } + + public get description(): string + { + return this._description; + } + + public get tradeMode(): number + { + return this._tradeMode; + } + + public get score(): number + { + return this._score; + } + + public get ranking(): number + { + return this._ranking; + } + + public get categoryId(): number + { + return this._categoryId; + } + + public get tags(): string[] + { + return this._tags; + } + + public get officialRoomPicRef(): string + { + return this._officialRoomPicRef; + } + + public get habboGroupId(): number + { + return this._groupId; + } + + public get groupName(): string + { + return this._groupName; + } + + public get groupBadgeCode(): string + { + return this._groupBadge; + } + + public get roomAdName(): string + { + return this._adName; + } + + public get roomAdDescription(): string + { + return this._adDescription; + } + + public get roomAdExpiresInMin(): number + { + return this._adExpiresIn; + } + + public get showOwner(): boolean + { + return this._showOwner; + } + + public get allowPets(): boolean + { + return this._allowPets; + } + + public get displayRoomEntryAd(): boolean + { + return this._displayAd; + } + + public get canMute(): boolean + { + return this._canMute; + } + + public set canMute(k: boolean) + { + this._canMute = k; + } + + public get allInRoomMuted(): boolean + { + return this._allInRoomMuted; + } + + public set allInRoomMuted(k: boolean) + { + this._allInRoomMuted = k; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/data/RoomEntryInfoMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/data/RoomEntryInfoMessageParser.ts new file mode 100644 index 0000000..57dfbee --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/data/RoomEntryInfoMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomEntryInfoMessageParser implements IMessageParser +{ + private _roomId: number; + private _isOwner: boolean; + + public flush(): boolean + { + this._roomId = 0; + this._isOwner = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + this._isOwner = wrapper.readBoolean(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get isOwner(): boolean + { + return this._isOwner; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/data/RoomScoreParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/data/RoomScoreParser.ts new file mode 100644 index 0000000..90e7064 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/data/RoomScoreParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomScoreParser implements IMessageParser +{ + private _totalLikes: number; + private _canLike: boolean; + + public flush(): boolean + { + this._totalLikes = 0; + this._canLike = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._totalLikes = wrapper.readInt(); + this._canLike = wrapper.readBoolean(); + + return true; + } + + public get totalLikes(): number + { + return this._totalLikes; + } + + public get canLike(): boolean + { + return this._canLike; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/data/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/data/index.ts new file mode 100644 index 0000000..7e040d1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/data/index.ts @@ -0,0 +1,4 @@ +export * from './RoomChatSettingsParser'; +export * from './RoomDataParser'; +export * from './RoomEntryInfoMessageParser'; +export * from './RoomScoreParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/engine/FavoriteMembershipUpdateMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/engine/FavoriteMembershipUpdateMessageParser.ts new file mode 100644 index 0000000..783ac99 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/engine/FavoriteMembershipUpdateMessageParser.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class FavoriteMembershipUpdateMessageParser implements IMessageParser +{ + private _roomIndex: number; + private _groupId: number; + private _status: number; + private _groupName: string; + + public flush(): boolean + { + this._roomIndex = -1; + this._groupId = -1; + this._status = 0; + this._groupName = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomIndex = wrapper.readInt(); + this._groupId = wrapper.readInt(); + this._status = wrapper.readInt(); + this._groupName = wrapper.readString(); + + return true; + } + + public get roomIndex(): number + { + return this._roomIndex; + } + + public get groupId(): number + { + return this._groupId; + } + + public get status(): number + { + return this._status; + } + + public get groupName(): string + { + return this._groupName; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/engine/ObjectData.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/engine/ObjectData.ts new file mode 100644 index 0000000..86cdc29 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/engine/ObjectData.ts @@ -0,0 +1,30 @@ +import { IObjectData } from '../../../../../../api'; + +export class ObjectData +{ + private _id: number = 0; + private _state: number = 0; + private _data: IObjectData; + + constructor(id: number, state: number, objectData: IObjectData) + { + this._id = id; + this._state = state; + this._data = objectData; + } + + public get id(): number + { + return this._id; + } + + public get state(): number + { + return this._state; + } + + public get data(): IObjectData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/engine/ObjectsDataUpdateParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/engine/ObjectsDataUpdateParser.ts new file mode 100644 index 0000000..1888a76 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/engine/ObjectsDataUpdateParser.ts @@ -0,0 +1,40 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { FurnitureDataParser } from '../furniture'; +import { ObjectData } from './ObjectData'; + +export class ObjectsDataUpdateParser implements IMessageParser +{ + private _objects: ObjectData[]; + + public flush(): boolean + { + this._objects = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalObjects = wrapper.readInt(); + + while(totalObjects > 0) + { + const id = wrapper.readInt(); + const stuffData = FurnitureDataParser.parseObjectData(wrapper); + const state = parseFloat(stuffData.getLegacyString()); + + this._objects.push(new ObjectData(id, state, stuffData)); + + totalObjects--; + } + + return true; + } + + public get objects(): ObjectData[] + { + return this._objects; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/engine/ObjectsRollingParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/engine/ObjectsRollingParser.ts new file mode 100644 index 0000000..1a1e41a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/engine/ObjectsRollingParser.ts @@ -0,0 +1,79 @@ +import { IMessageDataWrapper, IMessageParser, ObjectRolling, Vector3d } from '../../../../../../api'; + +export class ObjectsRollingParser implements IMessageParser +{ + private _rollerId: number; + private _itemsRolling: ObjectRolling[]; + private _unitRolling: ObjectRolling; + + public flush(): boolean + { + this._rollerId = 0; + + this._itemsRolling = []; + this._unitRolling = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + const x = wrapper.readInt(); + const y = wrapper.readInt(); + const nextX = wrapper.readInt(); + const nextY = wrapper.readInt(); + + let totalItems = wrapper.readInt(); + + while(totalItems > 0) + { + const id = wrapper.readInt(); + const height = parseFloat(wrapper.readString()); + const nextHeight = parseFloat(wrapper.readString()); + const rollingData = new ObjectRolling(id, new Vector3d(x, y, height), new Vector3d(nextX, nextY, nextHeight)); + + this._itemsRolling.push(rollingData); + + totalItems--; + } + + this._rollerId = wrapper.readInt(); + + if(!wrapper.bytesAvailable) return true; + + const movementType = wrapper.readInt(); + const unitId = wrapper.readInt(); + const height = parseFloat(wrapper.readString()); + const nextHeight = parseFloat(wrapper.readString()); + + switch(movementType) + { + case 0: break; + case 1: + this._unitRolling = new ObjectRolling(unitId, new Vector3d(x, y, height), new Vector3d(nextX, nextY, nextHeight), ObjectRolling.MOVE); + break; + case 2: + this._unitRolling = new ObjectRolling(unitId, new Vector3d(x, y, height), new Vector3d(nextX, nextY, nextHeight), ObjectRolling.SLIDE); + break; + } + + return true; + } + + public get rollerId(): number + { + return this._rollerId; + } + + public get itemsRolling(): ObjectRolling[] + { + return this._itemsRolling; + } + + public get unitRolling(): ObjectRolling + { + return this._unitRolling; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/engine/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/engine/index.ts new file mode 100644 index 0000000..ba275c9 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/engine/index.ts @@ -0,0 +1,4 @@ +export * from './FavoriteMembershipUpdateMessageParser'; +export * from './ObjectData'; +export * from './ObjectsDataUpdateParser'; +export * from './ObjectsRollingParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/CustomUserNotificationMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/CustomUserNotificationMessageParser.ts new file mode 100644 index 0000000..dd0e438 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/CustomUserNotificationMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class CustomUserNotificationMessageParser implements IMessageParser +{ + private _code: number; + + public flush(): boolean + { + this._code = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._code = wrapper.readInt(); + + return true; + } + + public get count(): number + { + return this._code; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/DiceValueMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/DiceValueMessageParser.ts new file mode 100644 index 0000000..c05b254 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/DiceValueMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class DiceValueMessageParser implements IMessageParser +{ + private _itemId: number; + private _value: number; + + public flush(): boolean + { + this._itemId = 0; + this._value = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemId = wrapper.readInt(); + this._value = wrapper.readInt(); + + return true; + } + + public get itemId(): number + { + return this._itemId; + } + + public get value(): number + { + return this._value; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/FurniRentOrBuyoutOfferMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/FurniRentOrBuyoutOfferMessageParser.ts new file mode 100644 index 0000000..5bb8f70 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/FurniRentOrBuyoutOfferMessageParser.ts @@ -0,0 +1,67 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class FurniRentOrBuyoutOfferMessageParser implements IMessageParser +{ + private _isWallItem: boolean; + private _furniTypeName: string; + private _buyout: boolean; + private _priceInCredits: number; + private _priceInActivityPoints: number; + private _activityPointType: number; + + public flush(): boolean + { + this._isWallItem = false; + this._furniTypeName = null; + this._buyout = false; + this._priceInCredits = -1; + this._priceInActivityPoints = -1; + this._activityPointType = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._isWallItem = wrapper.readBoolean(); + this._furniTypeName = wrapper.readString(); + this._buyout = wrapper.readBoolean(); + this._priceInCredits = wrapper.readInt(); + this._priceInActivityPoints = wrapper.readInt(); + this._activityPointType = wrapper.readInt(); + + return true; + } + + public get isWallItem(): boolean + { + return this._isWallItem; + } + + public get furniTypeName(): string + { + return this._furniTypeName; + } + + public get buyout(): boolean + { + return this._buyout; + } + + public get priceInCredits(): number + { + return this._priceInCredits; + } + + public get priceInActivityPoints(): number + { + return this._priceInActivityPoints; + } + + public get activityPointType(): number + { + return this._activityPointType; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/FurnitureAliasesParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/FurnitureAliasesParser.ts new file mode 100644 index 0000000..3bc3601 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/FurnitureAliasesParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class FurnitureAliasesParser implements IMessageParser +{ + private _aliases: Map; + + public flush(): boolean + { + this._aliases = new Map(); + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalCount = wrapper.readInt(); + + while(totalCount > 0) + { + this._aliases.set(wrapper.readString(), wrapper.readString()); + + totalCount--; + } + + return true; + } + + public get aliases(): Map + { + return this._aliases; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/FurnitureDataParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/FurnitureDataParser.ts new file mode 100644 index 0000000..77d23fa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/FurnitureDataParser.ts @@ -0,0 +1,48 @@ +import { IMessageDataWrapper, IMessageParser, IObjectData, ObjectDataFactory } from '../../../../../../api'; + +export class FurnitureDataParser implements IMessageParser +{ + private _itemId: number; + private _data: IObjectData; + + public flush(): boolean + { + this._itemId = 0; + this._data = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemId = parseInt(wrapper.readString()); + this._data = FurnitureDataParser.parseObjectData(wrapper); + + return true; + } + + public static parseObjectData(wrapper: IMessageDataWrapper): IObjectData + { + if(!wrapper) return null; + + const data = ObjectDataFactory.getData(wrapper.readInt()); + + if(!data) return null; + + data.parseWrapper(wrapper); + + return data; + } + + public get furnitureId(): number + { + return this._itemId; + } + + public get objectData(): IObjectData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/FurnitureStackHeightParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/FurnitureStackHeightParser.ts new file mode 100644 index 0000000..74477ba --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/FurnitureStackHeightParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class FurnitureStackHeightParser implements IMessageParser +{ + private _furniId: number; + private _height: number; + + public flush(): boolean + { + this._furniId = -1; + this._height = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._furniId = wrapper.readInt(); + this._height = (wrapper.readInt() / 100); + + return true; + } + + public get furniId(): number + { + return this._furniId; + } + + public get height(): number + { + return this._height; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/GroupFurniContextMenuInfoMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/GroupFurniContextMenuInfoMessageParser.ts new file mode 100644 index 0000000..573471e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/GroupFurniContextMenuInfoMessageParser.ts @@ -0,0 +1,67 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class GroupFurniContextMenuInfoMessageParser implements IMessageParser +{ + private _objectId: number; + private _guildId: number; + private _guildName: string; + private _guildHomeRoomId: number; + private _userIsMember: boolean; + private _guildHasReadableForum: boolean; + + public flush(): boolean + { + this._objectId = 0; + this._guildId = 0; + this._guildName = null; + this._guildHomeRoomId = 0; + this._userIsMember = false; + this._guildHasReadableForum = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._objectId = wrapper.readInt(); + this._guildId = wrapper.readInt(); + this._guildName = wrapper.readString(); + this._guildHomeRoomId = wrapper.readInt(); + this._userIsMember = wrapper.readBoolean(); + this._guildHasReadableForum = wrapper.readBoolean(); + + return true; + } + + public get objectId(): number + { + return this._objectId; + } + + public get guildId(): number + { + return this._guildId; + } + + public get guildName(): string + { + return this._guildName; + } + + public get guildHomeRoomId(): number + { + return this._guildHomeRoomId; + } + + public get userIsMember(): boolean + { + return this._userIsMember; + } + + public get guildHasReadableForum(): boolean + { + return this._guildHasReadableForum; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/ItemDataUpdateMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/ItemDataUpdateMessageParser.ts new file mode 100644 index 0000000..1ddd603 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/ItemDataUpdateMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class ItemDataUpdateMessageParser implements IMessageParser +{ + private _itemId: number; + private _data: string; + + public flush(): boolean + { + this._itemId = 0; + this._data = ''; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemId = parseInt(wrapper.readString()); + this._data = wrapper.readString(); + + return true; + } + + public get furnitureId(): number + { + return this._itemId; + } + + public get data(): string + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/LoveLockFurniFinishedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/LoveLockFurniFinishedParser.ts new file mode 100644 index 0000000..1abe5d1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/LoveLockFurniFinishedParser.ts @@ -0,0 +1,23 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class LoveLockFurniFinishedParser implements IMessageParser +{ + private _furniId: number; + + public get furniId(): number + { + return this._furniId; + } + + public flush(): boolean + { + this._furniId = -1; + return true; + } + + public parse(packet: IMessageDataWrapper): boolean + { + this._furniId = packet.readInt(); + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/LoveLockFurniFriendConfirmedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/LoveLockFurniFriendConfirmedParser.ts new file mode 100644 index 0000000..5eef7d2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/LoveLockFurniFriendConfirmedParser.ts @@ -0,0 +1,23 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class LoveLockFurniFriendConfirmedParser implements IMessageParser +{ + private _furniId: number; + + public get furniId(): number + { + return this._furniId; + } + + public flush(): boolean + { + this._furniId = -1; + return true; + } + + public parse(packet: IMessageDataWrapper): boolean + { + this._furniId = packet.readInt(); + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/LoveLockFurniStartParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/LoveLockFurniStartParser.ts new file mode 100644 index 0000000..e9f4cf8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/LoveLockFurniStartParser.ts @@ -0,0 +1,31 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class LoveLockFurniStartParser implements IMessageParser +{ + private _furniId: number; + private _start: boolean; + + public get furniId(): number + { + return this._furniId; + } + + public get start(): boolean + { + return this._start; + } + + public flush(): boolean + { + this._furniId = -1; + this._start = false; + return true; + } + + public parse(packet: IMessageDataWrapper): boolean + { + this._furniId = packet.readInt(); + this._start = packet.readBoolean(); + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/OneWayDoorStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/OneWayDoorStatusMessageParser.ts new file mode 100644 index 0000000..6da2b72 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/OneWayDoorStatusMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class OneWayDoorStatusMessageParser implements IMessageParser +{ + private _itemId: number; + private _state: number; + + public flush(): boolean + { + this._itemId = 0; + this._state = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemId = wrapper.readInt(); + this._state = wrapper.readInt(); + + return true; + } + + public get itemId(): number + { + return this._itemId; + } + + public get state(): number + { + return this._state; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RentableSpaceRentFailedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RentableSpaceRentFailedMessageParser.ts new file mode 100644 index 0000000..581567a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RentableSpaceRentFailedMessageParser.ts @@ -0,0 +1,25 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RentableSpaceRentFailedMessageParser implements IMessageParser +{ + private _reason: number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._reason = wrapper.readInt(); + + return true; + } + + public get reason(): number + { + return this._reason; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RentableSpaceRentOkMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RentableSpaceRentOkMessageParser.ts new file mode 100644 index 0000000..7d2c27d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RentableSpaceRentOkMessageParser.ts @@ -0,0 +1,25 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RentableSpaceRentOkMessageParser implements IMessageParser +{ + private _expiryTime: number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._expiryTime = wrapper.readInt(); + + return true; + } + + public get expiryTime(): number + { + return this._expiryTime; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RentableSpaceStatusMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RentableSpaceStatusMessageParser.ts new file mode 100644 index 0000000..5b5d651 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RentableSpaceStatusMessageParser.ts @@ -0,0 +1,92 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RentableSpaceStatusMessageParser implements IMessageParser +{ + public static readonly SPACE_ALREADY_RENTED = 100; + public static readonly SPACE_EXTEND_NOT_RENTED = 101; + public static readonly SPACE_EXTEND_NOT_RENTED_BY_YOU = 102; + public static readonly CAN_RENT_ONLY_ONE_SPACE = 103; + public static readonly NOT_ENOUGH_CREDITS = 200; + public static readonly NOT_ENOUGH_PIXELS = 201; + public static readonly CANT_RENT_NO_PERMISSION = 202; + public static readonly CANT_RENT_NO_HABBO_CLUB = 203; + public static readonly CANT_RENT = 300; + public static readonly CANT_RENT_GENERIC = 400; + + private _rented: boolean; + private _renterId: number; + private _renterName: string; + private _canRent: boolean; + private _canRentErrorCode: number; + private _timeRemaining: number; + private _price: number; + + public flush(): boolean + { + this._rented = false; + this._renterId = -1; + this._renterName = null; + this._canRent = false; + this._canRentErrorCode = -1; + this._timeRemaining = -1; + this._price = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._rented = wrapper.readBoolean(); + this._canRentErrorCode = wrapper.readInt(); + this._canRent = (this._canRentErrorCode === 0); + this._renterId = wrapper.readInt(); + this._renterName = wrapper.readString(); + this._timeRemaining = wrapper.readInt(); + this._price = wrapper.readInt(); + + if(!this._rented) + { + this._renterId = -1; + this._renterName = ''; + } + + return true; + } + + public get rented(): boolean + { + return this._rented; + } + + public get renterId(): number + { + return this._renterId; + } + + public get renterName(): string + { + return this._renterName; + } + + public get canRent(): boolean + { + return this._canRent; + } + + public get price(): number + { + return this._price; + } + + public get timeRemaining(): number + { + return this._timeRemaining; + } + + public get canRentErrorCode(): number + { + return this._canRentErrorCode; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RequestSpamWallPostItMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RequestSpamWallPostItMessageParser.ts new file mode 100644 index 0000000..9f6c91f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RequestSpamWallPostItMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RequestSpamWallPostItMessageParser implements IMessageParser +{ + private _itemId: number; + private _location: string; + + public flush(): boolean + { + this._itemId = -1; + this._location = ''; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemId = wrapper.readInt(); + this._location = wrapper.readString(); + + return true; + } + + public get itemId(): number + { + return this._itemId; + } + + public get location(): string + { + return this._location; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RoomDimmerPresetsMessageData.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RoomDimmerPresetsMessageData.ts new file mode 100644 index 0000000..9264b72 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RoomDimmerPresetsMessageData.ts @@ -0,0 +1,9 @@ +export class RoomDimmerPresetsMessageData +{ + constructor( + public id: number, + public type: number, + public color: number, + public brightness: number) + {} +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RoomDimmerPresetsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RoomDimmerPresetsMessageParser.ts new file mode 100644 index 0000000..02e0f87 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RoomDimmerPresetsMessageParser.ts @@ -0,0 +1,57 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { RoomDimmerPresetsMessageData } from './RoomDimmerPresetsMessageData'; + +export class RoomDimmerPresetsMessageParser implements IMessageParser +{ + private _selectedPresetId: number; + private _presets: RoomDimmerPresetsMessageData[]; + + constructor() + { + this._selectedPresetId = 0; + this._presets = []; + } + + public flush(): boolean + { + this._presets = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + const totalPresets = wrapper.readInt(); + + this._selectedPresetId = wrapper.readInt(); + + for(let i = 0; i < totalPresets; i++) + { + const presetId = wrapper.readInt(); + const type = wrapper.readInt(); + const color = parseInt(wrapper.readString().substr(1), 16); + const brightness = wrapper.readInt(); + + this._presets.push(new RoomDimmerPresetsMessageData(presetId, type, color, brightness)); + } + + return true; + } + + public getPreset(id: number): RoomDimmerPresetsMessageData + { + if((id < 0) || (id >= this.presetCount)) return null; + + return this._presets[id]; + } + + public get presetCount(): number + { + return this._presets.length; + } + + public get selectedPresetId(): number + { + return this._selectedPresetId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RoomMessageNotificationMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RoomMessageNotificationMessageParser.ts new file mode 100644 index 0000000..714c65f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/RoomMessageNotificationMessageParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomMessageNotificationMessageParser implements IMessageParser +{ + private _roomId: number; + private _roomName: string; + private _messageCount: number; + + public flush(): boolean + { + this._roomId = -1; + this._roomName = null; + this._messageCount = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + this._roomName = wrapper.readString(); + this._messageCount = wrapper.readInt(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get roomName(): string + { + return this._roomName; + } + + public get messageCount(): number + { + return this._messageCount; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/WelcomeGiftStatusParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/WelcomeGiftStatusParser.ts new file mode 100644 index 0000000..6c0a881 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/WelcomeGiftStatusParser.ts @@ -0,0 +1,59 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class WelcomeGiftStatusParser implements IMessageParser +{ + private _email: string; + private _isVerified: boolean; + private _allowChange: boolean; + private _furniId: number; + private _requestedByUser: boolean; + + public flush(): boolean + { + this._email = null; + this._isVerified = false; + this._allowChange = false; + this._furniId = -1; + this._requestedByUser = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._email = wrapper.readString(); + this._isVerified = wrapper.readBoolean(); + this._allowChange = wrapper.readBoolean(); + this._furniId = wrapper.readInt(); + this._requestedByUser = wrapper.readBoolean(); + + return true; + } + + public get email(): string + { + return this._email; + } + + public get isVerified(): boolean + { + return this._isVerified; + } + + public get allowChange(): boolean + { + return this._allowChange; + } + + public get furniId(): number + { + return this._furniId; + } + + public get requestedByUser(): boolean + { + return this._requestedByUser; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorAddParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorAddParser.ts new file mode 100644 index 0000000..75d74f1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorAddParser.ts @@ -0,0 +1,29 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; +import { FurnitureFloorDataParser } from './FurnitureFloorDataParser'; + +export class FurnitureFloorAddParser implements IMessageParser +{ + private _item: FurnitureFloorDataParser; + + public flush(): boolean + { + this._item = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._item = new FurnitureFloorDataParser(wrapper); + this._item.username = wrapper.readString(); + + return true; + } + + public get item(): FurnitureFloorDataParser + { + return this._item; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorDataParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorDataParser.ts new file mode 100644 index 0000000..8c23f86 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorDataParser.ts @@ -0,0 +1,159 @@ +import { IMessageDataWrapper, IObjectData } from '../../../../../../../api'; +import { FurnitureDataParser } from '../FurnitureDataParser'; + +export class FurnitureFloorDataParser +{ + private _itemId: number; + private _spriteId: number; + private _spriteName: string; + private _x: number; + private _y: number; + private _direction: number; + private _z: number; + private _stackHeight: number; + private _extra: number; + private _data: IObjectData; + private _state: number; + private _expires: number; + private _usagePolicy: number; + private _userId: number; + private _username: string; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._itemId = 0; + this._spriteId = 0; + this._spriteName = null; + this._x = 0; + this._y = 0; + this._direction = 0; + this._z = 0; + this._stackHeight = 0; + this._extra = 0; + this._data = null; + this._state = 0; + this._expires = 0; + this._usagePolicy = 0; + this._userId = 0; + this._username = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemId = wrapper.readInt(); + this._spriteId = wrapper.readInt(); + this._x = wrapper.readInt(); + this._y = wrapper.readInt(); + this._direction = ((wrapper.readInt() % 8) * 45); + this._z = parseFloat(wrapper.readString()); + this._stackHeight = parseFloat(wrapper.readString()); + this._extra = wrapper.readInt(); + this._data = FurnitureDataParser.parseObjectData(wrapper); + this._state = parseFloat(this._data && this._data.getLegacyString()) || 0; + this._expires = wrapper.readInt(); + this._usagePolicy = wrapper.readInt(); + this._userId = wrapper.readInt(); + this._username = null; + + if(this._spriteId < 0) this._spriteName = wrapper.readString(); + + return true; + } + + public get itemId(): number + { + return this._itemId; + } + + public get spriteId(): number + { + return this._spriteId; + } + + public get x(): number + { + return this._x; + } + + public get y(): number + { + return this._y; + } + + public get direction(): number + { + return this._direction; + } + + public get z(): number + { + return ((isNaN(this._z)) ? 0 : this._z); + } + + public get stackHeight(): number + { + return ((isNaN(this._stackHeight)) ? 0 : this._stackHeight); + } + + public get extra(): number + { + return this._extra; + } + + public get data(): IObjectData + { + return this._data; + } + + public get state(): number + { + return this._state; + } + + public get expires(): number + { + return this._expires; + } + + public get usagePolicy(): number + { + return this._usagePolicy; + } + + public get userId(): number + { + return this._userId; + } + + public get username(): string + { + return this._username; + } + + public set username(username: string) + { + this._username = username; + } + + public get spriteName(): string + { + return this._spriteName; + } + + public set spriteName(type: string) + { + this._spriteName = type; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorParser.ts new file mode 100644 index 0000000..e27d3e4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorParser.ts @@ -0,0 +1,68 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; +import { FurnitureFloorDataParser } from './FurnitureFloorDataParser'; + +export class FurnitureFloorParser implements IMessageParser +{ + private _owners: Map; + private _items: FurnitureFloorDataParser[]; + + public flush(): boolean + { + this._owners = new Map(); + this._items = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + if(!this.parseOwners(wrapper)) return false; + + let totalItems = wrapper.readInt(); + + while(totalItems > 0) + { + const item = new FurnitureFloorDataParser(wrapper); + + if(!item) continue; + + const username = this._owners.get(item.userId); + + if(username) item.username = username; + + this._items.push(item); + + totalItems--; + } + + return true; + } + + private parseOwners(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalOwners = wrapper.readInt(); + + while(totalOwners > 0) + { + this._owners.set(wrapper.readInt(), wrapper.readString()); + + totalOwners--; + } + + return true; + } + + public get owners(): Map + { + return this._owners; + } + + public get items(): FurnitureFloorDataParser[] + { + return this._items; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorRemoveParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorRemoveParser.ts new file mode 100644 index 0000000..ae4d778 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorRemoveParser.ts @@ -0,0 +1,51 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; + +export class FurnitureFloorRemoveParser implements IMessageParser +{ + private _itemId: number; + private _isExpired: boolean; + private _userId: number; + private _delay: number; + + public flush(): boolean + { + this._itemId = 0; + this._isExpired = true; + this._userId = 0; + this._delay = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemId = parseInt(wrapper.readString()); + this._isExpired = wrapper.readBoolean(); + this._userId = wrapper.readInt(); + this._delay = wrapper.readInt(); + + return true; + } + + public get itemId(): number + { + return this._itemId; + } + + public get isExpired(): boolean + { + return this._isExpired; + } + + public get userId(): number + { + return this._userId; + } + + public get delay(): number + { + return this._delay; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorUpdateParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorUpdateParser.ts new file mode 100644 index 0000000..c9dd10f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/FurnitureFloorUpdateParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; +import { FurnitureFloorDataParser } from './FurnitureFloorDataParser'; + +export class FurnitureFloorUpdateParser implements IMessageParser +{ + private _item: FurnitureFloorDataParser; + + public flush(): boolean + { + this._item = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._item = new FurnitureFloorDataParser(wrapper); + + return true; + } + + public get item(): FurnitureFloorDataParser + { + return this._item; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/index.ts new file mode 100644 index 0000000..710c755 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/floor/index.ts @@ -0,0 +1,5 @@ +export * from './FurnitureFloorAddParser'; +export * from './FurnitureFloorDataParser'; +export * from './FurnitureFloorParser'; +export * from './FurnitureFloorRemoveParser'; +export * from './FurnitureFloorUpdateParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/index.ts new file mode 100644 index 0000000..8cebe4b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/index.ts @@ -0,0 +1,23 @@ +export * from './CustomUserNotificationMessageParser'; +export * from './DiceValueMessageParser'; +export * from './floor'; +export * from './FurniRentOrBuyoutOfferMessageParser'; +export * from './FurnitureAliasesParser'; +export * from './FurnitureDataParser'; +export * from './FurnitureStackHeightParser'; +export * from './GroupFurniContextMenuInfoMessageParser'; +export * from './ItemDataUpdateMessageParser'; +export * from './LoveLockFurniFinishedParser'; +export * from './LoveLockFurniFriendConfirmedParser'; +export * from './LoveLockFurniStartParser'; +export * from './OneWayDoorStatusMessageParser'; +export * from './RentableSpaceRentFailedMessageParser'; +export * from './RentableSpaceRentOkMessageParser'; +export * from './RentableSpaceStatusMessageParser'; +export * from './RequestSpamWallPostItMessageParser'; +export * from './RoomDimmerPresetsMessageData'; +export * from './RoomDimmerPresetsMessageParser'; +export * from './RoomMessageNotificationMessageParser'; +export * from './wall'; +export * from './WelcomeGiftStatusParser'; +export * from './youtube'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallAddParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallAddParser.ts new file mode 100644 index 0000000..01da836 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallAddParser.ts @@ -0,0 +1,29 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; +import { FurnitureWallDataParser } from './FurnitureWallDataParser'; + +export class FurnitureWallAddParser implements IMessageParser +{ + private _item: FurnitureWallDataParser; + + public flush(): boolean + { + this._item = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._item = new FurnitureWallDataParser(wrapper); + this._item.username = wrapper.readString(); + + return true; + } + + public get item(): FurnitureWallDataParser + { + return this._item; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallDataParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallDataParser.ts new file mode 100644 index 0000000..d70cc32 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallDataParser.ts @@ -0,0 +1,228 @@ +import { IMessageDataWrapper } from '../../../../../../../api'; + +export class FurnitureWallDataParser +{ + private _itemId: number; + private _spriteId: number; + private _location: string; + private _stuffData: string; + private _state: number; + private _secondsToExpiration: number; + private _usagePolicy: number; + private _userId: number; + private _username: string; + + private _width: number; + private _height: number; + private _localX: number; + private _localY: number; + private _y: number; + private _z: number; + private _direction: string; + private _isOldFormat: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._itemId = 0; + this._spriteId = 0; + this._location = null; + this._stuffData = null; + this._state = 0; + this._secondsToExpiration = 0; + this._usagePolicy = -1; + this._userId = 0; + this._username = null; + + this._width = 0; + this._height = 0; + this._localX = 0; + this._localY = 0; + this._y = 0; + this._z = 0; + this._direction = null; + this._isOldFormat = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemId = parseInt(wrapper.readString()); + this._spriteId = wrapper.readInt(); + this._location = wrapper.readString(); + this._stuffData = wrapper.readString(); + this._secondsToExpiration = wrapper.readInt(); + this._usagePolicy = wrapper.readInt(); + this._userId = wrapper.readInt(); + this._username = null; + + const state = parseFloat(this._stuffData); + + if(!isNaN(state)) this._state = Math.trunc(state); + + if(this._location.indexOf(':') === 0) + { + this._isOldFormat = false; + + let parts = this._location.split(' '); + + if(parts.length >= 3) + { + let widthHeight = parts[0]; + let leftRight = parts[1]; + + const direction = parts[2]; + + if((widthHeight.length > 3) && (leftRight.length > 2)) + { + widthHeight = widthHeight.substr(3); + leftRight = leftRight.substr(2); + parts = widthHeight.split(','); + + if(parts.length >= 2) + { + const width = parseInt(parts[0]); + const height = parseInt(parts[1]); + + parts = leftRight.split(','); + + if(parts.length >= 2) + { + const localX = parseInt(parts[0]); + const localY = parseInt(parts[1]); + + this._width = width; + this._height = height; + this._localX = localX; + this._localY = localY; + this._direction = direction; + } + } + } + } + } + else + { + this._isOldFormat = true; + + // _local_12 = _local_4.split(" "); + // if (_local_12.length >= 2) + // { + // _local_13 = String(_local_12[0]); + // if (((_local_13 == "rightwall") || (_local_13 == "frontwall"))) + // { + // _local_13 = "r"; + // } + // else + // { + // _local_13 = "l"; + // } + // _local_20 = String(_local_12[1]); + // _local_21 = _local_20.split(","); + // if (_local_21.length >= 3) + // { + // _local_22 = 0; + // _local_23 = parseFloat(_local_21[0]); + // _local_24 = parseFloat(_local_21[1]); + // _local_11.y = _local_23; + // _local_11.z = _local_24; + // _local_11.dir = _local_13; + // _local_11.data = _local_5; + // _local_11.state = _local_9; + // } + // } + } + + return true; + } + + public get itemId(): number + { + return this._itemId; + } + + public get spriteId(): number + { + return this._spriteId; + } + + public get wallPosition(): string + { + return this._location; + } + + public get stuffData(): string + { + return this._stuffData; + } + + public get state(): number + { + return this._state; + } + + public get secondsToExpiration(): number + { + return this._secondsToExpiration; + } + + public get usagePolicy(): number + { + return this._usagePolicy; + } + + public get userId(): number + { + return this._userId; + } + + public get username(): string + { + return this._username; + } + + public set username(username: string) + { + this._username = username; + } + + public get width(): number + { + return this._width; + } + + public get height(): number + { + return this._height; + } + + public get localX(): number + { + return this._localX; + } + + public get localY(): number + { + return this._localY; + } + + public get direction(): string + { + return this._direction; + } + + public get isOldFormat(): boolean + { + return this._isOldFormat; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallParser.ts new file mode 100644 index 0000000..413e7e1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallParser.ts @@ -0,0 +1,68 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; +import { FurnitureWallDataParser } from './FurnitureWallDataParser'; + +export class FurnitureWallParser implements IMessageParser +{ + private _owners: Map; + private _items: FurnitureWallDataParser[]; + + public flush(): boolean + { + this._owners = new Map(); + this._items = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + if(!this.parseOwners(wrapper)) return false; + + let totalItems = wrapper.readInt(); + + while(totalItems > 0) + { + const item = new FurnitureWallDataParser(wrapper); + + if(!item) continue; + + const username = this._owners.get(item.userId); + + if(username) item.username = username; + + this._items.push(item); + + totalItems--; + } + + return true; + } + + private parseOwners(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalOwners = wrapper.readInt(); + + while(totalOwners > 0) + { + this._owners.set(wrapper.readInt(), wrapper.readString()); + + totalOwners--; + } + + return true; + } + + public get owners(): Map + { + return this._owners; + } + + public get items(): FurnitureWallDataParser[] + { + return this._items; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallRemoveParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallRemoveParser.ts new file mode 100644 index 0000000..7ccada5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallRemoveParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; + +export class FurnitureWallRemoveParser implements IMessageParser +{ + private _itemId: number; + private _userId: number; + + public flush(): boolean + { + this._itemId = 0; + this._userId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._itemId = parseInt(wrapper.readString()); + this._userId = wrapper.readInt(); + + return true; + } + + public get itemId(): number + { + return this._itemId; + } + + public get userId(): number + { + return this._userId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallUpdateParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallUpdateParser.ts new file mode 100644 index 0000000..4a7d052 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/FurnitureWallUpdateParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; +import { FurnitureWallDataParser } from './FurnitureWallDataParser'; + +export class FurnitureWallUpdateParser implements IMessageParser +{ + private _item: FurnitureWallDataParser; + + public flush(): boolean + { + this._item = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._item = new FurnitureWallDataParser(wrapper); + + return true; + } + + public get item(): FurnitureWallDataParser + { + return this._item; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/index.ts new file mode 100644 index 0000000..2b085b2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/wall/index.ts @@ -0,0 +1,5 @@ +export * from './FurnitureWallAddParser'; +export * from './FurnitureWallDataParser'; +export * from './FurnitureWallParser'; +export * from './FurnitureWallRemoveParser'; +export * from './FurnitureWallUpdateParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeControlVideoMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeControlVideoMessageParser.ts new file mode 100644 index 0000000..ea696f1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeControlVideoMessageParser.ts @@ -0,0 +1,31 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; + +export class YoutubeControlVideoMessageParser implements IMessageParser +{ + private _furniId: number; + private _commandId: number; + + public parse(wrapper: IMessageDataWrapper): boolean + { + this._furniId = wrapper.readInt(); + this._commandId = wrapper.readInt(); + return true; + } + + public flush(): boolean + { + this._furniId = -1; + this._commandId = -1; + return true; + } + + public get furniId(): number + { + return this._furniId; + } + + public get commandId(): number + { + return this._commandId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeDisplayPlaylist.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeDisplayPlaylist.ts new file mode 100644 index 0000000..f47c5ee --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeDisplayPlaylist.ts @@ -0,0 +1,28 @@ +export class YoutubeDisplayPlaylist +{ + private _video: string; + private _title: string; + private _description: string; + + constructor(k: string, _arg_2: string, _arg_3: string) + { + this._video = k; + this._title = _arg_2; + this._description = _arg_3; + } + + public get video():string + { + return this._video; + } + + public get title():string + { + return this._title; + } + + public get description():string + { + return this._description; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeDisplayPlaylistsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeDisplayPlaylistsMessageParser.ts new file mode 100644 index 0000000..b2e01a2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeDisplayPlaylistsMessageParser.ts @@ -0,0 +1,45 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; +import { YoutubeDisplayPlaylist } from './YoutubeDisplayPlaylist'; + +export class YoutubeDisplayPlaylistsMessageParser implements IMessageParser +{ + private _furniId: number; + private _playlists: YoutubeDisplayPlaylist[]; + private _selectedPlaylistId: string; + + flush(): boolean + { + this._furniId = -1; + this._playlists = null; + this._selectedPlaylistId = null; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._furniId = wrapper.readInt(); + const count = wrapper.readInt(); + this._playlists = []; + for(let i = 0; i < count; i++) + { + this._playlists.push(new YoutubeDisplayPlaylist(wrapper.readString(), wrapper.readString(), wrapper.readString())); + } + this._selectedPlaylistId = wrapper.readString(); + return true; + } + + public get furniId(): number + { + return this._furniId; + } + + public get playlists(): YoutubeDisplayPlaylist[] + { + return this._playlists; + } + + public get selectedPlaylistId(): string + { + return this._selectedPlaylistId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeDisplayVideoMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeDisplayVideoMessageParser.ts new file mode 100644 index 0000000..150f895 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/youtube/YoutubeDisplayVideoMessageParser.ts @@ -0,0 +1,50 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; + +export class YoutubeDisplayVideoMessageParser implements IMessageParser +{ + private _furniId: number; + private _videoId: string; + private _startAtSeconds: number; + private _endAtSeconds: number; + private _state: number; + + flush(): boolean + { + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._furniId = wrapper.readInt(); + this._videoId = wrapper.readString(); + this._startAtSeconds = wrapper.readInt(); + this._endAtSeconds = wrapper.readInt(); + this._state = wrapper.readInt(); + return true; + } + + public get furniId(): number + { + return this._furniId; + } + + public get videoId(): string + { + return this._videoId; + } + + public get state(): number + { + return this._state; + } + + public get startAtSeconds(): number + { + return this._startAtSeconds; + } + + public get endAtSeconds(): number + { + return this._endAtSeconds; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/youtube/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/youtube/index.ts new file mode 100644 index 0000000..9339473 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/furniture/youtube/index.ts @@ -0,0 +1,4 @@ +export * from './YoutubeControlVideoMessageParser'; +export * from './YoutubeDisplayPlaylist'; +export * from './YoutubeDisplayPlaylistsMessageParser'; +export * from './YoutubeDisplayVideoMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/index.ts new file mode 100644 index 0000000..81b327b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/index.ts @@ -0,0 +1,15 @@ +export * from './access'; +export * from './access/doorbell'; +export * from './access/rights'; +export * from './bots'; +export * from './data'; +export * from './engine'; +export * from './furniture'; +export * from './furniture/floor'; +export * from './furniture/wall'; +export * from './furniture/youtube'; +export * from './mapping'; +export * from './pet'; +export * from './session'; +export * from './unit'; +export * from './unit/chat'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/FloorHeightMapMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/FloorHeightMapMessageParser.ts new file mode 100644 index 0000000..4b12f96 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/FloorHeightMapMessageParser.ts @@ -0,0 +1,167 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class FloorHeightMapMessageParser implements IMessageParser +{ + public static TILE_BLOCKED: number = -110; + + private _model: string; + private _width: number; + private _height: number; + private _heightMap: number[][]; + private _wallHeight: number; + private _scale: number; + + public flush(): boolean + { + this._model = null; + this._width = 0; + this._height = 0; + this._wallHeight = -1; + this._heightMap = []; + this._scale = 64; + this._model = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + const scale = wrapper.readBoolean(); + const wallHeight = wrapper.readInt(); + const model = wrapper.readString(); + + return this.parseExplicitly(model, wallHeight, scale); + } + + public parseModel(modelString: string, wallHeight: number, scale: boolean = true): boolean + { + return this.parseExplicitly(modelString, wallHeight, scale); + } + + private parseExplicitly(modelString: string, wallHeight: number, scale: boolean = true): boolean + { + this._scale = scale ? 32 : 64; + this._wallHeight = wallHeight; + this._model = modelString; + + const model = this._model.split('\r'); + const modelRows = model.length; + + let width = 0; + const height = 0; + + let iterator = 0; + + while(iterator < modelRows) + { + const row = model[iterator]; + + if(row.length > width) + { + width = row.length; + } + + iterator++; + } + + this._heightMap = []; + iterator = 0; + + while(iterator < modelRows) + { + const heightMap: number[] = []; + + let subIterator = 0; + + while(subIterator < width) + { + heightMap.push(FloorHeightMapMessageParser.TILE_BLOCKED); + + subIterator++; + } + + this._heightMap.push(heightMap); + + iterator++; + } + + this._width = width; + this._height = modelRows; + + iterator = 0; + + while(iterator < modelRows) + { + const heightMap = this._heightMap[iterator]; + const text = model[iterator]; + + if(text.length > 0) + { + let subIterator = 0; + + while(subIterator < text.length) + { + const char = text.charAt(subIterator); + let height = FloorHeightMapMessageParser.TILE_BLOCKED; + + if((char !== 'x') && (char !== 'X')) height = parseInt(char, 36); + + heightMap[subIterator] = height; + + subIterator++; + } + } + + iterator++; + } + + return true; + } + + public getHeight(x: number, y: number): number + { + if((x < 0) || (x >= this._width) || (y < 0) || (y >= this._height)) return -110; + + const row = this._heightMap[y]; + + if(row === undefined) return -110; + + const height = row[x]; + + if(height === undefined) return -110; + + return height; + } + + public get model(): string + { + return this._model; + } + + public get width(): number + { + return this._width; + } + + public get height(): number + { + return this._height; + } + + public get heightMap(): number[][] + { + return this._heightMap; + } + + public get wallHeight(): number + { + return this._wallHeight; + } + + public get scale(): number + { + return this._scale; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomEntryTileMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomEntryTileMessageParser.ts new file mode 100644 index 0000000..d574ffb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomEntryTileMessageParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomEntryTileMessageParser implements IMessageParser +{ + private _x: number; + private _y: number; + private _direction: number; + + public flush(): boolean + { + this._x = 0; + this._y = 0; + this._direction = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._x = wrapper.readInt(); + this._y = wrapper.readInt(); + this._direction = wrapper.readInt(); + + return true; + } + + public get x(): number + { + return this._x; + } + + public get y(): number + { + return this._y; + } + + public get direction(): number + { + return this._direction; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomHeightMapParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomHeightMapParser.ts new file mode 100644 index 0000000..bd0817d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomHeightMapParser.ts @@ -0,0 +1,88 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomHeightMapParser implements IMessageParser +{ + private _width: number; + private _height: number; + private _heights: number[]; + + public static decodeTileHeight(height: number): number + { + return ((height < 0) ? -1 : ((height & 16383) / 0x0100)); + } + + public static decodeIsStackingBlocked(height: number): boolean + { + return !!(height & 0x4000); + } + + public static decodeIsRoomTile(height: number): boolean + { + return height >= 0; + } + + public getTileHeight(x: number, y: number): number + { + if((x < 0) || (x >= this._width) || (y < 0) || (y >= this._height)) return -1; + + return RoomHeightMapParser.decodeTileHeight(this._heights[((y * this._width) + x)]); + } + + public getStackingBlocked(x: number, y: number): boolean + { + if((x < 0) || (x >= this._width) || (y < 0) || (y >= this._height)) return true; + + return RoomHeightMapParser.decodeIsStackingBlocked(this._heights[((y * this._width) + x)]); + } + + public isRoomTile(x: number, y: number): boolean + { + if((x < 0) || (x >= this._width) || (y < 0) || (y >= this._height)) return false; + + return RoomHeightMapParser.decodeIsRoomTile(this._heights[((y * this._width) + x)]); + } + + public flush(): boolean + { + this._width = 0; + this._height = 0; + this._heights = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._width = wrapper.readInt(); + const totalTiles = wrapper.readInt(); + this._height = totalTiles / this._width; + + let i = 0; + + while(i < totalTiles) + { + this._heights[i] = wrapper.readShort(); + + i++; + } + + return true; + } + + public get width(): number + { + return this._width; + } + + public get height(): number + { + return this._height; + } + + public get heights(): number[] + { + return this._heights; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomHeightMapUpdateParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomHeightMapUpdateParser.ts new file mode 100644 index 0000000..a8b0a68 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomHeightMapUpdateParser.ts @@ -0,0 +1,75 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { RoomHeightMapParser } from './RoomHeightMapParser'; + +export class RoomHeightMapUpdateParser implements IMessageParser +{ + private _wrapper: IMessageDataWrapper; + private _count: number; + private _x: number; + private _y: number; + private _value: number; + + public flush(): boolean + { + this._wrapper = null; + this._count = 0; + this._x = 0; + this._y = 0; + this._value = 0; + + return true; + } + + public tileHeight(): number + { + return RoomHeightMapParser.decodeTileHeight(this._value); + } + + public isStackingBlocked(): boolean + { + return RoomHeightMapParser.decodeIsStackingBlocked(this._value); + } + + public isRoomTile(): boolean + { + return RoomHeightMapParser.decodeIsRoomTile(this._value); + } + + public next(): boolean + { + if(!this._count) return false; + + this._count--; + + this._x = this._wrapper.readByte(); + this._y = this._wrapper.readByte(); + this._value = this._wrapper.readShort(); + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._wrapper = wrapper; + this._count = wrapper.readByte(); + + return true; + } + + public get x(): number + { + return this._x; + } + + public get y(): number + { + return this._y; + } + + public get height(): number + { + return this._value; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomOccupiedTilesMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomOccupiedTilesMessageParser.ts new file mode 100644 index 0000000..1ba3467 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomOccupiedTilesMessageParser.ts @@ -0,0 +1,39 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomOccupiedTilesMessageParser implements IMessageParser +{ + private _blockedTilesMap: boolean[][]; + + public flush(): boolean + { + this._blockedTilesMap = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let tilesCount = wrapper.readInt(); + + while(tilesCount > 0) + { + const x = wrapper.readInt(); + const y = wrapper.readInt(); + + if(!this._blockedTilesMap[y]) this._blockedTilesMap[y] = []; + + this._blockedTilesMap[y][x] = true; + + tilesCount--; + } + + return true; + } + + public get blockedTilesMap(): boolean[][] + { + return this._blockedTilesMap; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomPaintParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomPaintParser.ts new file mode 100644 index 0000000..ce1e420 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomPaintParser.ts @@ -0,0 +1,65 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomPaintParser implements IMessageParser +{ + private _floorType: string; + private _wallType: string; + private _landscapeType: string; + private _landscapeAnimation: string; + + public flush(): boolean + { + this._floorType = null; + this._wallType = null; + this._landscapeType = null; + this._landscapeAnimation = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + const type = wrapper.readString(); + const value = wrapper.readString(); + + switch(type) + { + case 'floor': + this._floorType = value; + break; + case 'wallpaper': + this._wallType = value; + break; + case 'landscape': + this._landscapeType = value; + break; + case 'landscapeanim': + this._landscapeAnimation = value; + break; + } + + return true; + } + + public get floorType(): string + { + return this._floorType; + } + + public get wallType(): string + { + return this._wallType; + } + + public get landscapeType(): string + { + return this._landscapeType; + } + + public get landscapeAnimation(): string + { + return this._landscapeAnimation; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomReadyMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomReadyMessageParser.ts new file mode 100644 index 0000000..94b6801 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomReadyMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomReadyMessageParser implements IMessageParser +{ + private _name: string; + private _roomId: number; + + public flush(): boolean + { + this._name = null; + this._roomId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._name = wrapper.readString(); + this._roomId = wrapper.readInt(); + + return true; + } + + public get name(): string + { + return this._name; + } + + public get roomId(): number + { + return this._roomId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomVisualizationSettingsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomVisualizationSettingsParser.ts new file mode 100644 index 0000000..9b09466 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/RoomVisualizationSettingsParser.ts @@ -0,0 +1,50 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomVisualizationSettingsParser implements IMessageParser +{ + private _hideWalls: boolean; + private _thicknessWall: number; + private _thicknessFloor: number; + + public flush(): boolean + { + this._hideWalls = false; + this._thicknessWall = 0; + this._thicknessFloor = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._hideWalls = wrapper.readBoolean(); + + let thicknessWall = wrapper.readInt(); + let thicknessFloor = wrapper.readInt(); + + thicknessWall = (thicknessWall < -2) ? -2 : (thicknessWall > 1) ? 1 : thicknessWall; + thicknessFloor = (thicknessFloor < -2) ? -2 : (thicknessFloor > 1) ? 1 : thicknessFloor; + + this._thicknessWall = Math.pow(2, thicknessWall); + this._thicknessFloor = Math.pow(2, thicknessFloor); + + return true; + } + + public get hideWalls(): boolean + { + return this._hideWalls; + } + + public get thicknessWall(): number + { + return this._thicknessWall; + } + + public get thicknessFloor(): number + { + return this._thicknessFloor; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/index.ts new file mode 100644 index 0000000..11846fd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/mapping/index.ts @@ -0,0 +1,8 @@ +export * from './FloorHeightMapMessageParser'; +export * from './RoomEntryTileMessageParser'; +export * from './RoomHeightMapParser'; +export * from './RoomHeightMapUpdateParser'; +export * from './RoomOccupiedTilesMessageParser'; +export * from './RoomPaintParser'; +export * from './RoomReadyMessageParser'; +export * from './RoomVisualizationSettingsParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/pet/BreedingPetInfo.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/BreedingPetInfo.ts new file mode 100644 index 0000000..6c6d40f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/BreedingPetInfo.ts @@ -0,0 +1,55 @@ +import { IMessageDataWrapper } from '../../../../../../api'; + +export class BreedingPetInfo +{ + private _webId: number; + private _name: string; + private _level: number; + private _figure: string; + private _owner: string; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this._webId = wrapper.readInt(); + this._name = wrapper.readString(); + this._level = wrapper.readInt(); + this._figure = wrapper.readString(); + this._owner = wrapper.readString(); + } + + public dispose(): void + { + this._webId = 0; + this._name = ''; + this._level = 0; + this._figure = ''; + this._owner = ''; + } + + public get webId(): number + { + return this._webId; + } + + public get name(): string + { + return this._name; + } + + public get level(): number + { + return this._level; + } + + public get figure(): string + { + return this._figure; + } + + public get owner(): string + { + return this._owner; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetBreedingResultData.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetBreedingResultData.ts new file mode 100644 index 0000000..3c65d92 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetBreedingResultData.ts @@ -0,0 +1,58 @@ +import { IMessageDataWrapper, IPetBreedingResultData } from '../../../../../../api'; + +export class PetBreedingResultData implements IPetBreedingResultData +{ + private _stuffId: number; + private _classId: number; + private _productCode: string; + private _userId: number; + private _userName: string; + private _rarityLevel: number; + private _hasMutation: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + this._stuffId = wrapper.readInt(); + this._classId = wrapper.readInt(); + this._productCode = wrapper.readString(); + this._userId = wrapper.readInt(); + this._userName = wrapper.readString(); + this._rarityLevel = wrapper.readInt(); + this._hasMutation = wrapper.readBoolean(); + } + + public get stuffId(): number + { + return this._stuffId; + } + + public get classId(): number + { + return this._classId; + } + + public get productCode(): string + { + return this._productCode; + } + + public get userId(): number + { + return this._userId; + } + + public get userName(): string + { + return this._userName; + } + + public get rarityLevel(): number + { + return this._rarityLevel; + } + + public get hasMutation(): boolean + { + return this._hasMutation; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetBreedingResultParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetBreedingResultParser.ts new file mode 100644 index 0000000..b90aeaf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetBreedingResultParser.ts @@ -0,0 +1,35 @@ +import { PetBreedingResultData } from '.'; +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class PetBreedingResultParser implements IMessageParser +{ + private _resultData: PetBreedingResultData; + private _otherResultData: PetBreedingResultData; + + public flush(): boolean + { + this._resultData = null; + this._otherResultData = null; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._resultData = new PetBreedingResultData(wrapper); + this._otherResultData = new PetBreedingResultData(wrapper); + + return true; + } + + public get resultData(): PetBreedingResultData + { + return this._resultData; + } + + public get otherResultData(): PetBreedingResultData + { + return this._otherResultData; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetExperienceParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetExperienceParser.ts new file mode 100644 index 0000000..b41443c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetExperienceParser.ts @@ -0,0 +1,42 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class PetExperienceParser implements IMessageParser +{ + private _petId: number; + private _roomIndex: number; + private _gainedExperience: number; + + public flush(): boolean + { + this._petId = -1; + this._roomIndex = -1; + this._gainedExperience = 0; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._petId = wrapper.readInt(); + this._roomIndex = wrapper.readInt(); + this._gainedExperience = wrapper.readInt(); + + return true; + } + + public get petId(): number + { + return this._petId; + } + + public get roomIndex(): number + { + return this._roomIndex; + } + + public get gainedExperience(): number + { + return this._gainedExperience; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetFigureUpdateParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetFigureUpdateParser.ts new file mode 100644 index 0000000..4109bf6 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetFigureUpdateParser.ts @@ -0,0 +1,54 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { PetFigureDataParser } from '../../inventory'; + +export class PetFigureUpdateParser implements IMessageParser +{ + private _roomIndex: number; + private _petId: number; + private _figureData: PetFigureDataParser; + private _hasSaddle: boolean; + private _isRiding: boolean; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomIndex = wrapper.readInt(); + this._petId = wrapper.readInt(); + this._figureData = new PetFigureDataParser(wrapper); + this._hasSaddle = wrapper.readBoolean(); + this._isRiding = wrapper.readBoolean(); + + return true; + } + + public get roomIndex(): number + { + return this._roomIndex; + } + + public get petId(): number + { + return this._petId; + } + + public get figureData(): PetFigureDataParser + { + return this._figureData; + } + + public get hasSaddle(): boolean + { + return this._hasSaddle; + } + + public get isRiding(): boolean + { + return this._isRiding; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetInfoParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetInfoParser.ts new file mode 100644 index 0000000..bf582f4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetInfoParser.ts @@ -0,0 +1,220 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class PetInfoParser implements IMessageParser +{ + private _id: number; + private _name: string; + private _level: number; + private _maximumLevel: number; + private _experience: number; + private _energy: number; + private _happyness: number; + private _levelExperienceGoal: number; + private _maximumEnergy: number; + private _maximumHappyness: number; + private _respect: number; + private _ownerId: number; + private _ownerName: string; + private _age: number; + private _rarityLevel: number; + private _saddle: boolean; + private _rider: boolean; + private _breedable: boolean; + private _fullyGrown: boolean; + private _dead: boolean; + private _maximumTimeToLive: number; + private _remainingTimeToLive: number; + private _remainingGrowTime: number; + private _skillThresholds: number[]; + private _publiclyRideable: number; + private _unknownRarity: number; + private _publiclyBreedable: boolean; + + public flush(): boolean + { + this._id = -1; + this._skillThresholds = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._id = wrapper.readInt(); + this._name = wrapper.readString(); + this._level = wrapper.readInt(); + this._maximumLevel = wrapper.readInt(); + this._experience = wrapper.readInt(); + this._levelExperienceGoal = wrapper.readInt(); + this._energy = wrapper.readInt(); + this._maximumEnergy = wrapper.readInt(); + this._happyness = wrapper.readInt(); + this._maximumHappyness = wrapper.readInt(); + this._respect = wrapper.readInt(); + this._ownerId = wrapper.readInt(); + this._age = wrapper.readInt(); + this._ownerName = wrapper.readString(); + this._rarityLevel = wrapper.readInt(); + this._saddle = wrapper.readBoolean(); + this._rider = wrapper.readBoolean(); + + let total = wrapper.readInt(); + + while(total > 0) + { + this._skillThresholds.push(wrapper.readInt()); + + total--; + } + + this._skillThresholds.sort(); + this._publiclyRideable = wrapper.readInt(); + this._breedable = wrapper.readBoolean(); + this._fullyGrown = wrapper.readBoolean(); + this._dead = wrapper.readBoolean(); + this._unknownRarity = wrapper.readInt(); + this._maximumTimeToLive = wrapper.readInt(); + this._remainingTimeToLive = wrapper.readInt(); + this._remainingGrowTime = wrapper.readInt(); + this._publiclyBreedable = wrapper.readBoolean(); + + return true; + } + + public get id(): number + { + return this._id; + } + + public get name(): string + { + return this._name; + } + + public get level(): number + { + return this._level; + } + + public get maximumLevel(): number + { + return this._maximumLevel; + } + + public get experience(): number + { + return this._experience; + } + + public get energy(): number + { + return this._energy; + } + + public get happyness(): number + { + return this._happyness; + } + + public get levelExperienceGoal(): number + { + return this._levelExperienceGoal; + } + + public get maximumEnergy(): number + { + return this._maximumEnergy; + } + + public get maximumHappyness(): number + { + return this._maximumHappyness; + } + + public get respect(): number + { + return this._respect; + } + + public get ownerId(): number + { + return this._ownerId; + } + + public get ownerName(): string + { + return this._ownerName; + } + + public get age(): number + { + return this._age; + } + + public get rarityLevel(): number + { + return this._rarityLevel; + } + + public get saddle(): boolean + { + return this._saddle; + } + + public get rider(): boolean + { + return this._rider; + } + + public get breedable(): boolean + { + return this._breedable; + } + + public get fullyGrown(): boolean + { + return this._fullyGrown; + } + + public get dead(): boolean + { + return this._dead; + } + + public get maximumTimeToLive(): number + { + return this._maximumTimeToLive; + } + + public get remainingTimeToLive(): number + { + return this._remainingTimeToLive; + } + + public get remainingGrowTime(): number + { + return this._remainingGrowTime; + } + + public get skillTresholds(): number[] + { + return this._skillThresholds; + } + + public get publiclyRideable(): number + { + return this._publiclyRideable; + } + + public get unknownRarity(): number + { + return this._unknownRarity; + } + + public get publiclyBreedable(): boolean + { + return this._publiclyBreedable; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetStatusUpdateParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetStatusUpdateParser.ts new file mode 100644 index 0000000..80e241f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/PetStatusUpdateParser.ts @@ -0,0 +1,67 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class PetStatusUpdateParser implements IMessageParser +{ + private _roomIndex: number; + private _petId: number; + private _canBreed: boolean; + private _canHarvest: boolean; + private _canRevive: boolean; + private _hasBreedingPermission: boolean; + + public flush(): boolean + { + this._roomIndex = -1; + this._petId = -1; + this._canBreed = false; + this._canHarvest = false; + this._canRevive = false; + this._hasBreedingPermission = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomIndex = wrapper.readInt(); + this._petId = wrapper.readInt(); + this._canBreed = wrapper.readBoolean(); + this._canHarvest = wrapper.readBoolean(); + this._canRevive = wrapper.readBoolean(); + this._hasBreedingPermission = wrapper.readBoolean(); + + return true; + } + + public get roomIndex(): number + { + return this._roomIndex; + } + + public get petId(): number + { + return this._petId; + } + + public get canBreed(): boolean + { + return this._canBreed; + } + + public get canHarvest(): boolean + { + return this._canHarvest; + } + + public get canRevive(): boolean + { + return this._canRevive; + } + + public get hasBreedingPermission(): boolean + { + return this._hasBreedingPermission; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/pet/RarityCategoryData.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/RarityCategoryData.ts new file mode 100644 index 0000000..4b7ade3 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/RarityCategoryData.ts @@ -0,0 +1,40 @@ +import { IMessageDataWrapper } from '../../../../../../api'; + +export class RarityCategoryData +{ + private _chance: number; + private _breeds: number[]; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this._chance = wrapper.readInt(); + this._breeds = []; + + let totalCount = wrapper.readInt(); + + while(totalCount > 0) + { + this._breeds.push(wrapper.readInt()); + + totalCount--; + } + } + + public dispose(): void + { + this._chance = -1; + this._breeds = []; + } + + public get chance(): number + { + return this._chance; + } + + public get breeds(): number[] + { + return this._breeds; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/pet/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/index.ts new file mode 100644 index 0000000..c3ab6fe --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/pet/index.ts @@ -0,0 +1,8 @@ +export * from './BreedingPetInfo'; +export * from './PetBreedingResultData'; +export * from './PetBreedingResultParser'; +export * from './PetExperienceParser'; +export * from './PetFigureUpdateParser'; +export * from './PetInfoParser'; +export * from './PetStatusUpdateParser'; +export * from './RarityCategoryData'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/session/YouArePlayingGameParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/session/YouArePlayingGameParser.ts new file mode 100644 index 0000000..14c6d85 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/session/YouArePlayingGameParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class YouArePlayingGameParser implements IMessageParser +{ + private _isPlaying: boolean; + + public flush(): boolean + { + this._isPlaying = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._isPlaying = wrapper.readBoolean(); + + return true; + } + + public get isPlaying(): boolean + { + return this._isPlaying; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/session/YouAreSpectatorMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/session/YouAreSpectatorMessageParser.ts new file mode 100644 index 0000000..eac8a96 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/session/YouAreSpectatorMessageParser.ts @@ -0,0 +1,14 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class YouAreSpectatorMessageParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/session/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/session/index.ts new file mode 100644 index 0000000..4624934 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/session/index.ts @@ -0,0 +1,2 @@ +export * from './YouArePlayingGameParser'; +export * from './YouAreSpectatorMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitDanceParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitDanceParser.ts new file mode 100644 index 0000000..79c7396 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitDanceParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomUnitDanceParser implements IMessageParser +{ + private _unitId: number; + private _danceId: number; + + public flush(): boolean + { + this._unitId = null; + this._danceId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._unitId = wrapper.readInt(); + this._danceId = wrapper.readInt(); + + return true; + } + + public get unitId(): number + { + return this._unitId; + } + + public get danceId(): number + { + return this._danceId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitEffectParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitEffectParser.ts new file mode 100644 index 0000000..ce60cea --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitEffectParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomUnitEffectParser implements IMessageParser +{ + private _unitId: number; + private _effectId: number; + private _delay: number; + + public flush(): boolean + { + this._unitId = null; + this._effectId = 0; + this._delay = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._unitId = wrapper.readInt(); + this._effectId = wrapper.readInt(); + this._delay = wrapper.readInt(); + + return true; + } + + public get unitId(): number + { + return this._unitId; + } + + public get effectId(): number + { + return this._effectId; + } + + public get delay(): number + { + return this._delay; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitExpressionParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitExpressionParser.ts new file mode 100644 index 0000000..c993ba7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitExpressionParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomUnitExpressionParser implements IMessageParser +{ + private _unitId: number; + private _expression: number; + + public flush(): boolean + { + this._unitId = null; + this._expression = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._unitId = wrapper.readInt(); + this._expression = wrapper.readInt(); + + return true; + } + + public get unitId(): number + { + return this._unitId; + } + + public get expression(): number + { + return this._expression; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitHandItemParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitHandItemParser.ts new file mode 100644 index 0000000..965089a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitHandItemParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomUnitHandItemParser implements IMessageParser +{ + private _unitId: number; + private _handId: number; + + public flush(): boolean + { + this._unitId = null; + this._handId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._unitId = wrapper.readInt(); + this._handId = wrapper.readInt(); + + return true; + } + + public get unitId(): number + { + return this._unitId; + } + + public get handId(): number + { + return this._handId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitHandItemReceivedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitHandItemReceivedParser.ts new file mode 100644 index 0000000..3a1b983 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitHandItemReceivedParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomUnitHandItemReceivedParser implements IMessageParser +{ + private _giverUserId: number; + private _handItemType: number; + + public flush(): boolean + { + this._giverUserId = -1; + this._handItemType = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._giverUserId = wrapper.readInt(); + this._handItemType = wrapper.readInt(); + + return true; + } + + public get giverUserId(): number + { + return this._giverUserId; + } + + public get handItemType(): number + { + return this._handItemType; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitIdleParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitIdleParser.ts new file mode 100644 index 0000000..43b12a1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitIdleParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomUnitIdleParser implements IMessageParser +{ + private _unitId: number; + private _isIdle: boolean; + + public flush(): boolean + { + this._unitId = null; + this._isIdle = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._unitId = wrapper.readInt(); + this._isIdle = wrapper.readBoolean(); + + return true; + } + + public get unitId(): number + { + return this._unitId; + } + + public get isIdle(): boolean + { + return this._isIdle; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitInfoParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitInfoParser.ts new file mode 100644 index 0000000..f0042c1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitInfoParser.ts @@ -0,0 +1,59 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomUnitInfoParser implements IMessageParser +{ + private _unitId: number; + private _figure: string; + private _gender: string; + private _motto: string; + private _achievementScore: number; + + public flush(): boolean + { + this._unitId = null; + this._figure = null; + this._gender = 'M'; + this._motto = null; + this._achievementScore = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._unitId = wrapper.readInt(); + this._figure = wrapper.readString(); + this._gender = wrapper.readString().toLocaleUpperCase(); + this._motto = wrapper.readString(); + this._achievementScore = wrapper.readInt(); + + return true; + } + + public get unitId(): number + { + return this._unitId; + } + + public get figure(): string + { + return this._figure; + } + + public get gender(): string + { + return this._gender; + } + + public get motto(): string + { + return this._motto; + } + + public get achievementScore(): number + { + return this._achievementScore; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitNumberParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitNumberParser.ts new file mode 100644 index 0000000..219c378 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitNumberParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomUnitNumberParser implements IMessageParser +{ + private _unitId: number; + private _value: number; + + public flush(): boolean + { + this._unitId = null; + this._value = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._unitId = wrapper.readInt(); + this._value = wrapper.readInt(); + + return true; + } + + public get unitId(): number + { + return this._unitId; + } + + public get value(): number + { + return this._value; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitParser.ts new file mode 100644 index 0000000..2725587 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitParser.ts @@ -0,0 +1,186 @@ +import { IMessageDataWrapper, IMessageParser, RoomObjectType } from '../../../../../../api'; +import { UserMessageData } from './UserMessageData'; + +export class RoomUnitParser implements IMessageParser +{ + private _users: UserMessageData[]; + + public flush(): boolean + { + this._users = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._users = []; + + const totalUsers = wrapper.readInt(); + + let i = 0; + + while(i < totalUsers) + { + const id = wrapper.readInt(); + const username = wrapper.readString(); + const custom = wrapper.readString(); + let figure = wrapper.readString(); + const roomIndex = wrapper.readInt(); + const x = wrapper.readInt(); + const y = wrapper.readInt(); + const z = parseFloat(wrapper.readString()); + const direction = wrapper.readInt(); + const type = wrapper.readInt(); + + const user = new UserMessageData(roomIndex); + + user.dir = direction; + user.name = username; + user.custom = custom; + user.x = x; + user.y = y; + user.z = z; + + this._users.push(user); + + if(type === 1) + { + user.webID = id; + user.userType = RoomObjectType.USER; + user.sex = this.resolveSex(wrapper.readString()); + user.groupID = wrapper.readInt(); + user.groupStatus = wrapper.readInt(); + user.groupName = wrapper.readString(); + + const swimFigure = wrapper.readString(); + + if(swimFigure !== '') figure = this.convertSwimFigure(swimFigure, figure, user.sex); + + user.figure = figure; + user.activityPoints = wrapper.readInt(); + user.isModerator = wrapper.readBoolean(); + } + + else if(type === 2) + { + user.userType = RoomObjectType.PET; + user.figure = figure; + user.webID = id; + user.subType = wrapper.readInt().toString(); + user.ownerId = wrapper.readInt(); + user.ownerName = wrapper.readString(); + user.rarityLevel = wrapper.readInt(); + user.hasSaddle = wrapper.readBoolean(); + user.isRiding = wrapper.readBoolean(); + user.canBreed = wrapper.readBoolean(); + user.canHarvest = wrapper.readBoolean(); + user.canRevive = wrapper.readBoolean(); + user.hasBreedingPermission = wrapper.readBoolean(); + user.petLevel = wrapper.readInt(); + user.petPosture = wrapper.readString(); + } + + else if(type === 3) + { + user.userType = RoomObjectType.BOT; + user.webID = (roomIndex * -1); + + if(figure.indexOf('/') === -1) user.figure = figure; + else user.figure = 'hr-100-.hd-180-1.ch-876-66.lg-270-94.sh-300-64'; + + user.sex = UserMessageData.M; + } + + else if(type === 4) + { + user.userType = RoomObjectType.RENTABLE_BOT; + user.webID = id; + user.sex = this.resolveSex(wrapper.readString()); + user.figure = figure; + user.ownerId = wrapper.readInt(); + user.ownerName = wrapper.readString(); + + const totalSkills = wrapper.readInt(); + + if(totalSkills) + { + const skills: number[] = []; + + let j = 0; + + while(j < totalSkills) + { + skills.push(wrapper.readShort()); + + j++; + } + + user.botSkills = skills; + } + } + + i++; + } + + return true; + } + + private resolveSex(sex: string): string + { + if(sex.substr(0, 1).toLowerCase() === 'f') return UserMessageData.F; + + return UserMessageData.M; + } + + private convertSwimFigure(k: string, _arg_2: string, _arg_3: string): string + { + const _local_4 = _arg_2.split('.'); + let _local_5 = 1; + let _local_6 = 1; + let _local_7 = 1; + const _local_8 = 10000; + let i = 0; + + while(i < _local_4.length) + { + const _local_13 = _local_4[i]; + const _local_14 = _local_13.split('-'); + + if(_local_14.length > 2) + { + const _local_15 = _local_14[0]; + + if(_local_15 === 'hd') _local_5 = parseInt(_local_14[2]); + } + + i++; + } + + const _local_10 = ['238,238,238', '250,56,49', '253,146,160', '42,199,210', '53,51,44', '239,255,146', '198,255,152', '255,146,90', '157,89,126', '182,243,255', '109,255,51', '51,120,201', '255,182,49', '223,161,233', '249,251,50', '202,175,143', '197,198,197', '71,98,61', '138,131,97', '255,140,51', '84,198,39', '30,108,153', '152,79,136', '119,200,255', '255,192,142', '60,75,135', '124,44,71', '215,255,227', '143,63,28', '255,99,147', '31,155,121', '253,255,51']; + const _local_11 = k.split('='); + + if(_local_11.length > 1) + { + const _local_16 = _local_11[1].split('/'); + const _local_17 = _local_16[0]; + const _local_18 = _local_16[1]; + + if(_arg_3 === 'F') _local_7 = 10010; + else _local_7 = 10011; + + const _local_19 = _local_10.indexOf(_local_18); + + _local_6 = ((_local_8 + _local_19) + 1); + } + + return _arg_2 + ((((('.bds-10001-' + _local_5) + '.ss-') + _local_7) + '-') + _local_6); + } + + public get users(): UserMessageData[] + { + return this._users; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitRemoveParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitRemoveParser.ts new file mode 100644 index 0000000..2329877 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitRemoveParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class RoomUnitRemoveParser implements IMessageParser +{ + private _unitId: number; + + public flush(): boolean + { + this._unitId = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._unitId = parseInt(wrapper.readString()); + + return true; + } + + public get unitId(): number + { + return this._unitId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitStatusAction.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitStatusAction.ts new file mode 100644 index 0000000..f49e657 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitStatusAction.ts @@ -0,0 +1,21 @@ +export class RoomUnitStatusAction +{ + private _action: string; + private _value: string; + + constructor(action: string, value: string) + { + this._action = action; + this._value = value; + } + + public get action(): string + { + return this._action; + } + + public get value(): string + { + return this._value; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitStatusMessage.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitStatusMessage.ts new file mode 100644 index 0000000..5bc7d58 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitStatusMessage.ts @@ -0,0 +1,100 @@ +import { RoomUnitStatusAction } from './RoomUnitStatusAction'; + +export class RoomUnitStatusMessage +{ + private _id: number; + private _x: number; + private _y: number; + private _z: number; + private _height: number; + private _headDirection: number; + private _direction: number; + private _targetX: number; + private _targetY: number; + private _targetZ: number; + private _didMove: boolean; + private _canStandUp: boolean; + private _actions: RoomUnitStatusAction[]; + + constructor(id: number, x: number, y: number, z: number, height: number, headDirection: number, direction: number, targetX: number = 0, targetY: number = 0, targetZ: number = 0, didMove: boolean, canStandUp: boolean, actions: RoomUnitStatusAction[]) + { + this._id = id; + this._x = x; + this._y = y; + this._z = z; + this._height = height; + this._headDirection = headDirection; + this._direction = direction; + this._targetX = targetX; + this._targetY = targetY; + this._targetZ = targetZ; + this._didMove = didMove; + this._canStandUp = canStandUp; + this._actions = actions || []; + } + + public get id(): number + { + return this._id; + } + + public get x(): number + { + return this._x; + } + + public get y(): number + { + return this._y; + } + + public get z(): number + { + return this._z; + } + + public get height(): number + { + return this._height; + } + + public get headDirection(): number + { + return this._headDirection; + } + + public get direction(): number + { + return this._direction; + } + + public get targetX(): number + { + return this._targetX; + } + + public get targetY(): number + { + return this._targetY; + } + + public get targetZ(): number + { + return this._targetZ; + } + + public get didMove(): boolean + { + return this._didMove; + } + + public get canStandUp(): boolean + { + return this._canStandUp; + } + + public get actions(): RoomUnitStatusAction[] + { + return this._actions; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitStatusParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitStatusParser.ts new file mode 100644 index 0000000..ae1e910 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/RoomUnitStatusParser.ts @@ -0,0 +1,119 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { RoomUnitStatusAction } from './RoomUnitStatusAction'; +import { RoomUnitStatusMessage } from './RoomUnitStatusMessage'; + +export class RoomUnitStatusParser implements IMessageParser +{ + private _statuses: RoomUnitStatusMessage[]; + + public flush(): boolean + { + this._statuses = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalUnits = wrapper.readInt(); + + while(totalUnits > 0) + { + const status = this.parseStatus(wrapper); + + if(!status) + { + totalUnits--; + + continue; + } + + this._statuses.push(status); + + totalUnits--; + } + + return true; + } + + public parseStatus(wrapper: IMessageDataWrapper): RoomUnitStatusMessage + { + if(!wrapper) return null; + + const unitId = wrapper.readInt(); + const x = wrapper.readInt(); + const y = wrapper.readInt(); + const z = parseFloat(wrapper.readString()); + const headDirection = ((wrapper.readInt() % 8) * 45); + const direction = ((wrapper.readInt() % 8) * 45); + const actions = wrapper.readString(); + + let targetX = 0; + let targetY = 0; + let targetZ = 0; + let height = 0; + let canStandUp = false; + let didMove = false; + const isSlide = false; + + if(actions) + { + const actionParts = actions.split('/'); + const statusActions: RoomUnitStatusAction[] = []; + + for(const action of actionParts) + { + const parts = action.split(' '); + + if(parts[0] === '') continue; + + if(parts.length >= 2) + { + switch(parts[0]) + { + case 'mv': { + const values = parts[1].split(','); + + if(values.length >= 3) + { + targetX = parseInt(values[0]); + targetY = parseInt(values[1]); + targetZ = parseFloat(values[2]); + didMove = true; + } + + break; + } + case 'sit': { + const sitHeight = parseFloat(parts[1]); + + if(parts.length >= 3) canStandUp = (parts[2] === '1'); + + height = sitHeight; + + break; + } + case 'lay': { + const layHeight = parseFloat(parts[1]); + + height = Math.abs(layHeight); + + break; + } + } + + statusActions.push(new RoomUnitStatusAction(parts[0], parts[1])); + } + } + + this._statuses.push(new RoomUnitStatusMessage(unitId, x, y, z, height, headDirection, direction, targetX, targetY, targetZ, didMove, canStandUp, statusActions)); + } + } + + public get statuses(): RoomUnitStatusMessage[] + { + return this._statuses; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/UserMessageData.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/UserMessageData.ts new file mode 100644 index 0000000..b6a944d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/UserMessageData.ts @@ -0,0 +1,412 @@ +export class UserMessageData +{ + public static M: string = 'M'; + public static F: string = 'F'; + + private _roomIndex: number = 0; + private _x: number = 0; + private _y: number = 0; + private _z: number = 0; + private _dir: number = 0; + private _name: string = ''; + private _userType: number = 0; + private _sex: string = ''; + private _figure: string = ''; + private _custom: string = ''; + private _activityPoints: number = 0; + private _webID: number = 0; + private _groupID: number = 0; + private _groupStatus: number = 0; + private _groupName: string = ''; + private _subType: string = ''; + private _ownerId: number = 0; + private _ownerName: string = ''; + private _rarityLevel: number = 0; + private _hasSaddle: boolean = false; + private _isRiding: boolean = false; + private _canBreed: boolean = false; + private _canHarvest: boolean = false; + private _canRevive: boolean = false; + private _hasBreedingPermission: boolean = false; + private _petLevel: number = 0; + private _petPosture: string = ''; + private _botSkills: number[] = []; + private _isModerator: boolean = false; + private _isReadOnly: boolean = false; + + constructor(k: number) + { + this._roomIndex = k; + } + + public setReadOnly(): void + { + this._isReadOnly = true; + } + + public get roomIndex(): number + { + return this._roomIndex; + } + + public get x(): number + { + return this._x; + } + + public set x(k: number) + { + if(!this._isReadOnly) + { + this._x = k; + } + } + + public get y(): number + { + return this._y; + } + + public set y(k: number) + { + if(!this._isReadOnly) + { + this._y = k; + } + } + + public get z(): number + { + return this._z; + } + + public set z(k: number) + { + if(!this._isReadOnly) + { + this._z = k; + } + } + + public get dir(): number + { + return this._dir; + } + + public set dir(k: number) + { + if(!this._isReadOnly) + { + this._dir = k; + } + } + + public get name(): string + { + return this._name; + } + + public set name(k: string) + { + if(!this._isReadOnly) + { + this._name = k; + } + } + + public get userType(): number + { + return this._userType; + } + + public set userType(k: number) + { + if(!this._isReadOnly) + { + this._userType = k; + } + } + + public get sex(): string + { + return this._sex; + } + + public set sex(k: string) + { + if(!this._isReadOnly) + { + this._sex = k; + } + } + + public get figure(): string + { + return this._figure; + } + + public set figure(k: string) + { + if(!this._isReadOnly) + { + this._figure = k; + } + } + + public get custom(): string + { + return this._custom; + } + + public set custom(k: string) + { + if(!this._isReadOnly) + { + this._custom = k; + } + } + + public get activityPoints(): number + { + return this._activityPoints; + } + + public set activityPoints(k: number) + { + if(!this._isReadOnly) + { + this._activityPoints = k; + } + } + + public get webID(): number + { + return this._webID; + } + + public set webID(k: number) + { + if(!this._isReadOnly) + { + this._webID = k; + } + } + + public get groupID(): number + { + return this._groupID; + } + + public set groupID(groupId: number) + { + if(!this._isReadOnly) + { + this._groupID = groupId; + } + } + + public get groupName(): string + { + return this._groupName; + } + + public set groupName(k: string) + { + if(!this._isReadOnly) + { + this._groupName = k; + } + } + + public get groupStatus(): number + { + return this._groupStatus; + } + + public set groupStatus(k: number) + { + if(!this._isReadOnly) + { + this._groupStatus = k; + } + } + + public get subType(): string + { + return this._subType; + } + + public set subType(k: string) + { + if(!this._isReadOnly) + { + this._subType = k; + } + } + + public get ownerId(): number + { + return this._ownerId; + } + + public set ownerId(k: number) + { + if(!this._isReadOnly) + { + this._ownerId = k; + } + } + + public get ownerName(): string + { + return this._ownerName; + } + + public set ownerName(k: string) + { + if(!this._isReadOnly) + { + this._ownerName = k; + } + } + + public get rarityLevel(): number + { + return this._rarityLevel; + } + + public set rarityLevel(k: number) + { + if(!this._isReadOnly) + { + this._rarityLevel = k; + } + } + + public get hasSaddle(): boolean + { + return this._hasSaddle; + } + + public set hasSaddle(k: boolean) + { + if(!this._isReadOnly) + { + this._hasSaddle = k; + } + } + + public get isRiding(): boolean + { + return this._isRiding; + } + + public set isRiding(k: boolean) + { + if(!this._isReadOnly) + { + this._isRiding = k; + } + } + + public get canBreed(): boolean + { + return this._canBreed; + } + + public set canBreed(k: boolean) + { + if(!this._isReadOnly) + { + this._canBreed = k; + } + } + + public get canHarvest(): boolean + { + return this._canHarvest; + } + + public set canHarvest(k: boolean) + { + if(!this._isReadOnly) + { + this._canHarvest = k; + } + } + + public get canRevive(): boolean + { + return this._canRevive; + } + + public set canRevive(k: boolean) + { + if(!this._isReadOnly) + { + this._canRevive = k; + } + } + + public get hasBreedingPermission(): boolean + { + return this._hasBreedingPermission; + } + + public set hasBreedingPermission(k: boolean) + { + if(!this._isReadOnly) + { + this._hasBreedingPermission = k; + } + } + + public get petLevel(): number + { + return this._petLevel; + } + + public set petLevel(k: number) + { + if(!this._isReadOnly) + { + this._petLevel = k; + } + } + + public get petPosture(): string + { + return this._petPosture; + } + + public set petPosture(k: string) + { + if(!this._isReadOnly) + { + this._petPosture = k; + } + } + + public get botSkills(): number[] + { + return this._botSkills; + } + + public set botSkills(k: number[]) + { + this._botSkills = k; + } + + public get isModerator(): boolean + { + return this._isModerator; + } + + public set isModerator(k: boolean) + { + if(!this._isReadOnly) + { + this._isModerator = k; + } + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/chat/FloodControlParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/chat/FloodControlParser.ts new file mode 100644 index 0000000..d57b3dd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/chat/FloodControlParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; + +export class FloodControlParser implements IMessageParser +{ + private _seconds: number; + + public flush(): boolean + { + this._seconds = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._seconds = wrapper.readInt(); + + return true; + } + + public get seconds(): number + { + return this._seconds; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/chat/RemainingMuteParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/chat/RemainingMuteParser.ts new file mode 100644 index 0000000..321ca51 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/chat/RemainingMuteParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; + +export class RemainingMuteParser implements IMessageParser +{ + private _seconds: number; + + public flush(): boolean + { + this._seconds = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._seconds = wrapper.readInt(); + + return true; + } + + public get seconds(): number + { + return this._seconds; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/chat/RoomUnitChatParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/chat/RoomUnitChatParser.ts new file mode 100644 index 0000000..f9538e5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/chat/RoomUnitChatParser.ts @@ -0,0 +1,87 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; + +export class RoomUnitChatParser implements IMessageParser +{ + private _roomIndex: number; + private _message: string; + private _gesture: number; + private _bubble: number; + private _urls: string[]; + private _messageLength: number; + + public flush(): boolean + { + this._roomIndex = null; + this._message = null; + this._gesture = 0; + this._bubble = 0; + this._urls = []; + this._messageLength = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomIndex = wrapper.readInt(); + this._message = wrapper.readString(); + this._gesture = wrapper.readInt(); + this._bubble = wrapper.readInt(); + + this.parseUrls(wrapper); + + this._messageLength = wrapper.readInt(); + + return true; + } + + private parseUrls(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._urls = []; + + let totalUrls = wrapper.readInt(); + + while(totalUrls > 0) + { + this._urls.push(wrapper.readString()); + + totalUrls--; + } + + return true; + } + + public get roomIndex(): number + { + return this._roomIndex; + } + + public get message(): string + { + return this._message; + } + + public get gesture(): number + { + return this._gesture; + } + + public get bubble(): number + { + return this._bubble; + } + + public get urls(): string[] + { + return this._urls; + } + + public get messageLength(): number + { + return this._messageLength; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/chat/RoomUnitTypingParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/chat/RoomUnitTypingParser.ts new file mode 100644 index 0000000..6482cae --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/chat/RoomUnitTypingParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; + +export class RoomUnitTypingParser implements IMessageParser +{ + private _unitId: number; + private _isTyping: boolean; + + public flush(): boolean + { + this._unitId = null; + this._isTyping = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._unitId = wrapper.readInt(); + this._isTyping = wrapper.readInt() === 1 ? true : false; + + return true; + } + + public get unitId(): number + { + return this._unitId; + } + + public get isTyping(): boolean + { + return this._isTyping; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/chat/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/chat/index.ts new file mode 100644 index 0000000..e9ab87f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/chat/index.ts @@ -0,0 +1,4 @@ +export * from './FloodControlParser'; +export * from './RemainingMuteParser'; +export * from './RoomUnitChatParser'; +export * from './RoomUnitTypingParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/room/unit/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/index.ts new file mode 100644 index 0000000..9728961 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/room/unit/index.ts @@ -0,0 +1,15 @@ +export * from './chat'; +export * from './RoomUnitDanceParser'; +export * from './RoomUnitEffectParser'; +export * from './RoomUnitExpressionParser'; +export * from './RoomUnitHandItemParser'; +export * from './RoomUnitHandItemReceivedParser'; +export * from './RoomUnitIdleParser'; +export * from './RoomUnitInfoParser'; +export * from './RoomUnitNumberParser'; +export * from './RoomUnitParser'; +export * from './RoomUnitRemoveParser'; +export * from './RoomUnitStatusAction'; +export * from './RoomUnitStatusMessage'; +export * from './RoomUnitStatusParser'; +export * from './UserMessageData'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomevents/ConditionDefinition.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/ConditionDefinition.ts new file mode 100644 index 0000000..a4a67ac --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/ConditionDefinition.ts @@ -0,0 +1,24 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { Triggerable } from './Triggerable'; + +export class ConditionDefinition extends Triggerable +{ + private _type: number; + + constructor(wrapper: IMessageDataWrapper) + { + super(wrapper); + + this._type = wrapper.readInt(); + } + + public get type(): number + { + return this._type; + } + + public get code(): number + { + return this._type; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomevents/TriggerDefinition.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/TriggerDefinition.ts new file mode 100644 index 0000000..e226420 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/TriggerDefinition.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { Triggerable } from './Triggerable'; + +export class TriggerDefinition extends Triggerable +{ + private _triggerConf: number; + private _conflictingActions: number[]; + + constructor(wrapper: IMessageDataWrapper) + { + super(wrapper); + + this._conflictingActions = []; + this._triggerConf = wrapper.readInt(); + + let count = wrapper.readInt(); + + while(count > 0) + { + this._conflictingActions.push(wrapper.readInt()); + + count--; + } + } + + public get code(): number + { + return this._triggerConf; + } + + public get conflictingActions(): number[] + { + return this._conflictingActions; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomevents/Triggerable.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/Triggerable.ts new file mode 100644 index 0000000..fff5aab --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/Triggerable.ts @@ -0,0 +1,100 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class Triggerable +{ + private _stuffTypeSelectionEnabled: boolean; + private _furniLimit: number; + private _stuffIds: number[]; + private _id: number; + private _stringParam: string; + private _intParams: number[]; + private _stuffTypeId: number; + private _stuffTypeSelectionCode: number; + + constructor(wrapper: IMessageDataWrapper) + { + this._stuffIds = []; + this._intParams = []; + this._stuffTypeSelectionEnabled = wrapper.readBoolean(); + this._furniLimit = wrapper.readInt(); + + let count = wrapper.readInt(); + + while(count > 0) + { + this._stuffIds.push(wrapper.readInt()); + + count--; + } + + this._stuffTypeId = wrapper.readInt(); + this._id = wrapper.readInt(); + this._stringParam = wrapper.readString(); + + count = wrapper.readInt(); + + while(count > 0) + { + this._intParams.push(wrapper.readInt()); + + count--; + } + + this._stuffTypeSelectionCode = wrapper.readInt(); + } + + public getBoolean(index: number): boolean + { + return (this._intParams[index] === 1); + } + + public get stuffTypeSelectionEnabled(): boolean + { + return this._stuffTypeSelectionEnabled; + } + + public get stuffTypeSelectionCode(): number + { + return this._stuffTypeSelectionCode; + } + + public set stuffTypeSelectionCode(k: number) + { + this._stuffTypeSelectionCode = k; + } + + public get maximumItemSelectionCount(): number + { + return this._furniLimit; + } + + public get selectedItems(): number[] + { + return this._stuffIds; + } + + public get id(): number + { + return this._id; + } + + public get stringData(): string + { + return this._stringParam; + } + + public get intData(): number[] + { + return this._intParams; + } + + public get code(): number + { + return 0; + } + + public get spriteId(): number + { + return this._stuffTypeId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredActionDefinition.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredActionDefinition.ts new file mode 100644 index 0000000..1a68d3c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredActionDefinition.ts @@ -0,0 +1,47 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { Triggerable } from './Triggerable'; + +export class WiredActionDefinition extends Triggerable +{ + private _type: number; + private _delayInPulses: number; + private _conflictingTriggers: number[]; + + constructor(wrapper: IMessageDataWrapper) + { + super(wrapper); + + this._conflictingTriggers = []; + this._type = wrapper.readInt(); + this._delayInPulses = wrapper.readInt(); + + let count = wrapper.readInt(); + + while(count > 0) + { + this._conflictingTriggers.push(wrapper.readInt()); + + count--; + } + } + + public get type(): number + { + return this._type; + } + + public get code(): number + { + return this._type; + } + + public get delayInPulses(): number + { + return this._delayInPulses; + } + + public get conflictingTriggers(): number[] + { + return this._conflictingTriggers; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredFurniActionParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredFurniActionParser.ts new file mode 100644 index 0000000..b6cc070 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredFurniActionParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { WiredActionDefinition } from './WiredActionDefinition'; + +export class WiredFurniActionParser implements IMessageParser +{ + private _definition: WiredActionDefinition; + + public flush(): boolean + { + this._definition = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._definition = new WiredActionDefinition(wrapper); + + return true; + } + + public get definition(): WiredActionDefinition + { + return this._definition; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredFurniConditionParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredFurniConditionParser.ts new file mode 100644 index 0000000..8898b81 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredFurniConditionParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { ConditionDefinition } from './ConditionDefinition'; + +export class WiredFurniConditionParser implements IMessageParser +{ + private _definition: ConditionDefinition; + + public flush(): boolean + { + this._definition = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._definition = new ConditionDefinition(wrapper); + + return true; + } + + public get definition(): ConditionDefinition + { + return this._definition; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredFurniTriggerParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredFurniTriggerParser.ts new file mode 100644 index 0000000..e43f2ea --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredFurniTriggerParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { TriggerDefinition } from './TriggerDefinition'; + +export class WiredFurniTriggerParser implements IMessageParser +{ + private _definition: TriggerDefinition; + + public flush(): boolean + { + this._definition = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._definition = new TriggerDefinition(wrapper); + + return true; + } + + public get definition(): TriggerDefinition + { + return this._definition; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredOpenParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredOpenParser.ts new file mode 100644 index 0000000..176fbe1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredOpenParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class WiredOpenParser implements IMessageParser +{ + private _stuffId: number; + + public flush(): boolean + { + this._stuffId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._stuffId = wrapper.readInt(); + + return true; + } + + public get stuffId(): number + { + return this._stuffId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredRewardResultMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredRewardResultMessageParser.ts new file mode 100644 index 0000000..12dd05a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredRewardResultMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class WiredRewardResultMessageParser implements IMessageParser +{ + private _reason: number; + + public flush(): boolean + { + this._reason = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._reason = wrapper.readInt(); + + return true; + } + + public get reason(): number + { + return this._reason; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredSaveSuccessParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredSaveSuccessParser.ts new file mode 100644 index 0000000..ba81e3e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredSaveSuccessParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class WiredSaveSuccessParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredValidationErrorParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredValidationErrorParser.ts new file mode 100644 index 0000000..21cbcbf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/WiredValidationErrorParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class WiredValidationErrorParser implements IMessageParser +{ + private _info: string; + + public flush(): boolean + { + this._info = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._info = wrapper.readString(); + + return true; + } + + public get info(): string + { + return this._info; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomevents/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/index.ts new file mode 100644 index 0000000..cca201e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomevents/index.ts @@ -0,0 +1,11 @@ +export * from './ConditionDefinition'; +export * from './Triggerable'; +export * from './TriggerDefinition'; +export * from './WiredActionDefinition'; +export * from './WiredFurniActionParser'; +export * from './WiredFurniConditionParser'; +export * from './WiredFurniTriggerParser'; +export * from './WiredOpenParser'; +export * from './WiredRewardResultMessageParser'; +export * from './WiredSaveSuccessParser'; +export * from './WiredValidationErrorParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/BannedUserData.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/BannedUserData.ts new file mode 100644 index 0000000..7713d28 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/BannedUserData.ts @@ -0,0 +1,24 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { IFlatUser } from './IFlatUser'; + +export class BannedUserData implements IFlatUser +{ + private _userId: number; + private _userName: string; + + constructor(wrapper: IMessageDataWrapper) + { + this._userId = wrapper.readInt(); + this._userName = wrapper.readString(); + } + + public get userId(): number + { + return this._userId; + } + + public get userName(): string + { + return this._userName; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/BannedUsersFromRoomParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/BannedUsersFromRoomParser.ts new file mode 100644 index 0000000..b340674 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/BannedUsersFromRoomParser.ts @@ -0,0 +1,44 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { BannedUserData } from './BannedUserData'; + +export class BannedUsersFromRoomParser implements IMessageParser +{ + private _roomId: number; + private _bannedUsers: BannedUserData[]; + + public flush(): boolean + { + this._roomId = 0; + this._bannedUsers = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + + let totalBans = wrapper.readInt(); + + while(totalBans > 0) + { + this._bannedUsers.push(new BannedUserData(wrapper)); + + totalBans--; + } + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get bannedUsers(): BannedUserData[] + { + return this._bannedUsers; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/FlatControllerAddedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/FlatControllerAddedParser.ts new file mode 100644 index 0000000..c34123c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/FlatControllerAddedParser.ts @@ -0,0 +1,36 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { FlatControllerData } from './FlatControllerData'; + +export class FlatControllerAddedParser implements IMessageParser +{ + private _roomId: number; + private _data: FlatControllerData; + + public flush(): boolean + { + this._roomId = 0; + this._data = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + this._data = new FlatControllerData(wrapper); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get data(): FlatControllerData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/FlatControllerData.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/FlatControllerData.ts new file mode 100644 index 0000000..c7f4ae8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/FlatControllerData.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper } from '../../../../../api'; +import { IFlatUser } from './IFlatUser'; + +export class FlatControllerData implements IFlatUser +{ + private _userId: number; + private _userName: string; + private _selected: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + this._userId = wrapper.readInt(); + this._userName = wrapper.readString(); + } + + public get userId(): number + { + return this._userId; + } + + public get userName(): string + { + return this._userName; + } + + public get selected(): boolean + { + return this._selected; + } + + public set selected(selected: boolean) + { + this._selected = selected; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/FlatControllerRemovedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/FlatControllerRemovedParser.ts new file mode 100644 index 0000000..7005e12 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/FlatControllerRemovedParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class FlatControllerRemovedParser implements IMessageParser +{ + private _roomId: number; + private _userId: number; + + public flush(): boolean + { + this._roomId = 0; + this._userId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + this._userId = wrapper.readInt(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get userId(): number + { + return this._userId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/FlatControllersParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/FlatControllersParser.ts new file mode 100644 index 0000000..f362843 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/FlatControllersParser.ts @@ -0,0 +1,46 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class FlatControllersParser implements IMessageParser +{ + private _roomId: number; + private _users: Map; + + public flush(): boolean + { + this._roomId = 0; + this._users = new Map(); + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + + let usersCount = wrapper.readInt(); + + while(usersCount > 0) + { + const id = wrapper.readInt(); + const name = wrapper.readString(); + + this._users.set(id, name); + + usersCount--; + } + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get users(): Map + { + return this._users; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/IFlatUser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/IFlatUser.ts new file mode 100644 index 0000000..60c133d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/IFlatUser.ts @@ -0,0 +1,5 @@ +export interface IFlatUser +{ + userId: number; + userName: string; +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/MuteAllInRoomParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/MuteAllInRoomParser.ts new file mode 100644 index 0000000..beb3814 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/MuteAllInRoomParser.ts @@ -0,0 +1,25 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class MuteAllInRoomParser implements IMessageParser +{ + private _isMuted: boolean; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._isMuted = wrapper.readBoolean(); + + return true; + } + + public get isMuted(): boolean + { + return this._isMuted; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/NoSuchFlatParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/NoSuchFlatParser.ts new file mode 100644 index 0000000..ca8255f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/NoSuchFlatParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class NoSuchFlatParser implements IMessageParser +{ + private _roomId: number; + + public flush(): boolean + { + this._roomId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomChatSettings.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomChatSettings.ts new file mode 100644 index 0000000..c19ea55 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomChatSettings.ts @@ -0,0 +1,57 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class RoomChatSettings +{ + public static CHAT_MODE_FREE_FLOW: number = 0; + public static CHAT_MODE_LINE_BY_LINE: number = 1; + public static CHAT_BUBBLE_WIDTH_WIDE: number = 0; + public static CHAT_BUBBLE_WIDTH_NORMAL: number = 1; + public static CHAT_BUBBLE_WIDTH_THIN: number = 2; + public static CHAT_SCROLL_SPEED_FAST: number = 0; + public static CHAT_SCROLL_SPEED_NORMAL: number = 1; + public static CHAT_SCROLL_SPEED_SLOW: number = 2; + public static FLOOD_FILTER_STRICT: number = 0; + public static FLOOD_FILTER_NORMAL: number = 1; + public static FLOOD_FILTER_LOOSE: number = 2; + + private _mode: number; + private _weight: number; + private _speed: number; + private _distance: number; + private _protection: number; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this._mode = wrapper.readInt(); + this._weight = wrapper.readInt(); + this._speed = wrapper.readInt(); + this._distance = wrapper.readInt(); + this._protection = wrapper.readInt(); + } + + public get mode(): number + { + return this._mode; + } + public get weight(): number + { + return this._weight; + } + + public get speed(): number + { + return this._speed; + } + + public get distance(): number + { + return this._distance; + } + + public get protection(): number + { + return this._protection; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomModerationSettings.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomModerationSettings.ts new file mode 100644 index 0000000..7f6fcc2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomModerationSettings.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IRoomModerationSettings } from '../../../../../api'; + +export class RoomModerationSettings implements IRoomModerationSettings +{ + public static MODERATION_LEVEL_NONE: number = 0; + public static MODERATION_LEVEL_USER_WITH_RIGHTS: number = 1; + public static MODERATION_LEVEL_ALL: number = 2; + + private _allowMute: number; + private _allowKick: number; + private _allowBan: number; + + constructor(wrapper: IMessageDataWrapper) + { + this._allowMute = wrapper.readInt(); + this._allowKick = wrapper.readInt(); + this._allowBan = wrapper.readInt(); + } + + public get allowMute(): number + { + return this._allowMute; + } + + public get allowKick(): number + { + return this._allowKick; + } + + public get allowBan(): number + { + return this._allowBan; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomSettingsData.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomSettingsData.ts new file mode 100644 index 0000000..4384e5e --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomSettingsData.ts @@ -0,0 +1,332 @@ +import { BannedUserData } from './BannedUserData'; +import { FlatControllerData } from './FlatControllerData'; +import { RoomChatSettings } from './RoomChatSettings'; +import { RoomModerationSettings } from './RoomModerationSettings'; + +export class RoomSettingsData +{ + public static DOORMODE_OPEN: number = 0; + public static DOORMODE_CLOSED: number = 1; + public static DOORMODE_PASSWORD: number = 2; + public static DOORMODE_INVISIBLE: number = 3; + public static DOORMODE_NOOBS_ONLY: number = 4; + public static TRADEMODE_NOT_ALLOWED: number = 0; + public static TRADEMODE_WITH_CONTROLLER: number = 1; + public static TRADEMODE_ALLOWED: number = 2; + + private _roomId: number = -1; + private _name: string = null; + private _description: string = null; + private _doorMode: number = RoomSettingsData.DOORMODE_OPEN; + private _categoryId: number = -1; + private _maximumVisitors: number = 0; + private _maximumVisitorsLimit: number = 0; + private _tags: string[] = []; + private _tradeMode: number = RoomSettingsData.TRADEMODE_NOT_ALLOWED; + private _allowPets: boolean = false; + private _allowFoodConsume: boolean = false; + private _allowWalkThrough: boolean = false; + private _hideWalls: boolean = false; + private _wallThickness: number = 0; + private _floorThickness: number = 0; + private _controllersById: Map = new Map(); + private _controllerList: FlatControllerData[] = null; + private _highlightedUserId: number = -1; + private _bannedUsersById: Map = new Map(); + private _bannedUsersList: BannedUserData[] = null; + private _roomModerationSettings: RoomModerationSettings = null; + private _chatSettings: RoomChatSettings = null; + private _allowNavigatorDynamicCats: boolean = false; + + public static from(settings: RoomSettingsData) + { + const instance = new RoomSettingsData(); + + instance._roomId = settings._roomId; + instance._name = settings._name; + instance._description = settings._description; + instance._doorMode = settings._doorMode; + instance._categoryId = settings._categoryId; + instance._maximumVisitors = settings._maximumVisitors; + instance._maximumVisitorsLimit = settings._maximumVisitorsLimit; + instance._tags = settings._tags; + instance._tradeMode = settings._tradeMode; + instance._allowPets = settings._allowPets; + instance._allowFoodConsume = settings._allowFoodConsume; + instance._allowWalkThrough = settings._allowWalkThrough; + instance._hideWalls = settings._hideWalls; + instance._wallThickness = settings._wallThickness; + instance._floorThickness = settings._floorThickness; + instance._controllersById = settings._controllersById; + instance._controllerList = settings._controllerList; + instance._highlightedUserId = settings._highlightedUserId; + instance._bannedUsersById = settings._bannedUsersById; + instance._bannedUsersList = settings._bannedUsersList; + instance._roomModerationSettings = settings._roomModerationSettings; + instance._chatSettings = settings._chatSettings; + instance._allowNavigatorDynamicCats = settings._allowNavigatorDynamicCats; + + return instance; + } + + public static getDoorModeLocalizationKey(k: number): string + { + switch(k) + { + case RoomSettingsData.DOORMODE_OPEN: + return '${navigator.door.mode.open}'; + case RoomSettingsData.DOORMODE_CLOSED: + return '${navigator.door.mode.closed}'; + case RoomSettingsData.DOORMODE_PASSWORD: + return '${navigator.door.mode.password}'; + case RoomSettingsData.DOORMODE_INVISIBLE: + return '${navigator.door.mode.invisible}'; + case RoomSettingsData.DOORMODE_NOOBS_ONLY: + return '${navigator.door.mode.noobs_only}'; + } + return ''; + } + + public get tradeMode(): number + { + return this._tradeMode; + } + + public set tradeMode(mode: number) + { + this._tradeMode = mode; + } + + public get allowPets(): boolean + { + return this._allowPets; + } + + public set allowPets(flag: boolean) + { + this._allowPets = flag; + } + + public get allowFoodConsume(): boolean + { + return this._allowFoodConsume; + } + + public set allowFoodConsume(flag: boolean) + { + this._allowFoodConsume = flag; + } + + public get allowWalkThrough(): boolean + { + return this._allowWalkThrough; + } + + public set allowWalkThrough(flag: boolean) + { + this._allowWalkThrough = flag; + } + + public get hideWalls(): boolean + { + return this._hideWalls; + } + + public set hideWalls(flag: boolean) + { + this._hideWalls = flag; + } + + public get wallThickness(): number + { + return this._wallThickness; + } + + public set wallThickness(thickness: number) + { + this._wallThickness = thickness; + } + + public get floorThickness(): number + { + return this._floorThickness; + } + + public set floorThickness(thickness: number) + { + this._floorThickness = thickness; + } + + public get roomId(): number + { + return this._roomId; + } + + public set roomId(id: number) + { + this._roomId = id; + } + + public get name(): string + { + return this._name; + } + + public set name(name: string) + { + this._name = name; + } + + public get description(): string + { + return this._description; + } + + public set description(description: string) + { + this._description = description; + } + + public get doorMode(): number + { + return this._doorMode; + } + + public set doorMode(mode: number) + { + this._doorMode = mode; + } + + public get categoryId(): number + { + return this._categoryId; + } + + public set categoryId(id: number) + { + this._categoryId = id; + } + + public get maximumVisitors(): number + { + return this._maximumVisitors; + } + + public set maximumVisitors(max: number) + { + this._maximumVisitors = max; + } + + public get maximumVisitorsLimit(): number + { + return this._maximumVisitorsLimit; + } + + public set maximumVisitorsLimit(limit: number) + { + this._maximumVisitorsLimit = limit; + } + + public get tags(): string[] + { + return this._tags; + } + + public set tags(tags: string[]) + { + this._tags = tags; + } + + public setFlatController(id: number, data: FlatControllerData): void + { + this._controllersById.set(id, data); + + this._controllerList = null; + this._highlightedUserId = id; + } + + public get roomModerationSettings(): RoomModerationSettings + { + return this._roomModerationSettings; + } + + public set roomModerationSettings(settings: RoomModerationSettings) + { + this._roomModerationSettings = settings; + } + + public get controllersById(): Map + { + return this._controllersById; + } + + public set controllersById(controllers: Map) + { + this._controllersById = controllers; + } + + public get controllerList(): FlatControllerData[] + { + if(!this._controllerList) + { + this._controllerList = []; + + for(const controllerData of this._controllersById.values()) this._controllerList.push(controllerData); + + this._controllerList.sort((a, b) => a.userName.localeCompare(b.userName)); + } + + return this._controllerList; + } + + public get highlightedUserId(): number + { + return this._highlightedUserId; + } + + public setBannedUser(id: number, data: BannedUserData): void + { + this._bannedUsersById.set(id, data); + + this._bannedUsersList = null; + } + + public get bannedUsersById(): Map + { + return this._bannedUsersById; + } + + public get bannedUsersList(): BannedUserData[] + { + if(!this._bannedUsersList) + { + this._bannedUsersList = []; + + for(const bannedUserData of this._bannedUsersById.values()) this._bannedUsersList.push(bannedUserData); + + this._bannedUsersList.sort((a, b) => a.userName.localeCompare(b.userName)); + } + + return this._bannedUsersList; + } + + public get chatSettings(): RoomChatSettings + { + return this._chatSettings; + } + + public set chatSettings(settings: RoomChatSettings) + { + this._chatSettings = settings; + } + + public get allowNavigatorDynamicCats(): boolean + { + return this._allowNavigatorDynamicCats; + } + + public set allowNavigatorDynamicCats(flag: boolean) + { + this._allowNavigatorDynamicCats = flag; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomSettingsDataParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomSettingsDataParser.ts new file mode 100644 index 0000000..238be33 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomSettingsDataParser.ts @@ -0,0 +1,59 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { RoomChatSettings } from './RoomChatSettings'; +import { RoomModerationSettings } from './RoomModerationSettings'; +import { RoomSettingsData } from './RoomSettingsData'; + +export class RoomSettingsDataParser implements IMessageParser +{ + private _roomSettingsData: RoomSettingsData; + + public flush(): boolean + { + this._roomSettingsData = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomSettingsData = new RoomSettingsData(); + + this._roomSettingsData.roomId = wrapper.readInt(); + this._roomSettingsData.name = wrapper.readString(); + this._roomSettingsData.description = wrapper.readString(); + this._roomSettingsData.doorMode = wrapper.readInt(); + this._roomSettingsData.categoryId = wrapper.readInt(); + this._roomSettingsData.maximumVisitors = wrapper.readInt(); + this._roomSettingsData.maximumVisitorsLimit = wrapper.readInt(); + this._roomSettingsData.tags = []; + + let totalTags = wrapper.readInt(); + + while(totalTags > 0) + { + this._roomSettingsData.tags.push(wrapper.readString()); + + totalTags--; + } + + this._roomSettingsData.tradeMode = wrapper.readInt(); + this._roomSettingsData.allowPets = (wrapper.readInt() === 1); + this._roomSettingsData.allowFoodConsume = (wrapper.readInt() === 1); + this._roomSettingsData.allowWalkThrough = (wrapper.readInt() === 1); + this._roomSettingsData.hideWalls = (wrapper.readInt() === 1); + this._roomSettingsData.wallThickness = wrapper.readInt(); + this._roomSettingsData.floorThickness = wrapper.readInt(); + this._roomSettingsData.chatSettings = new RoomChatSettings(wrapper); + this._roomSettingsData.allowNavigatorDynamicCats = wrapper.readBoolean(); + this._roomSettingsData.roomModerationSettings = new RoomModerationSettings(wrapper); + + return true; + } + + public get data(): RoomSettingsData + { + return this._roomSettingsData; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomSettingsErrorParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomSettingsErrorParser.ts new file mode 100644 index 0000000..5b119e0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomSettingsErrorParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RoomSettingsErrorParser implements IMessageParser +{ + private _roomId: number; + private _code: number; + + public flush(): boolean + { + this._roomId = 0; + this._code = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + this._code = wrapper.readInt(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get code(): number + { + return this._code; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSaveErrorParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSaveErrorParser.ts new file mode 100644 index 0000000..3dc3294 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSaveErrorParser.ts @@ -0,0 +1,57 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RoomSettingsSaveErrorParser implements IMessageParser +{ + public static ERROR_ROOM_NOT_FOUND: number = 1; + public static ERROR_NOT_OWNER: number = 2; + public static ERROR_INVALID_DOOR_MODE: number = 3; + public static ERROR_INVALID_USER_LIMIT: number = 4; + public static ERROR_INVALID_PASSWORD: number = 5; + public static ERROR_INVALID_CATEGORY: number = 6; + public static ERROR_INVALID_NAME: number = 7; + public static ERROR_UNACCEPTABLE_NAME: number = 8; + public static ERROR_INVALID_DESCRIPTION: number = 9; + public static ERROR_UNACCEPTABLE_DESCRIPTION: number = 10; + public static ERROR_INVALID_TAG: number = 11; + public static ERROR_NON_USER_CHOOSABLE_TAG: number = 12; + public static ERROR_TOO_MANY_CHARACTERS_IN_TAG: number = 13; + + private _roomId: number; + private _code: number; + private _message: string; + + public flush(): boolean + { + this._roomId = 0; + this._code = 0; + this._message = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + this._code = wrapper.readInt(); + this._message = wrapper.readString(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get code(): number + { + return this._code; + } + + public get message(): string + { + return this._message; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSavedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSavedParser.ts new file mode 100644 index 0000000..62d6877 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/RoomSettingsSavedParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RoomSettingsSavedParser implements IMessageParser +{ + private _roomId: number; + + public flush(): boolean + { + this._roomId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/ShowEnforceRoomCategoryDialogParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/ShowEnforceRoomCategoryDialogParser.ts new file mode 100644 index 0000000..3bcbc85 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/ShowEnforceRoomCategoryDialogParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ShowEnforceRoomCategoryDialogParser implements IMessageParser +{ + private _selectionType: number; + + public flush(): boolean + { + this._selectionType = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._selectionType = wrapper.readInt(); + + return true; + } + + public get selectionType(): number + { + return this._selectionType; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/UserUnbannedFromRoomParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/UserUnbannedFromRoomParser.ts new file mode 100644 index 0000000..3dcf17d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/UserUnbannedFromRoomParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class UserUnbannedFromRoomParser implements IMessageParser +{ + private _roomId: number; + private _userId: number; + + public flush(): boolean + { + this._roomId = 0; + this._userId = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomId = wrapper.readInt(); + this._userId = wrapper.readInt(); + + return true; + } + + public get roomId(): number + { + return this._roomId; + } + + public get userId(): number + { + return this._userId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/index.ts new file mode 100644 index 0000000..383ff7b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/roomsettings/index.ts @@ -0,0 +1,18 @@ +export * from './BannedUserData'; +export * from './BannedUsersFromRoomParser'; +export * from './FlatControllerAddedParser'; +export * from './FlatControllerData'; +export * from './FlatControllerRemovedParser'; +export * from './FlatControllersParser'; +export * from './IFlatUser'; +export * from './MuteAllInRoomParser'; +export * from './NoSuchFlatParser'; +export * from './RoomChatSettings'; +export * from './RoomModerationSettings'; +export * from './RoomSettingsData'; +export * from './RoomSettingsDataParser'; +export * from './RoomSettingsErrorParser'; +export * from './RoomSettingsSavedParser'; +export * from './RoomSettingsSaveErrorParser'; +export * from './ShowEnforceRoomCategoryDialogParser'; +export * from './UserUnbannedFromRoomParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/security/AuthenticatedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/security/AuthenticatedParser.ts new file mode 100644 index 0000000..c5c4f73 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/security/AuthenticatedParser.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class AuthenticatedParser implements IMessageParser +{ + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/security/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/security/index.ts new file mode 100644 index 0000000..9ad83b5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/security/index.ts @@ -0,0 +1 @@ +export * from './AuthenticatedParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/sound/JukeboxPlayListFullMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/sound/JukeboxPlayListFullMessageParser.ts new file mode 100644 index 0000000..8302263 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/sound/JukeboxPlayListFullMessageParser.ts @@ -0,0 +1,14 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class JukeboxPlayListFullMessageParser implements IMessageParser +{ + flush(): boolean + { + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + return true; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/sound/JukeboxSongDisksMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/sound/JukeboxSongDisksMessageParser.ts new file mode 100644 index 0000000..ef00a21 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/sound/JukeboxSongDisksMessageParser.ts @@ -0,0 +1,37 @@ +import { AdvancedMap, IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class JukeboxSongDisksMessageParser implements IMessageParser +{ + private _songDisks: IAdvancedMap = new AdvancedMap(); + private _maxLength: number; + + flush(): boolean + { + this._songDisks.reset(); + this._maxLength = 0; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._maxLength = wrapper.readInt(); + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + this._songDisks.add(wrapper.readInt(), wrapper.readInt()); + } + + return true; + } + + public get songDisks(): IAdvancedMap + { + return this._songDisks; + } + + public get maxLength(): number + { + return this._maxLength; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/sound/NowPlayingMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/sound/NowPlayingMessageParser.ts new file mode 100644 index 0000000..e8c7a29 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/sound/NowPlayingMessageParser.ts @@ -0,0 +1,56 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class NowPlayingMessageParser implements IMessageParser +{ + private _currentSongId: number; + private _currentPosition: number; + private _nextSongId: number; + private _nextPosition: number; + private _syncCount: number; + + flush(): boolean + { + this._currentSongId = -1; + this._currentPosition = -1; + this._nextSongId = -1; + this._nextPosition = -1; + this._syncCount = -1; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._currentSongId = wrapper.readInt(); + this._currentPosition = wrapper.readInt(); + this._nextSongId = wrapper.readInt(); + this._nextPosition = wrapper.readInt(); + this._syncCount = wrapper.readInt(); + return true; + } + + public get currentSongId(): number + { + return this._currentSongId; + } + + public get currentPosition(): number + { + return this._currentPosition; + } + + public get nextSongId(): number + { + return this._nextSongId; + } + + public get nextPosition(): number + { + return this._nextPosition; + } + + public get syncCount(): number + { + return this._syncCount; + } + +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/sound/OfficialSongIdMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/sound/OfficialSongIdMessageParser.ts new file mode 100644 index 0000000..99f953a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/sound/OfficialSongIdMessageParser.ts @@ -0,0 +1,31 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class OfficialSongIdMessageParser implements IMessageParser +{ + private _songId: number; + private _officialSongId: string; + + flush(): boolean + { + this._songId = 0; + this._officialSongId = ''; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._officialSongId = wrapper.readString(); + this._songId = wrapper.readInt(); + return true; + } + + public get songId(): number + { + return this._songId; + } + + public get officialSongId(): string + { + return this._officialSongId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/sound/PlayListEntry.ts b/submodules/renderer/src/nitro/communication/messages/parser/sound/PlayListEntry.ts new file mode 100644 index 0000000..6a0f447 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/sound/PlayListEntry.ts @@ -0,0 +1,46 @@ +export class PlayListEntry +{ + protected _id: number; + protected _length: number; + protected _name: string; + protected _creator: string; + private _startPlayHead: number = 0; + + constructor(id: number, length: number, name: string, creator: string) + { + this._id = id; + this._length = length; + this._name = name; + this._creator = creator; + } + + public get id(): number + { + return this._id; + } + + public get length(): number + { + return this._length; + } + + public get name(): string + { + return this._name; + } + + public get creator(): string + { + return this._creator; + } + + public get startPlayHeadPos(): number + { + return this._startPlayHead; + } + + public set startPlayHeadPos(k: number) + { + this._startPlayHead = k; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/sound/PlayListMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/sound/PlayListMessageParser.ts new file mode 100644 index 0000000..a6051a4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/sound/PlayListMessageParser.ts @@ -0,0 +1,40 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { PlayListEntry } from './PlayListEntry'; + +export class PlayListMessageParser implements IMessageParser +{ + private _synchronizationCount: number; + private _playlist: PlayListEntry[]; + + flush(): boolean + { + this._synchronizationCount = -1; + this._playlist = []; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._synchronizationCount = wrapper.readInt(); + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + this._playlist.push(new PlayListEntry( + wrapper.readInt(), wrapper.readInt(), wrapper.readString(), wrapper.readString() + )); + } + return true; + } + + public get synchronizationCount(): number + { + return this._synchronizationCount; + } + + public get playList(): PlayListEntry[] + { + return this._playlist; + } + +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/sound/PlayListSongAddedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/sound/PlayListSongAddedMessageParser.ts new file mode 100644 index 0000000..18aec17 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/sound/PlayListSongAddedMessageParser.ts @@ -0,0 +1,24 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { PlayListEntry } from './PlayListEntry'; + +export class PlayListSongAddedMessageParser implements IMessageParser +{ + private _entry: PlayListEntry; + + flush(): boolean + { + this._entry = null; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + this._entry = new PlayListEntry(wrapper.readInt(), wrapper.readInt(), wrapper.readString(), wrapper.readString()); + return true; + } + + public get entry(): PlayListEntry + { + return this._entry; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/sound/SongInfoEntry.ts b/submodules/renderer/src/nitro/communication/messages/parser/sound/SongInfoEntry.ts new file mode 100644 index 0000000..0bef665 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/sound/SongInfoEntry.ts @@ -0,0 +1,17 @@ +import { PlayListEntry } from './PlayListEntry'; + +export class SongInfoEntry extends PlayListEntry +{ + private _data: string = ''; + + constructor(id: number, length: number, name: string, creator: string, data: string) + { + super(id, length, name, creator); + this._data = data; + } + + public get data(): string + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/sound/TraxSongInfoMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/sound/TraxSongInfoMessageParser.ts new file mode 100644 index 0000000..d31c63b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/sound/TraxSongInfoMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { SongInfoEntry } from './SongInfoEntry'; + +export class TraxSongInfoMessageParser implements IMessageParser +{ + private _songs: SongInfoEntry[]; + + flush(): boolean + { + this._songs = []; + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + const count = wrapper.readInt(); + for(let i = 0; i < count; i++) + { + const id = wrapper.readInt(); + const _local_3 = wrapper.readString(); + const name = wrapper.readString(); + const data = wrapper.readString(); + const length = wrapper.readInt(); + const creator = wrapper.readString(); + const _local_10 = new SongInfoEntry(id, length, name, creator, data); + this._songs.push(_local_10); + } + return true; + } + + public get songs(): SongInfoEntry[] + { + return this._songs; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts new file mode 100644 index 0000000..7af73aa --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts @@ -0,0 +1,46 @@ +import { AdvancedMap, IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class UserSongDisksInventoryMessageParser implements IMessageParser +{ + private _songDiskInventory: IAdvancedMap = new AdvancedMap(); + + flush(): boolean + { + this._songDiskInventory.reset(); + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + const count = wrapper.readInt(); + + for(let i = 0; i < count; i++) + { + this._songDiskInventory.add(wrapper.readInt(), wrapper.readInt()); + } + return true; + } + + public getDiskId(k: number): number + { + if(((k >= 0) && (k < this._songDiskInventory.length))) + { + return this._songDiskInventory.getKey(k); + } + return -1; + } + + public getSongId(k: number): number + { + if(((k >= 0) && (k < this._songDiskInventory.length))) + { + return this._songDiskInventory.getWithIndex(k); + } + return -1; + } + + public get songDiskCount(): number + { + return this._songDiskInventory.length; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/sound/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/sound/index.ts new file mode 100644 index 0000000..2fc0d7a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/sound/index.ts @@ -0,0 +1,10 @@ +export * from './JukeboxPlayListFullMessageParser'; +export * from './JukeboxSongDisksMessageParser'; +export * from './NowPlayingMessageParser'; +export * from './OfficialSongIdMessageParser'; +export * from './PlayListEntry'; +export * from './PlayListMessageParser'; +export * from './PlayListSongAddedMessageParser'; +export * from './SongInfoEntry'; +export * from './TraxSongInfoMessageParser'; +export * from './UserSongDisksInventoryMessageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentLevelUpMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentLevelUpMessageParser.ts new file mode 100644 index 0000000..e3cc4ca --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentLevelUpMessageParser.ts @@ -0,0 +1,74 @@ +import { TalentTrackRewardPerk, TalentTrackRewardProduct } from '.'; +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class TalentLevelUpMessageParser implements IMessageParser +{ + private _talentTrackName: string; + private _level: number; + private _rewardPerks: TalentTrackRewardPerk[]; + private _rewardProducts: TalentTrackRewardProduct[]; + + public flush(): boolean + { + this._talentTrackName = null; + this._level = -1; + this._rewardPerks = []; + this._rewardProducts = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalRewards = 0; + + this._talentTrackName = wrapper.readString(); + this._level = wrapper.readInt(); + + const totalRewardsPerks = wrapper.readInt(); + + while(totalRewards < totalRewardsPerks) + { + this._rewardPerks.push(new TalentTrackRewardPerk(wrapper)); + totalRewards++; + } + + const totalRewardsProducts = wrapper.readInt(); + + if(totalRewards < totalRewardsProducts) + { + for(let i = 0; i < totalRewardsProducts; i++) + { + const name = wrapper.readString(); + const vipDays = wrapper.readInt(); + + this._rewardProducts.push(new TalentTrackRewardProduct(name, vipDays)); + totalRewards++; + } + } + + return true; + } + + public get talentTrackName(): string + { + return this._talentTrackName; + } + + public get level(): number + { + return this._level; + } + + public get rewardPerks(): TalentTrackRewardPerk[] + { + return this._rewardPerks; + } + + public get rewardProducts(): TalentTrackRewardProduct[] + { + return this._rewardProducts; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackLevel.ts b/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackLevel.ts new file mode 100644 index 0000000..03a6eb0 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackLevel.ts @@ -0,0 +1,45 @@ +import { TalentTrackRewardProduct } from './TalentTrackRewardProduct'; +import { TalentTrackTask } from './TalentTrackTask'; + +export class TalentTrackLevel +{ + private _level: number; + private _state: number; + private _tasks: TalentTrackTask[]; + private _rewardPerks: string[]; + private _rewardProducts: TalentTrackRewardProduct[]; + + constructor(level: number, state: number, achievements: TalentTrackTask[], perks: string[], items: TalentTrackRewardProduct[]) + { + this._level = level; + this._state = state; + this._tasks = achievements; + this._rewardPerks = perks; + this._rewardProducts = items; + } + + public get level(): number + { + return this._level; + } + + public get state(): number + { + return this._state; + } + + public get tasks(): TalentTrackTask[] + { + return this._tasks; + } + + public get perks(): string[] + { + return this._rewardPerks; + } + + public get items(): TalentTrackRewardProduct[] + { + return this._rewardProducts; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackLevelMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackLevelMessageParser.ts new file mode 100644 index 0000000..2380b7b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackLevelMessageParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class TalentTrackLevelMessageParser implements IMessageParser +{ + private _talentTrackName: string; + private _level: number; + private _maxLevel: number; + + public flush(): boolean + { + this._talentTrackName = null; + this._level = -1; + this._maxLevel = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._talentTrackName = wrapper.readString(); + this._level = wrapper.readInt(); + this._maxLevel = wrapper.readInt(); + + return true; + } + + public get talentTrackName(): string + { + return this._talentTrackName; + } + + public get level(): number + { + return this._level; + } + + public get maxLevel(): number + { + return this._maxLevel; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackParser.ts new file mode 100644 index 0000000..ccf7047 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackParser.ts @@ -0,0 +1,79 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { TalentTrackLevel } from './TalentTrackLevel'; +import { TalentTrackRewardProduct } from './TalentTrackRewardProduct'; +import { TalentTrackTask } from './TalentTrackTask'; + +export class TalentTrackParser implements IMessageParser +{ + private _type: string; + private _levels: TalentTrackLevel[]; + + public flush(): boolean + { + this._type = null; + this._levels = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._type = wrapper.readString(); + + this._levels = []; + const levelsCount = wrapper.readInt(); + + for(let i = 0; i < levelsCount; i++) + { + const levelId = wrapper.readInt(); + const levelState = wrapper.readInt(); + + const levelAchievements: TalentTrackTask[] = []; + const achievementsCount = wrapper.readInt(); + + for(let j = 0; j < achievementsCount; j++) + { + const id = wrapper.readInt(); + const index = wrapper.readInt(); + const code = wrapper.readString(); + const state = wrapper.readInt(); + const progress = wrapper.readInt(); + const achievementProgress = wrapper.readInt(); + + levelAchievements.push(new TalentTrackTask(id, index, code, state, progress, achievementProgress)); + } + + const levelPerks: string[] = []; + const perksCount = wrapper.readInt(); + + for(let j = 0; j < perksCount; j++) levelPerks.push(wrapper.readString()); + + const levelItems: TalentTrackRewardProduct[] = []; + const itemsCount = wrapper.readInt(); + + for(let j = 0; j < itemsCount; j++) + { + const name = wrapper.readString(); + const unknownInt = wrapper.readInt(); + + levelItems.push(new TalentTrackRewardProduct(name, unknownInt)); + } + + this._levels.push(new TalentTrackLevel(levelId, levelState, levelAchievements, levelPerks, levelItems)); + } + + return true; + } + + public get type(): string + { + return this._type; + } + + public get levels(): TalentTrackLevel[] + { + return this._levels; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackRewardPerk.ts b/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackRewardPerk.ts new file mode 100644 index 0000000..aca6e4c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackRewardPerk.ts @@ -0,0 +1,16 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class TalentTrackRewardPerk +{ + private _perkId: number; + + constructor(wrapper: IMessageDataWrapper) + { + this._perkId = wrapper.readInt(); + } + + public get perkId(): number + { + return this._perkId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackRewardProduct.ts b/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackRewardProduct.ts new file mode 100644 index 0000000..d45c46d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackRewardProduct.ts @@ -0,0 +1,21 @@ +export class TalentTrackRewardProduct +{ + private _productCode: string; + private _vipDays: number; + + constructor(name: string, vipDays: number) + { + this._productCode = name; + this._vipDays = vipDays; + } + + public get productCode(): string + { + return this._productCode; + } + + public get vipDays(): number + { + return this._vipDays; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackTask.ts b/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackTask.ts new file mode 100644 index 0000000..a249b11 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/talent/TalentTrackTask.ts @@ -0,0 +1,49 @@ +export class TalentTrackTask +{ + private _id: number; + private _requiredLevel: number; + private _badgeCode: string; + private _state: number; + private _currentScore: number; + private _totalScore: number; + + constructor(id: number, requiredLevel: number, badgeCode: string, state: number, currentScore: number, totalScore: number) + { + this._id = id; + this._requiredLevel = requiredLevel; + this._badgeCode = badgeCode; + this._state = state; + this._currentScore = currentScore; + this._totalScore = totalScore; + } + + public get id(): number + { + return this._id; + } + + public get requiredLevel(): number + { + return this._requiredLevel; + } + + public get badgeCode(): string + { + return this._badgeCode; + } + + public get state(): number + { + return this._state; + } + + public get currentScore(): number + { + return this._currentScore; + } + + public get totalScore(): number + { + return this._totalScore; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/talent/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/talent/index.ts new file mode 100644 index 0000000..d48e436 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/talent/index.ts @@ -0,0 +1,7 @@ +export * from './TalentLevelUpMessageParser'; +export * from './TalentTrackLevel'; +export * from './TalentTrackLevelMessageParser'; +export * from './TalentTrackParser'; +export * from './TalentTrackRewardPerk'; +export * from './TalentTrackRewardProduct'; +export * from './TalentTrackTask'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/AccountSafetyLockStatusChangeParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/AccountSafetyLockStatusChangeParser.ts new file mode 100644 index 0000000..f1b1d55 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/AccountSafetyLockStatusChangeParser.ts @@ -0,0 +1,28 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class AccountSafetyLockStatusChangeParser implements IMessageParser +{ + public static SAFETY_LOCK_STATUS_LOCKED: number = 0; + public static SAFETY_LOCK_STATUS_UNLOCKED: number = 1; + + private _status: number; + + public flush(): boolean + { + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._status = wrapper.readInt(); + + return true; + } + + public get status(): number + { + return this._status; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/ApproveNameResultParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/ApproveNameResultParser.ts new file mode 100644 index 0000000..e6ddad7 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/ApproveNameResultParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ApproveNameResultParser implements IMessageParser +{ + private _result: number; + private _validationInfo: string; + + public flush(): boolean + { + this._result = -1; + this._validationInfo = ''; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._result = wrapper.readInt(); + this._validationInfo = wrapper.readString(); + + return true; + } + + public get result(): number + { + return this._result; + } + + public get validationInfo(): string + { + return this._validationInfo; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/ChangeEmailResultParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/ChangeEmailResultParser.ts new file mode 100644 index 0000000..351a7cb --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/ChangeEmailResultParser.ts @@ -0,0 +1,29 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ChangeEmailResultParser implements IMessageParser +{ + public static readonly EMAIL_STATUS_OK: number = 0; + + private _result: number; + + public flush(): boolean + { + this._result = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._result = wrapper.readInt(); + + return true; + } + + public get result(): number + { + return this._result; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/EmailStatusParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/EmailStatusParser.ts new file mode 100644 index 0000000..50dc53c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/EmailStatusParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class EmailStatusParser implements IMessageParser +{ + private _email: string; + private _isVerified: boolean; + private _allowChange: boolean; + + public flush(): boolean + { + this._email = null; + this._isVerified = false; + this._allowChange = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._email = wrapper.readString(); + this._isVerified = wrapper.readBoolean(); + this._allowChange = wrapper.readBoolean(); + + return true; + } + + public get email(): string + { + return this._email; + } + + public get isVerified(): boolean + { + return this._isVerified; + } + + public get allowChange(): boolean + { + return this._allowChange; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/ExtendedProfileChangedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/ExtendedProfileChangedMessageParser.ts new file mode 100644 index 0000000..5d9175d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/ExtendedProfileChangedMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class ExtendedProfileChangedMessageParser implements IMessageParser +{ + private _userId: number; + + public flush(): boolean + { + this._userId = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._userId = wrapper.readInt(); + + return true; + } + + public get userId(): number + { + return this._userId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/GroupDetailsChangedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/GroupDetailsChangedMessageParser.ts new file mode 100644 index 0000000..9f493a2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/GroupDetailsChangedMessageParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GroupDetailsChangedMessageParser implements IMessageParser +{ + private _groupId: number; + + public flush(): boolean + { + this._groupId = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._groupId = wrapper.readInt(); + + return true; + } + + public get groupId(): number + { + return this._groupId; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/GroupMembershipRequestedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/GroupMembershipRequestedMessageParser.ts new file mode 100644 index 0000000..48b9739 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/GroupMembershipRequestedMessageParser.ts @@ -0,0 +1,36 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { MemberData } from '../../incoming'; + +export class GroupMembershipRequestedMessageParser implements IMessageParser +{ + private _groupId: number; + private _requester: MemberData; + + public flush(): boolean + { + this._groupId = -1; + this._requester = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._groupId = wrapper.readInt(); + this._requester = new MemberData(wrapper); + + return true; + } + + public get groupId(): number + { + return this._groupId; + } + + public get requester(): MemberData + { + return this._requester; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/GuildEditFailedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/GuildEditFailedMessageParser.ts new file mode 100644 index 0000000..0e825e8 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/GuildEditFailedMessageParser.ts @@ -0,0 +1,29 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GuildEditFailedMessageParser implements IMessageParser +{ + public static readonly INSUFFICIENT_SUBSCRIPTION_LEVEL: number = 2; + + private _reason: number; + + public flush(): boolean + { + this._reason = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._reason = wrapper.readInt(); + + return true; + } + + public get reason(): number + { + return this._reason; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/GuildMemberMgmtFailedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/GuildMemberMgmtFailedMessageParser.ts new file mode 100644 index 0000000..52eb73a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/GuildMemberMgmtFailedMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class GuildMemberMgmtFailedMessageParser implements IMessageParser +{ + private _guildId: number; + private _reason: number; + + public flush(): boolean + { + this._guildId = -1; + this._reason = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._guildId = wrapper.readInt(); + this._reason = wrapper.readInt(); + + return true; + } + + public get guildId(): number + { + return this._guildId; + } + + public get reason(): number + { + return this._reason; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/GuildMembershipsMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/GuildMembershipsMessageParser.ts new file mode 100644 index 0000000..0d5dccd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/GuildMembershipsMessageParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { HabboGroupEntryData } from './HabboGroupEntryData'; + +export class GuildMembershipsMessageParser implements IMessageParser +{ + private _groups: HabboGroupEntryData[]; + + public flush(): boolean + { + this._groups = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalOffers = wrapper.readInt(); + + while(totalOffers > 0) + { + this._groups.push(new HabboGroupEntryData(wrapper)); + + totalOffers--; + } + + return true; + } + + public get groups(): HabboGroupEntryData[] + { + return this._groups; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/HabboGroupBadgesMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/HabboGroupBadgesMessageParser.ts new file mode 100644 index 0000000..14071cd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/HabboGroupBadgesMessageParser.ts @@ -0,0 +1,36 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class HabboGroupBadgesMessageParser implements IMessageParser +{ + private _badges: Map; + + flush(): boolean + { + this._badges = new Map(); + + return true; + } + + parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let badgesCount = wrapper.readInt(); + + while(badgesCount > 0) + { + const id = wrapper.readInt(); + const badge = wrapper.readString(); + + this._badges.set(id, badge); + badgesCount--; + } + + return true; + } + + public get badges(): Map + { + return this._badges; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/HabboGroupEntryData.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/HabboGroupEntryData.ts new file mode 100644 index 0000000..1ba1816 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/HabboGroupEntryData.ts @@ -0,0 +1,65 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class HabboGroupEntryData +{ + private _groupId: number; + private _groupName: string; + private _badgeCode: string; + private _colorA: string; + private _colorB: string; + private _favourite: boolean; + private _ownerId: number; + private _hasForum: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + this._groupId = wrapper.readInt(); + this._groupName = wrapper.readString(); + this._badgeCode = wrapper.readString(); + this._colorA = wrapper.readString(); + this._colorB = wrapper.readString(); + this._favourite = wrapper.readBoolean(); + this._ownerId = wrapper.readInt(); + this._hasForum = wrapper.readBoolean(); + } + + public get groupId(): number + { + return this._groupId; + } + + public get groupName(): string + { + return this._groupName; + } + + public get badgeCode(): string + { + return this._badgeCode; + } + + public get colorA(): string + { + return this._colorA; + } + + public get colorB(): string + { + return this._colorB; + } + + public get favourite(): boolean + { + return this._favourite; + } + + public get ownerId(): number + { + return this._ownerId; + } + + public get hasForum(): boolean + { + return this._hasForum; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/HabboGroupJoinFailedMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/HabboGroupJoinFailedMessageParser.ts new file mode 100644 index 0000000..4d67ba2 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/HabboGroupJoinFailedMessageParser.ts @@ -0,0 +1,29 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class HabboGroupJoinFailedMessageParser implements IMessageParser +{ + public static readonly INSUFFICIENT_SUBSCRIPTION_LEVEL: number = 4; + + private _reason: number; + + public flush(): boolean + { + this._reason = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._reason = wrapper.readInt(); + + return true; + } + + public get reason(): number + { + return this._reason; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/IgnoreResultParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/IgnoreResultParser.ts new file mode 100644 index 0000000..f122ced --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/IgnoreResultParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class IgnoreResultParser implements IMessageParser +{ + private _result: number; + private _name: string; + + public flush(): boolean + { + this._result = -1; + this._name = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._result = wrapper.readInt(); + this._name = wrapper.readString(); + + return true; + } + + public get result(): number + { + return this._result; + } + + public get name(): string + { + return this._name; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/IgnoredUsersParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/IgnoredUsersParser.ts new file mode 100644 index 0000000..2821a77 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/IgnoredUsersParser.ts @@ -0,0 +1,36 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class IgnoredUsersParser implements IMessageParser +{ + private _ignoredUsers: string[]; + + public flush(): boolean + { + this._ignoredUsers = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._ignoredUsers = []; + + let count = wrapper.readInt(); + + while(count > 0) + { + this._ignoredUsers.push(wrapper.readString()); + + count--; + } + + return true; + } + + public get ignoredUsers(): string[] + { + return this._ignoredUsers; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/InClientLinkParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/InClientLinkParser.ts new file mode 100644 index 0000000..009062b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/InClientLinkParser.ts @@ -0,0 +1,25 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class InClientLinkParser implements IMessageParser +{ + private _link: string; + + public flush(): boolean + { + this._link = null; + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._link = wrapper.readString(); + return true; + } + + public get link(): string + { + return this._link; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/PetRespectNotificationParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/PetRespectNotificationParser.ts new file mode 100644 index 0000000..c8404c1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/PetRespectNotificationParser.ts @@ -0,0 +1,49 @@ +import { IMessageDataWrapper, IMessageParser, PetType } from '../../../../../api'; +import { PetData } from '../inventory'; + +export class PetRespectNotificationParser implements IMessageParser +{ + private _respect: number; + private _petOwnerId: number; + private _petData: PetData; + + public flush(): boolean + { + this._respect = 0; + this._petOwnerId = 0; + this._petData = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._respect = wrapper.readInt(); + this._petOwnerId = wrapper.readInt(); + this._petData = new PetData(wrapper); + + return true; + } + + public get respect(): number + { + return this._respect; + } + + public get petOwnerId(): number + { + return this._petOwnerId; + } + + public get petData(): PetData + { + return this._petData; + } + + public get isTreat(): boolean + { + return (this._petData.typeId === PetType.MONSTERPLANT); + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/PetSupplementTypeEnum.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/PetSupplementTypeEnum.ts new file mode 100644 index 0000000..d111209 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/PetSupplementTypeEnum.ts @@ -0,0 +1,8 @@ +export class PetSupplementTypeEnum +{ + public static WATER: number = 0; + public static LIGHT: number = 1; + public static REVIVE: number = 2; + public static REBREED_FERTILIZER: number = 3; + public static SPEED_FERTILIZER: number = 4; +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/PetSupplementedNotificationParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/PetSupplementedNotificationParser.ts new file mode 100644 index 0000000..9aaf64b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/PetSupplementedNotificationParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class PetSupplementedNotificationParser implements IMessageParser +{ + private _petId: number; + private _userId: number; + private _supplementType: number; + + public flush(): boolean + { + this._petId = 0; + this._userId = 0; + this._supplementType = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._petId = wrapper.readInt(); + this._userId = wrapper.readInt(); + this._supplementType = wrapper.readInt(); + + return true; + } + + public get petId(): number + { + return this._petId; + } + + public get userId(): number + { + return this._userId; + } + + public get supplementType(): number + { + return this._supplementType; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/RespectReceivedParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/RespectReceivedParser.ts new file mode 100644 index 0000000..0c4b0ef --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/RespectReceivedParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class RespectReceivedParser implements IMessageParser +{ + private _userId: number; + private _respectsReceived: number; + + public flush(): boolean + { + this._userId = 0; + this._respectsReceived = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._userId = wrapper.readInt(); + this._respectsReceived = wrapper.readInt(); + + return true; + } + + public get userId(): number + { + return this._userId; + } + + public get respectsReceived(): number + { + return this._respectsReceived; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/RoomEntryData.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/RoomEntryData.ts new file mode 100644 index 0000000..4f9ee0b --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/RoomEntryData.ts @@ -0,0 +1,28 @@ +export class RoomEntryData +{ + private _roomId: number; + private _roomName: string; + private _hasControllers: boolean = false; + + constructor(roomId: number, roomName: string, hasControllers: boolean) + { + this._roomId = roomId; + this._roomName = roomName; + this._hasControllers = hasControllers; + } + + public get roomId(): number + { + return this._roomId; + } + + public get roomName(): string + { + return this._roomName; + } + + public get hasControllers(): boolean + { + return this._hasControllers; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/ScrKickbackData.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/ScrKickbackData.ts new file mode 100644 index 0000000..c5df544 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/ScrKickbackData.ts @@ -0,0 +1,72 @@ +import { IMessageDataWrapper } from '../../../../../api'; + +export class ScrKickbackData +{ + private _currentHcStreak: number; + private _firstSubscriptionDate: string; + private _kickbackPercentage: number; + private _totalCreditsMissed: number; + private _totalCreditsRewarded: number; + private _totalCreditsSpent: number; + private _creditRewardForStreakBonus: number; + private _creditRewardForMonthlySpent: number; + private _timeUntilPayday: number; + + constructor(k: IMessageDataWrapper) + { + this._currentHcStreak = k.readInt(); + this._firstSubscriptionDate = k.readString(); + this._kickbackPercentage = k.readDouble(); + this._totalCreditsMissed = k.readInt(); + this._totalCreditsRewarded = k.readInt(); + this._totalCreditsSpent = k.readInt(); + this._creditRewardForStreakBonus = k.readInt(); + this._creditRewardForMonthlySpent = k.readInt(); + this._timeUntilPayday = k.readInt(); + } + + public get currentHcStreak(): number + { + return this._currentHcStreak; + } + + public get firstSubscriptionDate(): string + { + return this._firstSubscriptionDate; + } + + public get kickbackPercentage(): number + { + return this._kickbackPercentage; + } + + public get totalCreditsMissed(): number + { + return this._totalCreditsMissed; + } + + public get totalCreditsRewarded(): number + { + return this._totalCreditsRewarded; + } + + public get totalCreditsSpent(): number + { + return this._totalCreditsSpent; + } + + public get creditRewardForStreakBonus(): number + { + return this._creditRewardForStreakBonus; + } + + public get creditRewardForMonthlySpent(): number + { + return this._creditRewardForMonthlySpent; + } + + public get timeUntilPayday(): number + { + return this._timeUntilPayday; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/ScrSendKickbackInfoMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/ScrSendKickbackInfoMessageParser.ts new file mode 100644 index 0000000..d65a4ef --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/ScrSendKickbackInfoMessageParser.ts @@ -0,0 +1,23 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; +import { ScrKickbackData } from './ScrKickbackData'; + +export class ScrSendKickbackInfoMessageParser implements IMessageParser +{ + private _data: ScrKickbackData; + + flush(): boolean + { + this._data = null; + return true; + } + parse(wrapper: IMessageDataWrapper): boolean + { + this._data = new ScrKickbackData(wrapper); + return true; + } + + public get data(): ScrKickbackData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/WelcomeGiftChangeEmailResultParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/WelcomeGiftChangeEmailResultParser.ts new file mode 100644 index 0000000..81c9bf1 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/WelcomeGiftChangeEmailResultParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class WelcomeGiftChangeEmailResultParser implements IMessageParser +{ + private _result: number; + + public flush(): boolean + { + this._result = -1; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._result = wrapper.readInt(); + + return true; + } + + public get result(): number + { + return this._result; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/access/UserPermissionsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/access/UserPermissionsParser.ts new file mode 100644 index 0000000..f40e406 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/access/UserPermissionsParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class UserPermissionsParser implements IMessageParser +{ + private _clubLevel: number; + private _securityLevel: number; + private _isAmbassador: boolean; + + public flush(): boolean + { + this._clubLevel = 0; + this._securityLevel = 0; + this._isAmbassador = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._clubLevel = wrapper.readInt(); + this._securityLevel = wrapper.readInt(); + this._isAmbassador = wrapper.readBoolean(); + + return true; + } + + public get clubLevel(): number + { + return this._clubLevel; + } + + public get securityLevel(): number + { + return this._securityLevel; + } + + public get isAmbassador(): boolean + { + return this._isAmbassador; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/access/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/access/index.ts new file mode 100644 index 0000000..7cb9b64 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/access/index.ts @@ -0,0 +1 @@ +export * from './UserPermissionsParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfo.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfo.ts new file mode 100644 index 0000000..04a4e01 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfo.ts @@ -0,0 +1,67 @@ +import { IMessageDataWrapper, RelationshipStatusEnum } from '../../../../../../api'; + +export class RelationshipStatusInfo +{ + private _relationshipStatusType: number; + private _friendCount: number; + private _randomFriendId: number; + private _randomFriendName: string; + private _randomFriendFigure: string; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._relationshipStatusType = RelationshipStatusEnum.NONE; + this._friendCount = 0; + this._randomFriendId = 0; + this._randomFriendFigure = null; + this._randomFriendName = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._relationshipStatusType = wrapper.readInt(); + this._friendCount = wrapper.readInt(); + this._randomFriendId = wrapper.readInt(); + this._randomFriendName = wrapper.readString(); + this._randomFriendFigure = wrapper.readString(); + + return true; + } + + public get relationshipStatusType(): number + { + return this._relationshipStatusType; + } + + public get friendCount(): number + { + return this._friendCount; + } + + public get randomFriendId(): number + { + return this._randomFriendId; + } + + public get randomFriendName(): string + { + return this._randomFriendName; + } + + public get randomFriendFigure(): string + { + return this._randomFriendFigure; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfoMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfoMessageParser.ts new file mode 100644 index 0000000..912fade --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfoMessageParser.ts @@ -0,0 +1,45 @@ +import { AdvancedMap, IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { RelationshipStatusInfo } from './RelationshipStatusInfo'; + +export class RelationshipStatusInfoMessageParser implements IMessageParser +{ + private _userId: number; + private _relationshipStatusMap: IAdvancedMap; + + public flush(): boolean + { + this._userId = 0; + this._relationshipStatusMap = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._userId = wrapper.readInt(); + this._relationshipStatusMap = new AdvancedMap(); + + const relationshipsCount = wrapper.readInt(); + + for(let i = 0; i < relationshipsCount; i++) + { + const relationship = new RelationshipStatusInfo(wrapper); + + this._relationshipStatusMap.add(relationship.relationshipStatusType, relationship); + } + + return true; + } + + public get userId(): number + { + return this._userId; + } + + public get relationshipStatusMap(): IAdvancedMap + { + return this._relationshipStatusMap; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserCurrentBadgesParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserCurrentBadgesParser.ts new file mode 100644 index 0000000..efa5ff5 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserCurrentBadgesParser.ts @@ -0,0 +1,46 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class UserCurrentBadgesParser implements IMessageParser +{ + private _userId: number; + private _badges: string[]; + + public flush(): boolean + { + this._userId = null; + this._badges = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._userId = wrapper.readInt(); + + let totalBadges = wrapper.readInt(); + + while(totalBadges > 0) + { + const slotId = wrapper.readInt(); + const badgeCode = wrapper.readString(); + + this._badges.push(badgeCode); + + totalBadges--; + } + + return true; + } + + public get userId(): number + { + return this._userId; + } + + public get badges(): string[] + { + return this._badges; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserFigureParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserFigureParser.ts new file mode 100644 index 0000000..d1bdf82 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserFigureParser.ts @@ -0,0 +1,35 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class UserFigureParser implements IMessageParser +{ + private _figure: string; + private _gender: string; + + public flush(): boolean + { + this._figure = null; + this._gender = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._figure = wrapper.readString(); + this._gender = wrapper.readString(); + + return true; + } + + public get figure(): string + { + return this._figure; + } + + public get gender(): string + { + return this._gender; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserInfoDataParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserInfoDataParser.ts new file mode 100644 index 0000000..c6b7dfd --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserInfoDataParser.ts @@ -0,0 +1,139 @@ +import { IMessageDataWrapper } from '../../../../../../api'; + +export class UserInfoDataParser +{ + private _userId: number; + private _username: string; + private _figure: string; + private _gender: string; + private _motto: string; + private _realName: string; + private _directMail: boolean; + private _respectsReceived: number; + private _respectsRemaining: number; + private _respectsPetRemaining: number; + private _streamPublishingAllowed: boolean; + private _lastAccessDate: string; + private _canChangeName: boolean; + private _safetyLocked: boolean; + + constructor(wrapper: IMessageDataWrapper) + { + if(!wrapper) throw new Error('invalid_wrapper'); + + this.flush(); + this.parse(wrapper); + } + + public flush(): boolean + { + this._userId = 0; + this._username = null; + this._figure = null; + this._gender = null; + this._motto = null; + this._realName = null; + this._directMail = false; + this._respectsReceived = 0; + this._respectsRemaining = 0; + this._respectsPetRemaining = 0; + this._streamPublishingAllowed = false; + this._lastAccessDate = null; + this._canChangeName = false; + this._safetyLocked = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._userId = wrapper.readInt(); + this._username = wrapper.readString(); + this._figure = wrapper.readString(); + this._gender = wrapper.readString(); + this._motto = wrapper.readString(); + this._realName = wrapper.readString(); + this._directMail = wrapper.readBoolean(); + this._respectsReceived = wrapper.readInt(); + this._respectsRemaining = wrapper.readInt(); + this._respectsPetRemaining = wrapper.readInt(); + this._streamPublishingAllowed = wrapper.readBoolean(); + this._lastAccessDate = wrapper.readString(); + this._canChangeName = wrapper.readBoolean(); + this._safetyLocked = wrapper.readBoolean(); + + return true; + } + + public get userId(): number + { + return this._userId; + } + + public get username(): string + { + return this._username; + } + + public get figure(): string + { + return this._figure; + } + + public get gender(): string + { + return this._gender; + } + + public get motto(): string + { + return this._motto; + } + + public get realName(): string + { + return this._realName; + } + + public get directMail(): boolean + { + return this._directMail; + } + + public get respectsReceived(): number + { + return this._respectsReceived; + } + + public get respectsRemaining(): number + { + return this._respectsRemaining; + } + + public get respectsPetRemaining(): number + { + return this._respectsPetRemaining; + } + + public get streamPublishingAllowed(): boolean + { + return this._streamPublishingAllowed; + } + + public get lastAccessedDate(): string + { + return this._lastAccessDate; + } + + public get canChangeName(): boolean + { + return this._canChangeName; + } + + public get safetyLocked(): boolean + { + return this._safetyLocked; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserInfoParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserInfoParser.ts new file mode 100644 index 0000000..27dce1f --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserInfoParser.ts @@ -0,0 +1,30 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { UserInfoDataParser } from './UserInfoDataParser'; + +export class UserInfoParser implements IMessageParser +{ + private _userInfo: UserInfoDataParser; + + public flush(): boolean + { + this._userInfo = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._userInfo = new UserInfoDataParser(wrapper); + + if(!this._userInfo) return false; + + return true; + } + + public get userInfo(): UserInfoDataParser + { + return this._userInfo; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserNameChangeMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserNameChangeMessageParser.ts new file mode 100644 index 0000000..0f77f69 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserNameChangeMessageParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class UserNameChangeMessageParser implements IMessageParser +{ + private _webId: number; + private _id: number; + private _newName: string; + + public flush(): boolean + { + this._webId = -1; + this._id = -1; + this._newName = ''; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._webId = wrapper.readInt(); + this._id = wrapper.readInt(); + this._newName = wrapper.readString(); + + return true; + } + + public get webId(): number + { + return this._webId; + } + + public get id(): number + { + return this._id; + } + + public get newName(): string + { + return this._newName; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserProfileParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserProfileParser.ts new file mode 100644 index 0000000..2837394 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserProfileParser.ts @@ -0,0 +1,130 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; +import { HabboGroupEntryData } from '../HabboGroupEntryData'; + +export class UserProfileParser implements IMessageParser +{ + private _id: number; + private _username: string; + private _figure: string; + private _motto: string; + private _registration: string; + private _achievementPoints: number; + private _friendsCount: number; + private _isMyFriend: boolean; + private _requestSent: boolean; + private _isOnline: boolean; + private _groups: HabboGroupEntryData[]; + private _secondsSinceLastVisit: number; + private _openProfileWindow: boolean; + + public flush(): boolean + { + this._id = 0; + this._username = null; + this._figure = null; + this._motto = null; + this._registration = null; + this._achievementPoints = 0; + this._friendsCount = 0; + this._isMyFriend = false; + this._requestSent = false; + this._isOnline = false; + this._groups = []; + this._secondsSinceLastVisit = 0; + this._openProfileWindow = false; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._id = wrapper.readInt(); + this._username = wrapper.readString(); + this._figure = wrapper.readString(); + this._motto = wrapper.readString(); + this._registration = wrapper.readString(); + this._achievementPoints = wrapper.readInt(); + this._friendsCount = wrapper.readInt(); + this._isMyFriend = wrapper.readBoolean(); + this._requestSent = wrapper.readBoolean(); + this._isOnline = wrapper.readBoolean(); + const groupsCount = wrapper.readInt(); + + for(let i = 0; i < groupsCount; i++) + { + this._groups.push(new HabboGroupEntryData(wrapper)); + } + + this._secondsSinceLastVisit = wrapper.readInt(); + this._openProfileWindow = wrapper.readBoolean(); + + return true; + } + + public get id(): number + { + return this._id; + } + + public get username(): string + { + return this._username; + } + + public get figure(): string + { + return this._figure; + } + + public get motto(): string + { + return this._motto; + } + + public get registration(): string + { + return this._registration; + } + + public get achievementPoints(): number + { + return this._achievementPoints; + } + + public get friendsCount(): number + { + return this._friendsCount; + } + + public get isMyFriend(): boolean + { + return this._isMyFriend; + } + + public get requestSent(): boolean + { + return this._requestSent; + } + + public get isOnline(): boolean + { + return this._isOnline; + } + + public get groups(): HabboGroupEntryData[] + { + return this._groups; + } + + public get secondsSinceLastVisit(): number + { + return this._secondsSinceLastVisit; + } + + public get openProfileWindow(): boolean + { + return this._openProfileWindow; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserSettingsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserSettingsParser.ts new file mode 100644 index 0000000..aa0e973 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserSettingsParser.ts @@ -0,0 +1,83 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class UserSettingsParser implements IMessageParser +{ + private _volumeSystem: number; + private _volumeFurni: number; + private _volumeTrax: number; + private _oldChat: boolean; + private _roomInvites: boolean; + private _cameraFollow: boolean; + private _flags: number; + private _chatType: number; + + public flush(): boolean + { + this._volumeSystem = 0; + this._volumeFurni = 0; + this._volumeTrax = 0; + this._oldChat = false; + this._roomInvites = false; + this._cameraFollow = false; + this._flags = 0; + this._chatType = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._volumeSystem = wrapper.readInt(); + this._volumeFurni = wrapper.readInt(); + this._volumeTrax = wrapper.readInt(); + this._oldChat = wrapper.readBoolean(); + this._roomInvites = wrapper.readBoolean(); + this._cameraFollow = wrapper.readBoolean(); + this._flags = wrapper.readInt(); + this._chatType = wrapper.readInt(); + + return true; + } + + public get volumeSystem(): number + { + return this._volumeSystem; + } + + public get volumeFurni(): number + { + return this._volumeFurni; + } + + public get volumeTrax(): number + { + return this._volumeTrax; + } + + public get oldChat(): boolean + { + return this._oldChat; + } + + public get roomInvites(): boolean + { + return this._roomInvites; + } + + public get cameraFollow(): boolean + { + return this._cameraFollow; + } + + public get flags(): number + { + return this._flags; + } + + public get chatType(): number + { + return this._chatType; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserTagsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserTagsParser.ts new file mode 100644 index 0000000..dfd2727 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/data/UserTagsParser.ts @@ -0,0 +1,43 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class UserTagsParser implements IMessageParser +{ + private _roomUnitId: number; + private _tags: string[]; + + public flush(): boolean + { + this._roomUnitId = -1; + this._tags = []; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._roomUnitId = wrapper.readInt(); + + let totalTags = wrapper.readInt(); + + while(totalTags > 0) + { + this._tags.push(wrapper.readString()); + + totalTags--; + } + + return true; + } + + public get roomUnitId(): number + { + return this._roomUnitId; + } + + public get tags(): string[] + { + return this._tags; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/data/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/data/index.ts new file mode 100644 index 0000000..ad707bf --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/data/index.ts @@ -0,0 +1,10 @@ +export * from './RelationshipStatusInfo'; +export * from './RelationshipStatusInfoMessageParser'; +export * from './UserCurrentBadgesParser'; +export * from './UserFigureParser'; +export * from './UserInfoDataParser'; +export * from './UserInfoParser'; +export * from './UserNameChangeMessageParser'; +export * from './UserProfileParser'; +export * from './UserSettingsParser'; +export * from './UserTagsParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/index.ts new file mode 100644 index 0000000..82dfb33 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/index.ts @@ -0,0 +1,30 @@ +export * from './access'; +export * from './AccountSafetyLockStatusChangeParser'; +export * from './ApproveNameResultParser'; +export * from './ChangeEmailResultParser'; +export * from './data'; +export * from './EmailStatusParser'; +export * from './ExtendedProfileChangedMessageParser'; +export * from './GroupDetailsChangedMessageParser'; +export * from './GroupMembershipRequestedMessageParser'; +export * from './GuildEditFailedMessageParser'; +export * from './GuildMemberMgmtFailedMessageParser'; +export * from './GuildMembershipsMessageParser'; +export * from './HabboGroupBadgesMessageParser'; +export * from './HabboGroupEntryData'; +export * from './HabboGroupJoinFailedMessageParser'; +export * from './IgnoredUsersParser'; +export * from './IgnoreResultParser'; +export * from './InClientLinkParser'; +export * from './inventory'; +export * from './inventory/currency'; +export * from './inventory/subscription'; +export * from './PetRespectNotificationParser'; +export * from './PetSupplementedNotificationParser'; +export * from './PetSupplementTypeEnum'; +export * from './RespectReceivedParser'; +export * from './RoomEntryData'; +export * from './ScrKickbackData'; +export * from './ScrSendKickbackInfoMessageParser'; +export * from './wardrobe'; +export * from './WelcomeGiftChangeEmailResultParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/currency/UserCreditsParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/currency/UserCreditsParser.ts new file mode 100644 index 0000000..c3f5c7c --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/currency/UserCreditsParser.ts @@ -0,0 +1,27 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; + +export class UserCreditsParser implements IMessageParser +{ + private _credits: string; + + public flush(): boolean + { + this._credits = null; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._credits = wrapper.readString(); + + return true; + } + + public get credits(): string + { + return this._credits; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/currency/UserCurrencyParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/currency/UserCurrencyParser.ts new file mode 100644 index 0000000..8b64e3a --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/currency/UserCurrencyParser.ts @@ -0,0 +1,34 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; + +export class UserCurrencyParser implements IMessageParser +{ + private _currencies: Map; + + public flush(): boolean + { + this._currencies = new Map(); + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let totalCurrencies = wrapper.readInt(); + + while(totalCurrencies > 0) + { + this._currencies.set(wrapper.readInt(), wrapper.readInt()); + + totalCurrencies--; + } + + return true; + } + + public get currencies(): Map + { + return this._currencies; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/currency/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/currency/index.ts new file mode 100644 index 0000000..a6e0537 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/currency/index.ts @@ -0,0 +1,2 @@ +export * from './UserCreditsParser'; +export * from './UserCurrencyParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/index.ts new file mode 100644 index 0000000..e25bf08 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/index.ts @@ -0,0 +1,2 @@ +export * from './currency'; +export * from './subscription'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/subscription/UserSubscriptionParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/subscription/UserSubscriptionParser.ts new file mode 100644 index 0000000..c4103bc --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/subscription/UserSubscriptionParser.ts @@ -0,0 +1,113 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../../api'; + +export class UserSubscriptionParser implements IMessageParser +{ + public static readonly RESPONSE_TYPE_LOGIN: number = 1; + public static readonly RESPONSE_TYPE_PURCHASE: number = 2; + public static readonly RESPONSE_TYPE_DISCOUNT_AVAILABLE: number = 3; + public static readonly RESPONSE_TYPE_CITIZENSHIP_DISCOUNT: number = 4; + + private _productName: string; + private _daysToPeriodEnd: number; + private _memberPeriods: number; + private _periodsSubscribedAhead: number; + private _responseType: number; + private _hasEverBeenMember: boolean; + private _isVip: boolean; + private _pastClubDays: number; + private _pastVipDays: number; + private _minutesUntilExpiration: number; + private _minutesSinceLastModified: number; + + public flush(): boolean + { + this._productName = null; + this._daysToPeriodEnd = 0; + this._memberPeriods = 0; + this._periodsSubscribedAhead = 0; + this._responseType = 0; + this._hasEverBeenMember = false; + this._isVip = false; + this._pastClubDays = 0; + this._pastVipDays = 0; + this._minutesUntilExpiration = 0; + this._minutesSinceLastModified = 0; + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + this._productName = wrapper.readString(); + this._daysToPeriodEnd = wrapper.readInt(); + this._memberPeriods = wrapper.readInt(); + this._periodsSubscribedAhead = wrapper.readInt(); + this._responseType = wrapper.readInt(); + this._hasEverBeenMember = wrapper.readBoolean(); + this._isVip = wrapper.readBoolean(); + this._pastClubDays = wrapper.readInt(); + this._pastVipDays = wrapper.readInt(); + this._minutesUntilExpiration = wrapper.readInt(); + + if(wrapper.bytesAvailable) this._minutesSinceLastModified = wrapper.readInt(); + + return true; + } + + public get productName(): string + { + return this._productName; + } + + public get daysToPeriodEnd(): number + { + return this._daysToPeriodEnd; + } + + public get memberPeriods(): number + { + return this._memberPeriods; + } + + public get periodsSubscribedAhead(): number + { + return this._periodsSubscribedAhead; + } + + public get responseType(): number + { + return this._responseType; + } + + public get hasEverBeenMember(): boolean + { + return this._hasEverBeenMember; + } + + public get isVip(): boolean + { + return this._isVip; + } + + public get pastClubDays(): number + { + return this._pastClubDays; + } + + public get pastVipDays(): number + { + return this._pastVipDays; + } + + public get minutesUntilExpiration(): number + { + return this._minutesUntilExpiration; + } + + public get minutesSinceLastModified(): number + { + return this._minutesSinceLastModified; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/subscription/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/subscription/index.ts new file mode 100644 index 0000000..e88ac0d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/inventory/subscription/index.ts @@ -0,0 +1 @@ +export * from './UserSubscriptionParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/wardrobe/UserWardrobePageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/wardrobe/UserWardrobePageParser.ts new file mode 100644 index 0000000..42dc671 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/wardrobe/UserWardrobePageParser.ts @@ -0,0 +1,40 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../../api'; + +export class UserWardrobePageParser implements IMessageParser +{ + private _looks: Map; + + public flush(): boolean + { + this._looks = new Map(); + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + wrapper.readInt(); + + let totalLooks = wrapper.readInt(); + + while(totalLooks > 0) + { + const slotId = wrapper.readInt(); + const look = wrapper.readString(); + const gender = wrapper.readString(); + + this._looks.set(slotId, [look, gender]); + + totalLooks--; + } + + return true; + } + + public get looks(): Map + { + return this._looks; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/user/wardrobe/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/user/wardrobe/index.ts new file mode 100644 index 0000000..a2878b4 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/user/wardrobe/index.ts @@ -0,0 +1 @@ +export * from './UserWardrobePageParser'; diff --git a/submodules/renderer/src/nitro/communication/messages/parser/userclassification/UserClassificationMessageParser.ts b/submodules/renderer/src/nitro/communication/messages/parser/userclassification/UserClassificationMessageParser.ts new file mode 100644 index 0000000..1c1a50d --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/userclassification/UserClassificationMessageParser.ts @@ -0,0 +1,57 @@ +import { IMessageDataWrapper, IMessageParser } from '../../../../../api'; + +export class UserClassificationMessageParser implements IMessageParser +{ + private _classifiedUsersNames: Map; + private _classifiedUsersClass: Map; + + public flush(): boolean + { + if(this._classifiedUsersNames) + { + this._classifiedUsersNames = new Map(); + } + if(this._classifiedUsersClass) + { + this._classifiedUsersClass = new Map(); + } + + return true; + } + + public parse(wrapper: IMessageDataWrapper): boolean + { + if(!wrapper) return false; + + let _local_3: number; + let _local_4: string; + let _local_5: string; + + let count: number = wrapper.readInt(); + + this._classifiedUsersNames = new Map(); + this._classifiedUsersClass = new Map(); + + while(count > 0) + { + _local_3 = wrapper.readInt(); + _local_4 = wrapper.readString(); + _local_5 = wrapper.readString(); + this._classifiedUsersNames.set(_local_3, _local_4); + this._classifiedUsersClass.set(_local_3, _local_5); + count--; + } + + return true; + } + + public get classifiedUsernameMap(): Map + { + return this._classifiedUsersNames; + } + + public get classifiedUserTypeMap(): Map + { + return this._classifiedUsersClass; + } +} diff --git a/submodules/renderer/src/nitro/communication/messages/parser/userclassification/index.ts b/submodules/renderer/src/nitro/communication/messages/parser/userclassification/index.ts new file mode 100644 index 0000000..8779e98 --- /dev/null +++ b/submodules/renderer/src/nitro/communication/messages/parser/userclassification/index.ts @@ -0,0 +1 @@ +export * from './UserClassificationMessageParser'; diff --git a/submodules/renderer/src/nitro/externalInterface/LegacyExternalInterface.ts b/submodules/renderer/src/nitro/externalInterface/LegacyExternalInterface.ts new file mode 100644 index 0000000..9dcc458 --- /dev/null +++ b/submodules/renderer/src/nitro/externalInterface/LegacyExternalInterface.ts @@ -0,0 +1,118 @@ +declare global +{ + interface Window + { + FlashExternalInterface?: + { + legacyTrack?: ( + category: string, + action: string, + data: unknown[] + ) => void; + logDebug?: (...params: string[]) => void; + disconnect?: (reasonCode: number, reasonString: string) => void; + logout?: () => void; + openWebPageAndMinimizeClient?: (pageUrl: string) => void; + heartBeat?: () => void; + logEventLog?: (log: string) => void; + openPage?: (pageUrl: string) => void; + closeWebPageAndRestoreClient?: () => void; + openHabblet?: (name: string, param: string) => void; + closeHabblet?: (name: string, param: string) => void; + openExternalLink?: (link: string) => void; + roomVisited?: (roomId: number) => void; + openMinimail?: (target: string) => void; + openNews?: () => void; + closeNews?: () => void; + openAvatars?: () => void; + openRoomEnterAd?: () => void; + updateFigure?: (figure: string) => void; + }; + + FlashExternalGameInterface?: + { + showGame?: (url: string) => void; + hideGame?: () => void; + }; + } +} + +export class LegacyExternalInterface +{ + private static readonly MESSAGE_KEY = 'Nitro_LegacyExternalInterface'; + private static _isListeningForPostMessages = false; + + + public static get available(): boolean + { + if(!this._isListeningForPostMessages) + { + this._isListeningForPostMessages = true; + window.addEventListener('message', (ev) => + { + if(typeof ev.data !== 'string') return; + + if(ev.data.startsWith(LegacyExternalInterface.MESSAGE_KEY)) + { + const { method, params } = JSON.parse( + ev.data.substr(LegacyExternalInterface.MESSAGE_KEY.length) + ); + + const fn = (window as any)[method]; + if(!fn) return; + + fn(...params); + return; + } + + }); + } + + return true; + } + + public static call( + method: K, + ...params: Parameters + ): ReturnType | undefined + { + if(window.top !== window) + { + window.top.postMessage(LegacyExternalInterface.MESSAGE_KEY + JSON.stringify({ + method, + params + }), '*'); + } + + if(!('FlashExternalInterface' in window)) return undefined; + + const fn = window.FlashExternalInterface[method] as Function; + + return typeof fn !== 'undefined' ? fn(...params) : undefined; + } + + public static callGame( + method: K, + ...params: Parameters + ): ReturnType | undefined + { + if(window.top !== window) + { + window.top.postMessage('Nitro_LegacyExternalGameInterface' + JSON.stringify({ + method, + params + }), '*'); + } + + if(!('FlashExternalGameInterface' in window)) return undefined; + + const fn = window.FlashExternalGameInterface[method] as Function; + + return typeof fn !== 'undefined' ? fn(...params) : undefined; + } + + public static addCallback(name: string, func: Function) + { + (window as any)[name] = func; + } +} diff --git a/submodules/renderer/src/nitro/externalInterface/index.ts b/submodules/renderer/src/nitro/externalInterface/index.ts new file mode 100644 index 0000000..231cd60 --- /dev/null +++ b/submodules/renderer/src/nitro/externalInterface/index.ts @@ -0,0 +1 @@ +export * from './LegacyExternalInterface'; diff --git a/submodules/renderer/src/nitro/game/GameMessageHandler.ts b/submodules/renderer/src/nitro/game/GameMessageHandler.ts new file mode 100644 index 0000000..04c6efa --- /dev/null +++ b/submodules/renderer/src/nitro/game/GameMessageHandler.ts @@ -0,0 +1,22 @@ +import { IConnection } from '../../api'; +import { LoadGameUrlEvent } from '../communication'; +import { LegacyExternalInterface } from '../externalInterface'; + +export class GameMessageHandler +{ + constructor(connection: IConnection) + { + connection.addMessageEvent(new LoadGameUrlEvent(this.onLoadGameUrl.bind(this))); + } + + private onLoadGameUrl(event: LoadGameUrlEvent): void + { + if(!event) return; + + const parser = event.getParser(); + + if(!parser) return; + + LegacyExternalInterface.callGame('showGame', parser.url); + } +} diff --git a/submodules/renderer/src/nitro/game/index.ts b/submodules/renderer/src/nitro/game/index.ts new file mode 100644 index 0000000..116431d --- /dev/null +++ b/submodules/renderer/src/nitro/game/index.ts @@ -0,0 +1 @@ +export * from './GameMessageHandler'; diff --git a/submodules/renderer/src/nitro/index.ts b/submodules/renderer/src/nitro/index.ts new file mode 100644 index 0000000..bd99803 --- /dev/null +++ b/submodules/renderer/src/nitro/index.ts @@ -0,0 +1,13 @@ +export * from './avatar'; +export * from './camera'; +export * from './communication'; +export * from './externalInterface'; +export * from './game'; +export * from './INitro'; +export * from './localization'; +export * from './Nitro'; +export * from './room'; +export * from './session'; +export * from './sound'; +export * from './utils'; +export * from './window'; diff --git a/submodules/renderer/src/nitro/localization/BadgeBaseAndLevel.ts b/submodules/renderer/src/nitro/localization/BadgeBaseAndLevel.ts new file mode 100644 index 0000000..f5f7c90 --- /dev/null +++ b/submodules/renderer/src/nitro/localization/BadgeBaseAndLevel.ts @@ -0,0 +1,53 @@ +export class BadgeBaseAndLevel +{ + private _badgeId: string = ''; + private _level: number = 1; + private _base: string = ''; + + constructor(badgeId: string) + { + this._badgeId = badgeId; + + this.parseText(); + } + + private parseText():void + { + let length = (this._badgeId.length - 1); + + while(length > 0 && this.isNumber(this._badgeId.charAt(length))) length--; + + this._base = this._badgeId.substr(0, (length + 1)); + + const level = this._badgeId.substr((length + 1), this._badgeId.length); + + if(level && (level !== '')) this._level = Number.parseInt(level); + } + + private isNumber(text: string): boolean + { + const char = text.charCodeAt(0); + + return (char >= 48 && char <= 57); + } + + public get level(): number + { + return this._level; + } + + public set level(k : number) + { + this._level = Math.max(1, k); + } + + public get getBadgeId(): string + { + return this._base + this._level; + } + + public get base(): string + { + return this._base; + } +} diff --git a/submodules/renderer/src/nitro/localization/NitroLocalizationManager.ts b/submodules/renderer/src/nitro/localization/NitroLocalizationManager.ts new file mode 100644 index 0000000..2721d25 --- /dev/null +++ b/submodules/renderer/src/nitro/localization/NitroLocalizationManager.ts @@ -0,0 +1,345 @@ +import { INitroCommunicationManager, INitroLocalizationManager, NitroConfiguration } from '../../api'; +import { NitroManager } from '../../core'; +import { NitroLocalizationEvent } from '../../events'; +import { BadgePointLimitsEvent } from '../communication'; +import { BadgeBaseAndLevel } from './BadgeBaseAndLevel'; + +export class NitroLocalizationManager extends NitroManager implements INitroLocalizationManager +{ + private _communication: INitroCommunicationManager; + private _definitions: Map; + private _parameters: Map>; + private _badgePointLimits: Map; + private _romanNumerals: string[]; + private _pendingUrls: string[]; + + constructor(communication: INitroCommunicationManager) + { + super(); + + this._communication = communication; + this._definitions = new Map(); + this._parameters = new Map(); + this._badgePointLimits = new Map(); + this._romanNumerals = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX', 'XXI', 'XXII', 'XXIII', 'XXIV', 'XXV', 'XXVI', 'XXVII', 'XXVIII', 'XXIX', 'XXX']; + this._pendingUrls = []; + } + + protected onInit(): void + { + this._communication.registerMessageEvent(new BadgePointLimitsEvent(this.onBadgePointLimitsEvent.bind(this))); + + let urls: string[] = NitroConfiguration.getValue('external.texts.url'); + + if(!Array.isArray(urls)) + { + urls = [NitroConfiguration.getValue('external.texts.url')]; + } + + for(let i = 0; i < urls.length; i++) urls[i] = NitroConfiguration.interpolate(urls[i]); + + this._pendingUrls = urls; + + this.loadNextLocalization(); + } + + private loadNextLocalization(): void + { + if(!this._pendingUrls.length) + { + this.events && this.events.dispatchEvent(new NitroLocalizationEvent(NitroLocalizationEvent.LOADED)); + + return; + } + + this.loadLocalizationFromURL(this._pendingUrls[0]); + } + + public loadLocalizationFromURL(url: string): void + { + fetch(url) + .then(response => response.json()) + .then(data => this.onLocalizationLoaded(data, url)) + .catch(err => this.onLocalizationFailed(err)); + } + + private onLocalizationLoaded(data: { [index: string]: any }, url: string): void + { + if(!data) return; + + if(!this.parseLocalization(data)) throw new Error(`Invalid json data for file ${url}`); + + const index = this._pendingUrls.indexOf(url); + + if(index >= 0) this._pendingUrls.splice(index, 1); + + this.loadNextLocalization(); + } + + private onLocalizationFailed(error: Error): void + { + this.events && this.events.dispatchEvent(new NitroLocalizationEvent(NitroLocalizationEvent.FAILED)); + } + + private parseLocalization(data: { [index: string]: any }): boolean + { + if(!data) return false; + + for(const key in data) this._definitions.set(key, data[key]); + + return true; + } + + private onBadgePointLimitsEvent(event: BadgePointLimitsEvent): void + { + const parser = event.getParser(); + + for(const data of parser.data) this.setBadgePointLimit(data.badgeId, data.limit); + } + + public getBadgePointLimit(badge: string): number + { + return (this._badgePointLimits.get(badge) || -1); + } + + public setBadgePointLimit(badge: string, point: number): void + { + this._badgePointLimits.set(badge, point); + } + + public getRomanNumeral(number: number): string + { + return this._romanNumerals[Math.max(0, (number - 1))]; + } + + public getPreviousLevelBadgeId(badgeName: string): string + { + const badge = new BadgeBaseAndLevel(badgeName); + + badge.level--; + + return badge.getBadgeId; + } + + public hasValue(key: string): boolean + { + return this._definitions.has(key); + } + + public getValue(key: string, doParams: boolean = true): string + { + if(!key || !key.length) return null; + + const keys = key.match(/\$\{.[^}]*\}/g); + + if(keys && keys.length) + { + for(const splitKey of keys) key = key.replace(splitKey, this.getValue(splitKey.slice(2, -1), doParams)); + } + + let value = (this._definitions.get(key) || null); + + if(!value) + { + value = (NitroConfiguration.definitions.get(key) as any); + + if(value) return value; + } + + if(value && doParams) + { + const parameters = this._parameters.get(key); + + if(parameters) + { + for(const [parameter, replacement] of parameters) + { + value = value.replace('%' + parameter + '%', replacement); + } + } + } + + return (value || key); + } + + public getValueWithParameter(key: string, parameter: string, replacement: string): string + { + const value = this.getValue(key, false); + + const replacedValue = value.replace('%' + parameter + '%', replacement); + + if(value.startsWith('%{')) + { + // This adds support for multi-optioned texts like + // catalog.vip.item.header.months=%{NUM_MONTHS|0 months|1 month|%% months} + // It only checks for this multi-optioned thext if the value of the key starts with %{ + + // If it does, it will create a RegEx with the provided parameter, eg. NUM_DAYS or NUM_MONTS + // Then, based on the provided replacement it searches for the resultgroup based on the replacement. + // If the replacement is not either 0, 1 - it will be assumed it will be plural. (eg. Months) + const regex = new RegExp('%{' + parameter.toUpperCase() + '\\|([^|]*)\\|([^|]*)\\|([^|]*)}'); + const result = value.match(regex); + + if(!result) return replacedValue; + + let indexKey = -1; + const replacementAsNumber = Number.parseInt(replacement); + let replace = false; + + switch(replacementAsNumber) + { + case 0: + indexKey = 1; + break; + case 1: + indexKey = 2; + break; + default: + case 2: + indexKey = 3; + replace = true; + break; + } + + + if(indexKey == -1 || typeof result[indexKey] == 'undefined') + { + return replacedValue; + } + + const valueFromResults = result[indexKey]; + + if(valueFromResults) + { + return valueFromResults.replace('%%', replacement); + } + } + + return replacedValue; + } + + public getValueWithParameters(key: string, parameters: string[], replacements: string[]): string + { + let value = this.getValue(key, false); + + if(parameters) + { + for(let i = 0; i < parameters.length; i++) + { + const parameter = parameters[i]; + const replacement = replacements[i]; + + if(replacement === undefined) continue; + + value = value.replace('%' + parameter + '%', replacement); + + if(value.startsWith('%{')) + { + const regex = new RegExp('%{' + parameter.toUpperCase() + '\\|([^|]*)\\|([^|]*)\\|([^|]*)}'); + const result = value.match(regex); + + if(!result) continue; + + const replacementAsNumber = parseInt(replacement); + + let indexKey = -1; + let replace = false; + + switch(replacementAsNumber) + { + case 0: + indexKey = 1; + break; + case 1: + indexKey = 2; + break; + case 2: + default: + indexKey = 3; + replace = true; + break; + } + + + if((indexKey === -1) || (typeof result[indexKey] === 'undefined')) continue; + + const valueFromResults = result[indexKey]; + + if(valueFromResults) + { + value = valueFromResults.replace('%%', replacement); + } + } + } + } + + return value; + } + + public setValue(key: string, value: string): void + { + this._definitions.set(key, value); + } + + public registerParameter(key: string, parameter: string, value: string): void + { + if(!key || (key.length === 0) || !parameter || (parameter.length === 0)) return; + + let existing = this._parameters.get(key); + + if(!existing) + { + existing = new Map(); + + this._parameters.set(key, existing); + } + + existing.set(parameter, value); + } + + public getBadgeName(key: string): string + { + const badge = new BadgeBaseAndLevel(key); + const keys = ['badge_name_' + key, 'badge_name_' + badge.base]; + + let name = this.fixBadLocalization(this.getExistingKey(keys)); + + name = name.replace('%roman%', this.getRomanNumeral(badge.level)); + + return name; + } + + public getBadgeDesc(key: string): string + { + const badge = new BadgeBaseAndLevel(key); + const keys = ['badge_desc_' + key, 'badge_desc_' + badge.base]; + + let desc = this.fixBadLocalization(this.getExistingKey(keys)); + + const limit = this.getBadgePointLimit(key); + + if(limit > -1) desc = desc.replace('%limit%', limit.toString()); + + desc = desc.replace('%roman%', this.getRomanNumeral(badge.level)); + + return desc; + } + + private getExistingKey(keys: string[]): string + { + for(const entry of keys) + { + const item = this.getValue(entry); + if(item != entry) return item; + } + + return ''; + } + + private fixBadLocalization(k: string): string + { + return k.replace('${', '$') + .replace('{', '$') + .replace('}', '$'); + } +} diff --git a/submodules/renderer/src/nitro/localization/index.ts b/submodules/renderer/src/nitro/localization/index.ts new file mode 100644 index 0000000..34e18ce --- /dev/null +++ b/submodules/renderer/src/nitro/localization/index.ts @@ -0,0 +1,2 @@ +export * from './BadgeBaseAndLevel'; +export * from './NitroLocalizationManager'; diff --git a/submodules/renderer/src/nitro/room/ImageResult.ts b/submodules/renderer/src/nitro/room/ImageResult.ts new file mode 100644 index 0000000..b59e496 --- /dev/null +++ b/submodules/renderer/src/nitro/room/ImageResult.ts @@ -0,0 +1,19 @@ +import { RenderTexture } from '@pixi/core'; +import { IImageResult } from '../../api'; +import { TextureUtils } from '../../pixi-proxy'; + +export class ImageResult implements IImageResult +{ + public id: number = 0; + public data: RenderTexture = null; + public image: HTMLImageElement = null; + + public getImage(): HTMLImageElement + { + if(this.image) return this.image; + + if(!this.data) return null; + + return TextureUtils.generateImage(this.data); + } +} diff --git a/submodules/renderer/src/nitro/room/PetColorResult.ts b/submodules/renderer/src/nitro/room/PetColorResult.ts new file mode 100644 index 0000000..7cb64d8 --- /dev/null +++ b/submodules/renderer/src/nitro/room/PetColorResult.ts @@ -0,0 +1,61 @@ +import { IPetColorResult } from '../../api'; + +export class PetColorResult implements IPetColorResult +{ + private static COLOR_TAGS: string[] = ['Null', 'Black', 'White', 'Grey', 'Red', 'Orange', 'Pink', 'Green', 'Lime', 'Blue', 'Light-Blue', 'Dark-Blue', 'Yellow', 'Brown', 'Dark-Brown', 'Beige', 'Cyan', 'Purple', 'Gold']; + + private _breed: number; + private _tag: string; + private _id: string; + private _primaryColor: number; + private _secondaryColor: number; + private _isMaster: boolean; + private _layerTags: string[]; + + constructor(primaryColor: number, secondaryColor: number, breed: number, tag: number, id: string, isMaster: boolean, layerTags: string[]) + { + this._layerTags = []; + this._primaryColor = (primaryColor & 0xFFFFFF); + this._secondaryColor = (secondaryColor & 0xFFFFFF); + this._breed = breed; + this._tag = (((tag > -1) && (tag < PetColorResult.COLOR_TAGS.length)) ? PetColorResult.COLOR_TAGS[tag] : ''); + this._id = id; + this._isMaster = isMaster; + this._layerTags = layerTags; + } + + public get primaryColor(): number + { + return this._primaryColor; + } + + public get secondaryColor(): number + { + return this._secondaryColor; + } + + public get breed(): number + { + return this._breed; + } + + public get tag(): string + { + return this._tag; + } + + public get id(): string + { + return this._id; + } + + public get isMaster(): boolean + { + return this._isMaster; + } + + public get layerTags(): string[] + { + return this._layerTags; + } +} diff --git a/submodules/renderer/src/nitro/room/RoomContentLoader.ts b/submodules/renderer/src/nitro/room/RoomContentLoader.ts new file mode 100644 index 0000000..dbfb9e4 --- /dev/null +++ b/submodules/renderer/src/nitro/room/RoomContentLoader.ts @@ -0,0 +1,704 @@ +import { BaseTexture, Resource, Texture } from '@pixi/core'; +import { Spritesheet } from '@pixi/spritesheet'; +import { FurnitureType, GetAssetManager, GraphicAssetCollection, GraphicAssetGifCollection, IAssetData, IEventDispatcher, IFurnitureData, IFurnitureDataListener, IGraphicAssetCollection, IGraphicAssetGifCollection, IPetColorResult, IRoomContentListener, IRoomContentLoader, IRoomObject, ISessionDataManager, NitroBundle, NitroConfiguration, NitroLogger, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, RoomObjectVisualizationType } from '../../api'; +import { NitroEvent } from '../../events'; +import { RoomContentLoadedEvent } from '../../events/room/RoomContentLoadedEvent'; +import { PetColorResult } from './PetColorResult'; + +export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLoader +{ + private static PLACE_HOLDER: string = 'place_holder'; + private static PLACE_HOLDER_WALL: string = 'place_holder_wall'; + private static PLACE_HOLDER_PET: string = 'place_holder_pet'; + private static PLACE_HOLDER_DEFAULT: string = RoomContentLoader.PLACE_HOLDER; + private static ROOM: string = 'room'; + private static TILE_CURSOR: string = 'tile_cursor'; + private static SELECTION_ARROW: string = 'selection_arrow'; + + public static LOADER_READY: string = 'RCL_LOADER_READY'; + public static MANDATORY_LIBRARIES: string[] = [RoomContentLoader.PLACE_HOLDER, RoomContentLoader.PLACE_HOLDER_WALL, RoomContentLoader.PLACE_HOLDER_PET, RoomContentLoader.ROOM, RoomContentLoader.TILE_CURSOR, RoomContentLoader.SELECTION_ARROW]; + + private _stateEvents: IEventDispatcher; + private _sessionDataManager: ISessionDataManager; + private _waitingForSessionDataManager: boolean; + private _iconListener: IRoomContentListener; + private _collections: Map; + private _gifCollections: Map; + private _images: Map; + + private _events: Map; + private _activeObjects: { [index: string]: number }; + private _activeObjectTypes: Map; + private _activeObjectTypeIds: Map; + private _objectTypeAdUrls: Map; + private _wallItems: { [index: string]: number }; + private _wallItemTypes: Map; + private _wallItemTypeIds: Map; + private _furniRevisions: Map; + private _pets: { [index: string]: number }; + private _petColors: Map>; + private _objectAliases: Map; + private _objectOriginalNames: Map; + + private _pendingContentTypes: string[]; + private _dataInitialized: boolean; + + constructor() + { + this._stateEvents = null; + this._sessionDataManager = null; + this._waitingForSessionDataManager = false; + this._iconListener = null; + this._collections = new Map(); + this._gifCollections = new Map(); + this._images = new Map(); + + this._events = new Map(); + this._activeObjects = {}; + this._activeObjectTypes = new Map(); + this._activeObjectTypeIds = new Map(); + this._objectTypeAdUrls = new Map(); + this._wallItems = {}; + this._wallItemTypes = new Map(); + this._wallItemTypeIds = new Map(); + this._furniRevisions = new Map(); + this._pets = {}; + this._petColors = new Map(); + this._objectAliases = new Map(); + this._objectOriginalNames = new Map(); + + this._pendingContentTypes = []; + this._dataInitialized = false; + } + + public initialize(events: IEventDispatcher): void + { + this._stateEvents = events; + + this.setFurnitureData(); + + for(const [index, name] of NitroConfiguration.getValue('pet.types').entries()) this._pets[name] = index; + } + + public dispose(): void + { + + } + + public setSessionDataManager(sessionData: ISessionDataManager): void + { + this._sessionDataManager = sessionData; + + if(this._waitingForSessionDataManager) + { + this._waitingForSessionDataManager = false; + + this.setFurnitureData(); + } + } + + public loadFurnitureData(): void + { + this.setFurnitureData(); + } + + private setFurnitureData(): void + { + if(!this._sessionDataManager) + { + this._waitingForSessionDataManager = true; + + return; + } + + const furnitureData = this._sessionDataManager.getAllFurnitureData(this); + + if(!furnitureData) return; + + this._sessionDataManager.removePendingFurniDataListener(this); + + this.processFurnitureData(furnitureData); + + this._stateEvents.dispatchEvent(new NitroEvent(RoomContentLoader.LOADER_READY)); + } + + private processFurnitureData(furnitureData: IFurnitureData[]): void + { + if(!furnitureData) return; + + for(const furniture of furnitureData) + { + if(!furniture) continue; + + const id = furniture.id; + + let className = furniture.className; + + if(furniture.hasIndexedColor) className = ((className + '*') + furniture.colorIndex); + + const revision = furniture.revision; + const adUrl = furniture.adUrl; + + if(adUrl && adUrl.length > 0) this._objectTypeAdUrls.set(className, adUrl); + + let name = furniture.className; + + if(furniture.type === FurnitureType.FLOOR) + { + this._activeObjectTypes.set(id, className); + this._activeObjectTypeIds.set(className, id); + + if(!this._activeObjects[name]) this._activeObjects[name] = 1; + } + + else if(furniture.type === FurnitureType.WALL) + { + if(name === 'post.it') + { + className = 'post_it'; + name = 'post_it'; + } + + if(name === 'post.it.vd') + { + className = 'post_it_vd'; + name = 'post_id_vd'; + } + + this._wallItemTypes.set(id, className); + this._wallItemTypeIds.set(className, id); + + if(!this._wallItems[name]) this._wallItems[name] = 1; + } + + const existingRevision = this._furniRevisions.get(name); + + if(revision > existingRevision) + { + this._furniRevisions.delete(name); + this._furniRevisions.set(name, revision); + } + } + } + + public getFurnitureFloorNameForTypeId(typeId: number): string + { + const type = this._activeObjectTypes.get(typeId); + + return this.removeColorIndex(type); + } + + public getFurnitureWallNameForTypeId(typeId: number, extra: string = null): string + { + let type = this._wallItemTypes.get(typeId); + + if((type === 'poster') && (extra !== null)) type = (type + extra); + + return this.removeColorIndex(type); + } + + public getFurnitureFloorColorIndex(typeId: number): number + { + const type = this._activeObjectTypes.get(typeId); + + if(!type) return -1; + + return this.getColorIndexFromName(type); + } + + public getFurnitureWallColorIndex(typeId: number): number + { + const type = this._wallItemTypes.get(typeId); + + if(!type) return -1; + + return this.getColorIndexFromName(type); + } + + private getColorIndexFromName(name: string): number + { + if(!name) return -1; + + const index = name.indexOf('*'); + + if(index === -1) return 0; + + return parseInt(name.substr(index + 1)); + } + + private removeColorIndex(name: string): string + { + if(!name) return null; + + const index = name.indexOf('*'); + + if(index === -1) return name; + + return name.substr(0, index); + } + + public getRoomObjectAdUrl(type: string): string + { + const value = this._objectTypeAdUrls.get(type); + + if(!value) return ''; + + return value; + } + + public getPetColorResult(petIndex: number, paletteIndex: number): IPetColorResult + { + const colorResults = this._petColors.get(petIndex); + + if(!colorResults) return null; + + return colorResults.get(paletteIndex); + } + + public getPetColorResultsForTag(petIndex: number, tagName: string): IPetColorResult[] + { + const colorResults = this._petColors.get(petIndex); + const results: IPetColorResult[] = []; + + if(colorResults) + { + for(const result of colorResults.values()) + { + if(result.tag === tagName) results.push(result); + } + } + + return results; + } + + public getCollection(name: string): IGraphicAssetCollection + { + if(!name) return null; + + const existing = this._collections.get(name); + + if(!existing) + { + const globalCollection = GetAssetManager().getCollection(name); + + if(globalCollection) + { + this._collections.set(name, globalCollection); + + return globalCollection; + } + + return null; + } + + return existing; + } + + public getGifCollection(name: string): IGraphicAssetGifCollection + { + if(!name) return null; + + return this._gifCollections.get(name) || null; + } + + public getImage(name: string): HTMLImageElement + { + if(!name) return null; + + const existing = this._images.get(name); + + if(!existing) return null; + + const image = new Image(); + + image.src = existing.src; + + return image; + } + + public addAssetToCollection(collectionName: string, assetName: string, texture: Texture, override: boolean = true): boolean + { + const collection = this.getCollection(collectionName); + + if(!collection) return false; + + return collection.addAsset(assetName, texture, override, 0, 0, false, false); + } + + public createGifCollection(collectionName: string, textures: Texture[], durations: number[]): GraphicAssetGifCollection + { + if(!collectionName || !textures || !durations) return null; + + const collection = new GraphicAssetGifCollection(collectionName, textures, durations); + + this._gifCollections.set(collectionName, collection); + + return collection; + } + + private createCollection(data: IAssetData, spritesheet: Spritesheet): GraphicAssetCollection + { + if(!data || !spritesheet) return null; + + const collection = new GraphicAssetCollection(data, spritesheet); + + this._collections.set(collection.name, collection); + + const petIndex = this._pets[collection.name]; + + if(petIndex !== undefined) + { + const keys = collection.getPaletteNames(); + const palettes: Map = new Map(); + + for(const key of keys) + { + const palette = collection.getPalette(key); + const paletteData = data.palettes[key]; + + const primaryColor = palette.primaryColor; + const secondaryColor = palette.secondaryColor; + const breed = ((paletteData.breed !== undefined) ? paletteData.breed : 0); + const tag = ((paletteData.colorTag !== undefined) ? paletteData.colorTag : -1); + const master = ((paletteData.master !== undefined) ? paletteData.master : false); + const layerTags = ((paletteData.tags !== undefined) ? paletteData.tags : []); + + palettes.set(parseInt(key), new PetColorResult(primaryColor, secondaryColor, breed, tag, key, master, layerTags)); + } + + this._petColors.set(petIndex, palettes); + } + } + + public getPlaceholderName(type: string): string + { + const category = this.getCategoryForType(type); + + switch(category) + { + case RoomObjectCategory.FLOOR: + return RoomContentLoader.PLACE_HOLDER; + case RoomObjectCategory.WALL: + return RoomContentLoader.PLACE_HOLDER_WALL; + default: + if(this._pets[type] !== undefined) return RoomContentLoader.PLACE_HOLDER_PET; + + return RoomContentLoader.PLACE_HOLDER_DEFAULT; + } + } + + public getCategoryForType(type: string): number + { + if(!type) return RoomObjectCategory.MINIMUM; + + if(this._activeObjects[type] !== undefined) return RoomObjectCategory.FLOOR; + + if(this._wallItems[type] !== undefined) return RoomObjectCategory.WALL; + + if(this._pets[type] !== undefined) return RoomObjectCategory.UNIT; + + if(type.indexOf('poster') === 0) return RoomObjectCategory.WALL; + + if(type === 'room') return RoomObjectCategory.ROOM; + + if(type === RoomObjectUserType.USER) return RoomObjectCategory.UNIT; + + if(type === RoomObjectUserType.PET) return RoomObjectCategory.UNIT; + + if(type === RoomObjectUserType.BOT) return RoomObjectCategory.UNIT; + + if(type === RoomObjectUserType.RENTABLE_BOT) return RoomObjectCategory.UNIT; + + if((type === RoomContentLoader.TILE_CURSOR) || (type === RoomContentLoader.SELECTION_ARROW)) return RoomObjectCategory.CURSOR; + + return RoomObjectCategory.MINIMUM; + } + + public getPetNameForType(type: number): string + { + return NitroConfiguration.getValue('pet.types')[type] || null; + } + + public isLoaderType(type: string): boolean + { + type = RoomObjectUserType.getRealType(type); + + if(type === RoomObjectVisualizationType.USER) return false; + + return true; + } + + public downloadImage(id: number, type: string, param: string, events: IEventDispatcher = null): boolean + { + let typeName: string = null; + let assetUrls: string[] = []; + + if(type && (type.indexOf(',') >= 0)) + { + typeName = type; + type = typeName.split(',')[0]; + } + + if(typeName) + { + assetUrls = this.getAssetUrls(typeName, param, true); + } + else + { + assetUrls = this.getAssetUrls(type, param, true); + } + + if(assetUrls && assetUrls.length) + { + const url = assetUrls[0]; + + const image = new Image(); + + image.src = url; + + image.onload = () => + { + image.onerror = null; + + this._images.set(([type, param].join('_')), image); + + this._iconListener.onRoomContentLoaded(id, [type, param].join('_'), true); + }; + + image.onerror = () => + { + image.onload = null; + + NitroLogger.error('Failed to download asset', url); + + this._iconListener.onRoomContentLoaded(id, [type, param].join('_'), false); + }; + + return true; + } + + return false; + } + + public async downloadAsset(type: string, events: IEventDispatcher): Promise + { + const assetUrl: string = this.getAssetUrls(type)?.[0]; + + if(!assetUrl || !assetUrl.length) return; + + if((this._pendingContentTypes.indexOf(type) >= 0) || this.getOrRemoveEventDispatcher(type)) return; + + this._pendingContentTypes.push(type); + this._events.set(type, events); + + try + { + const response = await fetch(assetUrl); + let contentType = 'application/octet-stream'; + + if(response.headers.has('Content-Type')) + { + contentType = response.headers.get('Content-Type'); + } + + switch(contentType) + { + case 'application/octet-stream': { + const nitroBundle = new NitroBundle(await response.arrayBuffer()); + + await this.processAsset(nitroBundle.baseTexture, (nitroBundle.jsonFile as IAssetData)); + + const events = this._events.get(type); + + if(!events) return; + + events.dispatchEvent(new RoomContentLoadedEvent(RoomContentLoadedEvent.RCLE_SUCCESS, type)); + break; + } + default: + throw new Error(); + } + } + + catch (err) + { + events.dispatchEvent(new RoomContentLoadedEvent(RoomContentLoadedEvent.RCLE_FAILURE, type)); + } + } + + private async processAsset(baseTexture: BaseTexture, data: IAssetData): Promise + { + const spritesheetData = data.spritesheet; + + if(!baseTexture || !spritesheetData || !Object.keys(spritesheetData).length) + { + this.createCollection(data, null); + + return; + } + + const createAsset = async () => + { + const spritesheet = new Spritesheet(baseTexture, spritesheetData); + + await spritesheet.parse(); + + this.createCollection(data, spritesheet); + }; + + if(baseTexture.valid) + { + await createAsset(); + } + else + { + await new Promise((resolve, reject) => + { + baseTexture.once('update', async () => + { + await createAsset(); + + return resolve(); + }); + }); + } + } + + public setAssetAliasName(name: string, originalName: string): void + { + this._objectAliases.set(name, originalName); + this._objectOriginalNames.set(originalName, name); + } + + private getAssetAliasName(name: string): string + { + const existing = this._objectAliases.get(name); + + if(!existing) return name; + + return existing; + } + + private getAssetOriginalName(name: string): string + { + const existing = this._objectOriginalNames.get(name); + + if(!existing) return name; + + return existing; + } + + public getAssetUrls(type: string, param: string = null, icon: boolean = false): string[] + { + switch(type) + { + case RoomContentLoader.PLACE_HOLDER: + return [this.getAssetUrlWithGenericBase(RoomContentLoader.PLACE_HOLDER)]; + case RoomContentLoader.PLACE_HOLDER_WALL: + return [this.getAssetUrlWithGenericBase(RoomContentLoader.PLACE_HOLDER_WALL)]; + case RoomContentLoader.PLACE_HOLDER_PET: + return [this.getAssetUrlWithGenericBase(RoomContentLoader.PLACE_HOLDER_PET)]; + case RoomContentLoader.ROOM: + return [this.getAssetUrlWithGenericBase('room')]; + case RoomContentLoader.TILE_CURSOR: + return [this.getAssetUrlWithGenericBase(RoomContentLoader.TILE_CURSOR)]; + case RoomContentLoader.SELECTION_ARROW: + return [this.getAssetUrlWithGenericBase(RoomContentLoader.SELECTION_ARROW)]; + default: { + const category = this.getCategoryForType(type); + + if((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL)) + { + const name = this.getAssetAliasName(type); + + let assetUrl = (icon ? this.getAssetUrlWithFurniIconBase(name) : this.getAssetUrlWithFurniBase(type)); + + if(icon) + { + const active = (param && (param !== '') && (this._activeObjectTypeIds.has((name + '*' + param)))); + + assetUrl = (assetUrl.replace(/%param%/gi, (active ? ('_' + param) : ''))); + } + + return [assetUrl]; + } + + if(category === RoomObjectCategory.UNIT) + { + return [this.getAssetUrlWithPetBase(type)]; + } + + return null; + } + } + } + + public getAssetIconUrl(type: string, colorIndex: string): string + { + let assetName: string = null; + let assetUrls: string[] = []; + + if(type && (type.indexOf(',') >= 0)) + { + assetName = type; + + type = assetName.split(',')[0]; + } + + if(assetName) + { + assetUrls = this.getAssetUrls(assetName, colorIndex, true); + } + else + { + assetUrls = this.getAssetUrls(type, colorIndex, true); + } + + if(assetUrls && assetUrls.length) return assetUrls[0]; + + return null; + } + + private getAssetUrlWithGenericBase(assetName: string): string + { + return (NitroConfiguration.getValue('generic.asset.url').replace(/%libname%/gi, assetName)); + } + + public getAssetUrlWithFurniBase(assetName: string): string + { + return (NitroConfiguration.getValue('furni.asset.url').replace(/%libname%/gi, assetName)); + } + + public getAssetUrlWithFurniIconBase(assetName: string): string + { + return (NitroConfiguration.getValue('furni.asset.icon.url').replace(/%libname%/gi, assetName)); + } + + public getAssetUrlWithPetBase(assetName: string): string + { + return (NitroConfiguration.getValue('pet.asset.url').replace(/%libname%/gi, assetName)); + } + + public setRoomObjectRoomId(object: IRoomObject, roomId: string): void + { + const model = object && object.model; + + if(!model) return; + + model.setValue(RoomObjectVariable.OBJECT_ROOM_ID, roomId); + } + + private getOrRemoveEventDispatcher(type: string, remove: boolean = false): IEventDispatcher + { + const existing = this._events.get(type); + + if(remove) this._events.delete(type); + + return existing; + } + + public setIconListener(listener: IRoomContentListener): void + { + this._iconListener = listener; + } +} diff --git a/submodules/renderer/src/nitro/room/RoomEngine.ts b/submodules/renderer/src/nitro/room/RoomEngine.ts new file mode 100644 index 0000000..d912d44 --- /dev/null +++ b/submodules/renderer/src/nitro/room/RoomEngine.ts @@ -0,0 +1,3619 @@ +import { RenderTexture, Resource, Texture } from '@pixi/core'; +import { Container, DisplayObject } from '@pixi/display'; +import { Matrix, Point, Rectangle } from '@pixi/math'; +import { IConnection, IDisposable, IFurnitureStackingHeightMap, IGetImageListener, IImageResult, ILegacyWallGeometry, IMessageComposer, INitroCommunicationManager, INitroEvent, IObjectData, IPetColorResult, IPetCustomPart, IRoomContentListener, IRoomContentLoader, IRoomCreator, IRoomEngine, IRoomEngineServices, IRoomGeometry, IRoomInstance, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectVisualizationFactory, IRoomRenderer, IRoomRendererFactory, IRoomRenderingCanvas, IRoomSessionManager, ISelectedRoomObjectData, ISessionDataManager, ITileObjectMap, IUpdateReceiver, IVector3D, LegacyDataType, MouseEventType, NitroConfiguration, NitroLogger, ObjectDataFactory, RoomControllerLevel, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, ToolbarIconEnum, Vector3d } from '../../api'; +import { NitroManager } from '../../core'; +import { BadgeImageReadyEvent, NitroToolbarAnimateIconEvent, RoomBackgroundColorEvent, RoomDragEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomObjectEvent, RoomObjectFurnitureActionEvent, RoomObjectMouseEvent, RoomSessionEvent, RoomToObjectOwnAvatarMoveEvent } from '../../events'; +import { GetTicker, GetTickerTime, NitroSprite, TextureUtils } from '../../pixi-proxy'; +import { NumberBank, RoomEnterEffect, RoomGeometry, RoomInstance, RoomObjectUpdateMessage, RoomRendererFactory } from '../../room'; +import { PetFigureData } from '../avatar'; +import { RenderRoomMessageComposer, RenderRoomThumbnailMessageComposer } from '../communication'; +import { FurniId } from '../utils'; +import { ImageResult } from './ImageResult'; +import { ObjectAvatarCarryObjectUpdateMessage, ObjectAvatarChatUpdateMessage, ObjectAvatarDanceUpdateMessage, ObjectAvatarEffectUpdateMessage, ObjectAvatarExperienceUpdateMessage, ObjectAvatarExpressionUpdateMessage, ObjectAvatarFigureUpdateMessage, ObjectAvatarFlatControlUpdateMessage, ObjectAvatarGestureUpdateMessage, ObjectAvatarGuideStatusUpdateMessage, ObjectAvatarMutedUpdateMessage, ObjectAvatarOwnMessage, ObjectAvatarPetGestureUpdateMessage, ObjectAvatarPlayerValueUpdateMessage, ObjectAvatarPlayingGameUpdateMessage, ObjectAvatarPostureUpdateMessage, ObjectAvatarSignUpdateMessage, ObjectAvatarSleepUpdateMessage, ObjectAvatarTypingUpdateMessage, ObjectAvatarUpdateMessage, ObjectAvatarUseObjectUpdateMessage, ObjectDataUpdateMessage, ObjectGroupBadgeUpdateMessage, ObjectHeightUpdateMessage, ObjectItemDataUpdateMessage, ObjectModelDataUpdateMessage, ObjectMoveUpdateMessage, ObjectRoomColorUpdateMessage, ObjectRoomFloorHoleUpdateMessage, ObjectRoomMaskUpdateMessage, ObjectRoomPlanePropertyUpdateMessage, ObjectRoomPlaneVisibilityUpdateMessage, ObjectRoomUpdateMessage, ObjectStateUpdateMessage } from './messages'; +import { RoomLogic, RoomMapData, RoomObjectVisualizationFactory } from './object'; +import { RoomContentLoader } from './RoomContentLoader'; +import { RoomMessageHandler } from './RoomMessageHandler'; +import { RoomObjectEventHandler } from './RoomObjectEventHandler'; +import { RoomObjectLogicFactory } from './RoomObjectLogicFactory'; +import { RoomVariableEnum } from './RoomVariableEnum'; +import { RoomCamera, RoomData, RoomFurnitureData, RoomInstanceData, RoomObjectBadgeImageAssetListener, SpriteDataCollector } from './utils'; + +export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreator, IRoomEngineServices, IRoomManagerListener, IRoomContentListener, IUpdateReceiver, IDisposable +{ + public static ROOM_OBJECT_ID: number = -1; + public static ROOM_OBJECT_TYPE: string = 'room'; + + public static CURSOR_OBJECT_ID: number = -2; + public static CURSOR_OBJECT_TYPE: string = 'tile_cursor'; + + public static ARROW_OBJECT_ID: number = -3; + public static ARROW_OBJECT_TYPE: string = 'selection_arrow'; + + public static OVERLAY: string = 'overlay'; + public static OBJECT_ICON_SPRITE: string = 'object_icon_sprite'; + + private static DRAG_THRESHOLD: number = 15; + private static TEMPORARY_ROOM: string = 'temporary_room'; + + private _communication: INitroCommunicationManager; + private _roomRendererFactory: IRoomRendererFactory; + private _roomManager: IRoomManager; + private _visualizationFactory: IRoomObjectVisualizationFactory; + private _sessionDataManager: ISessionDataManager; + private _roomSessionManager: IRoomSessionManager; + private _roomObjectEventHandler: RoomObjectEventHandler; + private _roomMessageHandler: RoomMessageHandler; + private _roomContentLoader: IRoomContentLoader; + private _ready: boolean; + private _roomContentLoaderReady: boolean; + private _imageObjectIdBank: NumberBank; + private _imageCallbacks: Map; + private _thumbnailObjectIdBank: NumberBank; + private _thumbnailCallbacks: Map; + private _activeRoomId: number; + private _activeRoomActiveCanvas: number; + private _activeRoomActiveCanvasMouseX: number; + private _activeRoomActiveCanvasMouseY: number; + private _activeRoomIsDragged: boolean; + private _activeRoomWasDragged: boolean; + private _activeRoomDragStartX: number; + private _activeRoomDragStartY: number; + private _activeRoomDragX: number; + private _activeRoomDragY: number; + private _roomDraggingAlwaysCenters: boolean; + private _roomAllowsDragging: boolean; + private _roomDatas: Map; + private _roomInstanceDatas: Map; + private _skipFurnitureCreationForNextFrame: boolean; + private _mouseCursorUpdate: boolean; + private _badgeListenerObjects: Map; + private _logicFactory: IRoomObjectLogicFactory; + + constructor(communication: INitroCommunicationManager) + { + super(); + + this._communication = communication; + this._sessionDataManager = null; + this._roomSessionManager = null; + this._roomManager = null; + this._roomObjectEventHandler = new RoomObjectEventHandler(this); + this._roomMessageHandler = new RoomMessageHandler(this); + this._roomContentLoader = new RoomContentLoader(); + this._ready = false; + this._roomContentLoaderReady = false; + + this._activeRoomId = -1; + this._activeRoomActiveCanvas = -1; + this._roomInstanceDatas = new Map(); + this._roomDatas = new Map(); + + this._roomRendererFactory = new RoomRendererFactory(); + this._visualizationFactory = new RoomObjectVisualizationFactory(); + this._logicFactory = new RoomObjectLogicFactory(); + + this._activeRoomActiveCanvasMouseX = 0; + this._activeRoomActiveCanvasMouseY = 0; + this._activeRoomIsDragged = false; + this._activeRoomWasDragged = false; + this._activeRoomDragStartX = 0; + this._activeRoomDragStartY = 0; + this._activeRoomDragX = 0; + this._activeRoomDragY = 0; + this._skipFurnitureCreationForNextFrame = false; + this._mouseCursorUpdate = false; + this._imageObjectIdBank = null; + this._imageCallbacks = new Map(); + this._thumbnailCallbacks = new Map(); + this._roomDraggingAlwaysCenters = false; + this._roomAllowsDragging = true; + this._badgeListenerObjects = new Map(); + + this.runVisibilityUpdate = this.runVisibilityUpdate.bind(this); + this.processRoomObjectEvent = this.processRoomObjectEvent.bind(this); + this.onRoomSessionEvent = this.onRoomSessionEvent.bind(this); + this.onRoomContentLoaderReadyEvent = this.onRoomContentLoaderReadyEvent.bind(this); + this.onBadgeImageReadyEvent = this.onBadgeImageReadyEvent.bind(this); + } + + public onInit(): void + { + if(this._ready) return; + + this._imageObjectIdBank = new NumberBank(1000); + this._thumbnailObjectIdBank = new NumberBank(1000); + + this._logicFactory.registerEventFunction(this.processRoomObjectEvent); + + if(this._roomManager) + { + this._roomManager.setContentLoader(this._roomContentLoader); + this._roomManager.addUpdateCategory(RoomObjectCategory.FLOOR); + this._roomManager.addUpdateCategory(RoomObjectCategory.WALL); + this._roomManager.addUpdateCategory(RoomObjectCategory.UNIT); + this._roomManager.addUpdateCategory(RoomObjectCategory.CURSOR); + this._roomManager.addUpdateCategory(RoomObjectCategory.ROOM); + } + + this._roomMessageHandler.setConnection(this._communication.connection); + + this._roomContentLoader.initialize(this.events); + this._roomContentLoader.setSessionDataManager(this._sessionDataManager); + this._roomContentLoader.setIconListener(this); + + if(this._roomSessionManager) + { + this._roomSessionManager.events.addEventListener(RoomSessionEvent.STARTED, this.onRoomSessionEvent); + this._roomSessionManager.events.addEventListener(RoomSessionEvent.ENDED, this.onRoomSessionEvent); + } + + this.events.addEventListener(RoomContentLoader.LOADER_READY, this.onRoomContentLoaderReadyEvent); + + GetTicker().add(this.update, this); + + document.addEventListener('visibilitychange', this.runVisibilityUpdate); + } + + public onDispose(): void + { + if(!this._ready) return; + + for(const [key, value] of this._roomInstanceDatas) + { + this.removeRoomInstance(key); + } + + document.removeEventListener('visibilitychange', this.runVisibilityUpdate); + + GetTicker().remove(this.update, this); + + if(this._roomObjectEventHandler) this._roomObjectEventHandler.dispose(); + + if(this._roomMessageHandler) this._roomMessageHandler.dispose(); + + if(this._roomContentLoader) this._roomContentLoader.dispose(); + + this.events.removeEventListener(RoomContentLoader.LOADER_READY, this.onRoomContentLoaderReadyEvent); + + if(this._roomSessionManager) + { + this._roomSessionManager.events.removeEventListener(RoomSessionEvent.STARTED, this.onRoomSessionEvent); + this._roomSessionManager.events.removeEventListener(RoomSessionEvent.ENDED, this.onRoomSessionEvent); + } + + super.onDispose(); + } + + private onRoomSessionEvent(event: RoomSessionEvent): void + { + if(!(event instanceof RoomSessionEvent)) return; + + switch(event.type) + { + case RoomSessionEvent.STARTED: + if(this._roomMessageHandler) this._roomMessageHandler.setRoomId(event.session.roomId); + return; + case RoomSessionEvent.ENDED: + if(this._roomMessageHandler) + { + this._roomMessageHandler.clearRoomId(); + this.removeRoomInstance(event.session.roomId); + } + return; + } + } + + private onRoomContentLoaderReadyEvent(event: INitroEvent): void + { + this._roomContentLoaderReady = true; + + this._roomManager.init(); + } + + public setActiveRoomId(roomId: number): void + { + this._activeRoomId = roomId; + } + + public destroyRoom(roomId: number): void + { + this.removeRoomInstance(roomId); + } + + public getRoomInstance(roomId: number): IRoomInstance + { + return (this._roomManager && this._roomManager.getRoomInstance(this.getRoomId(roomId))) || null; + } + + public removeRoomInstance(roomId: number): void + { + const instance = this.getRoomInstance(roomId); + + if(instance) + { + this._roomManager && this._roomManager.removeRoomInstance(this.getRoomId(roomId)); + } + + const existing = this._roomInstanceDatas.get(roomId); + + if(existing) + { + this._roomInstanceDatas.delete(existing.roomId); + + existing.dispose(); + } + + this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.DISPOSED, roomId)); + } + + public createRoomInstance(roomId: number, roomMap: RoomMapData): void + { + let floorType = '111'; + let wallType = '201'; + let landscapeType = '1'; + + if(!this._ready) + { + let data = this._roomDatas.get(roomId); + + if(data) + { + this._roomDatas.delete(roomId); + + floorType = data.floorType; + wallType = data.wallType; + landscapeType = data.landscapeType; + } + + data = new RoomData(roomId, roomMap); + + data.floorType = floorType; + data.wallType = wallType; + data.landscapeType = landscapeType; + + this._roomDatas.set(roomId, data); + + NitroLogger.warn('Room Engine not initilized yet, can not create room. Room data stored for later initialization.'); + + return; + } + + if(!roomMap) + { + NitroLogger.warn('Room property messages'); + + return; + } + + const data = this._roomDatas.get(roomId); + + if(data) + { + this._roomDatas.delete(roomId); + + if(data.floorType) floorType = data.floorType; + + if(data.wallType) wallType = data.wallType; + + if(data.landscapeType) landscapeType = data.landscapeType; + } + + const instance = this.setupRoomInstance(roomId, roomMap, floorType, wallType, landscapeType, this.getRoomInstanceModelName(roomId)); + + if(!instance) return; + + if(roomMap.restrictsDragging) + { + this._roomAllowsDragging = false; + } + else + { + this._roomAllowsDragging = true; + } + + this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.INITIALIZED, roomId)); + } + + private setupRoomInstance(roomId: number, roomMap: RoomMapData, floorType: string, wallType: string, landscapeType: string, worldType: string): IRoomInstance + { + if(!this._ready || !this._roomManager) return; + + const instance = this._roomManager.createRoomInstance(this.getRoomId(roomId)); + + if(!instance) return null; + + const category = RoomObjectCategory.ROOM; + + const roomObject = instance.createRoomObjectAndInitalize(RoomEngine.ROOM_OBJECT_ID, RoomEngine.ROOM_OBJECT_TYPE, category) as IRoomObjectController; + + instance.model.setValue(RoomVariableEnum.ROOM_IS_PUBLIC, 0); + instance.model.setValue(RoomVariableEnum.ROOM_Z_SCALE, 1); + + if(roomMap) + { + instance.model.setValue(RoomVariableEnum.RESTRICTS_DRAGGING, roomMap.restrictsDragging); + instance.model.setValue(RoomVariableEnum.RESTRICTS_SCALING, roomMap.restrictsScaling); + instance.model.setValue(RoomVariableEnum.RESTRICTED_SCALE, roomMap.restrictedScale); + + const dimensions = roomMap.dimensions; + + if(dimensions) + { + const minX = roomMap.dimensions.minX; + const maxX = roomMap.dimensions.maxX; + const minY = roomMap.dimensions.minY; + const maxY = roomMap.dimensions.maxY; + + instance.model.setValue(RoomVariableEnum.ROOM_MIN_X, minX); + instance.model.setValue(RoomVariableEnum.ROOM_MAX_X, maxX); + instance.model.setValue(RoomVariableEnum.ROOM_MIN_Y, minY); + instance.model.setValue(RoomVariableEnum.ROOM_MAX_Y, maxY); + + const seed = Math.trunc((minX * 423) + (maxX * 671) + (minY * 913) + (maxY * 7509)); + + if(roomObject && roomObject.model) roomObject.model.setValue(RoomObjectVariable.ROOM_RANDOM_SEED, seed); + } + } + + const logic = (roomObject && roomObject.logic as RoomLogic) || null; + + if(logic) + { + logic.initialize(roomMap); + + if(floorType) + { + logic.processUpdateMessage(new ObjectRoomUpdateMessage(ObjectRoomUpdateMessage.ROOM_FLOOR_UPDATE, floorType)); + instance.model.setValue(RoomObjectVariable.ROOM_FLOOR_TYPE, floorType); + } + + if(wallType) + { + logic.processUpdateMessage(new ObjectRoomUpdateMessage(ObjectRoomUpdateMessage.ROOM_WALL_UPDATE, wallType)); + instance.model.setValue(RoomObjectVariable.ROOM_WALL_TYPE, wallType); + } + + if(landscapeType) + { + logic.processUpdateMessage(new ObjectRoomUpdateMessage(ObjectRoomUpdateMessage.ROOM_LANDSCAPE_UPDATE, landscapeType)); + instance.model.setValue(RoomObjectVariable.ROOM_LANDSCAPE_TYPE, landscapeType); + } + } + + if(roomMap && roomMap.doors.length) + { + let doorIndex = 0; + + while(doorIndex < roomMap.doors.length) + { + const door = roomMap.doors[doorIndex]; + + if(door) + { + const doorX = door.x; + const doorY = door.y; + const doorZ = door.z; + const doorDir = door.dir; + const maskType = ObjectRoomMaskUpdateMessage.DOOR; + const maskId = 'door_' + doorIndex; + const maskLocation = new Vector3d(doorX, doorY, doorZ); + + logic.processUpdateMessage(new ObjectRoomMaskUpdateMessage(ObjectRoomMaskUpdateMessage.ADD_MASK, maskId, maskType, maskLocation, ObjectRoomMaskUpdateMessage.HOLE)); + + if((doorDir === 90) || (doorDir === 180)) + { + if(doorDir === 90) + { + instance.model.setValue(RoomObjectVariable.ROOM_DOOR_X, (doorX - 0.5)); + instance.model.setValue(RoomObjectVariable.ROOM_DOOR_Y, doorY); + } + + if(doorDir === 180) + { + instance.model.setValue(RoomObjectVariable.ROOM_DOOR_X, doorX); + instance.model.setValue(RoomObjectVariable.ROOM_DOOR_Y, (doorY - 0.5)); + } + + instance.model.setValue(RoomObjectVariable.ROOM_DOOR_Z, doorZ); + instance.model.setValue(RoomObjectVariable.ROOM_DOOR_DIR, doorDir); + } + } + + doorIndex++; + } + } + + instance.createRoomObjectAndInitalize(RoomEngine.CURSOR_OBJECT_ID, RoomEngine.CURSOR_OBJECT_TYPE, RoomObjectCategory.CURSOR); + if(NitroConfiguration.getValue('enable.avatar.arrow', false)) instance.createRoomObjectAndInitalize(RoomEngine.ARROW_OBJECT_ID, RoomEngine.ARROW_OBJECT_TYPE, RoomObjectCategory.CURSOR); + + return instance; + } + + public getRoomInstanceDisplay(roomId: number, id: number, width: number, height: number, scale: number): DisplayObject + { + const instance = this.getRoomInstance(roomId); + + if(!instance) return null; + + let renderer = instance.renderer as IRoomRenderer; + + if(!renderer) + { + renderer = this._roomRendererFactory.createRenderer(); + + if(!renderer) return null; + } + + renderer.roomObjectVariableAccurateZ = RoomObjectVariable.OBJECT_ACCURATE_Z_VALUE; + + instance.setRenderer(renderer); + + const canvas = renderer.createCanvas(id, width, height, scale); + + if(!canvas) return null; + + const restrictedScaling = instance.model.getValue(RoomVariableEnum.RESTRICTS_SCALING); + + if(restrictedScaling) + { + let restrictedScale = instance.model.getValue(RoomVariableEnum.RESTRICTED_SCALE); + + if(!restrictedScale) restrictedScale = 1; + + canvas.setScale(restrictedScale); + + canvas.restrictsScaling = true; + } + else + { + canvas.restrictsScaling = false; + } + + canvas.setMouseListener(this._roomObjectEventHandler); + + if(canvas.geometry) + { + canvas.geometry.z_scale = instance.model.getValue(RoomVariableEnum.ROOM_Z_SCALE); + + const doorX = instance.model.getValue(RoomObjectVariable.ROOM_DOOR_X); + const doorY = instance.model.getValue(RoomObjectVariable.ROOM_DOOR_Y); + const doorZ = instance.model.getValue(RoomObjectVariable.ROOM_DOOR_Z); + const doorDirection = instance.model.getValue(RoomObjectVariable.ROOM_DOOR_DIR); + const vector = new Vector3d(doorX, doorY, doorZ); + + let direction: IVector3D = null; + + if(doorDirection === 90) direction = new Vector3d(-2000, 0, 0); + + if(doorDirection === 180) direction = new Vector3d(0, -2000, 0); + + canvas.geometry.setDisplacement(vector, direction); + + const displayObject = (canvas.master as Container); + + if(displayObject) + { + const overlay = new NitroSprite(Texture.EMPTY); + + overlay.name = RoomEngine.OVERLAY; + overlay.interactive = false; + + displayObject.addChild(overlay); + } + } + + return canvas.master; + } + + public setRoomInstanceRenderingCanvasMask(roomId: number, canvasId: number, flag: boolean): void + { + const roomCanvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); + + if(roomCanvas) roomCanvas.setMask(flag); + } + + public setRoomInstanceRenderingCanvasScale(roomId: number, canvasId: number, scale: number, point: Point = null, offsetPoint: Point = null, override: boolean = false, asDelta: boolean = false): void + { + const roomCanvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); + + if(roomCanvas) + { + if(roomCanvas.restrictsScaling && !override) return; + + roomCanvas.setScale(scale, point, offsetPoint, override, asDelta); + + this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.ROOM_ZOOMED, roomId)); + } + } + + public getRoomInstanceRenderingCanvas(roomId: number, canvasId: number = -1): IRoomRenderingCanvas + { + const instance = this.getRoomInstance(roomId); + + if(!instance) return null; + + const renderer = instance.renderer as IRoomRenderer; + + if(!renderer) return null; + + if(canvasId === -1) canvasId = this._activeRoomActiveCanvas; + + const canvas = renderer.getCanvas(canvasId); + + if(!canvas) return null; + + return canvas; + } + + public getActiveRoomInstanceRenderingCanvas(): IRoomRenderingCanvas + { + return this.getRoomInstanceRenderingCanvas(this._activeRoomId, this._activeRoomActiveCanvas); + } + + public getRoomInstanceRenderingCanvasOffset(roomId: number, canvasId: number = -1): Point + { + if(canvasId === -1) canvasId = this._activeRoomActiveCanvas; + + const renderingCanvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); + + if(!renderingCanvas) return null; + + return new Point(renderingCanvas.screenOffsetX, renderingCanvas.screenOffsetY); + } + + public setRoomInstanceRenderingCanvasOffset(roomId: number, canvasId: number, point: Point): boolean + { + const renderingCanvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); + + if(!renderingCanvas || !point) return false; + + const x = ~~(point.x); + const y = ~~(point.y); + + if((renderingCanvas.screenOffsetX === x) && (renderingCanvas.screenOffsetY === y)) return; + + this.events.dispatchEvent(new RoomDragEvent(roomId, -(renderingCanvas.screenOffsetX - x), -(renderingCanvas.screenOffsetY - y))); + + renderingCanvas.screenOffsetX = x; + renderingCanvas.screenOffsetY = y; + + return true; + } + + public getRoomInstanceRenderingCanvasScale(roomId: number = -1000, canvasId: number = -1): number + { + if(roomId === -1000) roomId = this._activeRoomId; + + if(canvasId === -1) canvasId = this._activeRoomActiveCanvas; + + const canvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); + + if(!canvas) return 1; + + return canvas.scale; + } + + public initializeRoomInstanceRenderingCanvas(roomId: number, canvasId: number, width: number, height: number): void + { + const canvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); + + if(!canvas) return; + + canvas.initialize(width, height); + } + + public getRoomInstanceGeometry(roomId: number, canvasId: number = -1): IRoomGeometry + { + const instance = this.getRoomInstance(roomId); + + if(!instance) return null; + + const renderer = instance.renderer as IRoomRenderer; + + if(!renderer) return null; + + if(canvasId === -1) canvasId = this._activeRoomActiveCanvas; + + const canvas = renderer.getCanvas(canvasId); + + if(!canvas) return null; + + return canvas.geometry; + } + + public getRoomInstanceVariable(roomId: number, key: string): T + { + const instance = this.getRoomInstance(roomId); + + if(!instance) return null; + + return ((instance.model && instance.model.getValue(key)) || null); + } + + public updateRoomInstancePlaneVisibility(roomId: number, wallVisible: boolean, floorVisible: boolean = true): boolean + { + const object = this.getRoomOwnObject(roomId); + + if(!object) return false; + + object.processUpdateMessage(new ObjectRoomPlaneVisibilityUpdateMessage(ObjectRoomPlaneVisibilityUpdateMessage.WALL_VISIBILITY, wallVisible)); + object.processUpdateMessage(new ObjectRoomPlaneVisibilityUpdateMessage(ObjectRoomPlaneVisibilityUpdateMessage.FLOOR_VISIBILITY, floorVisible)); + + return true; + } + + public updateRoomInstancePlaneThickness(roomId: number, wallThickness: number, floorThickness: number): boolean + { + const object = this.getRoomOwnObject(roomId); + + if(!object) return false; + + object.processUpdateMessage(new ObjectRoomPlanePropertyUpdateMessage(ObjectRoomPlanePropertyUpdateMessage.WALL_THICKNESS, wallThickness)); + object.processUpdateMessage(new ObjectRoomPlanePropertyUpdateMessage(ObjectRoomPlanePropertyUpdateMessage.FLOOR_THICKNESS, floorThickness)); + + return true; + } + + public updateRoomInstancePlaneType(roomId: number, floorType: string = null, wallType: string = null, landscapeType: string = null, _arg_5: boolean = false): boolean + { + const roomObject = this.getRoomOwnObject(roomId); + const roomInstance = this.getRoomInstance(roomId); + + if(!roomObject) + { + let roomData = this._roomDatas.get(roomId); + + if(!roomData) + { + roomData = new RoomData(roomId, null); + + this._roomDatas.set(roomId, roomData); + } + + if(floorType) roomData.floorType = floorType; + + if(wallType) roomData.wallType = wallType; + + if(landscapeType) roomData.landscapeType = landscapeType; + + return true; + } + + if(floorType) + { + if(roomInstance && !_arg_5) roomInstance.model.setValue(RoomObjectVariable.ROOM_FLOOR_TYPE, floorType); + + roomObject.processUpdateMessage(new ObjectRoomUpdateMessage(ObjectRoomUpdateMessage.ROOM_FLOOR_UPDATE, floorType)); + } + + if(wallType) + { + if(roomInstance && !_arg_5) roomInstance.model.setValue(RoomObjectVariable.ROOM_WALL_TYPE, wallType); + + roomObject.processUpdateMessage(new ObjectRoomUpdateMessage(ObjectRoomUpdateMessage.ROOM_WALL_UPDATE, wallType)); + } + + if(landscapeType) + { + if(roomInstance && !_arg_5) roomInstance.model.setValue(RoomObjectVariable.ROOM_LANDSCAPE_TYPE, landscapeType); + + roomObject.processUpdateMessage(new ObjectRoomUpdateMessage(ObjectRoomUpdateMessage.ROOM_LANDSCAPE_UPDATE, landscapeType)); + } + + return true; + } + + public updateObjectRoomColor(roomId: number, color: number, light: number, backgroundOnly: boolean): boolean + { + const roomObject = this.getRoomOwnObject(roomId); + + if(!roomObject || !roomObject.logic) return false; + + const event = new ObjectRoomColorUpdateMessage(ObjectRoomColorUpdateMessage.BACKGROUND_COLOR, color, light, backgroundOnly); + + roomObject.logic.processUpdateMessage(event); + + this.events.dispatchEvent(new RoomBackgroundColorEvent(roomId, color, light, backgroundOnly)); + + return true; + } + + public addRoomInstanceFloorHole(roomId: number, objectId: number): void + { + if(objectId < 0) return; + + const roomOwnObject = this.getRoomOwnObject(roomId); + const roomObject = this.getRoomObjectFloor(roomId, objectId); + + if(roomOwnObject && roomOwnObject.logic && roomObject && roomObject.model) + { + const location = roomObject.getLocation(); + const sizeX = roomObject.model.getValue(RoomObjectVariable.FURNITURE_SIZE_X); + const sizeY = roomObject.model.getValue(RoomObjectVariable.FURNITURE_SIZE_Y); + + roomOwnObject.processUpdateMessage(new ObjectRoomFloorHoleUpdateMessage(ObjectRoomFloorHoleUpdateMessage.ADD, objectId, location.x, location.y, sizeX, sizeY)); + } + } + + public removeRoomInstanceFloorHole(roomId: number, objectId: number): void + { + if(objectId < 0) return; + + const roomOwnObject = this.getRoomOwnObject(roomId); + + if(roomOwnObject) + { + roomOwnObject.processUpdateMessage(new ObjectRoomFloorHoleUpdateMessage(ObjectRoomFloorHoleUpdateMessage.REMOVE, objectId)); + } + } + + public setRoomEngineGameMode(roomId: number, isPlaying: boolean): void + { + const roomInstance = this.getRoomInstance(roomId); + + if(!roomInstance) return; + + const mode = isPlaying ? 1 : 0; + + roomInstance.model.setValue(RoomVariableEnum.IS_PLAYING_GAME, mode); + + if(mode === 0) + { + this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.NORMAL_MODE, roomId)); + } + else + { + this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.GAME_MODE, roomId)); + } + } + + public isRoomIdPlayingGame(roomId: number): boolean + { + const roomInstance = this.getRoomInstance(roomId); + + if(!roomInstance) return false; + + return (roomInstance.model.getValue(RoomVariableEnum.IS_PLAYING_GAME) > 0); + } + + public isPlayingGame(): boolean + { + return this.isRoomIdPlayingGame(this._activeRoomId); + } + + public disableUpdate(flag: boolean): void + { + if(flag) + { + GetTicker().remove(this.update, this); + } + else + { + GetTicker().remove(this.update, this); + GetTicker().add(this.update, this); + } + } + + public runUpdate(): void + { + this.update(1); + } + + public runVisibilityUpdate(): void + { + if(!document.hidden) this.update(1, true); + } + + public update(time: number, update: boolean = false): void + { + if(!this._roomManager) return; + + time = GetTickerTime(); + + RoomEnterEffect.turnVisualizationOn(); + + this.processPendingFurniture(); + + this._roomManager.update(time, update); + + this.updateRoomCameras(time); + + if(this._mouseCursorUpdate) this.setPointer(); + + RoomEnterEffect.turnVisualizationOff(); + } + + private setPointer(): void + { + this._mouseCursorUpdate = false; + + const instanceData = this.getRoomInstanceData(this._activeRoomId); + + if(instanceData && instanceData.hasButtonMouseCursorOwners()) + { + document.body.style.cursor = 'pointer'; + } + else + { + document.body.style.cursor = 'auto'; + } + } + + private processPendingFurniture(): void + { + if(this._skipFurnitureCreationForNextFrame) + { + this._skipFurnitureCreationForNextFrame = false; + + return; + } + + const startTime = new Date().valueOf(); + const furniturePerTick = 5; + const hasTickLimit = true; + + for(const instanceData of this._roomInstanceDatas.values()) + { + if(!instanceData) continue; + + let pendingData: RoomFurnitureData = null; + let totalFurnitureAdded = 0; + let furnitureAdded = false; + + while((pendingData = instanceData.getNextPendingFurnitureFloor())) + { + furnitureAdded = this.processPendingFurnitureFloor(instanceData.roomId, pendingData.id, pendingData); + + if(hasTickLimit) + { + if(!(++totalFurnitureAdded % furniturePerTick)) + { + const time = new Date().valueOf(); + + if((time - startTime) >= 40) + { + this._skipFurnitureCreationForNextFrame = true; + + break; + } + } + } + } + + while(!this._skipFurnitureCreationForNextFrame && (pendingData = instanceData.getNextPendingFurnitureWall())) + { + furnitureAdded = this.processPendingFurnitureWall(instanceData.roomId, pendingData.id, pendingData); + + if(hasTickLimit) + { + if(!(++totalFurnitureAdded % furniturePerTick)) + { + const time = new Date().valueOf(); + + if((time - startTime) >= 40) + { + this._skipFurnitureCreationForNextFrame = true; + + break; + } + } + } + } + + if(furnitureAdded && this._roomManager) + { + const roomInstance = this._roomManager.getRoomInstance(this.getRoomId(instanceData.roomId)) as RoomInstance; + + if(!roomInstance.hasUninitializedObjects()) this.objectsInitialized(instanceData.roomId.toString()); + } + + if(this._skipFurnitureCreationForNextFrame) return; + } + } + + public onRoomEngineInitalized(flag: boolean): void + { + if(!flag) return; + + this._ready = true; + + this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.ENGINE_INITIALIZED, 0)); + + for(const roomData of this._roomDatas.values()) + { + if(!roomData) continue; + + this.createRoomInstance(roomData.roomId, roomData.data); + } + } + + private processPendingFurnitureFloor(roomId: number, id: number, data: RoomFurnitureData): boolean + { + if(!data) + { + const instanceData = this.getRoomInstanceData(roomId); + + if(instanceData) data = instanceData.getPendingFurnitureFloor(id); + + if(!data) return false; + } + + let type = data.type; + let didLoad = false; + + if(!type) + { + type = this.getFurnitureFloorName(data.typeId); + didLoad = true; + + } + + const object = this.createRoomObjectFloor(roomId, id, type); + + if(!object) return false; + + const model = object.model; + + if(model) + { + model.setValue(RoomObjectVariable.FURNITURE_COLOR, this.getFurnitureFloorColorIndex(data.typeId)); + model.setValue(RoomObjectVariable.FURNITURE_TYPE_ID, data.typeId); + model.setValue(RoomObjectVariable.FURNITURE_AD_URL, this.getRoomObjectAdUrl(data.type)); + model.setValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT, (data.realRoomObject ? 1 : 0)); + model.setValue(RoomObjectVariable.FURNITURE_EXPIRY_TIME, data.expiryTime); + model.setValue(RoomObjectVariable.FURNITURE_EXPIRTY_TIMESTAMP, GetTickerTime()); + model.setValue(RoomObjectVariable.FURNITURE_USAGE_POLICY, data.usagePolicy); + model.setValue(RoomObjectVariable.FURNITURE_OWNER_ID, data.ownerId); + model.setValue(RoomObjectVariable.FURNITURE_OWNER_NAME, data.ownerName); + } + + if(!this.updateRoomObjectFloor(roomId, id, data.location, data.direction, data.state, data.data, data.extra)) return false; + + if(data.sizeZ >= 0) + { + if(!this.updateRoomObjectFloorHeight(roomId, id, data.sizeZ)) return false; + } + + if(this.events) this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.ADDED, roomId, id, RoomObjectCategory.FLOOR)); + + const selectedRoomObjectData = this.getPlacedRoomObjectData(roomId); + + if(selectedRoomObjectData && (selectedRoomObjectData.id === id) && (selectedRoomObjectData.category === RoomObjectCategory.FLOOR)) + { + this.selectRoomObject(roomId, id, RoomObjectCategory.FLOOR); + } + + if(object.isReady && data.synchronized) this.addObjectToTileMap(roomId, object); + + return true; + } + + private processPendingFurnitureWall(roomId: number, id: number, data: RoomFurnitureData): boolean + { + if(!data) + { + const instanceData = this.getRoomInstanceData(roomId); + + if(instanceData) data = instanceData.getPendingFurnitureWall(id); + + if(!data) return false; + } + + let extra = ''; + + if(data.data) extra = data.data.getLegacyString(); + + let type = this.getFurnitureWallName(data.typeId, extra); + + if(!type) type = ''; + + const object = this.createRoomObjectWall(roomId, id, type); + + if(!object) return false; + + const model = object.model; + + if(model) + { + model.setValue(RoomObjectVariable.FURNITURE_COLOR, this.getFurnitureWallColorIndex(data.typeId)); + model.setValue(RoomObjectVariable.FURNITURE_TYPE_ID, data.typeId); + model.setValue(RoomObjectVariable.FURNITURE_AD_URL, this.getRoomObjectAdUrl(data.type)); + model.setValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT, (data.realRoomObject ? 1 : 0)); + model.setValue(RoomObjectVariable.OBJECT_ACCURATE_Z_VALUE, 1); + model.setValue(RoomObjectVariable.FURNITURE_EXPIRY_TIME, data.expiryTime); + model.setValue(RoomObjectVariable.FURNITURE_EXPIRTY_TIMESTAMP, GetTickerTime()); + model.setValue(RoomObjectVariable.FURNITURE_USAGE_POLICY, data.usagePolicy); + model.setValue(RoomObjectVariable.FURNITURE_OWNER_ID, data.ownerId); + model.setValue(RoomObjectVariable.FURNITURE_OWNER_NAME, data.ownerName); + } + + if(!this.updateRoomObjectWall(roomId, id, data.location, data.direction, data.state, extra)) return false; + + if(this.events) this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.ADDED, roomId, id, RoomObjectCategory.WALL)); + + const selectedRoomObjectData = this.getPlacedRoomObjectData(roomId); + + if(selectedRoomObjectData && (Math.abs(selectedRoomObjectData.id) === id) && (selectedRoomObjectData.category === RoomObjectCategory.WALL)) + { + this.selectRoomObject(roomId, id, RoomObjectCategory.WALL); + } + + return true; + } + + public setRoomSessionOwnUser(roomId: number, objectId: number): void + { + if(!this._roomSessionManager) return; + + const session = this._roomSessionManager.getSession(roomId); + + if(session) + { + session.setOwnRoomIndex(objectId); + } + + const camera = this.getRoomCamera(roomId); + + if(camera) + { + camera.targetId = objectId; + camera.targetCategory = RoomObjectCategory.UNIT; + + camera.activateFollowing(this.cameraFollowDuration); + } + } + + private get cameraFollowDuration(): number + { + return 1000; + //return (getBoolean("room.camera.follow_user")) ? 1000 : 0; + } + + private updateRoomCameras(time: number): void + { + for(const instanceData of this._roomInstanceDatas.values()) + { + if(!instanceData) continue; + + const camera = instanceData.roomCamera; + + if(!camera) continue; + + let location: IVector3D = null; + + const object = this.getRoomObject(instanceData.roomId, camera.targetId, camera.targetCategory); + + if(object) location = object.getLocation(); + + if(!location) continue; + + if((instanceData.roomId !== this._activeRoomId) || !this._activeRoomIsDragged) + { + this.updateRoomCamera(instanceData.roomId, 1, location, time); + } + } + + if(this._activeRoomWasDragged) + { + const renderingCanvas = this.getRoomInstanceRenderingCanvas(this._activeRoomId, 1); + + if(renderingCanvas) this.setRoomInstanceRenderingCanvasOffset(this._activeRoomId, 1, new Point((renderingCanvas.screenOffsetX + this._activeRoomDragX), (renderingCanvas.screenOffsetY + this._activeRoomDragY))); + + this._activeRoomDragX = 0; + this._activeRoomDragY = 0; + } + } + + private updateRoomCamera(roomId: number, canvasId: number, objectLocation: IVector3D, time: number): void + { + const renderingCanvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); + const instanceData = this.getRoomInstanceData(roomId); + + if(!renderingCanvas || !instanceData || (renderingCanvas.scale !== 1)) return; + + const roomGeometry = (renderingCanvas.geometry as RoomGeometry); + const roomCamera = instanceData.roomCamera; + const roomInstance = this.getRoomInstance(roomId); + + if(!roomGeometry || !roomCamera || !roomInstance) return; + + const canvasRectangle = this.getRoomCanvasRectangle(roomId, canvasId); + + if(!canvasRectangle) return; + + let _local_10 = (Math.floor(objectLocation.z) + 1); + const width = Math.round(canvasRectangle.width); + const height = Math.round(canvasRectangle.height); + const bounds = this.getCanvasBoundingRectangle(canvasId); + + if(bounds && ((bounds.right < 0) || (bounds.bottom < 0) || (bounds.left >= width) || (bounds.top >= height))) + { + roomCamera.reset(); + } + + if((roomCamera.screenWd !== width) || (roomCamera.screenHt !== height) || (roomCamera.scale !== roomGeometry.scale) || (roomCamera.geometryUpdateId !== roomGeometry.updateId) || !Vector3d.isEqual(objectLocation, roomCamera.targetObjectLoc) || roomCamera.isMoving) + { + roomCamera.targetObjectLoc = objectLocation; + + const _local_15 = new Vector3d(); + + _local_15.assign(objectLocation); + + _local_15.x = Math.round(_local_15.x); + _local_15.y = Math.round(_local_15.y); + + const _local_16 = (roomInstance.model.getValue(RoomVariableEnum.ROOM_MIN_X) - 0.5); + const _local_17 = (roomInstance.model.getValue(RoomVariableEnum.ROOM_MIN_Y) - 0.5); + const _local_18 = (roomInstance.model.getValue(RoomVariableEnum.ROOM_MAX_X) + 0.5); + const _local_19 = (roomInstance.model.getValue(RoomVariableEnum.ROOM_MAX_Y) + 0.5); + const _local_20 = Math.round(((_local_16 + _local_18) / 2)); + const _local_21 = Math.round(((_local_17 + _local_19) / 2)); + const _local_22 = 2; + let _local_23 = new Point((_local_15.x - _local_20), (_local_15.y - _local_21)); + const _local_24 = (roomGeometry.scale / Math.sqrt(2)); + const _local_25 = (_local_24 / 2); + const _local_26 = new Matrix(); + _local_26.rotate(((-(roomGeometry.direction.x + 90) / 180) * Math.PI)); + _local_23 = _local_26.apply(_local_23); + _local_23.y = (_local_23.y * (_local_25 / _local_24)); + const _local_27 = (((canvasRectangle.width / 2) / _local_24) - 1); + const _local_28 = (((canvasRectangle.height / 2) / _local_25) - 1); + + let _local_29 = 0; + let _local_30 = 0; + let _local_31 = 0; + let _local_32 = 0; + let _local_33 = roomGeometry.getScreenPoint(new Vector3d(_local_20, _local_21, _local_22)); + + if(!_local_33) return; + + _local_33.x = (_local_33.x + Math.round((canvasRectangle.width / 2))); + _local_33.y = (_local_33.y + Math.round((canvasRectangle.height / 2))); + + if(bounds) + { + bounds.x += -(renderingCanvas.screenOffsetX); + bounds.y += -(renderingCanvas.screenOffsetY); + + if(((bounds.width > 1) && (bounds.height > 1))) + { + _local_29 = (((bounds.left - _local_33.x) - (roomGeometry.scale * 0.25)) / _local_24); + _local_31 = (((bounds.right - _local_33.x) + (roomGeometry.scale * 0.25)) / _local_24); + _local_30 = (((bounds.top - _local_33.y) - (roomGeometry.scale * 0.5)) / _local_25); + _local_32 = (((bounds.bottom - _local_33.y) + (roomGeometry.scale * 0.5)) / _local_25); + } + else + { + roomGeometry.adjustLocation(new Vector3d(-30, -30), 25); + + return; + } + } + else + { + roomGeometry.adjustLocation(new Vector3d(0, 0), 25); + + return; + } + + let _local_34 = false; + let _local_35 = false; + let _local_36 = false; + let _local_37 = false; + const _local_38 = Math.round(((_local_31 - _local_29) * _local_24)); + + if(_local_38 < canvasRectangle.width) + { + _local_10 = 2; + _local_23.x = ((_local_31 + _local_29) / 2); + _local_36 = true; + } + else + { + if(_local_23.x > (_local_31 - _local_27)) + { + _local_23.x = (_local_31 - _local_27); + _local_34 = true; + } + if(_local_23.x < (_local_29 + _local_27)) + { + _local_23.x = (_local_29 + _local_27); + _local_34 = true; + } + } + const _local_39 = Math.round(((_local_32 - _local_30) * _local_25)); + if(_local_39 < canvasRectangle.height) + { + _local_10 = 2; + _local_23.y = ((_local_32 + _local_30) / 2); + _local_37 = true; + } + else + { + if(_local_23.y > (_local_32 - _local_28)) + { + _local_23.y = (_local_32 - _local_28); + _local_35 = true; + } + if(_local_23.y < (_local_30 + _local_28)) + { + _local_23.y = (_local_30 + _local_28); + _local_35 = true; + } + if(_local_35) + { + _local_23.y = (_local_23.y / (_local_25 / _local_24)); + } + } + _local_26.invert(); + _local_23 = _local_26.apply(_local_23); + _local_23.x = (_local_23.x + _local_20); + _local_23.y = (_local_23.y + _local_21); + let _local_40 = 0.35; + let _local_41 = 0.2; + let _local_42 = 0.2; + const _local_43 = 10; + const _local_44 = 10; + if((_local_42 * width) > 100) + { + _local_42 = (100 / width); + } + if((_local_40 * height) > 150) + { + _local_40 = (150 / height); + } + if((_local_41 * height) > 150) + { + _local_41 = (150 / height); + } + if((((roomCamera.limitedLocationX) && (roomCamera.screenWd == width)) && (roomCamera.screenHt == height))) + { + _local_42 = 0; + } + if((((roomCamera.limitedLocationY) && (roomCamera.screenWd == width)) && (roomCamera.screenHt == height))) + { + _local_40 = 0; + _local_41 = 0; + } + + canvasRectangle.width = (canvasRectangle.width * (1 - (_local_42 * 2))); + canvasRectangle.height = (canvasRectangle.height * (1 - (_local_40 + _local_41))); + + if(canvasRectangle.width < _local_43) + { + canvasRectangle.width = _local_43; + } + + if(canvasRectangle.height < _local_44) + { + canvasRectangle.height = _local_44; + } + + if((_local_40 + _local_41) > 0) + { + canvasRectangle.x += (-(canvasRectangle.width) / 2); + canvasRectangle.y += (-(canvasRectangle.height) * (_local_41 / (_local_40 + _local_41))); + } + else + { + canvasRectangle.x += (-(canvasRectangle.width) / 2); + canvasRectangle.y += (-(canvasRectangle.height) / 2); + } + + _local_33 = roomGeometry.getScreenPoint(_local_15); + + if(!_local_33) return; + + if(_local_33) + { + _local_33.x = (_local_33.x + renderingCanvas.screenOffsetX); + _local_33.y = (_local_33.y + renderingCanvas.screenOffsetY); + _local_15.z = _local_10; + _local_15.x = (Math.round((_local_23.x * 2)) / 2); + _local_15.y = (Math.round((_local_23.y * 2)) / 2); + if(!roomCamera.location) + { + roomGeometry.location = _local_15; + if(this.useOffsetScrolling) + { + roomCamera.initializeLocation(new Vector3d(0, 0, 0)); + } + else + { + roomCamera.initializeLocation(_local_15); + } + } + const _local_45 = roomGeometry.getScreenPoint(_local_15); + const _local_46 = new Vector3d(0, 0, 0); + if(_local_45) + { + _local_46.x = _local_45.x; + _local_46.y = _local_45.y; + } + if(((((((((_local_33.x < canvasRectangle.left) || (_local_33.x > canvasRectangle.right)) && (!(roomCamera.centeredLocX))) || (((_local_33.y < canvasRectangle.top) || (_local_33.y > canvasRectangle.bottom)) && (!(roomCamera.centeredLocY)))) || (((_local_36) && (!(roomCamera.centeredLocX))) && (!(roomCamera.screenWd == width)))) || (((_local_37) && (!(roomCamera.centeredLocY))) && (!(roomCamera.screenHt == height)))) || ((!(roomCamera.roomWd == bounds.width)) || (!(roomCamera.roomHt == bounds.height)))) || ((!(roomCamera.screenWd == width)) || (!(roomCamera.screenHt == height))))) + { + roomCamera.limitedLocationX = _local_34; + roomCamera.limitedLocationY = _local_35; + if(this.useOffsetScrolling) + { + roomCamera.target = _local_46; + } + else + { + roomCamera.target = _local_15; + } + } + else + { + if(!_local_34) roomCamera.limitedLocationX = false; + + if(!_local_35) roomCamera.limitedLocationY = false; + } + } + + roomCamera.centeredLocX = _local_36; + roomCamera.centeredLocY = _local_37; + roomCamera.screenWd = width; + roomCamera.screenHt = height; + roomCamera.scale = roomGeometry.scale; + roomCamera.geometryUpdateId = roomGeometry.updateId; + roomCamera.roomWd = bounds.width; + roomCamera.roomHt = bounds.height; + + if(!this._sessionDataManager.isCameraFollowDisabled) + { + if(this.useOffsetScrolling) + { + roomCamera.update(time, 8); + } + else + { + roomCamera.update(time, 0.5); + } + } + + if(this.useOffsetScrolling) + { + this.setRoomInstanceRenderingCanvasOffset(this.activeRoomId, 1, new Point(-(roomCamera.location.x), -(roomCamera.location.y))); + } + else + { + roomGeometry.adjustLocation(roomCamera.location, 25); + } + } + else + { + roomCamera.limitedLocationX = false; + roomCamera.limitedLocationY = false; + roomCamera.centeredLocX = false; + roomCamera.centeredLocY = false; + } + } + + private getRoomCanvasRectangle(roomId: number, canvasId: number): Rectangle + { + const canvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); + + if(!canvas) return null; + + return new Rectangle(0, 0, canvas.width, canvas.height); + } + + public getRoomObjectBoundingRectangle(roomId: number, objectId: number, category: number, canvasId: number): Rectangle + { + const geometry = this.getRoomInstanceGeometry(roomId, canvasId); + + if(!geometry) return null; + + const roomObject = this.getRoomObject(roomId, objectId, category); + + if(!roomObject) return null; + + const visualization = roomObject.visualization; + + if(!visualization) return null; + + const rectangle = visualization.getBoundingRectangle(); + const canvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); + const scale = ((canvas) ? canvas.scale : 1); + const screenPoint = geometry.getScreenPoint(roomObject.getLocation()); + + if(!screenPoint) return null; + + screenPoint.x = Math.round(screenPoint.x); + screenPoint.y = Math.round(screenPoint.y); + + rectangle.x = (rectangle.x * scale); + rectangle.y = (rectangle.y * scale); + rectangle.width = (rectangle.width * scale); + rectangle.height = (rectangle.height * scale); + + screenPoint.x = (screenPoint.x * scale); + screenPoint.y = (screenPoint.y * scale); + + rectangle.x += screenPoint.x; + rectangle.y += screenPoint.y; + + if(!canvas) return null; + + rectangle.x += (Math.round(canvas.width / 2) + canvas.screenOffsetX); + rectangle.y += (Math.round(canvas.height / 2) + canvas.screenOffsetY); + + return rectangle; + } + + public getCanvasBoundingRectangle(canvasId: number): Rectangle + { + return this.getRoomObjectBoundingRectangle(this._activeRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM, canvasId); + } + + public getFurnitureFloorName(typeId: number): string + { + if(!this._roomContentLoader) return null; + + return this._roomContentLoader.getFurnitureFloorNameForTypeId(typeId); + } + + public getFurnitureWallName(typeId: number, extra: string = null): string + { + if(!this._roomContentLoader) return null; + + return this._roomContentLoader.getFurnitureWallNameForTypeId(typeId, extra); + } + + public getFurnitureFloorColorIndex(typeId: number): number + { + if(!this._roomContentLoader) return null; + + return this._roomContentLoader.getFurnitureFloorColorIndex(typeId); + } + + public getFurnitureWallColorIndex(typeId: number): number + { + if(!this._roomContentLoader) return null; + + return this._roomContentLoader.getFurnitureWallColorIndex(typeId); + } + + private getRoomInstanceData(roomId: number): RoomInstanceData + { + const existing = this._roomInstanceDatas.get(roomId); + + if(existing) return existing; + + const data = new RoomInstanceData(roomId); + + this._roomInstanceDatas.set(data.roomId, data); + + return data; + } + + public getRoomInstanceModelName(roomId: number): string + { + const instanceData = this.getRoomInstanceData(roomId); + + if(!instanceData) return null; + + return instanceData.modelName; + } + + public setRoomInstanceModelName(roomId: number, name: string): void + { + const instanceData = this.getRoomInstanceData(roomId); + + if(!instanceData) return; + + instanceData.setModelName(name); + } + + public getRoomTileObjectMap(k: number): ITileObjectMap + { + const roomInstance = this.getRoomInstanceData(k); + + if(!roomInstance) return null; + + return roomInstance.tileObjectMap; + } + + private getCurrentRoomCamera(): RoomCamera + { + return this.getRoomCamera(this._activeRoomId); + } + + private getRoomCamera(roomId: number): RoomCamera + { + const instanceData = this.getRoomInstanceData(roomId); + + if(!instanceData) return null; + + return instanceData.roomCamera; + } + + public getSelectedRoomObjectData(roomId: number): ISelectedRoomObjectData + { + const instanceData = this.getRoomInstanceData(roomId); + + if(!instanceData) return null; + + return instanceData.selectedObject; + } + + public setSelectedRoomObjectData(roomId: number, data: ISelectedRoomObjectData): void + { + const instanceData = this.getRoomInstanceData(roomId); + + if(!instanceData) return null; + + instanceData.setSelectedObject(data); + + if(data) instanceData.setPlacedObject(null); + } + + public getPlacedRoomObjectData(roomId: number): ISelectedRoomObjectData + { + const instanceData = this.getRoomInstanceData(roomId); + + if(!instanceData) return null; + + return instanceData.placedObject; + } + + public setPlacedRoomObjectData(roomId: number, data: ISelectedRoomObjectData): void + { + const instanceData = this.getRoomInstanceData(roomId); + + if(!instanceData) return null; + + instanceData.setPlacedObject(data); + } + + public cancelRoomObjectPlacement(): void + { + if(!this._roomObjectEventHandler) return; + + this._roomObjectEventHandler.cancelRoomObjectPlacement(this._activeRoomId); + } + + public getFurnitureStackingHeightMap(roomId: number): IFurnitureStackingHeightMap + { + const instanceData = this.getRoomInstanceData(roomId); + + if(!instanceData) return null; + + return instanceData.furnitureStackingHeightMap; + } + + public setFurnitureStackingHeightMap(roomId: number, heightMap: IFurnitureStackingHeightMap): void + { + const instanceData = this.getRoomInstanceData(roomId); + + if(!instanceData) return null; + + instanceData.setFurnitureStackingHeightMap(heightMap); + } + + public getLegacyWallGeometry(roomId: number): ILegacyWallGeometry + { + const instanceData = this.getRoomInstanceData(roomId); + + if(!instanceData) return null; + + return instanceData.legacyGeometry; + } + + private createRoomObjectAndInitialize(roomId: number, objectId: number, type: string, category: number): IRoomObjectController + { + const instance = this.getRoomInstance(roomId); + + if(!instance) return null; + + return instance.createRoomObjectAndInitalize(objectId, type, category) as IRoomObjectController; + } + + public getTotalObjectsForManager(roomId: number, category: number): number + { + const instance = this.getRoomInstance(roomId); + + if(!instance) return 0; + + return instance.getTotalObjectsForManager(category); + } + + public getRoomObject(roomId: number, objectId: number, category: number): IRoomObjectController + { + if(!this._ready) return null; + + let roomIdString = this.getRoomId(roomId); + + if(roomId === 0) roomIdString = RoomEngine.TEMPORARY_ROOM; + + return this.getObject(roomIdString, objectId, category); + } + + public getObject(roomId: string, objectId: number, category: number): IRoomObjectController + { + let roomInstance: IRoomInstance = null; + + if(this._roomManager) roomInstance = this._roomManager.getRoomInstance(roomId); + + if(!roomInstance) return null; + + let roomObject = (roomInstance.getRoomObject(objectId, category) as IRoomObjectController); + + if(!roomObject) + { + switch(category) + { + case RoomObjectCategory.FLOOR: + this.processPendingFurnitureFloor(this.getRoomIdFromString(roomId), objectId, null); + + roomObject = (roomInstance.getRoomObject(objectId, category) as IRoomObjectController); + break; + case RoomObjectCategory.WALL: + this.processPendingFurnitureWall(this.getRoomIdFromString(roomId), objectId, null); + + roomObject = (roomInstance.getRoomObject(objectId, category) as IRoomObjectController); + break; + } + } + + return roomObject; + } + + public getRoomObjectByIndex(roomId: number, index: number, category: number): IRoomObjectController + { + const instance = this.getRoomInstance(roomId); + + if(!instance) return null; + + return instance.getRoomObjectByIndex(index, category) as IRoomObjectController; + } + + public getRoomObjectCategoryForType(type: string): number + { + if(!type || !this._roomContentLoader) return RoomObjectCategory.MINIMUM; + + return this._roomContentLoader.getCategoryForType(type); + } + + public getRoomObjectCursor(roomId: number): IRoomObjectController + { + return this.getObject(this.getRoomId(roomId), RoomEngine.CURSOR_OBJECT_ID, RoomObjectCategory.CURSOR); + } + + public getRoomObjectSelectionArrow(roomId: number): IRoomObjectController + { + return this.getObject(this.getRoomId(roomId), RoomEngine.ARROW_OBJECT_ID, RoomObjectCategory.CURSOR); + } + + public getRoomOwnObject(roomId: number): IRoomObjectController + { + return this.getObject(this.getRoomId(roomId), RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM); + } + + public getRoomObjectUser(roomId: number, objectId: number): IRoomObjectController + { + return this.getObject(this.getRoomId(roomId), objectId, RoomObjectCategory.UNIT); + } + + public removeRoomObjectUser(roomId: number, objectId: number): void + { + return this.removeRoomObject(roomId, objectId, RoomObjectCategory.UNIT); + } + + public createRoomObjectUser(roomId: number, objectId: number, type: string): IRoomObjectController + { + return this.createRoomObjectAndInitialize(roomId, objectId, type, RoomObjectCategory.UNIT); + } + + public getRoomObjectFloor(roomId: number, objectId: number): IRoomObjectController + { + return this.getObject(this.getRoomId(roomId), objectId, RoomObjectCategory.FLOOR); + } + + public createRoomObjectFloor(roomId: number, id: number, type: string): IRoomObjectController + { + return this.createRoomObjectAndInitialize(roomId, id, type, RoomObjectCategory.FLOOR); + } + + public removeRoomObjectFloor(roomId: number, objectId: number, userId: number = -1, _arg_4: boolean = false): void + { + const roomInstanceData = this.getRoomInstanceData(roomId); + + if(roomInstanceData) roomInstanceData.removePendingFunitureFloor(objectId); + + if(this._sessionDataManager && (userId === this._sessionDataManager.userId) && !FurniId.isBuilderClubId(objectId)) + { + const roomObject = this.getRoomObject(roomId, objectId, RoomObjectCategory.FLOOR); + + if(roomObject) + { + const screenLocation = this.getRoomObjectScreenLocation(roomId, objectId, RoomObjectCategory.FLOOR, this._activeRoomActiveCanvas); + + if(screenLocation) + { + const disabledPickingAnimation = (roomObject.model.getValue(RoomObjectVariable.FURNITURE_DISABLE_PICKING_ANIMATION) === 1); + + if(!disabledPickingAnimation) + { + const typeId = roomObject.model.getValue(RoomObjectVariable.FURNITURE_TYPE_ID); + const extras = roomObject.model.getValue(RoomObjectVariable.FURNITURE_EXTRAS); + const dataKey = roomObject.model.getValue(RoomObjectVariable.FURNITURE_DATA_FORMAT); + const objectData = ObjectDataFactory.getData(dataKey); + const icon = this.getFurnitureFloorIcon(typeId, null, extras, objectData).data; + + if(icon) + { + const image = TextureUtils.generateImage(icon); + + if(this.events) + { + const event = new NitroToolbarAnimateIconEvent(image, screenLocation.x, screenLocation.y); + + event.iconName = ToolbarIconEnum.INVENTORY; + + this.events.dispatchEvent(event); + } + } + } + } + } + } + + this.removeRoomObject(roomId, objectId, RoomObjectCategory.FLOOR); + this.setMouseDefault(roomId, RoomObjectCategory.FLOOR, objectId); + + if(_arg_4) this.refreshTileObjectMap(roomId, 'RoomEngine.disposeObjectFurniture()'); + } + + public getRoomObjectWall(roomId: number, objectId: number): IRoomObjectController + { + return this.getObject(this.getRoomId(roomId), objectId, RoomObjectCategory.WALL); + } + + public removeRoomObjectWall(roomId: number, objectId: number, userId: number = -1): void + { + if(this._sessionDataManager && (userId === this._sessionDataManager.userId) && !FurniId.isBuilderClubId(objectId)) + { + const roomObject = this.getRoomObject(roomId, objectId, RoomObjectCategory.WALL); + + if(roomObject && (roomObject.type.indexOf('post_it') === -1) && (roomObject.type.indexOf('external_image_wallitem') === -1)) + { + const screenLocation = this.getRoomObjectScreenLocation(roomId, objectId, RoomObjectCategory.WALL, this._activeRoomActiveCanvas); + + if(screenLocation) + { + const typeId = roomObject.model.getValue(RoomObjectVariable.FURNITURE_TYPE_ID); + const objectData = roomObject.model.getValue(RoomObjectVariable.FURNITURE_DATA); + const icon = this.getFurnitureWallIcon(typeId, null, objectData).data; + + if(icon) + { + const image = TextureUtils.generateImage(icon); + + if(this.events) + { + const event = new NitroToolbarAnimateIconEvent(image, screenLocation.x, screenLocation.y); + + event.iconName = ToolbarIconEnum.INVENTORY; + + this.events.dispatchEvent(event); + } + } + } + } + } + + this.removeRoomObject(roomId, objectId, RoomObjectCategory.WALL); + this.updateRoomObjectMask(roomId, objectId, false); + this.setMouseDefault(roomId, RoomObjectCategory.WALL, objectId); + } + + public createRoomObjectWall(roomId: number, id: number, type: string): IRoomObjectController + { + return this.createRoomObjectAndInitialize(roomId, id, type, RoomObjectCategory.WALL); + } + + private removeRoomObject(roomId: number, objectId: number, category: number): void + { + const instance = this.getRoomInstance(roomId); + + if(!instance) return null; + + instance.removeRoomObject(objectId, category); + + if(this.events) this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REMOVED, roomId, objectId, category)); + } + + public addFurnitureFloor(roomId: number, id: number, typeId: number, location: IVector3D, direction: IVector3D, state: number, objectData: IObjectData, extra: number = NaN, expires: number = -1, usagePolicy: number = 0, ownerId: number = 0, ownerName: string = '', synchronized: boolean = true, realRoomObject: boolean = true, sizeZ: number = -1): boolean + { + const instanceData = this.getRoomInstanceData(roomId); + + if(!instanceData) return false; + + const furnitureData = new RoomFurnitureData(id, typeId, null, location, direction, state, objectData, extra, expires, usagePolicy, ownerId, ownerName, synchronized, realRoomObject, sizeZ); + + instanceData.addPendingFurnitureFloor(furnitureData); + + return true; + } + + public addFurnitureFloorByTypeName(roomId: number, id: number, typeName: string, location: IVector3D, direction: IVector3D, state: number, objectData: IObjectData, extra: number = NaN, expires: number = -1, usagePolicy: number = 0, ownerId: number = 0, ownerName: string = '', synchronized: boolean = true, realRoomObject: boolean = true, sizeZ: number = -1): boolean + { + const instanceData = this.getRoomInstanceData(roomId); + + if(!instanceData) return false; + + const furnitureData = new RoomFurnitureData(id, 0, typeName, location, direction, state, objectData, extra, expires, usagePolicy, ownerId, ownerName, synchronized, realRoomObject, sizeZ); + + instanceData.addPendingFurnitureFloor(furnitureData); + + return true; + } + + public addFurnitureWall(roomId: number, id: number, typeId: number, location: IVector3D, direction: IVector3D, state: number, extra: string, expires: number = -1, usagePolicy: number = 0, ownerId: number = 0, ownerName: string = '', realRoomObject: boolean = true): boolean + { + const instanceData = this.getRoomInstanceData(roomId); + + if(!instanceData) return false; + + const objectData = new LegacyDataType(); + + objectData.setString(extra); + + const furnitureData = new RoomFurnitureData(id, typeId, null, location, direction, state, objectData, NaN, expires, usagePolicy, ownerId, ownerName, true, realRoomObject); + + instanceData.addPendingFurnitureWall(furnitureData); + + return true; + } + + public updateRoomObjectFloor(roomId: number, objectId: number, location: IVector3D, direction: IVector3D, state: number, data: IObjectData, extra: number = null): boolean + { + const object = this.getRoomObjectFloor(roomId, objectId); + + if(!object) return false; + + object.processUpdateMessage(new RoomObjectUpdateMessage(location, direction)); + object.processUpdateMessage(new ObjectDataUpdateMessage(state, data, extra)); + + return true; + } + + public updateRoomObjectWall(roomId: number, objectId: number, location: IVector3D, direction: IVector3D, state: number, extra: string = null): boolean + { + const object = this.getRoomObjectWall(roomId, objectId); + + if(!object || !object.logic) return false; + + const updateMessage = new RoomObjectUpdateMessage(location, direction); + const data = new LegacyDataType(); + const dataUpdateMessage = new ObjectDataUpdateMessage(state, data); + + data.setString(extra); + + object.logic.processUpdateMessage(updateMessage); + object.logic.processUpdateMessage(dataUpdateMessage); + + this.updateRoomObjectMask(roomId, objectId); + + return true; + } + + public updateRoomObjectWallItemData(roomId: number, objectId: number, data: string): boolean + { + const object = this.getRoomObjectWall(roomId, objectId); + + if(!object || !object.logic) return false; + + object.logic.processUpdateMessage(new ObjectItemDataUpdateMessage(data)); + + return true; + } + + public updateRoomObjectFloorHeight(roomId: number, objectId: number, height: number): boolean + { + const object = this.getRoomObjectFloor(roomId, objectId); + + if(!object) return false; + + object.processUpdateMessage(new ObjectHeightUpdateMessage(null, null, height)); + + return true; + } + + public updateRoomObjectFloorExpiration(roomId: number, objectId: number, expires: number): boolean + { + const object = this.getRoomObjectFloor(roomId, objectId); + + if(!object) return false; + + object.model.setValue(RoomObjectVariable.FURNITURE_EXPIRY_TIME, expires); + object.model.setValue(RoomObjectVariable.FURNITURE_EXPIRTY_TIMESTAMP, GetTickerTime()); + + return true; + } + + public updateRoomObjectWallExpiration(roomId: number, objectId: number, expires: number): boolean + { + const object = this.getRoomObjectWall(roomId, objectId); + + if(!object) return false; + + object.model.setValue(RoomObjectVariable.FURNITURE_EXPIRY_TIME, expires); + object.model.setValue(RoomObjectVariable.FURNITURE_EXPIRTY_TIMESTAMP, GetTickerTime()); + + return true; + } + + public updateRoomObjectMask(roomId: number, objectId: number, _arg_3: boolean = true): void + { + const maskName = RoomObjectCategory.WALL + '_' + objectId; + const roomObject = this.getRoomObjectWall(roomId, objectId); + + let maskUpdate: ObjectRoomMaskUpdateMessage = null; + + if(roomObject && roomObject.model) + { + if(roomObject.model.getValue(RoomObjectVariable.FURNITURE_USES_PLANE_MASK) > 0) + { + const maskType = roomObject.model.getValue(RoomObjectVariable.FURNITURE_PLANE_MASK_TYPE); + const location = roomObject.getLocation(); + + if(_arg_3) maskUpdate = new ObjectRoomMaskUpdateMessage(ObjectRoomMaskUpdateMessage.ADD_MASK, maskName, maskType, location); + else maskUpdate = new ObjectRoomMaskUpdateMessage(ObjectRoomMaskUpdateMessage.REMOVE_MASK, maskName); + } + } + else + { + maskUpdate = new ObjectRoomMaskUpdateMessage(ObjectRoomMaskUpdateMessage.REMOVE_MASK, maskName); + } + + const roomOwnObject = this.getRoomOwnObject(roomId); + + if(roomOwnObject && roomOwnObject.logic && maskUpdate) roomOwnObject.logic.processUpdateMessage(maskUpdate); + } + + public rollRoomObjectFloor(roomId: number, objectId: number, location: IVector3D, targetLocation: IVector3D): void + { + const object = this.getRoomObjectFloor(roomId, objectId); + + if(!object) return; + + object.processUpdateMessage(new ObjectMoveUpdateMessage(location, targetLocation, null, !!targetLocation)); + } + + public updateRoomObjectWallLocation(roomId: number, objectId: number, location: IVector3D): boolean + { + const roomObject = this.getRoomObjectWall(roomId, objectId); + + if(!roomObject) return false; + + if(roomObject.logic) roomObject.logic.processUpdateMessage(new ObjectMoveUpdateMessage(location, null, null)); + + this.updateRoomObjectMask(roomId, objectId); + + return true; + } + + public addRoomObjectUser(roomId: number, objectId: number, location: IVector3D, direction: IVector3D, headDirection: number, type: number, figure: string): boolean + { + const existing = this.getRoomObjectUser(roomId, objectId); + + if(existing) return false; + + let objectType = RoomObjectUserType.getTypeString(type); + + if(objectType === RoomObjectUserType.PET) objectType = this.getPetType(figure); + + const object = this.createRoomObjectUser(roomId, objectId, objectType); + + if(!object) return false; + + //object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT_ENABLE, 1); + + object.processUpdateMessage(new ObjectAvatarUpdateMessage(this.fixedUserLocation(roomId, location), null, direction, headDirection, false, 0)); + + if(figure) object.processUpdateMessage(new ObjectAvatarFigureUpdateMessage(figure)); + + if(this.events) this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.ADDED, roomId, objectId, RoomObjectCategory.UNIT)); + + return true; + } + + public updateRoomObjectUserLocation(roomId: number, objectId: number, location: IVector3D, targetLocation: IVector3D, canStandUp: boolean = false, baseY: number = 0, direction: IVector3D = null, headDirection: number = NaN): boolean + { + const object = this.getRoomObjectUser(roomId, objectId); + + if(!object) return false; + + if(!location) location = object.getLocation(); + + if(!direction) direction = object.getDirection(); + + if(isNaN(headDirection)) headDirection = object.model.getValue(RoomObjectVariable.HEAD_DIRECTION); + + object.processUpdateMessage(new ObjectAvatarUpdateMessage(this.fixedUserLocation(roomId, location), this.fixedUserLocation(roomId, targetLocation), direction, headDirection, canStandUp, baseY)); + + const roomSession = ((this._roomSessionManager && this._roomSessionManager.getSession(roomId)) || null); + + if(roomSession && (roomSession.ownRoomIndex === objectId)) + { + this._logicFactory.events.dispatchEvent(new RoomToObjectOwnAvatarMoveEvent(RoomToObjectOwnAvatarMoveEvent.ROAME_MOVE_TO, targetLocation)); + } + + return true; + } + + private fixedUserLocation(roomId: number, location: IVector3D): IVector3D + { + if(!location) return null; + + const heightMap = this.getFurnitureStackingHeightMap(roomId); + const wallGeometry = this.getLegacyWallGeometry(roomId); + + if(!heightMap || !wallGeometry) return location; + + let _local_5 = location.z; + const _local_6 = heightMap.getTileHeight(location.x, location.y); + const _local_7 = wallGeometry.getHeight(location.x, location.y); + + if((Math.abs((_local_5 - _local_6)) < 0.1) && (Math.abs((_local_6 - _local_7)) < 0.1)) + { + _local_5 = wallGeometry.getFloorAltitude(location.x, location.y); + } + + return new Vector3d(location.x, location.y, _local_5); + } + + public updateRoomObjectUserAction(roomId: number, objectId: number, action: string, value: number, parameter: string = null): boolean + { + const object = this.getRoomObjectUser(roomId, objectId); + + if(!object) return false; + + let message: ObjectStateUpdateMessage = null; + + switch(action) + { + case RoomObjectVariable.FIGURE_TALK: + message = new ObjectAvatarChatUpdateMessage(value); + break; + case RoomObjectVariable.FIGURE_SLEEP: + message = new ObjectAvatarSleepUpdateMessage(value === 1); + break; + case RoomObjectVariable.FIGURE_IS_TYPING: + message = new ObjectAvatarTypingUpdateMessage(value === 1); + break; + case RoomObjectVariable.FIGURE_IS_MUTED: + message = new ObjectAvatarMutedUpdateMessage(value === 1); + break; + case RoomObjectVariable.FIGURE_CARRY_OBJECT: + message = new ObjectAvatarCarryObjectUpdateMessage(value, parameter); + break; + case RoomObjectVariable.FIGURE_USE_OBJECT: + message = new ObjectAvatarUseObjectUpdateMessage(value); + break; + case RoomObjectVariable.FIGURE_DANCE: + message = new ObjectAvatarDanceUpdateMessage(value); + break; + case RoomObjectVariable.FIGURE_GAINED_EXPERIENCE: + message = new ObjectAvatarExperienceUpdateMessage(value); + break; + case RoomObjectVariable.FIGURE_NUMBER_VALUE: + message = new ObjectAvatarPlayerValueUpdateMessage(value); + break; + case RoomObjectVariable.FIGURE_SIGN: + message = new ObjectAvatarSignUpdateMessage(value); + break; + case RoomObjectVariable.FIGURE_EXPRESSION: + message = new ObjectAvatarExpressionUpdateMessage(value); + break; + case RoomObjectVariable.FIGURE_IS_PLAYING_GAME: + message = new ObjectAvatarPlayingGameUpdateMessage(value === 1); + break; + case RoomObjectVariable.FIGURE_GUIDE_STATUS: + message = new ObjectAvatarGuideStatusUpdateMessage(value); + break; + } + + if(!message) return false; + + object.processUpdateMessage(message); + + return true; + } + + public updateRoomObjectUserFigure(roomId: number, objectId: number, figure: string, gender: string = null, subType: string = null, isRiding: boolean = false): boolean + { + const object = this.getRoomObjectUser(roomId, objectId); + + if(!object) return false; + + object.processUpdateMessage(new ObjectAvatarFigureUpdateMessage(figure, gender, subType, isRiding)); + + return true; + } + + public updateRoomObjectUserFlatControl(roomId: number, objectId: number, level: string): boolean + { + const object = this.getRoomObjectUser(roomId, objectId); + + if(!object) return false; + + object.processUpdateMessage(new ObjectAvatarFlatControlUpdateMessage(parseInt(level))); + + return true; + } + + public updateRoomObjectUserEffect(roomId: number, objectId: number, effectId: number, delay: number = 0): boolean + { + const object = this.getRoomObjectUser(roomId, objectId); + + if(!object) return false; + + object.processUpdateMessage(new ObjectAvatarEffectUpdateMessage(effectId, delay)); + + return true; + } + + public updateRoomObjectUserGesture(roomId: number, objectId: number, gestureId: number): boolean + { + const object = this.getRoomObjectUser(roomId, objectId); + + if(!object) return false; + + object.processUpdateMessage(new ObjectAvatarGestureUpdateMessage(gestureId)); + + return true; + } + + public updateRoomObjectUserPetGesture(roomId: number, objectId: number, gesture: string): boolean + { + const object = this.getRoomObjectUser(roomId, objectId); + + if(!object) return false; + + object.processUpdateMessage(new ObjectAvatarPetGestureUpdateMessage(gesture)); + + return true; + } + + public updateRoomObjectUserPosture(roomId: number, objectId: number, type: string, parameter: string = null): boolean + { + const object = this.getRoomObjectUser(roomId, objectId); + + if(!object) return false; + + object.processUpdateMessage(new ObjectAvatarPostureUpdateMessage(type, parameter)); + + return true; + } + + public updateRoomObjectUserOwn(roomId: number, objectId: number): void + { + const object = this.getRoomObjectUser(roomId, objectId); + + if(!object) return; + + object.processUpdateMessage(new ObjectAvatarOwnMessage()); + } + + public useRoomObject(objectId: number, category: number): boolean + { + const roomObject = this.getRoomObject(this._activeRoomId, objectId, category); + + if(roomObject) + { + const eventHandler = roomObject.logic; + + if(eventHandler) + { + eventHandler.useObject(); + + return true; + } + } + + return false; + } + + public objectInitialized(roomId: string, objectId: number, category: number): void + { + const id = this.getRoomIdFromString(roomId); + + if(category === RoomObjectCategory.WALL) + { + this.updateRoomObjectMask(id, objectId); + } + + const object = this.getRoomObject(id, objectId, category); + + if(object && object.model && object.logic) + { + const dataFormat = object.model.getValue(RoomObjectVariable.FURNITURE_DATA_FORMAT); + + if(!isNaN(dataFormat)) + { + const data = ObjectDataFactory.getData(dataFormat); + + data.initializeFromRoomObjectModel(object.model); + + object.processUpdateMessage(new ObjectDataUpdateMessage(object.getState(0), data)); + } + + this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.CONTENT_UPDATED, id, objectId, category)); + } + + if(roomId !== RoomEngine.TEMPORARY_ROOM) this.addObjectToTileMap(id, object); + } + + public changeObjectModelData(roomId: number, objectId: number, category: number, numberKey: string, numberValue: number): boolean + { + const roomObject = this.getObject(this.getRoomId(roomId), objectId, category); + + if(!roomObject || !roomObject.logic) return false; + + const message = new ObjectModelDataUpdateMessage(numberKey, numberValue); + + roomObject.processUpdateMessage(message); + + return true; + } + + public changeObjectState(roomId: number, objectId: number, category: number): void + { + const roomObject = this.getObject(this.getRoomId(roomId), objectId, category); + + if(!roomObject || !roomObject.model) return; + + let stateIndex = roomObject.model.getValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX); + + if(isNaN(stateIndex)) stateIndex = 1; + else stateIndex = (stateIndex + 1); + + roomObject.model.setValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX, stateIndex); + + const objectDataKey = roomObject.model.getValue(RoomObjectVariable.FURNITURE_DATA_FORMAT); + const objectData = ObjectDataFactory.getData(objectDataKey); + + objectData.initializeFromRoomObjectModel(roomObject.model); + + if(roomObject.logic) roomObject.logic.processUpdateMessage(new ObjectDataUpdateMessage(stateIndex, objectData)); + } + + public loadRoomObjectBadgeImage(roomId: number, objectId: number, objectCategory: number, badgeId: string, groupBadge: boolean = true): void + { + if(!this._sessionDataManager) return; + + let roomObject: IRoomObjectController = null; + + if(roomId === 0) + { + const room = this._roomManager.getRoomInstance(RoomEngine.TEMPORARY_ROOM); + + if(room) roomObject = (room.getRoomObject(objectId, objectCategory) as IRoomObjectController); + } + else + { + roomObject = this.getRoomObjectFloor(roomId, objectId); + } + + if(!roomObject || !roomObject.logic) return; + + let badgeName = (groupBadge) ? this._sessionDataManager.loadGroupBadgeImage(badgeId) : this._sessionDataManager.loadBadgeImage(badgeId); + + if(!badgeName) + { + badgeName = 'loading_icon'; + + if(!this._badgeListenerObjects) this._badgeListenerObjects = new Map(); + + if(!this._badgeListenerObjects.size) + { + this._sessionDataManager.events.addEventListener(BadgeImageReadyEvent.IMAGE_READY, this.onBadgeImageReadyEvent); + } + + let listeners = this._badgeListenerObjects.get(badgeId); + + if(!listeners) listeners = []; + + listeners.push(new RoomObjectBadgeImageAssetListener(roomObject, groupBadge)); + + this._badgeListenerObjects.set(badgeId, listeners); + } + else + { + this.putBadgeInObjectAssets(roomObject, badgeId, groupBadge); + } + + roomObject.logic.processUpdateMessage(new ObjectGroupBadgeUpdateMessage(badgeId, badgeName)); + } + + private onBadgeImageReadyEvent(k: BadgeImageReadyEvent): void + { + if(!this._sessionDataManager) return; + + const listeners = this._badgeListenerObjects && this._badgeListenerObjects.get(k.badgeId); + + if(!listeners) return; + + for(const listener of listeners) + { + if(!listener) continue; + + this.putBadgeInObjectAssets(listener.object, k.badgeId, listener.groupBadge); + + const badgeName = (listener.groupBadge) ? this._sessionDataManager.loadGroupBadgeImage(k.badgeId) : this._sessionDataManager.loadBadgeImage(k.badgeId); + + if(listener.object && listener.object.logic) listener.object.logic.processUpdateMessage(new ObjectGroupBadgeUpdateMessage(k.badgeId, badgeName)); + } + + this._badgeListenerObjects.delete(k.badgeId); + + if(!this._badgeListenerObjects.size) + { + this._sessionDataManager.events.removeEventListener(BadgeImageReadyEvent.IMAGE_READY, this.onBadgeImageReadyEvent); + } + } + + private putBadgeInObjectAssets(object: IRoomObjectController, badgeId: string, groupBadge: boolean = false): void + { + if(!this._roomContentLoader || !this._sessionDataManager) return; + + const badgeName = (groupBadge) ? this._sessionDataManager.loadGroupBadgeImage(badgeId) : this._sessionDataManager.loadBadgeImage(badgeId); + const badgeImage = (groupBadge) ? this._sessionDataManager.getGroupBadgeImage(badgeId) : this._sessionDataManager.getBadgeImage(badgeId); + + if(badgeImage) this._roomContentLoader.addAssetToCollection(object.type, badgeName, badgeImage, false); + } + + public dispatchMouseEvent(canvasId: number, x: number, y: number, type: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean, buttonDown: boolean): void + { + const canvas = this.getRoomInstanceRenderingCanvas(this._activeRoomId, canvasId); + + if(!canvas) return; + + const overlay = this.getRenderingCanvasOverlay(canvas); + const sprite = this.getOverlayIconSprite(overlay, RoomEngine.OBJECT_ICON_SPRITE); + + if(sprite) + { + const rectangle = sprite.getLocalBounds(); + + sprite.x = (x - (rectangle.width / 2)); + sprite.y = (y - (rectangle.height / 2)); + } + + if(!this.handleRoomDragging(canvas, x, y, type, altKey, ctrlKey, shiftKey)) + { + if(!canvas.handleMouseEvent(x, y, type, altKey, ctrlKey, shiftKey, buttonDown)) + { + let eventType: string = null; + + if(type === MouseEventType.MOUSE_CLICK) + { + if(this.events) + { + this.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DESELECTED, this._activeRoomId, -1, RoomObjectCategory.MINIMUM)); + } + + eventType = RoomObjectMouseEvent.CLICK; + } + else + { + if(type === MouseEventType.MOUSE_MOVE) eventType = RoomObjectMouseEvent.MOUSE_MOVE; + + else if(type === MouseEventType.MOUSE_DOWN) eventType = RoomObjectMouseEvent.MOUSE_DOWN; + + else if(type === MouseEventType.MOUSE_DOWN_LONG) eventType = RoomObjectMouseEvent.MOUSE_DOWN_LONG; + + else if(type === MouseEventType.MOUSE_UP) eventType = RoomObjectMouseEvent.MOUSE_UP; + } + + this._roomObjectEventHandler.handleRoomObjectEvent(new RoomObjectMouseEvent(eventType, this.getRoomObject(this._activeRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM), null, altKey), this._activeRoomId); + } + } + + this._activeRoomActiveCanvas = canvasId; + this._activeRoomActiveCanvasMouseX = x; + this._activeRoomActiveCanvasMouseY = y; + } + + private handleRoomDragging(canvas: IRoomRenderingCanvas, x: number, y: number, type: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean): boolean + { + let offsetX = (x - this._activeRoomActiveCanvasMouseX); + let offsetY = (y - this._activeRoomActiveCanvasMouseY); + + if(type === MouseEventType.MOUSE_DOWN) + { + if(!altKey && !ctrlKey && !shiftKey && !this.isDecorating) + { + if(this._roomAllowsDragging) + { + this._activeRoomIsDragged = true; + this._activeRoomWasDragged = false; + this._activeRoomDragStartX = this._activeRoomActiveCanvasMouseX; + this._activeRoomDragStartY = this._activeRoomActiveCanvasMouseY; + } + } + } + + else if(type === MouseEventType.MOUSE_UP) + { + if(this._activeRoomIsDragged) + { + this._activeRoomIsDragged = false; + + if(this._activeRoomWasDragged) + { + const instanceData = this.getRoomInstanceData(this._activeRoomId); + + if(instanceData) + { + const camera = instanceData.roomCamera; + + if(camera) + { + if(this.useOffsetScrolling) + { + if(!camera.isMoving) + { + camera.centeredLocX = false; + camera.centeredLocY = false; + } + + camera.resetLocation(new Vector3d(-(canvas.screenOffsetX), -(canvas.screenOffsetY))); + } + + if(this._roomDraggingAlwaysCenters) camera.reset(); + } + } + } + } + } + + else if(type === MouseEventType.MOUSE_MOVE) + { + if(this._activeRoomIsDragged) + { + if(!this._activeRoomWasDragged) + { + offsetX = (x - this._activeRoomDragStartX); + offsetY = (y - this._activeRoomDragStartY); + + if(((((offsetX <= -(RoomEngine.DRAG_THRESHOLD)) || (offsetX >= RoomEngine.DRAG_THRESHOLD)) || (offsetY <= -(RoomEngine.DRAG_THRESHOLD))) || (offsetY >= RoomEngine.DRAG_THRESHOLD))) + { + this._activeRoomWasDragged = true; + } + + offsetX = 0; + offsetY = 0; + } + + if(((!(offsetX == 0)) || (!(offsetY == 0)))) + { + this._activeRoomDragX += offsetX; + this._activeRoomDragY += offsetY; + + this._activeRoomWasDragged = true; + } + } + } + + else if((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK)) + { + this._activeRoomIsDragged = false; + + if(this._activeRoomWasDragged) + { + this._activeRoomWasDragged = false; + + return true; + } + } + + return false; + } + + public updateMousePointer(type: string, objectId: number, objectType: string): void + { + const category = this.getRoomObjectCategoryForType(objectType); + + switch(type) + { + case RoomObjectFurnitureActionEvent.MOUSE_BUTTON: + this.setMouseButton(this._activeRoomId, category, objectId); + return; + default: + this.setMouseDefault(this._activeRoomId, category, objectId); + return; + } + } + + private setMouseButton(roomId: number, category: number, objectId: number): void + { + if(!this._roomSessionManager) return; + + const session = this._roomSessionManager.getSession(roomId); + + if(!session) return; + + if(((category !== RoomObjectCategory.FLOOR) && (category !== RoomObjectCategory.WALL)) || ((session.controllerLevel >= RoomControllerLevel.GUEST))) + { + const instanceData = this.getRoomInstanceData(roomId); + + if(instanceData) + { + if(instanceData.addButtonMouseCursorOwner((category + '_' + objectId))) this._mouseCursorUpdate = true; + } + } + } + + private setMouseDefault(roomId: number, category: number, objectId: number): void + { + if(!this._roomSessionManager) return; + + const instanceData = this.getRoomInstanceData(roomId); + + if(instanceData) + { + if(instanceData.removeButtonMouseCursorOwner((category + '_' + objectId))) this._mouseCursorUpdate = true; + } + } + + public processRoomObjectOperation(objectId: number, category: number, operation: string): boolean + { + if(!this._roomObjectEventHandler) return false; + + this._roomObjectEventHandler.modifyRoomObject(this._activeRoomId, objectId, category, operation); + } + + public modifyRoomObjectDataWithMap(objectId: number, category: number, operation: string, data: Map): boolean + { + if(!this._roomObjectEventHandler) return false; + + if(category !== RoomObjectCategory.FLOOR) return; + + this._roomObjectEventHandler.modifyRoomObjectDataWithMap(this._activeRoomId, objectId, category, operation, data); + } + + public modifyRoomObjectData(objectId: number, category: number, colorHex: string, data: string): boolean + { + if(!this._roomObjectEventHandler) return false; + + if(category !== RoomObjectCategory.WALL) return; + + this._roomObjectEventHandler.modifyWallItemData(this._activeRoomId, objectId, colorHex, data); + } + + private processRoomObjectEvent(event: RoomObjectEvent): void + { + if(!this._roomObjectEventHandler) return; + + const roomIdString = this.getRoomObjectRoomId(event.object); + + if(!roomIdString) return; + + const roomId = this.getRoomIdFromString(roomIdString); + + this._roomObjectEventHandler.handleRoomObjectEvent(event, roomId); + } + + public processRoomObjectPlacement(placementSource: string, id: number, category: number, typeId: number, extra: string = null, stuffData: IObjectData = null, state: number = -1, frameNumber: number = -1, posture: string = null): boolean + { + const roomInstance = this.getRoomInstance(this._activeRoomId); + + if(!roomInstance || (roomInstance.model.getValue(RoomVariableEnum.ROOM_IS_PUBLIC) !== 0)) return false; + + if(!this._roomObjectEventHandler) return false; + + return this._roomObjectEventHandler.processRoomObjectPlacement(placementSource, this._activeRoomId, id, category, typeId, extra, stuffData, state, frameNumber, posture); + } + + public getRoomObjectScreenLocation(roomId: number, objectId: number, objectType: number, canvasId: number = -1): Point + { + if(canvasId == -1) canvasId = this._activeRoomActiveCanvas; + + const geometry = this.getRoomInstanceGeometry(roomId, canvasId); + + if(!geometry) return null; + + const roomObject = this.getRoomObject(roomId, objectId, objectType); + + if(!roomObject) return null; + + const screenPoint = geometry.getScreenPoint(roomObject.getLocation()); + + if(!screenPoint) return null; + + const renderingCanvas = this.getRoomInstanceRenderingCanvas(roomId, canvasId); + + if(!renderingCanvas) return null; + + screenPoint.x = (screenPoint.x * renderingCanvas.scale); + screenPoint.y = (screenPoint.y * renderingCanvas.scale); + + screenPoint.x += ((renderingCanvas.width / 2) + renderingCanvas.screenOffsetX); + screenPoint.y += ((renderingCanvas.height / 2) + renderingCanvas.screenOffsetY); + + screenPoint.x = Math.round(screenPoint.x); + screenPoint.y = Math.round(screenPoint.y); + + return screenPoint; + } + + public selectRoomObject(roomId: number, objectId: number, objectCategory: number): void + { + if(!this._roomObjectEventHandler) return; + + this._roomObjectEventHandler.setSelectedObject(roomId, objectId, objectCategory); + } + + public setSelectedAvatar(roomId: number, objectId: number): void + { + if(this._roomObjectEventHandler) return; + + this._roomObjectEventHandler.setSelectedAvatar(roomId, objectId, true); + } + + public cancelRoomObjectInsert(): void + { + if(!this._roomObjectEventHandler) return; + + this._roomObjectEventHandler.cancelRoomObjectInsert(this._activeRoomId); + } + + private addOverlayIconSprite(k: NitroSprite, _arg_2: string, _arg_3: Texture, scale: number = 1): NitroSprite + { + if(!k || !_arg_3) return; + + let sprite = this.getOverlayIconSprite(k, _arg_2); + + if(sprite) return null; + + sprite = new NitroSprite(_arg_3); + + sprite.name = _arg_2; + + sprite.scale.set(scale); + + k.addChild(sprite); + + return sprite; + } + + public onRoomContentLoaded(id: number, assetName: string, success: boolean): void + { + if(!this._roomContentLoader || (id === -1)) return; + + this._thumbnailObjectIdBank.freeNumber((id - 1)); + + const listeners = this._thumbnailCallbacks.get(assetName); + + if(listeners) + { + this._thumbnailCallbacks.delete(assetName); + + const image = this._roomContentLoader.getImage(assetName); + + if(image) + { + for(const listener of listeners) + { + if(!listener) continue; + + listener.imageReady(id, null, image); + } + } + } + } + + public setObjectMoverIconSprite(objectId: number, category: number, _arg_3: boolean, instanceData: string = null, stuffData: IObjectData = null, state: number = -1, frameNumber: number = -1, posture: string = null): void + { + let type: string = null; + let colorIndex = 0; + let imageResult: IImageResult = null; + const scale = 1; + + if(_arg_3) + { + imageResult = this.getRoomObjectImage(this._activeRoomId, objectId, category, new Vector3d(), 1, null); + } + else + { + if(this._roomContentLoader) + { + if(category === RoomObjectCategory.FLOOR) + { + type = this._roomContentLoader.getFurnitureFloorNameForTypeId(objectId); + colorIndex = this._roomContentLoader.getFurnitureFloorColorIndex(objectId); + } + + else if(category === RoomObjectCategory.WALL) + { + type = this._roomContentLoader.getFurnitureWallNameForTypeId(objectId, instanceData); + colorIndex = this._roomContentLoader.getFurnitureWallColorIndex(objectId); + } + + if(category === RoomObjectCategory.UNIT) + { + type = RoomObjectUserType.getTypeString(objectId); + + if(type === 'pet') + { + type = this.getPetType(instanceData); + + const petFigureData = new PetFigureData(instanceData); + + imageResult = this.getRoomObjectPetImage(petFigureData.typeId, petFigureData.paletteId, petFigureData.color, new Vector3d(180), 64, null, true, 0, petFigureData.customParts, posture); + } + else + { + imageResult = this.getGenericRoomObjectImage(type, instanceData, new Vector3d(180), 64, null, 0, null, stuffData, state, frameNumber, posture); + } + } + else + { + imageResult = this.getGenericRoomObjectImage(type, colorIndex.toString(), new Vector3d(), 1, null, 0, instanceData, stuffData, state, frameNumber, posture); + } + } + } + + if(!imageResult || !imageResult.data) return; + + const canvas = this.getActiveRoomInstanceRenderingCanvas(); + + if(!canvas) return; + + const overlay = this.getRenderingCanvasOverlay(canvas); + + this.removeOverlayIconSprite(overlay, RoomEngine.OBJECT_ICON_SPRITE); + + const _local_15 = this.addOverlayIconSprite(overlay, RoomEngine.OBJECT_ICON_SPRITE, imageResult.data, scale); + + if(_local_15) + { + _local_15.x = (this._activeRoomActiveCanvasMouseX - (imageResult.data.width / 2)); + _local_15.y = (this._activeRoomActiveCanvasMouseY - (imageResult.data.height / 2)); + } + } + + public getRoomObjectImage(roomId: number, objectId: number, category: number, direction: IVector3D, scale: number, listener: IGetImageListener, bgColor: number = 0): IImageResult + { + if(!this._roomManager) return null; + + let id = -1; + let type: string = null; + let data: IObjectData = null; + let color = ''; + let extras: string = null; + + const roomIdString = this.getRoomId(roomId); + const roomInstance = this._roomManager.getRoomInstance(roomIdString); + + if(roomInstance) + { + const roomObject = roomInstance.getRoomObject(objectId, category); + + if(roomObject && roomObject.model) + { + id = roomObject.id; + type = roomObject.type; + + switch(category) + { + case RoomObjectCategory.FLOOR: + case RoomObjectCategory.WALL: { + color = (roomObject.model.getValue(RoomObjectVariable.FURNITURE_COLOR).toString()); + extras = roomObject.model.getValue(RoomObjectVariable.FURNITURE_EXTRAS); + + const dataFormat = roomObject.model.getValue(RoomObjectVariable.FURNITURE_DATA_FORMAT); + + if(dataFormat !== LegacyDataType.FORMAT_KEY) + { + data = ObjectDataFactory.getData(dataFormat); + + data.initializeFromRoomObjectModel(roomObject.model); + } + + break; + } + case RoomObjectCategory.UNIT: + color = roomObject.model.getValue(RoomObjectVariable.FIGURE); + break; + } + } + } + + return this.getGenericRoomObjectImage(type, color, direction, scale, listener, bgColor, extras, data, -1, -1, null, id); + } + + public getFurnitureFloorIconUrl(typeId: number): string + { + let type: string = null; + let color = ''; + + if(this._roomContentLoader) + { + type = this._roomContentLoader.getFurnitureFloorNameForTypeId(typeId); + color = (this._roomContentLoader.getFurnitureFloorColorIndex(typeId).toString()); + + return this._roomContentLoader.getAssetIconUrl(type, color); + } + + return null; + } + + public getFurnitureFloorIcon(typeId: number, listener: IGetImageListener, extras: string = null, objectData: IObjectData = null): IImageResult + { + return this.getFurnitureFloorImage(typeId, new Vector3d(), 1, listener, 0, extras, -1, -1, objectData); + } + + public getFurnitureWallIconUrl(typeId: number, extra: string = null): string + { + let type: string = null; + let color = ''; + + if(this._roomContentLoader) + { + type = this._roomContentLoader.getFurnitureWallNameForTypeId(typeId, extra); + color = (this._roomContentLoader.getFurnitureWallColorIndex(typeId).toString()); + + return this._roomContentLoader.getAssetIconUrl(type, color); + } + + return null; + } + + public getFurnitureWallIcon(typeId: number, listener: IGetImageListener, extras: string = null): IImageResult + { + return this.getFurnitureWallImage(typeId, new Vector3d(), 1, listener, 0, extras); + } + + public getFurnitureFloorImage(typeId: number, direction: IVector3D, scale: number, listener: IGetImageListener, bgColor: number = 0, extras: string = null, state: number = -1, frameCount: number = -1, objectData: IObjectData = null): IImageResult + { + let type: string = null; + let color = ''; + + if(this._roomContentLoader) + { + type = this._roomContentLoader.getFurnitureFloorNameForTypeId(typeId); + color = (this._roomContentLoader.getFurnitureFloorColorIndex(typeId).toString()); + } + + if((scale === 1) && listener) + { + return this.getGenericRoomObjectThumbnail(type, color, listener, extras, objectData); + } + + return this.getGenericRoomObjectImage(type, color, direction, scale, listener, bgColor, extras, objectData, state, frameCount); + } + + public getFurnitureWallImage(typeId: number, direction: IVector3D, scale: number, listener: IGetImageListener, bgColor: number = 0, extras: string = null, state: number = -1, frameCount: number = -1): IImageResult + { + let type: string = null; + let color = ''; + + if(this._roomContentLoader) + { + type = this._roomContentLoader.getFurnitureWallNameForTypeId(typeId); + color = this._roomContentLoader.getFurnitureWallColorIndex(typeId).toString(); + } + + if((scale === 1) && listener) + { + return this.getGenericRoomObjectThumbnail(type, color, listener, extras, null); + } + + return this.getGenericRoomObjectImage(type, color, direction, scale, listener, bgColor, extras, null, state, frameCount); + } + + public getRoomObjectPetImage(typeId: number, paletteId: number, color: number, direction: IVector3D, scale: number, listener: IGetImageListener, headOnly: boolean = false, bgColor: number = 0, customParts: IPetCustomPart[] = null, posture: string = null): IImageResult + { + let type: string = null; + let value = ((((typeId + ' ') + paletteId) + ' ') + color.toString(16)); + + if(headOnly) value = (value + (' ' + 'head')); + + if(customParts) + { + value = (value + (' ' + customParts.length)); + + for(const _local_13 of customParts) + { + value = (value + (((((' ' + _local_13.layerId) + ' ') + _local_13.partId) + ' ') + _local_13.paletteId)); + } + } + + if(this._roomContentLoader) type = this._roomContentLoader.getPetNameForType(typeId); + + return this.getGenericRoomObjectImage(type, value, direction, scale, listener, bgColor, null, null, -1, -1, posture); + } + + public getGenericRoomObjectImage(type: string, value: string, direction: IVector3D, scale: number, listener: IGetImageListener, bgColor: number = 0, extras: string = null, objectData: IObjectData = null, state: number = -1, frameCount: number = -1, posture: string = null, originalId: number = -1): IImageResult + { + if(!this._roomManager) return null; + + const imageResult = new ImageResult(); + + imageResult.id = -1; + + if(!this._ready || !type) return imageResult; + + let roomInstance = this._roomManager.getRoomInstance(RoomEngine.TEMPORARY_ROOM); + + if(!roomInstance) + { + roomInstance = this._roomManager.createRoomInstance(RoomEngine.TEMPORARY_ROOM); + + if(!roomInstance) return imageResult; + } + + let objectId = this._imageObjectIdBank.reserveNumber(); + const objectCategory = this.getRoomObjectCategoryForType(type); + + if(objectId < 0) return imageResult; + + objectId++; + + const roomObject = (roomInstance.createRoomObjectAndInitalize(objectId, type, objectCategory) as IRoomObjectController); + + if(!roomObject || !roomObject.model || !roomObject.logic) return imageResult; + + const model = roomObject.model; + + switch(objectCategory) + { + case RoomObjectCategory.FLOOR: + case RoomObjectCategory.WALL: + model.setValue(RoomObjectVariable.FURNITURE_COLOR, parseInt(value)); + model.setValue(RoomObjectVariable.FURNITURE_EXTRAS, extras); + break; + case RoomObjectCategory.UNIT: + if((type === RoomObjectUserType.USER) || (type === RoomObjectUserType.BOT) || (type === RoomObjectUserType.RENTABLE_BOT) || (type === RoomObjectUserType.PET)) + { + model.setValue(RoomObjectVariable.FIGURE, value); + } + else + { + const figureData = new PetFigureData(value); + + model.setValue(RoomObjectVariable.PET_PALETTE_INDEX, figureData.paletteId); + model.setValue(RoomObjectVariable.PET_COLOR, figureData.color); + + if(figureData.headOnly) model.setValue(RoomObjectVariable.PET_HEAD_ONLY, 1); + + if(figureData.hasCustomParts) + { + model.setValue(RoomObjectVariable.PET_CUSTOM_LAYER_IDS, figureData.customLayerIds); + model.setValue(RoomObjectVariable.PET_CUSTOM_PARTS_IDS, figureData.customPartIds); + model.setValue(RoomObjectVariable.PET_CUSTOM_PALETTE_IDS, figureData.customPaletteIds); + } + + if(posture) model.setValue(RoomObjectVariable.FIGURE_POSTURE, posture); + } + break; + case RoomObjectCategory.ROOM: + break; + } + + roomObject.setDirection(direction); + + const visualization = roomObject.visualization; + + if(!visualization) + { + roomInstance.removeRoomObject(objectId, objectCategory); + + return imageResult; + } + + if((state > -1) || objectData) + { + if(objectData && (objectData.getLegacyString() !== '')) + { + roomObject.logic.processUpdateMessage(new ObjectDataUpdateMessage(parseInt(objectData.getLegacyString()), objectData)); + } + else + { + roomObject.logic.processUpdateMessage(new ObjectDataUpdateMessage(state, objectData)); + } + } + + const geometry = new RoomGeometry(scale, new Vector3d(-135, 30, 0), new Vector3d(11, 11, 5)); + + visualization.update(geometry, 0, true, false); + + if(frameCount > 0) + { + let i = 0; + + while(i < frameCount) + { + visualization.update(geometry, 0, true, false); + + i++; + } + } + + const texture = visualization.getImage(bgColor, originalId); + + imageResult.data = texture; + imageResult.id = objectId; + + if(!this.isRoomContentTypeLoaded(type) && listener) + { + let imageListeners = this._imageCallbacks.get(objectId.toString()); + + if(!imageListeners) + { + imageListeners = []; + + this._imageCallbacks.set(objectId.toString(), imageListeners); + } + + imageListeners.push(listener); + + model.setValue(RoomObjectVariable.IMAGE_QUERY_SCALE, scale); + } + else + { + roomInstance.removeRoomObject(objectId, objectCategory); + + this._imageObjectIdBank.freeNumber((objectId - 1)); + + imageResult.id = 0; + } + + geometry.dispose(); + + return imageResult; + } + + public getGenericRoomObjectThumbnail(type: string, param: string, listener: IGetImageListener, extraData: string = null, stuffData: IObjectData = null): IImageResult + { + if(!this._roomManager) return null; + + const imageResult = new ImageResult(); + + imageResult.id = -1; + + if(!this._ready || !type) return imageResult; + + let roomInstance = this._roomManager.getRoomInstance(RoomEngine.TEMPORARY_ROOM); + + if(!roomInstance) + { + roomInstance = this._roomManager.createRoomInstance(RoomEngine.TEMPORARY_ROOM); + + if(!roomInstance) return imageResult; + } + + let objectId = this._thumbnailObjectIdBank.reserveNumber(); + const objectCategory = this.getRoomObjectCategoryForType(type); + + if(objectId < 0) return imageResult; + + objectId++; + + imageResult.id = objectId; + imageResult.data = null; + imageResult.image = null; + + const assetName = [type, param].join('_'); + + const asset = this._roomContentLoader.getImage(assetName); + + if(!asset && listener) + { + let contentListeners = this._thumbnailCallbacks.get(assetName); + + if(!contentListeners) + { + contentListeners = []; + + this._thumbnailCallbacks.set(assetName, contentListeners); + + this._roomContentLoader.downloadImage(objectId, type, param, null); + } + + contentListeners.push(listener); + } + else + { + if(asset) + { + imageResult.image = asset; + } + + this._thumbnailObjectIdBank.freeNumber((objectId - 1)); + + imageResult.id = 0; + } + + return imageResult; + } + + public initalizeTemporaryObjectsByType(type: string, _arg_2: boolean): void + { + const roomInstance = this._roomManager.getRoomInstance(RoomEngine.TEMPORARY_ROOM); + + if(!roomInstance || !this._roomContentLoader) return; + + const objectCategory = this._roomContentLoader.getCategoryForType(type); + const objectManager = roomInstance.getManager(objectCategory); + + let geometry: RoomGeometry = null; + let scale = 0; + + if(objectManager && objectManager.objects.length) + { + for(const roomObject of objectManager.objects.getValues()) + { + if(roomObject && roomObject.model && (roomObject.type === type)) + { + const objectId = roomObject.id; + const visualization = roomObject.visualization; + + let texture: RenderTexture = null; + + if(visualization) + { + const imageScale = roomObject.model.getValue(RoomObjectVariable.IMAGE_QUERY_SCALE); + + if(geometry && (scale !== imageScale)) + { + geometry.dispose(); + + geometry = null; + } + + if(!geometry) + { + scale = imageScale; + + geometry = new RoomGeometry(imageScale, new Vector3d(-135, 30, 0), new Vector3d(11, 11, 5)); + } + + visualization.update(geometry, 0, true, false); + + texture = visualization.image; + } + + roomInstance.removeRoomObject(objectId, objectCategory); + + this._imageObjectIdBank.freeNumber((objectId - 1)); + + const imageListeners = this._imageCallbacks.get(objectId.toString()); + + if(imageListeners) + { + this._imageCallbacks.delete(objectId.toString()); + + for(const imageListener of imageListeners) + { + if(!imageListener) continue; + + if(texture) imageListener.imageReady(objectId, texture); + else imageListener.imageFailed(objectId); + } + } + } + } + } + + if(geometry) geometry.dispose(); + } + + public setObjectMoverIconSpriteVisible(k: boolean): void + { + const canvas = this.getActiveRoomInstanceRenderingCanvas(); + + if(!canvas) return; + + const overlay = this.getRenderingCanvasOverlay(canvas); + const sprite = this.getOverlayIconSprite(overlay, RoomEngine.OBJECT_ICON_SPRITE); + + if(sprite) + { + sprite.visible = k; + } + } + + public removeObjectMoverIconSprite(): void + { + const canvas = this.getActiveRoomInstanceRenderingCanvas(); + + if(!canvas) return; + + const sprite = this.getRenderingCanvasOverlay(canvas); + + this.removeOverlayIconSprite(sprite, RoomEngine.OBJECT_ICON_SPRITE); + } + + private getRenderingCanvasOverlay(k: IRoomRenderingCanvas): NitroSprite + { + if(!k) return null; + + const displayObject = (k.master as Container); + + if(!displayObject) return null; + + return ((displayObject.getChildByName(RoomEngine.OVERLAY) as NitroSprite) || null); + } + + private removeOverlayIconSprite(k: NitroSprite, _arg_2: string): boolean + { + if(!k) return false; + + let index = (k.children.length - 1); + + while(index >= 0) + { + const child = (k.getChildAt(index) as NitroSprite); + + if(child) + { + if(child.name === _arg_2) + { + k.removeChildAt(index); + + if(child.children.length) + { + const firstChild = (child.getChildAt(0) as NitroSprite); + + firstChild.parent.removeChild(firstChild); + + firstChild.destroy(); + } + + return true; + } + } + + index--; + } + + return false; + } + + private getOverlayIconSprite(k: NitroSprite, _arg_2: string): NitroSprite + { + if(!k) return null; + + let index = (k.children.length - 1); + + while(index >= 0) + { + const child = (k.getChildAt(index) as NitroSprite); + + if(child) + { + if(child.name === _arg_2) return child; + } + + index--; + } + + return null; + } + + public getRoomObjects(roomId: number, category: number): IRoomObject[] + { + if(this._ready) + { + const _local_3 = this.getRoomId(roomId); + const _local_4 = this._roomManager.getRoomInstance(_local_3); + + + if(_local_4) return _local_4.getRoomObjectsForCategory(category); + } + + return []; + } + + protected addObjectToTileMap(k: number, _arg_2: IRoomObject): void + { + const tileObjectMap = this.getRoomInstanceData(k).tileObjectMap; + + if(tileObjectMap) tileObjectMap.addRoomObject(_arg_2); + } + + public refreshTileObjectMap(k: number, _arg_2: string): void + { + const tileObjectMap = this.getRoomInstanceData(k).tileObjectMap; + + if(tileObjectMap) tileObjectMap.populate(this.getRoomObjects(k, RoomObjectCategory.FLOOR)); + } + + public getRenderRoomMessage(k: Rectangle, _arg_2: number, _arg_3: boolean = false, _arg_4: boolean = true, _arg_5: boolean = false, canvasId: number = -1): IMessageComposer + { + let canvas: IRoomRenderingCanvas = null; + + if(canvasId > -1) + { + canvas = this.getRoomInstanceRenderingCanvas(this._activeRoomId, canvasId); + } + else + { + canvas = this.getActiveRoomInstanceRenderingCanvas(); + } + + if(!canvas) return null; + + if(_arg_5) + { + canvas.skipSpriteVisibilityChecking(); + } + + let _local_8 = -1; + + if(((!(_arg_4)) && (!(this._roomSessionManager.getSession(this._activeRoomId) == null)))) + { + _local_8 = this._roomSessionManager.getSession(this._activeRoomId).ownRoomIndex; + } + + const _local_9 = new SpriteDataCollector(); + const _local_10 = _local_9.getFurniData(k, canvas, this, _local_8); + const _local_11 = _local_9.getRoomRenderingModifiers(this); + const _local_12 = _local_9.getRoomPlanes(k, canvas, this, _arg_2); + + if(_arg_5) canvas.resumeSpriteVisibilityChecking(); + + if(_arg_3) + { + //return new RenderRoomThumbnailMessageComposer(_local_12, _local_10, _local_11, this._activeRoomId, this._sessionDataManager._Str_8500); + } + + NitroLogger.log(_local_10, _local_11, _local_12); + + //return new RenderRoomMessageComposer(_local_12, _local_10, _local_11, this._activeRoomId, this._sessionDataManager._Str_8500); + + return null; + } + + public createTextureFromRoom(roomId: number, canvasId: number = -1, bounds: Rectangle = null): RenderTexture + { + let canvas: IRoomRenderingCanvas = null; + + if(canvasId > -1) + { + canvas = this.getRoomInstanceRenderingCanvas(this._activeRoomId, canvasId); + } + else + { + canvas = this.getActiveRoomInstanceRenderingCanvas(); + } + + let texture: RenderTexture = null; + + if(bounds) + { + texture = TextureUtils.generateTexture(canvas.master, bounds); + } + else + { + texture = canvas.getDisplayAsTexture(); + } + + return texture; + } + + public saveTextureAsScreenshot(texture: RenderTexture, saveAsThumbnail: boolean = false): void + { + let composer: RenderRoomMessageComposer = null; + + if(saveAsThumbnail) composer = new RenderRoomThumbnailMessageComposer(); + else composer = new RenderRoomMessageComposer(); + + composer.assignBitmap(texture); + + this._communication.connection.send(composer); + } + + public saveBase64AsScreenshot(base64: string, saveAsThumbnail: boolean = false): void + { + let composer: RenderRoomMessageComposer = null; + + if(saveAsThumbnail) composer = new RenderRoomThumbnailMessageComposer(); + else composer = new RenderRoomMessageComposer(); + + composer.assignBase64(base64); + + this._communication.connection.send(composer); + } + + public objectsInitialized(k: string): void + { + const roomId = this.getRoomIdFromString(k); + + this.events.dispatchEvent(new RoomEngineEvent(RoomEngineEvent.OBJECTS_INITIALIZED, roomId)); + } + + public getRoomId(id: number): string + { + return (id.toString()); + } + + private getRoomIdFromString(roomId: string): number + { + if(!roomId) return -1; + + const split = roomId.split('_'); + + if(split.length <= 0) return -1; + + return (parseInt(split[0]) || 0); + } + + private getRoomObjectRoomId(object: IRoomObject): string + { + if(!object || !object.model) return null; + + return (object.model.getValue(RoomObjectVariable.OBJECT_ROOM_ID)); + } + + private getRoomObjectAdUrl(type: string): string + { + return this._roomContentLoader.getRoomObjectAdUrl(type); + } + + public getPetTypeId(figure: string): number + { + let type = -1; + + if(figure) + { + const parts = figure.split(' '); + + if(parts.length > 1) type = parseInt(parts[0]); + } + + return type; + } + + private getPetType(type: string): string + { + if(!type) return null; + + const parts = type.split(' '); + + if(parts.length > 1) + { + const typeId = parseInt(parts[0]); + + if(this._roomContentLoader) return this._roomContentLoader.getPetNameForType(typeId); + + return 'pet'; + } + + return null; + } + + public isRoomContentTypeLoaded(name: string): boolean + { + if(!this._roomContentLoader) return false; + + return (this._roomContentLoader.getCollection(name) !== null); + } + + public getPetColorResult(petIndex: number, paletteIndex: number): IPetColorResult + { + if(!this._roomContentLoader) return null; + + return this._roomContentLoader.getPetColorResult(petIndex, paletteIndex); + } + + public getPetColorResultsForTag(petIndex: number, tagName: string): IPetColorResult[] + { + if(!this._roomContentLoader) return null; + + return this._roomContentLoader.getPetColorResultsForTag(petIndex, tagName); + } + + public deleteRoomObject(objectId: number, objectCategory: number): boolean + { + if(!this._roomObjectEventHandler || (objectCategory !== RoomObjectCategory.WALL)) return false; + + return this._roomObjectEventHandler.deleteWallItem(this._activeRoomId, objectId); + } + + public get connection(): IConnection + { + return this._communication.connection; + } + + public get sessionDataManager(): ISessionDataManager + { + return this._sessionDataManager; + } + + public set sessionDataManager(manager: ISessionDataManager) + { + this._sessionDataManager = manager; + } + + public get roomSessionManager(): IRoomSessionManager + { + return this._roomSessionManager; + } + + public set roomSessionManager(manager: IRoomSessionManager) + { + this._roomSessionManager = manager; + } + + public get roomManager(): IRoomManager + { + return this._roomManager; + } + + public set roomManager(manager: IRoomManager) + { + this._roomManager = manager; + } + + public get objectEventHandler(): RoomObjectEventHandler + { + return this._roomObjectEventHandler; + } + + public get roomRendererFactory(): IRoomRendererFactory + { + return this._roomRendererFactory; + } + + public get visualizationFactory(): IRoomObjectVisualizationFactory + { + return this._visualizationFactory; + } + + public get logicFactory(): IRoomObjectLogicFactory + { + return this._logicFactory; + } + + public get activeRoomId(): number + { + return this._activeRoomId; + } + + public get ready(): boolean + { + return this._ready; + } + + public get roomContentLoader(): IRoomContentLoader + { + return this._roomContentLoader; + } + + public get isDecorating(): boolean + { + if(!this._roomSessionManager) return false; + + const session = this._roomSessionManager.getSession(this._activeRoomId); + + return (session && session.isDecorating) || false; + } + + private get useOffsetScrolling(): boolean + { + return true; + } + + public get selectedAvatarId(): number + { + if(!this._roomObjectEventHandler) return -1; + + return this._roomObjectEventHandler.selectedAvatarId; + } + + public getRoomObjectCount(roomId: number, categoryId: number): number + { + if(this._roomManager == null) return 0; + + return this._roomManager.getRoomInstance(roomId.toString()).getRoomObjectsForCategory(categoryId).length; + } +} diff --git a/submodules/renderer/src/nitro/room/RoomMessageHandler.ts b/submodules/renderer/src/nitro/room/RoomMessageHandler.ts new file mode 100644 index 0000000..ad1921c --- /dev/null +++ b/submodules/renderer/src/nitro/room/RoomMessageHandler.ts @@ -0,0 +1,1006 @@ +import { AvatarGuideStatus, IConnection, IRoomCreator, IVector3D, LegacyDataType, ObjectRolling, PetType, RoomObjectType, RoomObjectUserType, RoomObjectVariable, Vector3d } from '../../api'; +import { Disposable } from '../../core'; +import { DiceValueMessageEvent, FloorHeightMapEvent, FurnitureAliasesComposer, FurnitureAliasesEvent, FurnitureDataEvent, FurnitureFloorAddEvent, FurnitureFloorDataParser, FurnitureFloorEvent, FurnitureFloorRemoveEvent, FurnitureFloorUpdateEvent, FurnitureWallAddEvent, FurnitureWallDataParser, FurnitureWallEvent, FurnitureWallRemoveEvent, FurnitureWallUpdateEvent, GetRoomEntryDataMessageComposer, GuideSessionEndedMessageEvent, GuideSessionErrorMessageEvent, GuideSessionStartedMessageEvent, IgnoreResultEvent, ItemDataUpdateMessageEvent, ObjectsDataUpdateEvent, ObjectsRollingEvent, OneWayDoorStatusMessageEvent, PetExperienceEvent, PetFigureUpdateEvent, RoomEntryTileMessageEvent, RoomEntryTileMessageParser, RoomHeightMapEvent, RoomHeightMapUpdateEvent, RoomPaintEvent, RoomReadyMessageEvent, RoomUnitChatEvent, RoomUnitChatShoutEvent, RoomUnitChatWhisperEvent, RoomUnitDanceEvent, RoomUnitEffectEvent, RoomUnitEvent, RoomUnitExpressionEvent, RoomUnitHandItemEvent, RoomUnitIdleEvent, RoomUnitInfoEvent, RoomUnitNumberEvent, RoomUnitRemoveEvent, RoomUnitStatusEvent, RoomUnitTypingEvent, RoomVisualizationSettingsEvent, UserInfoEvent, YouArePlayingGameEvent } from '../communication'; +import { RoomPlaneParser } from './object/RoomPlaneParser'; +import { RoomVariableEnum } from './RoomVariableEnum'; +import { FurnitureStackingHeightMap, LegacyWallGeometry } from './utils'; + +export class RoomMessageHandler extends Disposable +{ + private _connection: IConnection; + private _roomCreator: IRoomCreator; + private _planeParser: RoomPlaneParser; + private _latestEntryTileEvent: RoomEntryTileMessageEvent; + + private _currentRoomId: number; + private _ownUserId: number; + private _initialConnection: boolean; + private _guideId: number; + private _requesterId: number; + + constructor(roomCreator: IRoomCreator) + { + super(); + + this._connection = null; + this._roomCreator = roomCreator; + this._planeParser = new RoomPlaneParser(); + this._latestEntryTileEvent = null; + + this._currentRoomId = 0; + this._ownUserId = 0; + this._initialConnection = true; + this._guideId = -1; + this._requesterId = -1; + } + + protected onDispose(): void + { + super.onDispose(); + + this._connection = null; + this._roomCreator = null; + this._latestEntryTileEvent = null; + + if(this._planeParser) + { + this._planeParser.dispose(); + + this._planeParser = null; + } + } + + public setConnection(connection: IConnection) + { + if(this._connection || !connection) return; + + this._connection = connection; + + this._connection.addMessageEvent(new UserInfoEvent(this.onUserInfoEvent.bind(this))); + this._connection.addMessageEvent(new RoomReadyMessageEvent(this.onRoomReadyMessageEvent.bind(this))); + this._connection.addMessageEvent(new RoomPaintEvent(this.onRoomPaintEvent.bind(this))); + this._connection.addMessageEvent(new FloorHeightMapEvent(this.onRoomModelEvent.bind(this))); + this._connection.addMessageEvent(new RoomHeightMapEvent(this.onRoomHeightMapEvent.bind(this))); + this._connection.addMessageEvent(new RoomHeightMapUpdateEvent(this.onRoomHeightMapUpdateEvent.bind(this))); + this._connection.addMessageEvent(new RoomVisualizationSettingsEvent(this.onRoomThicknessEvent.bind(this))); + this._connection.addMessageEvent(new RoomEntryTileMessageEvent(this.onRoomDoorEvent.bind(this))); + this._connection.addMessageEvent(new ObjectsRollingEvent(this.onRoomRollingEvent.bind(this))); + this._connection.addMessageEvent(new ObjectsDataUpdateEvent(this.onObjectsDataUpdateEvent.bind(this))); + this._connection.addMessageEvent(new FurnitureAliasesEvent(this.onFurnitureAliasesEvent.bind(this))); + this._connection.addMessageEvent(new FurnitureFloorAddEvent(this.onFurnitureFloorAddEvent.bind(this))); + this._connection.addMessageEvent(new FurnitureFloorEvent(this.onFurnitureFloorEvent.bind(this))); + this._connection.addMessageEvent(new FurnitureFloorRemoveEvent(this.onFurnitureFloorRemoveEvent.bind(this))); + this._connection.addMessageEvent(new FurnitureFloorUpdateEvent(this.onFurnitureFloorUpdateEvent.bind(this))); + this._connection.addMessageEvent(new FurnitureWallAddEvent(this.onFurnitureWallAddEvent.bind(this))); + this._connection.addMessageEvent(new FurnitureWallEvent(this.onFurnitureWallEvent.bind(this))); + this._connection.addMessageEvent(new FurnitureWallRemoveEvent(this.onFurnitureWallRemoveEvent.bind(this))); + this._connection.addMessageEvent(new FurnitureWallUpdateEvent(this.onFurnitureWallUpdateEvent.bind(this))); + this._connection.addMessageEvent(new FurnitureDataEvent(this.onFurnitureDataEvent.bind(this))); + this._connection.addMessageEvent(new ItemDataUpdateMessageEvent(this.onItemDataUpdateMessageEvent.bind(this))); + this._connection.addMessageEvent(new OneWayDoorStatusMessageEvent(this.onOneWayDoorStatusMessageEvent.bind(this))); + this._connection.addMessageEvent(new RoomUnitDanceEvent(this.onRoomUnitDanceEvent.bind(this))); + this._connection.addMessageEvent(new RoomUnitEffectEvent(this.onRoomUnitEffectEvent.bind(this))); + this._connection.addMessageEvent(new RoomUnitEvent(this.onRoomUnitEvent.bind(this))); + this._connection.addMessageEvent(new RoomUnitExpressionEvent(this.onRoomUnitExpressionEvent.bind(this))); + this._connection.addMessageEvent(new RoomUnitHandItemEvent(this.onRoomUnitHandItemEvent.bind(this))); + this._connection.addMessageEvent(new RoomUnitIdleEvent(this.onRoomUnitIdleEvent.bind(this))); + this._connection.addMessageEvent(new RoomUnitInfoEvent(this.onRoomUnitInfoEvent.bind(this))); + this._connection.addMessageEvent(new RoomUnitNumberEvent(this.onRoomUnitNumberEvent.bind(this))); + this._connection.addMessageEvent(new RoomUnitRemoveEvent(this.onRoomUnitRemoveEvent.bind(this))); + this._connection.addMessageEvent(new RoomUnitStatusEvent(this.onRoomUnitStatusEvent.bind(this))); + this._connection.addMessageEvent(new RoomUnitChatEvent(this.onRoomUnitChatEvent.bind(this))); + this._connection.addMessageEvent(new RoomUnitChatShoutEvent(this.onRoomUnitChatEvent.bind(this))); + this._connection.addMessageEvent(new RoomUnitChatWhisperEvent(this.onRoomUnitChatEvent.bind(this))); + this._connection.addMessageEvent(new RoomUnitTypingEvent(this.onRoomUnitTypingEvent.bind(this))); + this._connection.addMessageEvent(new PetFigureUpdateEvent(this.onPetFigureUpdateEvent.bind(this))); + this._connection.addMessageEvent(new PetExperienceEvent(this.onPetExperienceEvent.bind(this))); + this._connection.addMessageEvent(new YouArePlayingGameEvent(this.onYouArePlayingGameEvent.bind(this))); + this._connection.addMessageEvent(new DiceValueMessageEvent(this.onDiceValueMessageEvent.bind(this))); + this._connection.addMessageEvent(new IgnoreResultEvent(this.onIgnoreResultEvent.bind(this))); + this._connection.addMessageEvent(new GuideSessionStartedMessageEvent(this.onGuideSessionStartedMessageEvent.bind(this))); + this._connection.addMessageEvent(new GuideSessionEndedMessageEvent(this.onGuideSessionEndedMessageEvent.bind(this))); + this._connection.addMessageEvent(new GuideSessionErrorMessageEvent(this.onGuideSessionErrorMessageEvent.bind(this))); + } + + public setRoomId(id: number): void + { + if(this._currentRoomId !== 0) + { + if(this._roomCreator) this._roomCreator.destroyRoom(this._currentRoomId); + } + + this._currentRoomId = id; + this._latestEntryTileEvent = null; + } + + public clearRoomId(): void + { + this._currentRoomId = 0; + this._latestEntryTileEvent = null; + } + + private onUserInfoEvent(event: UserInfoEvent): void + { + if(!(event instanceof UserInfoEvent) || !event.connection) return; + + const parser = event.getParser(); + + if(!parser) return; + + this._ownUserId = parser.userInfo.userId; + } + + private onRoomReadyMessageEvent(event: RoomReadyMessageEvent): void + { + const parser = event.getParser(); + + if(this._currentRoomId !== parser.roomId) + { + this.setRoomId(parser.roomId); + } + + if(this._roomCreator) + { + this._roomCreator.setRoomInstanceModelName(parser.roomId, parser.name); + } + + if(this._initialConnection) + { + event.connection.send(new FurnitureAliasesComposer()); + + this._initialConnection = false; + + return; + } + + event.connection.send(new GetRoomEntryDataMessageComposer()); + } + + private onRoomPaintEvent(event: RoomPaintEvent): void + { + if(!(event instanceof RoomPaintEvent)) return; + + const parser = event.getParser(); + + if(!parser) return; + + const floorType = parser.floorType; + const wallType = parser.wallType; + const landscapeType = parser.landscapeType; + + if(this._roomCreator) + { + this._roomCreator.updateRoomInstancePlaneType(this._currentRoomId, floorType, wallType, landscapeType); + } + } + + private onRoomModelEvent(event: FloorHeightMapEvent): void + { + if(!(event instanceof FloorHeightMapEvent) || !event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + if(!parser) return; + + const wallGeometry = this._roomCreator.getLegacyWallGeometry(this._currentRoomId); + + if(!wallGeometry) return; + + this._planeParser.reset(); + + const width = parser.width; + const height = parser.height; + + this._planeParser.initializeTileMap(width, height); + + let entryTile: RoomEntryTileMessageParser = null; + + if(this._latestEntryTileEvent) entryTile = this._latestEntryTileEvent.getParser(); + + let doorX = -1; + let doorY = -1; + let doorZ = 0; + let doorDirection = 0; + + let y = 0; + + while(y < height) + { + let x = 0; + + while(x < width) + { + const tileHeight = parser.getHeight(x, y); + + if(((((y > 0) && (y < (height - 1))) || ((x > 0) && (x < (width - 1)))) && (!(tileHeight == RoomPlaneParser.TILE_BLOCKED))) && ((entryTile == null) || ((x == entryTile.x) && (y == entryTile.y)))) + { + if(((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight(x, (y + 1)) == RoomPlaneParser.TILE_BLOCKED)) + { + doorX = (x + 0.5); + doorY = y; + doorZ = tileHeight; + doorDirection = 90; + } + + if(((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight((x + 1), y) == RoomPlaneParser.TILE_BLOCKED)) + { + doorX = x; + doorY = (y + 0.5); + doorZ = tileHeight; + doorDirection = 180; + } + } + + this._planeParser.setTileHeight(x, y, tileHeight); + + x++; + } + + y++; + } + + this._planeParser.setTileHeight(Math.floor(doorX), Math.floor(doorY), doorZ); + this._planeParser.initializeFromTileData(parser.wallHeight); + this._planeParser.setTileHeight(Math.floor(doorX), Math.floor(doorY), (doorZ + this._planeParser.wallHeight)); + + if(parser.scale === 64) + { + this._planeParser.restrictsDragging = true; + this._planeParser.restrictsScaling = true; + this._planeParser.restrictedScale = 0.5; + } + else + { + this._planeParser.restrictsDragging = false; + this._planeParser.restrictsScaling = false; + this._planeParser.restrictedScale = 1; + } + + wallGeometry.scale = LegacyWallGeometry.DEFAULT_SCALE; + wallGeometry.initialize(width, height, this._planeParser.floorHeight); + + let heightIterator = (parser.height - 1); + + while(heightIterator >= 0) + { + let widthIterator = (parser.width - 1); + + while(widthIterator >= 0) + { + wallGeometry.setHeight(widthIterator, heightIterator, this._planeParser.getTileHeight(widthIterator, heightIterator)); + widthIterator--; + } + + heightIterator--; + } + + const roomMap = this._planeParser.getMapData(); + + roomMap.doors.push({ + x: doorX, + y: doorY, + z: doorZ, + dir: doorDirection + }); + + this._roomCreator.createRoomInstance(this._currentRoomId, roomMap); + } + + private onRoomHeightMapEvent(event: RoomHeightMapEvent): void + { + if(!(event instanceof RoomHeightMapEvent) || !event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + if(!parser) return; + + const width = parser.width; + const height = parser.height; + const heightMap = new FurnitureStackingHeightMap(width, height); + + let y = 0; + + while(y < height) + { + let x = 0; + + while(x < width) + { + heightMap.setTileHeight(x, y, parser.getTileHeight(x, y)); + heightMap.setStackingBlocked(x, y, parser.getStackingBlocked(x, y)); + heightMap.setIsRoomTile(x, y, parser.isRoomTile(x, y)); + + x++; + } + + y++; + } + + this._roomCreator.setFurnitureStackingHeightMap(this._currentRoomId, heightMap); + } + + private onRoomHeightMapUpdateEvent(event: RoomHeightMapUpdateEvent): void + { + if(!(event instanceof RoomHeightMapUpdateEvent) || !event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + if(!parser) return; + + const heightMap = this._roomCreator.getFurnitureStackingHeightMap(this._currentRoomId); + + if(!heightMap) return; + + while(parser.next()) + { + heightMap.setTileHeight(parser.x, parser.y, parser.tileHeight()); + heightMap.setStackingBlocked(parser.x, parser.y, parser.isStackingBlocked()); + heightMap.setIsRoomTile(parser.x, parser.y, parser.isRoomTile()); + } + + this._roomCreator.refreshTileObjectMap(this._currentRoomId, 'RoomMessageHandler.onRoomHeightMapUpdateEvent()'); + } + + private onRoomThicknessEvent(event: RoomVisualizationSettingsEvent): void + { + if(!(event instanceof RoomVisualizationSettingsEvent)) return; + + const parser = event.getParser(); + + if(!parser) return; + + const visibleWall = !parser.hideWalls; + const visibleFloor = true; + const thicknessWall = parser.thicknessWall; + const thicknessFloor = parser.thicknessFloor; + + if(this._roomCreator) + { + this._roomCreator.updateRoomInstancePlaneVisibility(this._currentRoomId, visibleWall, visibleFloor); + this._roomCreator.updateRoomInstancePlaneThickness(this._currentRoomId, thicknessWall, thicknessFloor); + } + } + + private onRoomDoorEvent(event: RoomEntryTileMessageEvent): void + { + if(!(event instanceof RoomEntryTileMessageEvent)) return; + + this._latestEntryTileEvent = event; + } + + private onRoomRollingEvent(event: ObjectsRollingEvent): void + { + if(!(event instanceof ObjectsRollingEvent) || !event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + this._roomCreator.updateRoomObjectFloor(this._currentRoomId, parser.rollerId, null, null, 1, null); + this._roomCreator.updateRoomObjectFloor(this._currentRoomId, parser.rollerId, null, null, 2, null); + + const furnitureRolling = parser.itemsRolling; + + if(furnitureRolling && furnitureRolling.length) + { + for(const rollData of furnitureRolling) + { + if(!rollData) continue; + + this._roomCreator.rollRoomObjectFloor(this._currentRoomId, rollData.id, rollData.location, rollData.targetLocation); + } + } + + const unitRollData = parser.unitRolling; + + if(unitRollData) + { + this._roomCreator.updateRoomObjectUserLocation(this._currentRoomId, unitRollData.id, unitRollData.location, unitRollData.targetLocation); + + const object = this._roomCreator.getRoomObjectUser(this._currentRoomId, unitRollData.id); + + if(object && object.type !== RoomObjectUserType.MONSTER_PLANT) + { + let posture = 'std'; + + switch(unitRollData.movementType) + { + case ObjectRolling.MOVE: + posture = 'mv'; + break; + case ObjectRolling.SLIDE: + posture = 'std'; + break; + } + + this._roomCreator.updateRoomObjectUserPosture(this._currentRoomId, unitRollData.id, posture); + } + } + } + + private onObjectsDataUpdateEvent(event: ObjectsDataUpdateEvent): void + { + if(!(event instanceof ObjectsDataUpdateEvent) || !event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + if(!parser) return; + + for(const object of parser.objects) + { + this._roomCreator.updateRoomObjectFloor(this._currentRoomId, object.id, null, null, object.state, object.data); + } + } + + private onFurnitureAliasesEvent(event: FurnitureAliasesEvent): void + { + if(!(event instanceof FurnitureAliasesEvent) || !event.connection || !this._roomCreator) return; + + const alises = event.getParser().aliases; + + this._connection.send(new GetRoomEntryDataMessageComposer()); + } + + private onFurnitureFloorAddEvent(event: FurnitureFloorAddEvent): void + { + if(!(event instanceof FurnitureFloorAddEvent) || !event.connection || !this._roomCreator) return; + + const item = event.getParser().item; + + if(!item) return; + + this.addRoomObjectFurnitureFloor(this._currentRoomId, item); + } + + private onFurnitureFloorEvent(event: FurnitureFloorEvent): void + { + if(!(event instanceof FurnitureFloorEvent) || !event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + if(!parser) return; + + const totalObjects = parser.items.length; + + let iterator = 0; + + while(iterator < totalObjects) + { + const object = parser.items[iterator]; + + if(object) this.addRoomObjectFurnitureFloor(this._currentRoomId, object); + + iterator++; + } + } + + private onFurnitureFloorRemoveEvent(event: FurnitureFloorRemoveEvent): void + { + if(!(event instanceof FurnitureFloorRemoveEvent) || !event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + if(!parser) return; + + if(parser.delay > 0) + { + setTimeout(() => + { + this._roomCreator.removeRoomObjectFloor(this._currentRoomId, parser.itemId, (parser.isExpired) ? -1 : parser.userId, true); + }, parser.delay); + } + else + { + this._roomCreator.removeRoomObjectFloor(this._currentRoomId, parser.itemId, (parser.isExpired) ? -1 : parser.userId, true); + } + } + + private onFurnitureFloorUpdateEvent(event: FurnitureFloorUpdateEvent): void + { + if(!(event instanceof FurnitureFloorUpdateEvent) || !event.connection || !this._roomCreator) return; + + const item = event.getParser().item; + + if(!item) return; + + const location: IVector3D = new Vector3d(item.x, item.y, item.z); + const direction: IVector3D = new Vector3d(item.direction); + + this._roomCreator.updateRoomObjectFloor(this._currentRoomId, item.itemId, location, direction, item.data.state, item.data, item.extra); + this._roomCreator.updateRoomObjectFloorHeight(this._currentRoomId, item.itemId, item.stackHeight); + this._roomCreator.updateRoomObjectFloorExpiration(this._currentRoomId, item.itemId, item.expires); + } + + private onFurnitureWallAddEvent(event: FurnitureWallAddEvent): void + { + if(!(event instanceof FurnitureWallAddEvent) || !event.connection || !this._roomCreator) return; + + const data = event.getParser().item; + + if(!data) return; + + this.addRoomObjectFurnitureWall(this._currentRoomId, data); + } + + private onFurnitureWallEvent(event: FurnitureWallEvent): void + { + if(!(event instanceof FurnitureWallEvent) || !event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + if(!parser) return; + + const totalObjects = parser.items.length; + + let iterator = 0; + + while(iterator < totalObjects) + { + const data = parser.items[iterator]; + + if(data) this.addRoomObjectFurnitureWall(this._currentRoomId, data); + + iterator++; + } + } + + private onFurnitureWallRemoveEvent(event: FurnitureWallRemoveEvent): void + { + if(!(event instanceof FurnitureWallRemoveEvent) || !event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + if(!parser) return; + + this._roomCreator.removeRoomObjectWall(this._currentRoomId, parser.itemId, parser.userId); + } + + private onFurnitureWallUpdateEvent(event: FurnitureWallUpdateEvent): void + { + if(!(event instanceof FurnitureWallUpdateEvent) || !event.connection || !this._roomCreator) return; + + const wallGeometry = this._roomCreator.getLegacyWallGeometry(this._currentRoomId); + + if(!wallGeometry) return; + + const item = event.getParser().item; + + if(!item) return; + + const location = wallGeometry.getLocation(item.width, item.height, item.localX, item.localY, item.direction); + const direction = new Vector3d(wallGeometry.getDirection(item.direction)); + + this._roomCreator.updateRoomObjectWall(this._currentRoomId, item.itemId, location, direction, item.state, item.stuffData); + this._roomCreator.updateRoomObjectWallExpiration(this._currentRoomId, item.itemId, item.secondsToExpiration); + } + + private onFurnitureDataEvent(event: FurnitureDataEvent): void + { + if(!(event instanceof FurnitureDataEvent) || !event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + this._roomCreator.updateRoomObjectFloor(this._currentRoomId, parser.furnitureId, null, null, parser.objectData.state, parser.objectData); + } + + private onItemDataUpdateMessageEvent(event: ItemDataUpdateMessageEvent): void + { + if(!(event instanceof ItemDataUpdateMessageEvent) || !event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + this._roomCreator.updateRoomObjectWallItemData(this._currentRoomId, parser.furnitureId, parser.data); + } + + private onOneWayDoorStatusMessageEvent(event: OneWayDoorStatusMessageEvent): void + { + if(!(event instanceof OneWayDoorStatusMessageEvent) || !event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + this._roomCreator.updateRoomObjectFloor(this._currentRoomId, parser.itemId, null, null, parser.state, new LegacyDataType()); + } + + private onDiceValueMessageEvent(event: DiceValueMessageEvent): void + { + if(!(event instanceof DiceValueMessageEvent) || !event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + this._roomCreator.updateRoomObjectFloor(this._currentRoomId, parser.itemId, null, null, parser.value, new LegacyDataType()); + } + + private onRoomUnitDanceEvent(event: RoomUnitDanceEvent): void + { + if(!(event instanceof RoomUnitDanceEvent) || !event.connection || !this._roomCreator) return; + + this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_DANCE, event.getParser().danceId); + } + + private onRoomUnitEffectEvent(event: RoomUnitEffectEvent): void + { + if(!(event instanceof RoomUnitEffectEvent) || !event.connection || !this._roomCreator) return; + + this._roomCreator.updateRoomObjectUserEffect(this._currentRoomId, event.getParser().unitId, event.getParser().effectId, event.getParser().delay); + } + + private onRoomUnitEvent(event: RoomUnitEvent): void + { + if(!(event instanceof RoomUnitEvent) || !event.connection || !this._roomCreator) return; + + const users = event.getParser().users; + + if(!users || !users.length) return; + + for(const user of users) + { + if(!user) continue; + + const location = new Vector3d(user.x, user.y, user.z); + const direction = new Vector3d(user.dir); + + this._roomCreator.addRoomObjectUser(this._currentRoomId, user.roomIndex, location, direction, user.dir, user.userType, user.figure); + + if(user.webID === this._ownUserId) + { + this._roomCreator.setRoomSessionOwnUser(this._currentRoomId, user.roomIndex); + this._roomCreator.updateRoomObjectUserOwn(this._currentRoomId, user.roomIndex); + } + + this._roomCreator.updateRoomObjectUserFigure(this._currentRoomId, user.roomIndex, user.figure, user.sex, user.subType, user.isRiding); + + if(RoomObjectUserType.getTypeString(user.userType) === RoomObjectUserType.PET) + { + if(this._roomCreator.getPetTypeId(user.figure) === PetType.MONSTERPLANT) + { + this._roomCreator.updateRoomObjectUserPosture(this._currentRoomId, user.roomIndex, user.petPosture); + } + } + + this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, user.roomIndex, RoomObjectVariable.FIGURE_IS_MUTED, (this._roomCreator.sessionDataManager.isUserIgnored(user.name) ? 1 : 0)); + } + + this.updateGuideMarker(); + } + + private onRoomUnitExpressionEvent(event: RoomUnitExpressionEvent): void + { + if(!(event instanceof RoomUnitExpressionEvent) || !event.connection || !this._roomCreator) return; + + this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_EXPRESSION, event.getParser().expression); + } + + private onRoomUnitHandItemEvent(event: RoomUnitHandItemEvent): void + { + if(!(event instanceof RoomUnitHandItemEvent) || !event.connection || !this._roomCreator) return; + + this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_CARRY_OBJECT, event.getParser().handId); + } + + private onRoomUnitIdleEvent(event: RoomUnitIdleEvent): void + { + if(!(event instanceof RoomUnitIdleEvent) || !event.connection || !this._roomCreator) return; + + this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_SLEEP, (event.getParser().isIdle ? 1 : 0)); + } + + private onRoomUnitInfoEvent(event: RoomUnitInfoEvent): void + { + if(!(event instanceof RoomUnitInfoEvent) || !event.connection || !this._roomCreator) return; + + this._roomCreator.updateRoomObjectUserFigure(this._currentRoomId, event.getParser().unitId, event.getParser().figure, event.getParser().gender); + } + + private onRoomUnitNumberEvent(event: RoomUnitNumberEvent): void + { + if(!(event instanceof RoomUnitNumberEvent) || !event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + if(!parser) return; + + this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, parser.unitId, RoomObjectVariable.FIGURE_NUMBER_VALUE, parser.value); + } + + private onRoomUnitRemoveEvent(event: RoomUnitRemoveEvent): void + { + if(!(event instanceof RoomUnitRemoveEvent) || !event.connection || !this._roomCreator) return; + + this._roomCreator.removeRoomObjectUser(this._currentRoomId, event.getParser().unitId); + + this.updateGuideMarker(); + } + + private onRoomUnitStatusEvent(event: RoomUnitStatusEvent): void + { + if(!(event instanceof RoomUnitStatusEvent) || !event.connection || !this._roomCreator) return; + + const statuses = event.getParser().statuses; + + if(!statuses || !statuses.length) return; + + const roomInstance = this._roomCreator.getRoomInstance(this._currentRoomId); + + if(!roomInstance) return; + + const zScale = (roomInstance.model.getValue(RoomVariableEnum.ROOM_Z_SCALE) || 1); + + for(const status of statuses) + { + if(!status) continue; + + let height = status.height; + + if(height) height = (height / zScale); + + const location = new Vector3d(status.x, status.y, (status.z + height)); + const direction = new Vector3d(status.direction); + + let goal: IVector3D = null; + + if(status.didMove) goal = new Vector3d(status.targetX, status.targetY, status.targetZ); + + this._roomCreator.updateRoomObjectUserLocation(this._currentRoomId, status.id, location, goal, status.canStandUp, height, direction, status.headDirection); + this._roomCreator.updateRoomObjectUserFlatControl(this._currentRoomId, status.id, null); + + let isPosture = true; + let postureUpdate = false; + let postureType = RoomObjectVariable.STD; + let parameter = ''; + + if(status.actions && status.actions.length) + { + for(const action of status.actions) + { + if(!action) continue; + + switch(action.action) + { + case 'flatctrl': + this._roomCreator.updateRoomObjectUserFlatControl(this._currentRoomId, status.id, action.value); + break; + case 'sign': + if(status.actions.length === 1) isPosture = false; + + this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, status.id, RoomObjectVariable.FIGURE_SIGN, parseInt(action.value)); + break; + case 'gst': + if(status.actions.length === 1) isPosture = false; + + this._roomCreator.updateRoomObjectUserPetGesture(this._currentRoomId, status.id, action.value); + break; + case 'wav': + case 'mv': + postureUpdate = true; + postureType = action.action; + parameter = action.value; + break; + case 'trd': break; + default: + postureUpdate = true; + postureType = action.action; + parameter = action.value; + break; + } + } + } + + if(postureUpdate) this._roomCreator.updateRoomObjectUserPosture(this._currentRoomId, status.id, postureType, parameter); + else if(isPosture) this._roomCreator.updateRoomObjectUserPosture(this._currentRoomId, status.id, RoomObjectVariable.STD, ''); + } + + this.updateGuideMarker(); + } + + private onRoomUnitChatEvent(event: RoomUnitChatEvent): void + { + if(!event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + if(!parser) return; + + this._roomCreator.updateRoomObjectUserGesture(this._currentRoomId, parser.roomIndex, parser.gesture); + this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, parser.roomIndex, RoomObjectVariable.FIGURE_TALK, (parser.message.length / 10)); + } + + private onRoomUnitTypingEvent(event: RoomUnitTypingEvent): void + { + if(!(event instanceof RoomUnitTypingEvent) || !event.connection || !this._roomCreator) return; + + this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, event.getParser().unitId, RoomObjectVariable.FIGURE_IS_TYPING, event.getParser().isTyping ? 1 : 0); + } + + private onPetFigureUpdateEvent(event: PetFigureUpdateEvent): void + { + if(!(event instanceof PetFigureUpdateEvent) || !event.connection || !this._roomCreator) return; + + const parser = event.getParser(); + + if(!parser) return; + + this._roomCreator.updateRoomObjectUserFigure(this._currentRoomId, parser.roomIndex, parser.figureData.figuredata, '', '', parser.isRiding); + } + + private onPetExperienceEvent(event: PetExperienceEvent): void + { + const parser = event.getParser(); + + if(!parser) return; + + this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, parser.roomIndex, RoomObjectVariable.FIGURE_GAINED_EXPERIENCE, parser.gainedExperience); + } + + private onYouArePlayingGameEvent(event: YouArePlayingGameEvent): void + { + if(!event) return; + + const parser = event.getParser(); + + if(!parser) return; + + this._roomCreator.setRoomEngineGameMode(this._currentRoomId, parser.isPlaying); + } + + private addRoomObjectFurnitureFloor(roomId: number, data: FurnitureFloorDataParser): void + { + if(!data || !this._roomCreator) return; + + const location = new Vector3d(data.x, data.y, data.z); + const direction = new Vector3d(data.direction); + + if(data.spriteName) + { + this._roomCreator.addFurnitureFloorByTypeName(roomId, data.itemId, data.spriteName, location, direction, data.state, data.data, data.extra, data.expires, data.usagePolicy, data.userId, data.username, true, true, data.stackHeight); + } + else + { + this._roomCreator.addFurnitureFloor(roomId, data.itemId, data.spriteId, location, direction, data.state, data.data, data.extra, data.expires, data.usagePolicy, data.userId, data.username, true, true, data.stackHeight); + } + } + + private addRoomObjectFurnitureWall(roomId: number, data: FurnitureWallDataParser): void + { + if(!data || !this._roomCreator) return; + + const wallGeometry = this._roomCreator.getLegacyWallGeometry(roomId); + + if(!wallGeometry) return; + + let location: IVector3D = null; + + if(!data.isOldFormat) + { + location = wallGeometry.getLocation(data.width, data.height, data.localX, data.localY, data.direction); + } + else + { + //location = wallGeometry.getLocationOldFormat(data.y, data.z, data.direction); + } + + const direction = new Vector3d(wallGeometry.getDirection(data.direction)); + + this._roomCreator.addFurnitureWall(roomId, data.itemId, data.spriteId, location, direction, data.state, data.stuffData, data.secondsToExpiration, data.usagePolicy, data.userId, data.username); + } + + private onIgnoreResultEvent(event: IgnoreResultEvent): void + { + if(!event) return; + + const parser = event.getParser(); + + if(!parser) return; + + const roomSession = this._roomCreator.roomSessionManager.getSession(this._currentRoomId); + + if(!roomSession) return; + + const userData = roomSession.userDataManager.getUserDataByName(parser.name); + + if(!userData) return; + + switch(parser.result) + { + case 1: + case 2: + this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, userData.roomIndex, RoomObjectVariable.FIGURE_IS_MUTED, 1); + return; + case 3: + this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, userData.roomIndex, RoomObjectVariable.FIGURE_IS_MUTED, 0); + return; + } + } + + private onGuideSessionStartedMessageEvent(event: GuideSessionStartedMessageEvent): void + { + const parser = event.getParser(); + + this._guideId = parser.guideUserId; + this._requesterId = parser.requesterUserId; + + this.updateGuideMarker(); + } + + private onGuideSessionEndedMessageEvent(k: GuideSessionEndedMessageEvent): void + { + this.removeGuideMarker(); + } + + private onGuideSessionErrorMessageEvent(k: GuideSessionErrorMessageEvent): void + { + this.removeGuideMarker(); + } + + private updateGuideMarker(): void + { + const userId = this._roomCreator.sessionDataManager.userId; + + this.setUserGuideStatus(this._guideId, ((this._requesterId === userId) ? AvatarGuideStatus.GUIDE : AvatarGuideStatus.NONE)); + this.setUserGuideStatus(this._requesterId, ((this._guideId === userId) ? AvatarGuideStatus.REQUESTER : AvatarGuideStatus.NONE)); + } + + private removeGuideMarker(): void + { + this.setUserGuideStatus(this._guideId, AvatarGuideStatus.NONE); + this.setUserGuideStatus(this._requesterId, AvatarGuideStatus.NONE); + + this._guideId = -1; + this._requesterId = -1; + } + + private setUserGuideStatus(userId: number, status: number): void + { + if(!this._roomCreator || !this._roomCreator.roomSessionManager) return; + + const roomSession = this._roomCreator.roomSessionManager.getSession(this._currentRoomId); + + if(!roomSession) return; + + const userData = roomSession.userDataManager.getDataByType(userId, RoomObjectType.USER); + + if(!userData) return; + + this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, userData.roomIndex, RoomObjectVariable.FIGURE_GUIDE_STATUS, status); + } + + // public _SafeStr_10580(event:_SafeStr_2242): void + // { + // var arrayIndex: number; + // var discoColours:Array; + // var discoTimer:Timer; + // var eventParser:_SafeStr_4576 = (event.parser as _SafeStr_4576); + // switch (eventParser._SafeStr_7025) + // { + // case 0: + // _SafeStr_4588.init(250, 5000); + // _SafeStr_4588._SafeStr_6766(); + // return; + // case 1: + // _SafeStr_4231.init(250, 5000); + // _SafeStr_4231._SafeStr_6766(); + // return; + // case 2: + // this._SafeStr_10592.roomSessionManager.events.dispatchEvent(new _SafeStr_2821(this._SafeStr_10593, -1, true)); + // return; + // case 3: + // arrayIndex = 0; + // discoColours = [29371, 16731195, 16764980, 0x99FF00, 29371, 16731195, 16764980, 0x99FF00, 0]; + // discoTimer = new Timer(1000, (discoColours.length + 1)); + // discoTimer.addEventListener(TimerEvent.TIMER, function (k:TimerEvent): void + // { + // if (arrayIndex == discoColours.length) + // { + // _SafeStr_10592._SafeStr_21164(_SafeStr_10593, discoColours[arrayIndex++], 176, true); + // } else + // { + // _SafeStr_10592._SafeStr_21164(_SafeStr_10593, discoColours[arrayIndex++], 176, false); + // }; + // }); + // discoTimer.start(); + // return; + // }; + // } + + public get currentRoomId(): number + { + return this._currentRoomId; + } +} diff --git a/submodules/renderer/src/nitro/room/RoomObjectEventHandler.ts b/submodules/renderer/src/nitro/room/RoomObjectEventHandler.ts new file mode 100644 index 0000000..5731eba --- /dev/null +++ b/submodules/renderer/src/nitro/room/RoomObjectEventHandler.ts @@ -0,0 +1,2224 @@ +import { IFurnitureStackingHeightMap, ILegacyWallGeometry, IObjectData, IRoomCanvasMouseListener, IRoomEngineServices, IRoomGeometry, IRoomObject, IRoomObjectController, IRoomObjectEventManager, ISelectedRoomObjectData, IVector3D, MouseEventType, NitroConfiguration, NitroLogger, RoomObjectCategory, RoomObjectOperationType, RoomObjectPlacementSource, RoomObjectType, RoomObjectUserType, RoomObjectVariable, Vector3d } from '../../api'; +import { Disposable } from '../../core'; +import { RoomEngineDimmerStateEvent, RoomEngineObjectEvent, RoomEngineObjectPlacedEvent, RoomEngineObjectPlacedOnUserEvent, RoomEngineObjectPlaySoundEvent, RoomEngineRoomAdEvent, RoomEngineSamplePlaybackEvent, RoomEngineTriggerWidgetEvent, RoomEngineUseProductEvent, RoomObjectBadgeAssetEvent, RoomObjectDataRequestEvent, RoomObjectDimmerStateUpdateEvent, RoomObjectEvent, RoomObjectFloorHoleEvent, RoomObjectFurnitureActionEvent, RoomObjectHSLColorEnabledEvent, RoomObjectHSLColorEnableEvent, RoomObjectMouseEvent, RoomObjectMoveEvent, RoomObjectPlaySoundIdEvent, RoomObjectRoomAdEvent, RoomObjectSamplePlaybackEvent, RoomObjectSoundMachineEvent, RoomObjectStateChangedEvent, RoomObjectTileMouseEvent, RoomObjectWallMouseEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '../../events'; +import { RoomEnterEffect, RoomId, RoomObjectUpdateMessage } from '../../room'; +import { BotPlaceComposer, FurnitureColorWheelComposer, FurnitureDiceActivateComposer, FurnitureDiceDeactivateComposer, FurnitureFloorUpdateComposer, FurnitureGroupInfoComposer, FurnitureMultiStateComposer, FurnitureOneWayDoorComposer, FurniturePickupComposer, FurniturePlaceComposer, FurniturePostItPlaceComposer, FurnitureRandomStateComposer, FurnitureWallMultiStateComposer, FurnitureWallUpdateComposer, GetItemDataComposer, GetResolutionAchievementsMessageComposer, PetMoveComposer, PetPlaceComposer, RemoveWallItemComposer, RoomUnitLookComposer, RoomUnitWalkComposer, SetItemDataMessageComposer, SetObjectDataMessageComposer } from '../communication'; +import { Nitro } from '../Nitro'; +import { ObjectAvatarSelectedMessage, ObjectDataUpdateMessage, ObjectSelectedMessage, ObjectTileCursorUpdateMessage, ObjectVisibilityUpdateMessage } from './messages'; +import { SelectedRoomObjectData } from './utils'; + +export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMouseListener, IRoomObjectEventManager +{ + private _roomEngine: IRoomEngineServices; + + private _eventIds: Map>; + + private _selectedAvatarId: number; + private _selectedObjectId: number; + private _selectedObjectCategory: number; + private _whereYouClickIsWhereYouGo: boolean; + private _objectPlacementSource: string; + + constructor(roomEngine: IRoomEngineServices) + { + super(); + + this._roomEngine = roomEngine; + + this._eventIds = new Map(); + + this._selectedAvatarId = -1; + this._selectedObjectId = -1; + this._selectedObjectCategory = -2; + this._whereYouClickIsWhereYouGo = true; + this._objectPlacementSource = null; + + this.onRoomEngineObjectEvent = this.onRoomEngineObjectEvent.bind(this); + + this._roomEngine.events.addEventListener(RoomEngineObjectEvent.ADDED, this.onRoomEngineObjectEvent); + } + + public dispose(): void + { + if(this._eventIds) + { + this._eventIds = null; + } + + this._roomEngine.events.removeEventListener(RoomEngineObjectEvent.ADDED, this.onRoomEngineObjectEvent); + + this._roomEngine = null; + } + + private onRoomEngineObjectEvent(event: RoomEngineObjectEvent): void + { + let selectedData = this.getSelectedRoomObjectData(event.roomId); + + if(!selectedData) return; + + if((selectedData.operation === RoomObjectOperationType.OBJECT_PLACE) && (selectedData.id === event.objectId)) + { + const roomObject = this._roomEngine.getRoomObject(event.roomId, selectedData.id, selectedData.category); + + if(roomObject && roomObject.model) + { + if(selectedData.category === RoomObjectCategory.FLOOR) + { + const allowedDirections = roomObject.model.getValue(RoomObjectVariable.FURNITURE_ALLOWED_DIRECTIONS); + + if(allowedDirections && allowedDirections.length) + { + const direction = new Vector3d(allowedDirections[0]); + + roomObject.setDirection(direction); + + this.updateSelectedObjectData(event.roomId, selectedData.id, selectedData.category, selectedData.loc, direction, selectedData.operation, selectedData.typeId, selectedData.instanceData, selectedData.stuffData, selectedData.state, selectedData.animFrame, selectedData.posture); + + selectedData = this.getSelectedRoomObjectData(event.roomId); + + if(!selectedData) return; + } + } + } + + this.setFurnitureAlphaMultiplier(roomObject, 0.5); + } + } + + public processRoomCanvasMouseEvent(event: RoomSpriteMouseEvent, object: IRoomObject, geometry: IRoomGeometry): void + { + if(!event || !object) return; + + if(RoomEnterEffect.isRunning()) return; + + const type = object.type; + + let category = this._roomEngine.getRoomObjectCategoryForType(type); + + if((category !== RoomObjectCategory.ROOM) && (!this._roomEngine.isPlayingGame() || category !== RoomObjectCategory.UNIT)) category = RoomObjectCategory.MINIMUM; + + const _local_7 = this.getMouseEventId(category, event.type); + + if(_local_7 === event.eventId) + { + if((event.type === MouseEventType.MOUSE_CLICK) || (event.type === MouseEventType.DOUBLE_CLICK) || (event.type === MouseEventType.MOUSE_DOWN) || (event.type === MouseEventType.MOUSE_UP) || (event.type === MouseEventType.MOUSE_MOVE)) return; + } + else + { + if(event.eventId) + { + this.setMouseEventId(category, event.type, event.eventId); + } + } + + if(object.mouseHandler) object.mouseHandler.mouseEvent(event, geometry); + } + + public processRoomObjectPlacement(placementSource: string, roomId: number, id: number, category: number, typeId: number, extra: string = null, stuffData: IObjectData = null, state: number = -1, frameNumber: number = -1, posture: string = null): boolean + { + this._objectPlacementSource = placementSource; + + const location = new Vector3d(-100, -100); + const direction = new Vector3d(0); + + this.setSelectedRoomObjectData(roomId, id, category, location, direction, RoomObjectOperationType.OBJECT_PLACE, typeId, extra, stuffData, state, frameNumber, posture); + + if(this._roomEngine) + { + this._roomEngine.setObjectMoverIconSprite(typeId, category, false, extra, stuffData, state, frameNumber, posture); + this._roomEngine.setObjectMoverIconSpriteVisible(false); + } + + return true; + } + + public cancelRoomObjectInsert(k: number): boolean + { + this.resetSelectedObjectData(k); + + return true; + } + + private getMouseEventId(k: number, _arg_2: string): string + { + const existing = this._eventIds.get(k); + + if(!existing) return null; + + return (existing.get(_arg_2) || null); + } + + private setMouseEventId(k: number, _arg_2: string, _arg_3: string): void + { + let existing = this._eventIds.get(k); + + if(!existing) + { + existing = new Map(); + + this._eventIds.set(k, existing); + } + + existing.delete(_arg_2); + existing.set(_arg_2, _arg_3); + } + + + public handleRoomObjectEvent(event: RoomObjectEvent, roomId: number): void + { + if(!event) return; + + if(event instanceof RoomObjectMouseEvent) + { + this.handleRoomObjectMouseEvent(event, roomId); + + return; + } + + switch(event.type) + { + case RoomObjectStateChangedEvent.STATE_CHANGE: + case RoomObjectStateChangedEvent.STATE_RANDOM: + this.onRoomObjectStateChangedEvent((event as RoomObjectStateChangedEvent), roomId); + return; + case RoomObjectDimmerStateUpdateEvent.DIMMER_STATE: + this.onRoomObjectDimmerStateUpdateEvent((event as RoomObjectDimmerStateUpdateEvent), roomId); + return; + case RoomObjectMoveEvent.POSITION_CHANGED: + case RoomObjectMoveEvent.OBJECT_REMOVED: + this.handleSelectedObjectRemove((event as RoomObjectMoveEvent), roomId); + return; + case RoomObjectWidgetRequestEvent.OPEN_WIDGET: + case RoomObjectWidgetRequestEvent.CLOSE_WIDGET: + case RoomObjectWidgetRequestEvent.OPEN_FURNI_CONTEXT_MENU: + case RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU: + case RoomObjectWidgetRequestEvent.PLACEHOLDER: + case RoomObjectWidgetRequestEvent.CREDITFURNI: + case RoomObjectWidgetRequestEvent.STACK_HEIGHT: + case RoomObjectWidgetRequestEvent.EXTERNAL_IMAGE: + case RoomObjectWidgetRequestEvent.STICKIE: + case RoomObjectWidgetRequestEvent.PRESENT: + case RoomObjectWidgetRequestEvent.TROPHY: + case RoomObjectWidgetRequestEvent.TEASER: + case RoomObjectWidgetRequestEvent.ECOTRONBOX: + case RoomObjectWidgetRequestEvent.DIMMER: + case RoomObjectWidgetRequestEvent.WIDGET_REMOVE_DIMMER: + case RoomObjectWidgetRequestEvent.CLOTHING_CHANGE: + case RoomObjectWidgetRequestEvent.JUKEBOX_PLAYLIST_EDITOR: + case RoomObjectWidgetRequestEvent.MANNEQUIN: + case RoomObjectWidgetRequestEvent.PET_PRODUCT_MENU: + case RoomObjectWidgetRequestEvent.GUILD_FURNI_CONTEXT_MENU: + case RoomObjectWidgetRequestEvent.MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG: + case RoomObjectWidgetRequestEvent.PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG: + case RoomObjectWidgetRequestEvent.BACKGROUND_COLOR: + case RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG: + case RoomObjectWidgetRequestEvent.EFFECTBOX_OPEN_DIALOG: + case RoomObjectWidgetRequestEvent.MYSTERYTROPHY_OPEN_DIALOG: + case RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_OPEN: + case RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_ENGRAVING: + case RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_FAILED: + case RoomObjectWidgetRequestEvent.FRIEND_FURNITURE_CONFIRM: + case RoomObjectWidgetRequestEvent.FRIEND_FURNITURE_ENGRAVING: + case RoomObjectWidgetRequestEvent.BADGE_DISPLAY_ENGRAVING: + case RoomObjectWidgetRequestEvent.HIGH_SCORE_DISPLAY: + case RoomObjectWidgetRequestEvent.HIDE_HIGH_SCORE_DISPLAY: + case RoomObjectWidgetRequestEvent.INERNAL_LINK: + case RoomObjectWidgetRequestEvent.ROOM_LINK: + case RoomObjectWidgetRequestEvent.YOUTUBE: + this.onRoomObjectWidgetRequestEvent((event as RoomObjectWidgetRequestEvent), roomId); + return; + case RoomObjectFurnitureActionEvent.DICE_ACTIVATE: + case RoomObjectFurnitureActionEvent.DICE_OFF: + case RoomObjectFurnitureActionEvent.USE_HABBOWHEEL: + case RoomObjectFurnitureActionEvent.STICKIE: + case RoomObjectFurnitureActionEvent.ENTER_ONEWAYDOOR: + this.onRoomObjectFurnitureActionEvent((event as RoomObjectFurnitureActionEvent), roomId); + return; + case RoomObjectFurnitureActionEvent.SOUND_MACHINE_INIT: + case RoomObjectFurnitureActionEvent.SOUND_MACHINE_START: + case RoomObjectFurnitureActionEvent.SOUND_MACHINE_STOP: + case RoomObjectFurnitureActionEvent.SOUND_MACHINE_DISPOSE: + this.handleObjectSoundMachineEvent(event, roomId); + return; + case RoomObjectFurnitureActionEvent.JUKEBOX_INIT: + case RoomObjectFurnitureActionEvent.JUKEBOX_START: + case RoomObjectFurnitureActionEvent.JUKEBOX_MACHINE_STOP: + case RoomObjectFurnitureActionEvent.JUKEBOX_DISPOSE: + this.handleObjectJukeboxEvent(event, roomId); + return; + case RoomObjectFloorHoleEvent.ADD_HOLE: + case RoomObjectFloorHoleEvent.REMOVE_HOLE: + this.onRoomObjectFloorHoleEvent((event as RoomObjectFloorHoleEvent), roomId); + return; + case RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK: + case RoomObjectRoomAdEvent.ROOM_AD_FURNI_DOUBLE_CLICK: + case RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_SHOW: + case RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE: + case RoomObjectRoomAdEvent.ROOM_AD_LOAD_IMAGE: + this.onRoomObjectRoomAdEvent((event as RoomObjectRoomAdEvent), roomId); + return; + case RoomObjectBadgeAssetEvent.LOAD_BADGE: + this.onRoomObjectBadgeAssetEvent((event as RoomObjectBadgeAssetEvent), roomId); + return; + case RoomObjectFurnitureActionEvent.MOUSE_ARROW: + case RoomObjectFurnitureActionEvent.MOUSE_BUTTON: + this.handleMousePointer((event as RoomObjectFurnitureActionEvent), roomId); + return; + case RoomObjectPlaySoundIdEvent.PLAY_SOUND: + case RoomObjectPlaySoundIdEvent.PLAY_SOUND_AT_PITCH: + this.handleRoomObjectPlaySoundEvent((event as RoomObjectPlaySoundIdEvent), roomId); + return; + case RoomObjectSamplePlaybackEvent.ROOM_OBJECT_INITIALIZED: + case RoomObjectSamplePlaybackEvent.ROOM_OBJECT_DISPOSED: + case RoomObjectSamplePlaybackEvent.PLAY_SAMPLE: + case RoomObjectSamplePlaybackEvent.CHANGE_PITCH: + this.handleRoomObjectSamplePlaybackEvent((event as RoomObjectSamplePlaybackEvent), roomId); + return; + case RoomObjectHSLColorEnableEvent.ROOM_BACKGROUND_COLOR: + this.onHSLColorEnableEvent((event as RoomObjectHSLColorEnableEvent), roomId); + return; + case RoomObjectDataRequestEvent.RODRE_CURRENT_USER_ID: + case RoomObjectDataRequestEvent.RODRE_URL_PREFIX: + this.onRoomObjectDataRequestEvent((event as RoomObjectDataRequestEvent), roomId); + return; + default: + NitroLogger.warn('Unhandled Event', event.constructor.name, 'Object ID', event.object.id); + return; + } + } + + private handleRoomObjectMouseEvent(event: RoomObjectMouseEvent, roomId: number): void + { + if(!event || !event.type) return; + + switch(event.type) + { + case RoomObjectMouseEvent.CLICK: + this.handleRoomObjectMouseClickEvent(event, roomId); + return; + case RoomObjectMouseEvent.DOUBLE_CLICK: + this.handleRoomObjectMouseDoubleClickEvent(event, roomId); + return; + case RoomObjectMouseEvent.MOUSE_MOVE: + this.handleRoomObjectMouseMoveEvent(event, roomId); + return; + case RoomObjectMouseEvent.MOUSE_DOWN: + this.handleRoomObjectMouseDownEvent(event, roomId); + return; + case RoomObjectMouseEvent.MOUSE_DOWN_LONG: + this.handleRoomObjectMouseDownLongEvent(event, roomId); + return; + case RoomObjectMouseEvent.MOUSE_ENTER: + this.handleRoomObjectMouseEnterEvent(event, roomId); + return; + case RoomObjectMouseEvent.MOUSE_LEAVE: + this.handleRoomObjectMouseLeaveEvent(event, roomId); + return; + } + } + + private handleRoomObjectMouseClickEvent(event: RoomObjectMouseEvent, roomId: number): void + { + if(!event) return; + + let operation = RoomObjectOperationType.OBJECT_UNDEFINED; + + const selectedData = this.getSelectedRoomObjectData(roomId); + + if(selectedData) operation = selectedData.operation; + + let didWalk = false; + let didMove = false; + + if(this._whereYouClickIsWhereYouGo) + { + if(!operation || (operation === RoomObjectOperationType.OBJECT_UNDEFINED)) + { + didWalk = this.handleMoveTargetFurni(roomId, event); + } + } + + const category = this._roomEngine.getRoomObjectCategoryForType(event.objectType); + + switch(operation) + { + case RoomObjectOperationType.OBJECT_MOVE: + if(category === RoomObjectCategory.ROOM) + { + if(selectedData) + { + this.modifyRoomObject(roomId, selectedData.id, selectedData.category, RoomObjectOperationType.OBJECT_MOVE_TO); + } + } + + else if(category === RoomObjectCategory.UNIT) + { + if(selectedData && (event.objectType === RoomObjectUserType.MONSTER_PLANT)) + { + this.modifyRoomObject(roomId, selectedData.id, selectedData.category, RoomObjectOperationType.OBJECT_MOVE_TO); + } + + if(event.eventId) this.setMouseEventId(RoomObjectCategory.ROOM, MouseEventType.MOUSE_CLICK, event.eventId); + + this.placeObjectOnUser(roomId, event.objectId, category); + } + + didMove = true; + + if(event.objectId !== -1) this.setSelectedObject(roomId, event.objectId, category); + + break; + case RoomObjectOperationType.OBJECT_PLACE: + if(category === RoomObjectCategory.ROOM) + { + this.placeObject(roomId, (event instanceof RoomObjectTileMouseEvent), (event instanceof RoomObjectWallMouseEvent)); + } + + else if(category === RoomObjectCategory.UNIT) + { + switch(event.objectType) + { + case RoomObjectUserType.MONSTER_PLANT: + case RoomObjectUserType.RENTABLE_BOT: + this.placeObject(roomId, (event instanceof RoomObjectTileMouseEvent), (event instanceof RoomObjectWallMouseEvent)); + break; + default: + if(event.eventId) + { + this.setMouseEventId(RoomObjectCategory.ROOM, MouseEventType.MOUSE_CLICK, event.eventId); + } + + this.placeObjectOnUser(roomId, event.objectId, category); + break; + } + } + break; + case RoomObjectOperationType.OBJECT_UNDEFINED: + if(category === RoomObjectCategory.ROOM) + { + if(!didWalk && (event instanceof RoomObjectTileMouseEvent)) this.onRoomObjectTileMouseEvent(roomId, event); + } + else + { + this.setSelectedObject(roomId, event.objectId, category); + + didMove = false; + + if(category === RoomObjectCategory.UNIT) + { + if(event.ctrlKey && !event.altKey && !event.shiftKey && (event.objectType === RoomObjectUserType.RENTABLE_BOT)) + { + this.modifyRoomObject(roomId, event.objectId, category, RoomObjectOperationType.OBJECT_PICKUP_BOT); + } + + else if(event.ctrlKey && !event.altKey && !event.shiftKey && (event.objectType === RoomObjectUserType.MONSTER_PLANT)) + { + this.modifyRoomObject(roomId, event.objectId, category, RoomObjectOperationType.OBJECT_PICKUP_PET); + } + + else if(!event.ctrlKey && !event.altKey && event.shiftKey && (event.objectType === RoomObjectUserType.MONSTER_PLANT)) + { + this.modifyRoomObject(roomId, event.objectId, category, RoomObjectOperationType.OBJECT_ROTATE_POSITIVE); + } + + if(!this._roomEngine.isPlayingGame()) + { + didWalk = true; + } + else + { + didMove = true; + } + } + + else if((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL)) + { + if(event.altKey || event.ctrlKey || event.shiftKey) + { + if(!event.ctrlKey && !event.altKey && event.shiftKey) + { + if(category === RoomObjectCategory.FLOOR) + { + if(this._roomEngine.events) + { + this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REQUEST_ROTATE, roomId, event.objectId, category)); + } + } + } + + else if(event.ctrlKey && !event.altKey && !event.shiftKey) + { + this.modifyRoomObject(roomId, event.objectId, category, RoomObjectOperationType.OBJECT_PICKUP); + } + + if(!this._roomEngine.isPlayingGame()) + { + didWalk = true; + } + else + { + didMove = true; + } + } + } + + if(event.eventId) + { + if(didWalk) + { + this.setMouseEventId(RoomObjectCategory.ROOM, MouseEventType.MOUSE_CLICK, event.eventId); + } + + if(didMove) + { + this.setMouseEventId(RoomObjectCategory.MINIMUM, MouseEventType.MOUSE_CLICK, event.eventId); + } + } + } + break; + } + + if(category === RoomObjectCategory.ROOM) + { + const _local_15 = this.getMouseEventId(RoomObjectCategory.MINIMUM, MouseEventType.MOUSE_CLICK); + const _local_16 = this.getMouseEventId(RoomObjectCategory.UNIT, MouseEventType.MOUSE_CLICK); + + if((_local_15 !== event.eventId) && (_local_16 !== event.eventId) && !didMove) + { + this.deselectObject(roomId); + + if(this._roomEngine.events) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DESELECTED, roomId, -1, RoomObjectCategory.MINIMUM)); + + this.setSelectedAvatar(roomId, 0, false); + } + } + } + + private handleRoomObjectMouseDoubleClickEvent(event: RoomObjectMouseEvent, roomId: number): void + { + const id = event.objectId; + const type = event.objectType; + const category = this._roomEngine.getRoomObjectCategoryForType(type); + + if(this._roomEngine.events) + { + this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DOUBLE_CLICK, roomId, id, category)); + } + } + + private handleRoomObjectMouseMoveEvent(event: RoomObjectMouseEvent, roomId: number): void + { + if(!event) return; + + let operation = RoomObjectOperationType.OBJECT_UNDEFINED; + + const selectedData = this.getSelectedRoomObjectData(roomId); + + if(selectedData) operation = selectedData.operation; + + const category = this._roomEngine.getRoomObjectCategoryForType(event.objectType); + + if(this._roomEngine) + { + const roomCursor = this._roomEngine.getRoomObjectCursor(roomId); + + if(roomCursor && roomCursor.logic) + { + let newEvent: ObjectTileCursorUpdateMessage = null; + + if(event instanceof RoomObjectTileMouseEvent) + { + newEvent = this.handleMouseOverTile(event, roomId); + } + + else if(event.object && (event.object.id !== -1)) + { + if(this._whereYouClickIsWhereYouGo) + { + newEvent = this.handleMouseOverObject(category, roomId, event); + } + } + + else + { + newEvent = new ObjectTileCursorUpdateMessage(null, 0, false, event.eventId); + } + + roomCursor.processUpdateMessage(newEvent); + } + } + + switch(operation) + { + case RoomObjectOperationType.OBJECT_MOVE: + if(category === RoomObjectCategory.ROOM) this.handleObjectMove(event, roomId); + + return; + case RoomObjectOperationType.OBJECT_PLACE: + if(category === RoomObjectCategory.ROOM) this.handleObjectPlace(event, roomId); + + return; + } + } + + private handleRoomObjectMouseDownEvent(event: RoomObjectMouseEvent, roomId: number): void + { + if(!event) return; + + let operation = RoomObjectOperationType.OBJECT_UNDEFINED; + + const selectedData = this.getSelectedRoomObjectData(roomId); + + if(selectedData) operation = selectedData.operation; + + const category = this._roomEngine.getRoomObjectCategoryForType(event.objectType); + + switch(operation) + { + case RoomObjectOperationType.OBJECT_UNDEFINED: + if((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL) || (event.objectType === RoomObjectUserType.MONSTER_PLANT)) + { + if((event.altKey && !event.ctrlKey && !event.shiftKey) || this.decorateModeMove(event)) + { + if(this._roomEngine.events) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REQUEST_MOVE, roomId, event.objectId, category)); + } + } + return; + } + } + + private handleRoomObjectMouseDownLongEvent(event: RoomObjectMouseEvent, roomId: number): void + { + if(!event) return; + + let operation = RoomObjectOperationType.OBJECT_UNDEFINED; + + const selectedData = this.getSelectedRoomObjectData(roomId); + + if(selectedData) operation = selectedData.operation; + + const category = this._roomEngine.getRoomObjectCategoryForType(event.objectType); + + switch(operation) + { + case RoomObjectOperationType.OBJECT_UNDEFINED: + if((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL) || (event.objectType === RoomObjectUserType.MONSTER_PLANT)) + { + if((!event.ctrlKey && !event.shiftKey) || this.decorateModeMove(event)) + { + if(this._roomEngine.events) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REQUEST_MANIPULATION, roomId, event.objectId, category)); + } + } + return; + } + } + + private handleRoomObjectMouseEnterEvent(event: RoomObjectMouseEvent, roomId: number): void + { + const id = event.objectId; + const type = event.objectType; + const category = this._roomEngine.getRoomObjectCategoryForType(type); + + if(this._roomEngine.events) + { + this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.MOUSE_ENTER, roomId, id, category)); + } + } + + private handleRoomObjectMouseLeaveEvent(event: RoomObjectMouseEvent, roomId: number): void + { + const id = event.objectId; + const type = event.objectType; + const category = this._roomEngine.getRoomObjectCategoryForType(type); + + if(category !== RoomObjectCategory.ROOM) + { + if(category === RoomObjectCategory.UNIT) + { + const cursor = this._roomEngine.getRoomObjectCursor(roomId); + + if(cursor) cursor.processUpdateMessage(new ObjectDataUpdateMessage(0, null)); + } + } + + if(this._roomEngine.events) + { + this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.MOUSE_LEAVE, roomId, id, category)); + } + + return; + } + + private onRoomObjectStateChangedEvent(event: RoomObjectStateChangedEvent, roomId: number): void + { + if(!event) return; + + switch(event.type) + { + case RoomObjectStateChangedEvent.STATE_CHANGE: + this.changeObjectState(roomId, event.object.id, event.object.type, event.state, false); + return; + case RoomObjectStateChangedEvent.STATE_RANDOM: + this.changeObjectState(roomId, event.object.id, event.object.type, event.state, true); + return; + } + } + + private onRoomObjectDimmerStateUpdateEvent(event: RoomObjectDimmerStateUpdateEvent, roomId: number): void + { + if(!event) return; + + switch(event.type) + { + case RoomObjectDimmerStateUpdateEvent.DIMMER_STATE: + this._roomEngine.events.dispatchEvent(new RoomEngineDimmerStateEvent(roomId, event.state, event.presetId, event.effectId, event.color, event.brightness)); + return; + } + } + + private handleSelectedObjectRemove(event: RoomObjectMoveEvent, roomId: number): void + { + if(!event || !this._roomEngine) return; + + switch(event.type) + { + case RoomObjectMoveEvent.POSITION_CHANGED: { + const objectId = event.objectId; + const objectType = event.objectType; + const objectCategory = this._roomEngine.getRoomObjectCategoryForType(objectType); + const object = this._roomEngine.getRoomObject(roomId, objectId, objectCategory); + const selectionArrow = this._roomEngine.getRoomObjectSelectionArrow(roomId); + + if(object && selectionArrow && selectionArrow.logic) + { + const location = object.getLocation(); + + selectionArrow.logic.processUpdateMessage(new RoomObjectUpdateMessage(location, null)); + } + return; + } + case RoomObjectMoveEvent.OBJECT_REMOVED: + this.setSelectedAvatar(roomId, 0, false); + return; + } + } + + private onRoomObjectWidgetRequestEvent(event: RoomObjectWidgetRequestEvent, roomId: number): void + { + if(!event || !this._roomEngine) return; + + const objectId = event.objectId; + const objectType = event.objectType; + const objectCategory = this._roomEngine.getRoomObjectCategoryForType(objectType); + const eventDispatcher = this._roomEngine.events; + + if(!eventDispatcher) return; + + if(RoomId.isRoomPreviewerId(roomId)) return; + + switch(event.type) + { + case RoomObjectWidgetRequestEvent.OPEN_WIDGET: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.OPEN_WIDGET, roomId, objectId, objectCategory, ((event.object as IRoomObjectController).logic.widget))); + return; + case RoomObjectWidgetRequestEvent.CLOSE_WIDGET: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.CLOSE_WIDGET, roomId, objectId, objectCategory, ((event.object as IRoomObjectController).logic.widget))); + return; + case RoomObjectWidgetRequestEvent.OPEN_FURNI_CONTEXT_MENU: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.OPEN_FURNI_CONTEXT_MENU, roomId, objectId, objectCategory, ((event.object as IRoomObjectController).logic.contextMenu))); + return; + case RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.CLOSE_FURNI_CONTEXT_MENU, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.PLACEHOLDER: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_PLACEHOLDER, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.CREDITFURNI: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_CREDITFURNI, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.STACK_HEIGHT: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_STACK_HEIGHT, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.EXTERNAL_IMAGE: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_EXTERNAL_IMAGE, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.STICKIE: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_STICKIE, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.PRESENT: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_PRESENT, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.TROPHY: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_TROPHY, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.TEASER: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_TEASER, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.ECOTRONBOX: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_ECOTRONBOX, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.DIMMER: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_DIMMER, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.WIDGET_REMOVE_DIMMER: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REMOVE_DIMMER, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.CLOTHING_CHANGE: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_CLOTHING_CHANGE, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.JUKEBOX_PLAYLIST_EDITOR: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_PLAYLIST_EDITOR, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.MANNEQUIN: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MANNEQUIN, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.PET_PRODUCT_MENU: + eventDispatcher.dispatchEvent(new RoomEngineUseProductEvent(RoomEngineUseProductEvent.USE_PRODUCT_FROM_ROOM, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.GUILD_FURNI_CONTEXT_MENU: + this._roomEngine.connection.send(new FurnitureGroupInfoComposer(event.objectId, event.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_GUILD_ID))); + return; + case RoomObjectWidgetRequestEvent.MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.BACKGROUND_COLOR: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_BACKGROUND_COLOR, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MYSTERYBOX_OPEN_DIALOG, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.EFFECTBOX_OPEN_DIALOG: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_EFFECTBOX_OPEN_DIALOG, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.MYSTERYTROPHY_OPEN_DIALOG: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MYSTERYTROPHY_OPEN_DIALOG, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_OPEN: + this._roomEngine.connection.send(new GetResolutionAchievementsMessageComposer(event.objectId, 0)); + return; + case RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_ENGRAVING: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_ACHIEVEMENT_RESOLUTION_ENGRAVING, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_FAILED: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_ACHIEVEMENT_RESOLUTION_FAILED, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.FRIEND_FURNITURE_CONFIRM: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_FRIEND_FURNITURE_CONFIRM, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.FRIEND_FURNITURE_ENGRAVING: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_FRIEND_FURNITURE_ENGRAVING, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.BADGE_DISPLAY_ENGRAVING: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_BADGE_DISPLAY_ENGRAVING, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.HIGH_SCORE_DISPLAY: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_HIGH_SCORE_DISPLAY, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.HIDE_HIGH_SCORE_DISPLAY: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_HIDE_HIGH_SCORE_DISPLAY, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.INERNAL_LINK: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_INTERNAL_LINK, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.ROOM_LINK: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_ROOM_LINK, roomId, objectId, objectCategory)); + return; + case RoomObjectWidgetRequestEvent.YOUTUBE: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_YOUTUBE, roomId, objectId, objectCategory)); + return; + } + } + + private onRoomObjectFurnitureActionEvent(event: RoomObjectFurnitureActionEvent, roomId: number): void + { + if(!event) return; + + this.useObject(roomId, event.object.id, event.object.type, event.type); + } + + private handleObjectSoundMachineEvent(event: RoomObjectEvent, roomId: number): void + { + if(!event) return; + + const objectCategory = this._roomEngine.getRoomObjectCategoryForType(event.objectType); + const selectedData = this.getSelectedRoomObjectData(roomId); + + if(selectedData) + { + if((selectedData.category === objectCategory) && (selectedData.id === event.objectId)) + { + if(selectedData.operation === RoomObjectOperationType.OBJECT_PLACE) return; + } + } + + switch(event.type) + { + case RoomObjectFurnitureActionEvent.SOUND_MACHINE_INIT: + this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_INIT, roomId, event.objectId, objectCategory)); + return; + case RoomObjectFurnitureActionEvent.SOUND_MACHINE_START: + this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_SWITCHED_ON, roomId, event.objectId, objectCategory)); + return; + case RoomObjectFurnitureActionEvent.SOUND_MACHINE_STOP: + this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_SWITCHED_OFF, roomId, event.objectId, objectCategory)); + return; + case RoomObjectFurnitureActionEvent.SOUND_MACHINE_DISPOSE: + this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_DISPOSE, roomId, event.objectId, objectCategory)); + return; + } + } + + private handleObjectJukeboxEvent(event: RoomObjectEvent, roomId: number): void + { + if(!event) return; + + const objectCategory = this._roomEngine.getRoomObjectCategoryForType(event.objectType); + const selectedData = this.getSelectedRoomObjectData(roomId); + + if(selectedData) + { + if((selectedData.category === objectCategory) && (selectedData.id === event.objectId)) + { + if(selectedData.operation === RoomObjectOperationType.OBJECT_PLACE) return; + } + } + + switch(event.type) + { + case RoomObjectFurnitureActionEvent.JUKEBOX_INIT: + this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_INIT, roomId, event.objectId, objectCategory)); + return; + case RoomObjectFurnitureActionEvent.JUKEBOX_START: + this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_SWITCHED_ON, roomId, event.objectId, objectCategory)); + return; + case RoomObjectFurnitureActionEvent.JUKEBOX_MACHINE_STOP: + this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_SWITCHED_OFF, roomId, event.objectId, objectCategory)); + return; + case RoomObjectFurnitureActionEvent.JUKEBOX_DISPOSE: + this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_DISPOSE, roomId, event.objectId, objectCategory)); + return; + } + } + + private onRoomObjectFloorHoleEvent(event: RoomObjectFloorHoleEvent, roomId: number): void + { + if(!event) return; + + switch(event.type) + { + case RoomObjectFloorHoleEvent.ADD_HOLE: + this._roomEngine.addRoomInstanceFloorHole(roomId, event.objectId); + return; + case RoomObjectFloorHoleEvent.REMOVE_HOLE: + this._roomEngine.removeRoomInstanceFloorHole(roomId, event.objectId); + return; + } + } + + private onRoomObjectRoomAdEvent(event: RoomObjectRoomAdEvent, roomId: number): void + { + if(!event) return; + + let eventType: string = null; + + switch(event.type) + { + case RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK: + this._roomEngine.events.dispatchEvent(event); + + if(event.clickUrl && (event.clickUrl.length > 0)) + { + Nitro.instance.createLinkEvent(event.clickUrl); + } + + eventType = RoomEngineRoomAdEvent.FURNI_CLICK; + break; + case RoomObjectRoomAdEvent.ROOM_AD_FURNI_DOUBLE_CLICK: + if(event.clickUrl && (event.clickUrl.length > 0)) + { + const catalogPage = 'CATALOG_PAGE'; + + if(event.clickUrl.indexOf(catalogPage) === 0) + { + Nitro.instance.createLinkEvent(event.clickUrl.substr(catalogPage.length)); + } + } + + eventType = RoomEngineRoomAdEvent.FURNI_DOUBLE_CLICK; + break; + case RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_SHOW: + eventType = RoomEngineRoomAdEvent.TOOLTIP_SHOW; + break; + case RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE: + eventType = RoomEngineRoomAdEvent.TOOLTIP_HIDE; + break; + } + + if(eventType) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(eventType, roomId, event.objectId, this._roomEngine.getRoomObjectCategoryForType(event.objectType))); + } + + private onRoomObjectBadgeAssetEvent(event: RoomObjectBadgeAssetEvent, roomId: number): void + { + if(!event || !this._roomEngine) return; + + switch(event.type) + { + case RoomObjectBadgeAssetEvent.LOAD_BADGE: { + const objectId = event.objectId; + const objectType = event.objectType; + const objectCategory = this._roomEngine.getRoomObjectCategoryForType(objectType); + + this._roomEngine.loadRoomObjectBadgeImage(roomId, objectId, objectCategory, event.badgeId, event.groupBadge); + return; + } + } + } + + private handleMousePointer(event: RoomObjectFurnitureActionEvent, roomId: number): void + { + if(!event) return; + + this._roomEngine.updateMousePointer(event.type, event.objectId, event.objectType); + } + + private handleRoomObjectPlaySoundEvent(event: RoomObjectPlaySoundIdEvent, roomId: number): void + { + const objectCategory = this._roomEngine.getRoomObjectCategoryForType(event.objectType); + + switch(event.type) + { + case RoomObjectPlaySoundIdEvent.PLAY_SOUND: + this._roomEngine.events.dispatchEvent(new RoomEngineObjectPlaySoundEvent(RoomEngineObjectPlaySoundEvent.PLAY_SOUND, roomId, event.objectId, objectCategory, event.soundId, event.pitch)); + return; + case RoomObjectPlaySoundIdEvent.PLAY_SOUND_AT_PITCH: + this._roomEngine.events.dispatchEvent(new RoomEngineObjectPlaySoundEvent(RoomEngineObjectPlaySoundEvent.PLAY_SOUND_AT_PITCH, roomId, event.objectId, objectCategory, event.soundId, event.pitch)); + return; + } + } + + private handleRoomObjectSamplePlaybackEvent(event: RoomObjectSamplePlaybackEvent, roomId: number): void + { + if(!event) return; + + const objectCategory = this._roomEngine.getRoomObjectCategoryForType(event.objectType); + + switch(event.type) + { + case RoomObjectSamplePlaybackEvent.ROOM_OBJECT_INITIALIZED: + this._roomEngine.events.dispatchEvent(new RoomEngineSamplePlaybackEvent(RoomEngineSamplePlaybackEvent.ROOM_OBJECT_INITIALIZED, roomId, event.objectId, objectCategory, event.sampleId, event.pitch)); + break; + case RoomObjectSamplePlaybackEvent.ROOM_OBJECT_DISPOSED: + this._roomEngine.events.dispatchEvent(new RoomEngineSamplePlaybackEvent(RoomEngineSamplePlaybackEvent.ROOM_OBJECT_DISPOSED, roomId, event.objectId, objectCategory, event.sampleId, event.pitch)); + break; + case RoomObjectSamplePlaybackEvent.PLAY_SAMPLE: + this._roomEngine.events.dispatchEvent(new RoomEngineSamplePlaybackEvent(RoomEngineSamplePlaybackEvent.PLAY_SAMPLE, roomId, event.objectId, objectCategory, event.sampleId, event.pitch)); + break; + case RoomObjectSamplePlaybackEvent.CHANGE_PITCH: + this._roomEngine.events.dispatchEvent(new RoomEngineSamplePlaybackEvent(RoomEngineSamplePlaybackEvent.CHANGE_PITCH, roomId, event.objectId, objectCategory, event.sampleId, event.pitch)); + break; + } + } + + private onHSLColorEnableEvent(event: RoomObjectHSLColorEnableEvent, roomId: number): void + { + if(!event || !this._roomEngine) return; + + switch(event.type) + { + case RoomObjectHSLColorEnableEvent.ROOM_BACKGROUND_COLOR: + this._roomEngine.events.dispatchEvent(new RoomObjectHSLColorEnabledEvent(RoomObjectHSLColorEnabledEvent.ROOM_BACKGROUND_COLOR, roomId, event.enable, event.hue, event.saturation, event.lightness)); + return; + } + } + + private onRoomObjectDataRequestEvent(event: RoomObjectDataRequestEvent, roomId: number): void + { + if(!event || !this._roomEngine || !event.object) return; + + switch(event.type) + { + case RoomObjectDataRequestEvent.RODRE_CURRENT_USER_ID: + event.object.model.setValue(RoomObjectVariable.SESSION_CURRENT_USER_ID, this._roomEngine.sessionDataManager.userId); + return; + case RoomObjectDataRequestEvent.RODRE_URL_PREFIX: + event.object.model.setValue(RoomObjectVariable.SESSION_URL_PREFIX, NitroConfiguration.getValue('url.prefix')); + return; + } + } + + private onRoomObjectTileMouseEvent(roomId: number, event: RoomObjectTileMouseEvent): void + { + if(!this._roomEngine || this._roomEngine.isDecorating || !this._roomEngine.roomSessionManager) return; + + const session = this._roomEngine.roomSessionManager.getSession(roomId); + + if(!session || session.isSpectator) return; + + this.sendWalkUpdate(event.tileXAsInt, event.tileYAsInt); + } + + private handleObjectMove(event: RoomObjectMouseEvent, roomId: number): void + { + if(!event || !this._roomEngine) return; + + const eventDispatcher = this._roomEngine.events; + + if(!eventDispatcher) return; + + const selectedData = this.getSelectedRoomObjectData(roomId); + + if(!selectedData) return; + + const roomObject = this._roomEngine.getRoomObject(roomId, selectedData.id, selectedData.category); + + if(!roomObject) return; + + let _local_6 = true; + + if((selectedData.category === RoomObjectCategory.FLOOR) || (selectedData.category === RoomObjectCategory.UNIT)) + { + const stackingHeightMap = this._roomEngine.getFurnitureStackingHeightMap(roomId); + + if(!(((event instanceof RoomObjectTileMouseEvent)) && (this.handleFurnitureMove(roomObject, selectedData, Math.trunc(event.tileX + 0.5), Math.trunc(event.tileY + 0.5), stackingHeightMap)))) + { + this.handleFurnitureMove(roomObject, selectedData, selectedData.loc.x, selectedData.loc.y, stackingHeightMap); + + _local_6 = false; + } + } + + else if((selectedData.category === RoomObjectCategory.WALL)) + { + _local_6 = false; + + if(event instanceof RoomObjectWallMouseEvent) + { + const _local_10 = event.wallLocation; + const _local_11 = event.wallWidth; + const _local_12 = event.wallHeight; + const _local_13 = event.x; + const _local_14 = event.y; + const _local_15 = event.direction; + + if(this.handleWallItemMove(roomObject, selectedData, _local_10, _local_11, _local_12, _local_13, _local_14, _local_15)) + { + _local_6 = true; + } + } + + if(!_local_6) + { + roomObject.setLocation(selectedData.loc); + roomObject.setDirection(selectedData.dir); + } + + this._roomEngine.updateRoomObjectMask(roomId, selectedData.id, _local_6); + } + + if(_local_6) + { + this.setFurnitureAlphaMultiplier(roomObject, 0.5); + + this._roomEngine.setObjectMoverIconSpriteVisible(false); + } + else + { + this.setFurnitureAlphaMultiplier(roomObject, 0); + + this._roomEngine.setObjectMoverIconSpriteVisible(true); + } + } + + private handleObjectPlace(event: RoomObjectMouseEvent, roomId: number): void + { + if(!event || !this._roomEngine) return; + + const eventDispatcher = this._roomEngine.events; + + if(!eventDispatcher) return; + + let selectedData = this.getSelectedRoomObjectData(roomId); + + if(!selectedData) return; + + let roomObject = this._roomEngine.getRoomObject(roomId, selectedData.id, selectedData.category); + + if(!roomObject) + { + if(event instanceof RoomObjectTileMouseEvent) + { + if(selectedData.category === RoomObjectCategory.FLOOR) + { + this._roomEngine.addFurnitureFloor(roomId, selectedData.id, selectedData.typeId, selectedData.loc, selectedData.dir, 0, selectedData.stuffData, parseFloat(selectedData.instanceData), -1, 0, 0, '', false); + } + + else if(selectedData.category === RoomObjectCategory.UNIT) + { + this._roomEngine.addRoomObjectUser(roomId, selectedData.id, new Vector3d(), new Vector3d(180), 180, selectedData.typeId, selectedData.instanceData); + + const roomObject = this._roomEngine.getRoomObject(roomId, selectedData.id, selectedData.category); + + (roomObject && selectedData.posture && roomObject.model.setValue(RoomObjectVariable.FIGURE_POSTURE, selectedData.posture)); + } + } + + else if(event instanceof RoomObjectWallMouseEvent) + { + if(selectedData.category === RoomObjectCategory.WALL) + { + this._roomEngine.addFurnitureWall(roomId, selectedData.id, selectedData.typeId, selectedData.loc, selectedData.dir, 0, selectedData.instanceData, 0); + } + } + + roomObject = this._roomEngine.getRoomObject(roomId, selectedData.id, selectedData.category); + + if(roomObject) + { + if(selectedData.category === RoomObjectCategory.FLOOR) + { + const allowedDirections = roomObject.model.getValue(RoomObjectVariable.FURNITURE_ALLOWED_DIRECTIONS); + + if(allowedDirections && allowedDirections.length) + { + const direction = new Vector3d(allowedDirections[0]); + + roomObject.setDirection(direction); + + this.updateSelectedObjectData(roomId, selectedData.id, selectedData.category, selectedData.loc, direction, selectedData.operation, selectedData.typeId, selectedData.instanceData, selectedData.stuffData, selectedData.state, selectedData.animFrame, selectedData.posture); + + selectedData = this.getSelectedRoomObjectData(roomId); + + if(!selectedData) return; + } + } + } + + this.setFurnitureAlphaMultiplier(roomObject, 0.5); + this._roomEngine.setObjectMoverIconSpriteVisible(true); + } + + if(roomObject) + { + let _local_12 = true; + + const stackingHeightMap = this._roomEngine.getFurnitureStackingHeightMap(roomId); + + if(selectedData.category === RoomObjectCategory.FLOOR) + { + if(!((event instanceof RoomObjectTileMouseEvent) && this.handleFurnitureMove(roomObject, selectedData, Math.trunc(event.tileX + 0.5), Math.trunc(event.tileY + 0.5), stackingHeightMap))) + { + this._roomEngine.removeRoomObjectFloor(roomId, selectedData.id); + + _local_12 = false; + } + } + + else if(selectedData.category === RoomObjectCategory.WALL) + { + _local_12 = false; + + if(event instanceof RoomObjectWallMouseEvent) + { + const _local_14 = event.wallLocation; + const _local_15 = event.wallWidth; + const _local_16 = event.wallHeight; + const _local_17 = event.x; + const _local_18 = event.y; + const _local_19 = event.direction; + + if(this.handleWallItemMove(roomObject, selectedData, _local_14, _local_15, _local_16, _local_17, _local_18, _local_19)) + { + _local_12 = true; + } + } + + if(!_local_12) + { + this._roomEngine.removeRoomObjectWall(roomId, selectedData.id); + } + + this._roomEngine.updateRoomObjectMask(roomId, selectedData.id, _local_12); + } + + else if(selectedData.category === RoomObjectCategory.UNIT) + { + if(!((event instanceof RoomObjectTileMouseEvent) && this.handleUserPlace(roomObject, Math.trunc(event.tileX + 0.5), Math.trunc(event.tileY + 0.5), this._roomEngine.getLegacyWallGeometry(roomId)))) + { + this._roomEngine.removeRoomObjectUser(roomId, selectedData.id); + + _local_12 = false; + } + } + + this._roomEngine.setObjectMoverIconSpriteVisible(!_local_12); + } + } + + private handleFurnitureMove(roomObject: IRoomObjectController, selectedObjectData: ISelectedRoomObjectData, x: number, y: number, stackingHeightMap: IFurnitureStackingHeightMap): boolean + { + if(!roomObject || !selectedObjectData) return false; + + const _local_6 = new Vector3d(); + _local_6.assign(roomObject.getDirection()); + + roomObject.setDirection(selectedObjectData.dir); + + const _local_7 = new Vector3d(x, y, 0); + const _local_8 = new Vector3d(); + + _local_8.assign(roomObject.getDirection()); + + let _local_9 = this.validateFurnitureLocation(roomObject, _local_7, selectedObjectData.loc, selectedObjectData.dir, stackingHeightMap); + + if(!_local_9) + { + _local_8.x = this.getValidRoomObjectDirection(roomObject, true); + + roomObject.setDirection(_local_8); + + _local_9 = this.validateFurnitureLocation(roomObject, _local_7, selectedObjectData.loc, selectedObjectData.dir, stackingHeightMap); + } + + if(!_local_9) + { + roomObject.setDirection(_local_6); + + return false; + } + + roomObject.setLocation(_local_9); + + if(_local_8) roomObject.setDirection(_local_8); + + return true; + } + + private handleWallItemMove(k: IRoomObjectController, _arg_2: ISelectedRoomObjectData, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: IVector3D, _arg_6: number, _arg_7: number, _arg_8: number): boolean + { + if(!k || !_arg_2) return false; + + const _local_9 = new Vector3d(_arg_8); + const _local_10 = this.validateWallItemLocation(k, _arg_3, _arg_4, _arg_5, _arg_6, _arg_7, _arg_2); + + if(!_local_10) return false; + + k.setLocation(_local_10); + k.setDirection(_local_9); + + return true; + } + + private validateFurnitureLocation(k: IRoomObject, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: IFurnitureStackingHeightMap): Vector3d + { + if(!k || !k.model || !_arg_2) return null; + + let _local_15: Vector3d = null; + + const _local_6 = k.getDirection(); + + if(!_local_6) return null; + + if(!_arg_3 || !_arg_4) return null; + + if((_arg_2.x === _arg_3.x) && (_arg_2.y === _arg_3.y)) + { + if(_local_6.x === _arg_4.x) + { + _local_15 = new Vector3d(); + + _local_15.assign(_arg_3); + + return _local_15; + } + } + + let sizeX = k.model.getValue(RoomObjectVariable.FURNITURE_SIZE_X); + let sizeY = k.model.getValue(RoomObjectVariable.FURNITURE_SIZE_Y); + + if(sizeX < 1) sizeX = 1; + + if(sizeY < 1) sizeY = 1; + + const _local_9 = _arg_3.x; + const _local_10 = _arg_3.y; + let _local_11 = sizeX; + let _local_12 = sizeY; + let _local_13 = 0; + let _local_14 = (Math.trunc((Math.trunc(_local_6.x + 45) % 360) / 90)); + + if((_local_14 === 1) || (_local_14 === 3)) + { + _local_13 = sizeX; + + sizeX = sizeY; + sizeY = _local_13; + } + + _local_14 = Math.trunc((Math.trunc(_arg_4.x + 45) % 360) / 90); + + if((_local_14 === 1) || (_local_14 === 3)) + { + _local_13 = _local_11; + _local_11 = _local_12; + _local_12 = _local_13; + } + + if(_arg_5 && _arg_2) + { + const stackable = (k.model.getValue(RoomObjectVariable.FURNITURE_ALWAYS_STACKABLE) === 1); + + if(_arg_5.validateLocation(_arg_2.x, _arg_2.y, sizeX, sizeY, _local_9, _local_10, _local_11, _local_12, stackable)) + { + return new Vector3d(_arg_2.x, _arg_2.y, _arg_5.getTileHeight(_arg_2.x, _arg_2.y)); + } + + return null; + } + + return null; + } + + private validateWallItemLocation(k: IRoomObject, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: number, _arg_6: number, _arg_7: ISelectedRoomObjectData): Vector3d + { + if((((((k == null) || (k.model == null)) || (_arg_2 == null)) || (_arg_3 == null)) || (_arg_4 == null)) || (_arg_7 == null)) return null; + + const _local_8 = k.model.getValue(RoomObjectVariable.FURNITURE_SIZE_X); + const _local_9 = k.model.getValue(RoomObjectVariable.FURNITURE_SIZE_Z); + const _local_10 = k.model.getValue(RoomObjectVariable.FURNITURE_CENTER_Z); + + if((((_arg_5 < (_local_8 / 2)) || (_arg_5 > (_arg_3.length - (_local_8 / 2)))) || (_arg_6 < _local_10)) || (_arg_6 > (_arg_4.length - (_local_9 - _local_10)))) + { + if((_arg_5 < (_local_8 / 2)) && (_arg_5 <= (_arg_3.length - (_local_8 / 2)))) + { + _arg_5 = (_local_8 / 2); + } + else + { + if((_arg_5 >= (_local_8 / 2)) && (_arg_5 > (_arg_3.length - (_local_8 / 2)))) + { + _arg_5 = (_arg_3.length - (_local_8 / 2)); + } + } + + if((_arg_6 < _local_10) && (_arg_6 <= (_arg_4.length - (_local_9 - _local_10)))) + { + _arg_6 = _local_10; + } + else + { + if((_arg_6 >= _local_10) && (_arg_6 > (_arg_4.length - (_local_9 - _local_10)))) + { + _arg_6 = (_arg_4.length - (_local_9 - _local_10)); + } + } + } + + if((((_arg_5 < (_local_8 / 2)) || (_arg_5 > (_arg_3.length - (_local_8 / 2)))) || (_arg_6 < _local_10)) || (_arg_6 > (_arg_4.length - (_local_9 - _local_10)))) + { + return null; + } + + let _local_11 = Vector3d.sum(Vector3d.product(_arg_3, (_arg_5 / _arg_3.length)), Vector3d.product(_arg_4, (_arg_6 / _arg_4.length))); + + _local_11 = Vector3d.sum(_arg_2, _local_11); + + return _local_11; + } + + private changeObjectState(roomId: number, objectId: number, type: string, state: number, isRandom: boolean): void + { + const category = this._roomEngine.getRoomObjectCategoryForType(type); + + this.changeRoomObjectState(roomId, objectId, category, state, isRandom); + } + + private useObject(roomId: number, objectId: number, type: string, action: string): void + { + if(!this._roomEngine || !this._roomEngine.connection) return; + switch(action) + { + case RoomObjectFurnitureActionEvent.DICE_ACTIVATE: + this._roomEngine.connection.send(new FurnitureDiceActivateComposer(objectId)); + return; + case RoomObjectFurnitureActionEvent.DICE_OFF: + this._roomEngine.connection.send(new FurnitureDiceDeactivateComposer(objectId)); + return; + case RoomObjectFurnitureActionEvent.USE_HABBOWHEEL: + this._roomEngine.connection.send(new FurnitureColorWheelComposer(objectId)); + return; + case RoomObjectFurnitureActionEvent.STICKIE: + this._roomEngine.connection.send(new GetItemDataComposer(objectId)); + return; + case RoomObjectFurnitureActionEvent.ENTER_ONEWAYDOOR: + this._roomEngine.connection.send(new FurnitureOneWayDoorComposer(objectId)); + return; + } + } + + private changeRoomObjectState(roomId: number, objectId: number, category: number, state: number, isRandom: boolean): boolean + { + if(!this._roomEngine || !this._roomEngine.connection) return true; + + if(category === RoomObjectCategory.FLOOR) + { + if(!isRandom) + { + this._roomEngine.connection.send(new FurnitureMultiStateComposer(objectId, state)); + } + else + { + this._roomEngine.connection.send(new FurnitureRandomStateComposer(objectId, state)); + } + } + + else if(category === RoomObjectCategory.WALL) + { + this._roomEngine.connection.send(new FurnitureWallMultiStateComposer(objectId, state)); + } + + return true; + } + + private sendWalkUpdate(x: number, y: number): void + { + if(!this._roomEngine || !this._roomEngine.connection) return; + + this._roomEngine.connection.send(new RoomUnitWalkComposer(x, y)); + } + + private handleMouseOverObject(category: number, roomId: number, event: RoomObjectMouseEvent): ObjectTileCursorUpdateMessage + { + if(category !== RoomObjectCategory.FLOOR) return null; + + const roomObject = this._roomEngine.getRoomObject(roomId, event.objectId, RoomObjectCategory.FLOOR); + + if(!roomObject) return null; + + const location = this.getActiveSurfaceLocation(roomObject, event); + + if(!location) return null; + + const furnitureHeightMap = this._roomEngine.getFurnitureStackingHeightMap(roomId); + + if(!furnitureHeightMap) return null; + + const x = location.x; + const y = location.y; + const z = location.z; + + return new ObjectTileCursorUpdateMessage(new Vector3d(x, y, roomObject.getLocation().z), z, true, event.eventId); + } + + private handleMoveTargetFurni(k: number, _arg_2: RoomObjectMouseEvent): boolean + { + if((_arg_2.objectType === RoomObjectUserType.USER) || (_arg_2.objectType === RoomObjectUserType.PET) || (_arg_2.objectType === RoomObjectUserType.BOT) || (_arg_2.objectType === RoomObjectUserType.RENTABLE_BOT) || (_arg_2.objectType === RoomObjectUserType.MONSTER_PLANT)) return; + + const _local_3 = this._roomEngine.getRoomObject(k, _arg_2.objectId, RoomObjectCategory.FLOOR); + const _local_4 = this.getActiveSurfaceLocation(_local_3, _arg_2); + + if(_local_4) + { + this.sendWalkUpdate(_local_4.x, _local_4.y); + + return true; + } + + return false; + } + + private getActiveSurfaceLocation(k: IRoomObject, _arg_2: RoomObjectMouseEvent): Vector3d + { + if(!k || !_arg_2) return null; + + const furniData = this._roomEngine.sessionDataManager.getFloorItemDataByName(k.type); + + if(!furniData) return null; + + if(!furniData.canStandOn && !furniData.canSitOn && !furniData.canLayOn) return null; + + const model = k.model; + + if(!model) return null; + + const location = k.getLocation(); + const direction = k.getDirection(); + + let sizeX = model.getValue(RoomObjectVariable.FURNITURE_SIZE_X); + let sizeY = model.getValue(RoomObjectVariable.FURNITURE_SIZE_Y); + const sizeZ = model.getValue(RoomObjectVariable.FURNITURE_SIZE_Z); + + if((direction.x === 90) || (direction.x === 270)) [sizeX, sizeY] = [sizeY, sizeX]; + + if(sizeX < 1) sizeX = 1; + if(sizeY < 1) sizeY = 1; + + const renderingCanvas = this._roomEngine.getActiveRoomInstanceRenderingCanvas(); + + if(!renderingCanvas) return null; + + const scale = renderingCanvas.geometry.scale; + const _local_13 = furniData.canSitOn ? 0.5 : 0; + const _local_14 = ((((scale / 2) + _arg_2.spriteOffsetX) + _arg_2.localX) / (scale / 4)); + const _local_15 = (((_arg_2.spriteOffsetY + _arg_2.localY) + (((sizeZ - _local_13) * scale) / 2)) / (scale / 4)); + const _local_16 = ((_local_14 + (2 * _local_15)) / 4); + const _local_17 = ((_local_14 - (2 * _local_15)) / 4); + const _local_18 = Math.floor((location.x + _local_16)); + const _local_19 = Math.floor(((location.y - _local_17) + 1)); + + let _local_20 = false; + + if((_local_18 < location.x) || (_local_18 >= (location.x + sizeX))) _local_20 = true; + else if((_local_19 < location.y) || (_local_19 >= (location.y + sizeY))) _local_20 = true; + + const _local_21 = furniData.canSitOn ? (sizeZ - 0.5) : sizeZ; + + if(!_local_20) return new Vector3d(_local_18, _local_19, _local_21); + + return null; + } + + private handleMouseOverTile(k: RoomObjectTileMouseEvent, roomId: number): ObjectTileCursorUpdateMessage + { + if(this._whereYouClickIsWhereYouGo) + { + return new ObjectTileCursorUpdateMessage(new Vector3d(k.tileXAsInt, k.tileYAsInt, k.tileZAsInt), 0, true, k.eventId); + } + + const roomObject = this._roomEngine.getRoomObjectCursor(roomId); + + if(roomObject && roomObject.visualization) + { + const _local_4 = k.tileXAsInt; + const _local_5 = k.tileYAsInt; + const _local_6 = k.tileZAsInt; + const _local_7 = this._roomEngine.getRoomInstance(roomId); + + if(_local_7) + { + const _local_8 = this._roomEngine.getRoomTileObjectMap(roomId); + + if(_local_8) + { + const _local_9 = _local_8.getObjectIntTile(_local_4, _local_5); + const _local_10 = this._roomEngine.getFurnitureStackingHeightMap(roomId); + + if(_local_10) + { + if(_local_9 && _local_9.model && (_local_9.model.getValue(RoomObjectVariable.FURNITURE_IS_VARIABLE_HEIGHT) > 0)) + { + const _local_11 = _local_10.getTileHeight(_local_4, _local_5); + const _local_12 = this._roomEngine.getLegacyWallGeometry(roomId).getHeight(_local_4, _local_5); + + return new ObjectTileCursorUpdateMessage(new Vector3d(_local_4, _local_5, _local_6), (_local_11 - _local_12), true, k.eventId); + } + + return new ObjectTileCursorUpdateMessage(new Vector3d(_local_4, _local_5, _local_6), 0, true, k.eventId); + } + } + } + } + + return null; + } + + private placeObject(roomId: number, isTileEvent: boolean, isWallEvent: boolean): void + { + const selectedData = this.getSelectedRoomObjectData(roomId); + + if(!selectedData) return; + + let roomObject: IRoomObjectController = null; + let objectId = selectedData.id; + const category = selectedData.category; + + let x = 0; + let y = 0; + let z = 0; + let direction = 0; + let wallLocation = ''; + + if(this._roomEngine && this._roomEngine.connection) + { + roomObject = this._roomEngine.getRoomObject(roomId, objectId, category); + + if(roomObject) + { + const location = roomObject.getLocation(); + + direction = roomObject.getDirection().x; + + if((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.UNIT)) + { + x = location.x; + y = location.y; + z = location.z; + } + + else if(category === RoomObjectCategory.WALL) + { + x = location.x; + y = location.y; + z = location.z; + + const wallGeometry = this._roomEngine.getLegacyWallGeometry(roomId); + + if(wallGeometry) wallLocation = wallGeometry.getOldLocationString(location, direction); + } + + direction = ((((direction / 45) % 8) + 8) % 8); + + if((objectId < 0) && (category === RoomObjectCategory.UNIT)) objectId = (objectId * -1); + + if(this._objectPlacementSource !== RoomObjectPlacementSource.CATALOG) + { + if(category === RoomObjectCategory.UNIT) + { + if(selectedData.typeId === RoomObjectType.PET) + { + this._roomEngine.connection.send(new PetPlaceComposer(objectId, Math.trunc(x), Math.trunc(y))); + } + + else if(selectedData.typeId === RoomObjectType.RENTABLE_BOT) + { + this._roomEngine.connection.send(new BotPlaceComposer(objectId, Math.trunc(x), Math.trunc(y))); + } + } + + else if(roomObject.model.getValue(RoomObjectVariable.FURNITURE_IS_STICKIE) !== undefined) + { + this._roomEngine.connection.send(new FurniturePostItPlaceComposer(objectId, wallLocation)); + } + + else + { + this._roomEngine.connection.send(new FurniturePlaceComposer(objectId, category, wallLocation, Math.trunc(x), Math.trunc(y), direction)); + } + } + } + } + + this._roomEngine.setPlacedRoomObjectData(roomId, new SelectedRoomObjectData(selectedData.id, selectedData.category, null, selectedData.dir, null)); + + this.resetSelectedObjectData(roomId); + + if(this._roomEngine && this._roomEngine.events) + { + const placedInRoom = (roomObject && (roomObject.id === selectedData.id)); + + this._roomEngine.events.dispatchEvent(new RoomEngineObjectPlacedEvent(RoomEngineObjectEvent.PLACED, roomId, objectId, category, wallLocation, x, y, z, direction, placedInRoom, isTileEvent, isWallEvent, selectedData.instanceData)); + } + } + + public modifyRoomObject(roomId: number, objectId: number, category: number, operation: string): boolean + { + if(!this._roomEngine) return false; + + const roomObject = this._roomEngine.getRoomObject(roomId, objectId, category); + + if(!roomObject) return false; + + let _local_9 = true; + + switch(operation) + { + case RoomObjectOperationType.OBJECT_ROTATE_POSITIVE: + case RoomObjectOperationType.OBJECT_ROTATE_NEGATIVE: + if(this._roomEngine.connection) + { + let direction = 0; + + if(operation == RoomObjectOperationType.OBJECT_ROTATE_NEGATIVE) + { + direction = this.getValidRoomObjectDirection(roomObject, false); + } + else + { + direction = this.getValidRoomObjectDirection(roomObject, true); + } + + const x = roomObject.getLocation().x; + const y = roomObject.getLocation().y; + + if(this.isValidLocation(roomObject, new Vector3d(direction), this._roomEngine.getFurnitureStackingHeightMap(roomId))) + { + direction = Math.trunc((direction / 45)); + + if(roomObject.type === RoomObjectUserType.MONSTER_PLANT) + { + const roomSession = this._roomEngine.roomSessionManager.getSession(roomId); + + if(roomSession) + { + const userData = roomSession.userDataManager.getUserDataByIndex(objectId); + + if(userData) + { + this._roomEngine.connection.send(new PetMoveComposer(userData.webID, Math.trunc(x), Math.trunc(y), direction)); + } + } + } + else + { + this._roomEngine.connection.send(new FurnitureFloorUpdateComposer(objectId, x, y, direction)); + } + } + } + break; + case RoomObjectOperationType.OBJECT_EJECT: + case RoomObjectOperationType.OBJECT_PICKUP: + if(this._roomEngine.connection) this._roomEngine.connection.send(new FurniturePickupComposer(category, objectId)); + break; + case RoomObjectOperationType.OBJECT_PICKUP_PET: + if(this._roomEngine.connection) + { + const session = this._roomEngine.roomSessionManager.getSession(roomId); + + if(session) + { + const userData = session.userDataManager.getUserDataByIndex(objectId); + + session.pickupPet(userData.webID); + } + } + break; + case RoomObjectOperationType.OBJECT_PICKUP_BOT: + if(this._roomEngine.connection) + { + const session = this._roomEngine.roomSessionManager.getSession(roomId); + + if(session) + { + const userData = session.userDataManager.getUserDataByIndex(objectId); + + session.pickupBot(userData.webID); + } + } + break; + case RoomObjectOperationType.OBJECT_MOVE: + _local_9 = false; + this.setFurnitureAlphaMultiplier(roomObject, 0.5); + this.setSelectedRoomObjectData(roomId, roomObject.id, category, roomObject.getLocation(), roomObject.getDirection(), operation); + this._roomEngine.setObjectMoverIconSprite(roomObject.id, category, true); + this._roomEngine.setObjectMoverIconSpriteVisible(false); + break; + case RoomObjectOperationType.OBJECT_MOVE_TO: { + const selectedData = this.getSelectedRoomObjectData(roomId); + + this.updateSelectedObjectData(roomId, selectedData.id, selectedData.category, selectedData.loc, selectedData.dir, RoomObjectOperationType.OBJECT_MOVE_TO, selectedData.typeId, selectedData.instanceData, selectedData.stuffData, selectedData.state, selectedData.animFrame, selectedData.posture); + this.setFurnitureAlphaMultiplier(roomObject, 1); + this._roomEngine.removeObjectMoverIconSprite(); + + if(this._roomEngine.connection) + { + if(category === RoomObjectCategory.FLOOR) + { + const angle = ((roomObject.getDirection().x) % 360); + const location = roomObject.getLocation(); + const direction = (angle / 45); + + this._roomEngine.connection.send(new FurnitureFloorUpdateComposer(objectId, location.x, location.y, direction)); + } + + else if(category === RoomObjectCategory.WALL) + { + const angle = ((roomObject.getDirection().x) % 360); + const wallGeometry = this._roomEngine.getLegacyWallGeometry(roomId); + + if(wallGeometry) + { + const location = wallGeometry.getOldLocationString(roomObject.getLocation(), angle); + + if(location) this._roomEngine.connection.send(new FurnitureWallUpdateComposer(objectId, location)); + } + } + + else if(category === RoomObjectCategory.UNIT) + { + const angle = ((roomObject.getDirection().x) % 360); + const location = roomObject.getLocation(); + const direction = (angle / 45); + const race = parseInt(roomObject.model.getValue(RoomObjectVariable.RACE)); + const roomSession = this._roomEngine.roomSessionManager.getSession(roomId); + + if(roomSession) + { + const userData = roomSession.userDataManager.getUserDataByIndex(objectId); + + if(userData) this._roomEngine.connection.send(new PetMoveComposer(userData.webID, location.x, location.y, direction)); + } + } + } + + break; + } + } + + if(_local_9) this.resetSelectedObjectData(roomId); + + return true; + } + + public modifyRoomObjectDataWithMap(roomId: number, objectId: number, category: number, operation: string, data: Map): boolean + { + if(!this._roomEngine) return false; + + const roomObject = this._roomEngine.getRoomObject(roomId, objectId, category); + + if(!roomObject) return false; + + switch(operation) + { + case RoomObjectOperationType.OBJECT_SAVE_STUFF_DATA: + if(this._roomEngine.connection) + { + this._roomEngine.connection.send(new SetObjectDataMessageComposer(objectId, data)); + } + break; + } + + return true; + } + + public modifyWallItemData(roomId: number, objectId: number, colorHex: string, text: string): boolean + { + if(!this._roomEngine || !this._roomEngine.connection) return false; + + this._roomEngine.connection.send(new SetItemDataMessageComposer(objectId, colorHex, text)); + + return true; + } + + public deleteWallItem(roomId: number, itemId: number): boolean + { + if(!this._roomEngine || !this._roomEngine.connection) return false; + + this._roomEngine.connection.send(new RemoveWallItemComposer(itemId)); + + return true; + } + + public getValidRoomObjectDirection(k: IRoomObjectController, _arg_2: boolean): number + { + if(!k || !k.model) return 0; + + let _local_6 = 0; + let _local_7 = 0; + let allowedDirections: number[] = []; + + if(k.type === RoomObjectUserType.MONSTER_PLANT) + { + allowedDirections = k.model.getValue(RoomObjectVariable.PET_ALLOWED_DIRECTIONS); + } + else + { + allowedDirections = k.model.getValue(RoomObjectVariable.FURNITURE_ALLOWED_DIRECTIONS); + } + + let direction = k.getDirection().x; + + if(allowedDirections && allowedDirections.length) + { + _local_6 = allowedDirections.indexOf(direction); + + if(_local_6 < 0) + { + _local_6 = 0; + _local_7 = 0; + + while(_local_7 < allowedDirections.length) + { + if(direction <= allowedDirections[_local_7]) break; + + _local_6++; + _local_7++; + } + + _local_6 = (_local_6 % allowedDirections.length); + } + + if(_arg_2) _local_6 = ((_local_6 + 1) % allowedDirections.length); + else _local_6 = (((_local_6 - 1) + allowedDirections.length) % allowedDirections.length); + + direction = allowedDirections[_local_6]; + } + + return direction; + } + + private isValidLocation(object: IRoomObject, goalDirection: IVector3D, stackingHeightMap: IFurnitureStackingHeightMap): boolean + { + if(!object || !object.model || !goalDirection) return false; + + const direction = object.getDirection(); + const location = object.getLocation(); + + if(!direction || !location) return false; + + if((direction.x % 180) === (goalDirection.x % 180)) return true; + + let sizeX = object.model.getValue(RoomObjectVariable.FURNITURE_SIZE_X); + let sizeY = object.model.getValue(RoomObjectVariable.FURNITURE_SIZE_Y); + + if(sizeX < 1) sizeX = 1; + + if(sizeY < 1) sizeY = 1; + + let _local_8 = sizeX; + let _local_9 = sizeY; + + let _local_11 = (Math.trunc((Math.trunc((goalDirection.x + 45)) % 360) / 90)); + + if((_local_11 === 1) || (_local_11 === 3)) [sizeX, sizeY] = [sizeY, sizeX]; + + _local_11 = (Math.trunc((Math.trunc((direction.x + 45)) % 360) / 90)); + + if(((_local_11 === 1) || (_local_11 === 3))) [_local_8, _local_9] = [_local_9, _local_8]; + + if(stackingHeightMap && location) + { + const alwaysStackable = (object.model.getValue(RoomObjectVariable.FURNITURE_ALWAYS_STACKABLE) === 1); + + if(stackingHeightMap.validateLocation(location.x, location.y, sizeX, sizeY, location.x, location.y, _local_8, _local_9, alwaysStackable, location.z)) return true; + } + + return false; + } + + private placeObjectOnUser(roomId: number, objectId: number, category: number): void + { + const _local_4 = this.getSelectedRoomObjectData(roomId); + + if(!_local_4) return; + + const _local_5 = (this._roomEngine.getRoomObject(roomId, objectId, category) as IRoomObjectController); + + if(!_local_5) return; + + if(!this._roomEngine || !this._roomEngine.events) return; + + this._roomEngine.events.dispatchEvent(new RoomEngineObjectPlacedOnUserEvent(RoomEngineObjectEvent.PLACED_ON_USER, roomId, objectId, category, _local_4.id, _local_4.category)); + } + + public setSelectedObject(roomId: number, objectId: number, category: number): void + { + if(!this._roomEngine) return; + + const eventDispatcher = this._roomEngine.events; + + if(!eventDispatcher) return; + + switch(category) + { + case RoomObjectCategory.UNIT: + case RoomObjectCategory.FLOOR: + case RoomObjectCategory.WALL: + if(category === RoomObjectCategory.UNIT) + { + this.deselectObject(roomId); + this.setSelectedAvatar(roomId, objectId, true); + } + else + { + this.setSelectedAvatar(roomId, 0, false); + + if(objectId !== this._selectedObjectId) + { + this.deselectObject(roomId); + + const roomObject = this._roomEngine.getRoomObject(roomId, objectId, category); + + if(roomObject && roomObject.logic) + { + roomObject.logic.processUpdateMessage(new ObjectSelectedMessage(true)); + + this._selectedObjectId = objectId; + this._selectedObjectCategory = category; + } + } + } + + eventDispatcher.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.SELECTED, roomId, objectId, category)); + + return; + } + } + + private deselectObject(roomId: number): void + { + if(this._selectedObjectId === -1) return; + + const object = this._roomEngine.getRoomObject(roomId, this._selectedObjectId, this._selectedObjectCategory); + + if(object && object.logic) + { + object.logic.processUpdateMessage(new ObjectSelectedMessage(false)); + + this._selectedObjectId = -1; + this._selectedObjectCategory = RoomObjectCategory.MINIMUM; + } + } + + public setSelectedAvatar(k: number, _arg_2: number, _arg_3: boolean): void + { + if(!this._roomEngine) return; + + const _local_4 = RoomObjectCategory.UNIT; + const _local_5 = this._roomEngine.getRoomObject(k, this._selectedAvatarId, _local_4); + + if(_local_5 && _local_5.logic) + { + _local_5.logic.processUpdateMessage(new ObjectAvatarSelectedMessage(false)); + + this._selectedAvatarId = -1; + } + + let _local_6 = false; + + if(_arg_3) + { + const _local_5 = this._roomEngine.getRoomObject(k, _arg_2, _local_4); + + if(_local_5 && _local_5.logic) + { + _local_5.logic.processUpdateMessage(new ObjectAvatarSelectedMessage(true)); + + _local_6 = true; + + this._selectedAvatarId = _arg_2; + + const location = _local_5.getLocation(); + + if(location) this._roomEngine.connection.send(new RoomUnitLookComposer(~~(location.x), ~~(location.y))); + } + } + + const selectionArrow = this._roomEngine.getRoomObjectSelectionArrow(k); + + if(selectionArrow && selectionArrow.logic) + { + if(_local_6 && !this._roomEngine.isPlayingGame()) selectionArrow.logic.processUpdateMessage(new ObjectVisibilityUpdateMessage(ObjectVisibilityUpdateMessage.ENABLED)); + else selectionArrow.logic.processUpdateMessage(new ObjectVisibilityUpdateMessage(ObjectVisibilityUpdateMessage.DISABLED)); + } + } + + private resetSelectedObjectData(roomId: number): void + { + if(!this._roomEngine) return; + + this._roomEngine.removeObjectMoverIconSprite(); + + const selectedData = this.getSelectedRoomObjectData(roomId); + + if(selectedData) + { + if((selectedData.operation === RoomObjectOperationType.OBJECT_MOVE) || (selectedData.operation === RoomObjectOperationType.OBJECT_MOVE_TO)) + { + const roomObject = this._roomEngine.getRoomObject(roomId, selectedData.id, selectedData.category); + + if(roomObject && (selectedData.operation !== RoomObjectOperationType.OBJECT_MOVE_TO)) + { + roomObject.setLocation(selectedData.loc); + roomObject.setDirection(selectedData.dir); + } + + this.setFurnitureAlphaMultiplier(roomObject, 1); + + if(selectedData.category === RoomObjectCategory.WALL) + { + this._roomEngine.updateRoomObjectMask(roomId, selectedData.id, true); + } + + this.updateSelectedObjectData(roomId, selectedData.id, selectedData.category, selectedData.loc, selectedData.dir, RoomObjectOperationType.OBJECT_MOVE, selectedData.typeId, selectedData.instanceData, selectedData.stuffData, selectedData.state, selectedData.animFrame, selectedData.posture); + } + + else if((selectedData.operation === RoomObjectOperationType.OBJECT_PLACE)) + { + const objectId = selectedData.id; + const category = selectedData.category; + + switch(category) + { + case RoomObjectCategory.FLOOR: + this._roomEngine.removeRoomObjectFloor(roomId, objectId); + break; + case RoomObjectCategory.WALL: + this._roomEngine.removeRoomObjectWall(roomId, objectId); + break; + case RoomObjectCategory.UNIT: + this._roomEngine.removeRoomObjectUser(roomId, objectId); + break; + } + } + + this._roomEngine.setSelectedRoomObjectData(roomId, null); + } + } + + private getSelectedRoomObjectData(roomId: number): ISelectedRoomObjectData + { + if(!this._roomEngine) return null; + + return this._roomEngine.getSelectedRoomObjectData(roomId); + } + + private setFurnitureAlphaMultiplier(object: IRoomObjectController, multiplier: number): void + { + if(!object || !object.model) return; + + object.model.setValue(RoomObjectVariable.FURNITURE_ALPHA_MULTIPLIER, multiplier); + } + + private decorateModeMove(event: RoomObjectMouseEvent): boolean + { + return (this._roomEngine.isDecorating) && (!(event.ctrlKey || event.shiftKey)); + } + + public cancelRoomObjectPlacement(roomId: number): boolean + { + this.resetSelectedObjectData(roomId); + + return true; + } + + private setSelectedRoomObjectData(roomId: number, id: number, category: number, location: IVector3D, direction: IVector3D, operation: string, typeId: number = 0, instanceData: string = null, stuffData: IObjectData = null, state: number = -1, frameNumber: number = -1, posture: string = null): void + { + this.resetSelectedObjectData(roomId); + + if(!this._roomEngine) return; + + const selectedData = new SelectedRoomObjectData(id, category, operation, location, direction, typeId, instanceData, stuffData, state, frameNumber, posture); + + this._roomEngine.setSelectedRoomObjectData(roomId, selectedData); + } + + private updateSelectedObjectData(roomId: number, id: number, category: number, location: IVector3D, direction: IVector3D, operation: string, typeId: number = 0, instanceData: string = null, stuffData: IObjectData = null, state: number = -1, frameNumber: number = -1, posture: string = null): void + { + if(!this._roomEngine) return null; + + const selectedData = new SelectedRoomObjectData(id, category, operation, location, direction, typeId, instanceData, stuffData, state, frameNumber, posture); + + this._roomEngine.setSelectedRoomObjectData(roomId, selectedData); + } + + private handleUserPlace(roomObject: IRoomObjectController, x: number, y: number, wallGeometry: ILegacyWallGeometry): boolean + { + if(!wallGeometry.isRoomTile(x, y)) return false; + + roomObject.setLocation(new Vector3d(x, y, wallGeometry.getHeight(x, y))); + + return true; + } + + public get engine(): IRoomEngineServices + { + return this._roomEngine; + } + + public get selectedAvatarId(): number + { + return this._selectedAvatarId; + } +} diff --git a/submodules/renderer/src/nitro/room/RoomObjectLogicFactory.ts b/submodules/renderer/src/nitro/room/RoomObjectLogicFactory.ts new file mode 100644 index 0000000..ec21059 --- /dev/null +++ b/submodules/renderer/src/nitro/room/RoomObjectLogicFactory.ts @@ -0,0 +1,324 @@ +import { IEventDispatcher, IRoomObjectEventHandler, IRoomObjectLogicFactory, NitroLogger, RoomObjectLogicType } from '../../api'; +import { EventDispatcher } from '../../core'; +import { RoomObjectLogicBase } from '../../room'; +import { AvatarLogic, FurnitureAchievementResolutionLogic, FurnitureBadgeDisplayLogic, FurnitureChangeStateWhenStepOnLogic, FurnitureClothingChangeLogic, FurnitureCounterClockLogic, FurnitureCrackableLogic, FurnitureCraftingGizmoLogic, FurnitureCreditLogic, FurnitureCuckooClockLogic, FurnitureCustomStackHeightLogic, FurnitureDiceLogic, FurnitureEcotronBoxLogic, FurnitureEditableInternalLinkLogic, FurnitureEditableRoomLinkLogic, FurnitureEffectBoxLogic, FurnitureExternalImageLogic, FurnitureFireworksLogic, FurnitureFloorHoleLogic, FurnitureGroupForumTerminalLogic, FurnitureGuildCustomizedLogic, FurnitureHabboWheelLogic, FurnitureHighScoreLogic, FurnitureHockeyScoreLogic, FurnitureHweenLovelockLogic, FurnitureIceStormLogic, FurnitureInternalLinkLogic, FurnitureJukeboxLogic, FurnitureLogic, FurnitureLoveLockLogic, FurnitureMannequinLogic, FurnitureMonsterplantSeedLogic, FurnitureMultiHeightLogic, FurnitureMultiStateLogic, FurnitureMysteryBoxLogic, FurnitureMysteryTrophyLogic, FurnitureOneWayDoorLogic, FurniturePetCustomizationLogic, FurniturePlaceholderLogic, FurniturePlanetSystemLogic, FurniturePresentLogic, FurniturePurchaseableClothingLogic, FurniturePushableLogic, FurnitureRandomStateLogic, FurnitureRandomTeleportLogic, FurnitureRentableSpaceLogic, FurnitureRoomBackgroundColorLogic, FurnitureRoomBackgroundLogic, FurnitureRoomBillboardLogic, FurnitureRoomDimmerLogic, FurnitureScoreLogic, FurnitureSongDiskLogic, FurnitureSoundBlockLogic, FurnitureSoundMachineLogic, FurnitureStickieLogic, FurnitureTrophyLogic, FurnitureVoteCounterLogic, FurnitureVoteMajorityLogic, FurnitureWelcomeGiftLogic, FurnitureWindowLogic, FurnitureYoutubeLogic, PetLogic, RoomLogic, SelectionArrowLogic, TileCursorLogic } from './object'; + +export class RoomObjectLogicFactory implements IRoomObjectLogicFactory +{ + private _events: IEventDispatcher; + + private _cachedEvents: Map; + private _registeredEvents: Map; + private _functions: Function[]; + + constructor() + { + this._events = new EventDispatcher(); + + this._cachedEvents = new Map(); + this._registeredEvents = new Map(); + this._functions = []; + } + + public getLogic(type: string): IRoomObjectEventHandler + { + const logic = this.getLogicType(type); + + if(!logic) return null; + + const instance = (new logic() as IRoomObjectEventHandler); + + if(!instance) return null; + + instance.eventDispatcher = this._events; + + if(!this._cachedEvents.get(type)) + { + this._cachedEvents.set(type, true); + + const eventTypes = instance.getEventTypes(); + + for(const eventType of eventTypes) + { + if(!eventType) continue; + + this.registerEventType(eventType); + } + } + + return instance; + } + + private registerEventType(type: string): void + { + if(this._registeredEvents.get(type)) return; + + this._registeredEvents.set(type, true); + + for(const func of this._functions) + { + if(!func) continue; + + this._events.addEventListener(type, func); + } + } + + public registerEventFunction(func: Function): void + { + if(!func) return; + + if(this._functions.indexOf(func) >= 0) return; + + this._functions.push(func); + + for(const eventType of this._registeredEvents.keys()) + { + if(!eventType) continue; + + this._events.addEventListener(eventType, func); + } + } + + public removeEventFunction(func: Function): void + { + if(!func) return; + + const index = this._functions.indexOf(func); + + if(index === -1) return; + + this._functions.splice(index, 1); + + for(const event of this._registeredEvents.keys()) + { + if(!event) continue; + + this._events.removeEventListener(event, func); + } + } + + public getLogicType(type: string): typeof RoomObjectLogicBase + { + if(!type) return null; + + let logic: typeof RoomObjectLogicBase = null; + + switch(type) + { + case RoomObjectLogicType.ROOM: + logic = RoomLogic; + break; + case RoomObjectLogicType.TILE_CURSOR: + logic = TileCursorLogic; + break; + case RoomObjectLogicType.SELECTION_ARROW: + logic = SelectionArrowLogic; + break; + case RoomObjectLogicType.USER: + case RoomObjectLogicType.BOT: + case RoomObjectLogicType.RENTABLE_BOT: + logic = AvatarLogic; + break; + case RoomObjectLogicType.PET: + logic = PetLogic; + break; + case RoomObjectLogicType.FURNITURE_BASIC: + logic = FurnitureLogic; + break; + case RoomObjectLogicType.FURNITURE_BADGE_DISPLAY: + logic = FurnitureBadgeDisplayLogic; + break; + case RoomObjectLogicType.FURNITURE_CHANGE_STATE_WHEN_STEP_ON: + logic = FurnitureChangeStateWhenStepOnLogic; + break; + case RoomObjectLogicType.FURNITURE_COUNTER_CLOCK: + logic = FurnitureCounterClockLogic; + break; + case RoomObjectLogicType.FURNITURE_CRACKABLE: + logic = FurnitureCrackableLogic; + break; + case RoomObjectLogicType.FURNITURE_CREDIT: + logic = FurnitureCreditLogic; + break; + case RoomObjectLogicType.FURNITURE_CUSTOM_STACK_HEIGHT: + logic = FurnitureCustomStackHeightLogic; + break; + case RoomObjectLogicType.FURNITURE_DICE: + logic = FurnitureDiceLogic; + break; + case RoomObjectLogicType.FURNITURE_EDITABLE_INTERNAL_LINK: + logic = FurnitureEditableInternalLinkLogic; + break; + case RoomObjectLogicType.FURNITURE_EDITABLE_ROOM_LINK: + logic = FurnitureEditableRoomLinkLogic; + break; + case RoomObjectLogicType.FURNITURE_EXTERNAL_IMAGE_WALLITEM: + logic = FurnitureExternalImageLogic; + break; + case RoomObjectLogicType.FURNITURE_FIREWORKS: + logic = FurnitureFireworksLogic; + break; + case RoomObjectLogicType.FURNITURE_FLOOR_HOLE: + logic = FurnitureFloorHoleLogic; + break; + case RoomObjectLogicType.FURNITURE_GUILD_CUSTOMIZED: + logic = FurnitureGuildCustomizedLogic; + break; + case RoomObjectLogicType.FURNITURE_HIGH_SCORE: + logic = FurnitureHighScoreLogic; + break; + case RoomObjectLogicType.FURNITURE_HOCKEY_SCORE: + logic = FurnitureHockeyScoreLogic; + break; + case RoomObjectLogicType.FURNITURE_ES: + logic = FurnitureIceStormLogic; + break; + case RoomObjectLogicType.FURNITURE_MANNEQUIN: + logic = FurnitureMannequinLogic; + break; + case RoomObjectLogicType.FURNITURE_MULTIHEIGHT: + logic = FurnitureMultiHeightLogic; + break; + case RoomObjectLogicType.FURNITURE_MULTISTATE: + logic = FurnitureMultiStateLogic; + break; + case RoomObjectLogicType.FURNITURE_ONE_WAY_DOOR: + logic = FurnitureOneWayDoorLogic; + break; + case RoomObjectLogicType.FURNITURE_PET_CUSTOMIZATION: + logic = FurniturePetCustomizationLogic; + break; + case RoomObjectLogicType.FURNITURE_PRESENT: + logic = FurniturePresentLogic; + break; + case RoomObjectLogicType.FURNITURE_PURCHASABLE_CLOTHING: + logic = FurniturePurchaseableClothingLogic; + break; + case RoomObjectLogicType.FURNITURE_PUSHABLE: + logic = FurniturePushableLogic; + break; + case RoomObjectLogicType.FURNITURE_BACKGROUND_COLOR: + logic = FurnitureRoomBackgroundColorLogic; + break; + case RoomObjectLogicType.FURNITURE_BG: + logic = FurnitureRoomBackgroundLogic; + break; + case RoomObjectLogicType.FURNITURE_BB: + logic = FurnitureRoomBillboardLogic; + break; + case RoomObjectLogicType.FURNITURE_ROOMDIMMER: + logic = FurnitureRoomDimmerLogic; + break; + case RoomObjectLogicType.FURNITURE_SCORE: + logic = FurnitureScoreLogic; + break; + case RoomObjectLogicType.FURNITURE_SOUNDBLOCK: + logic = FurnitureSoundBlockLogic; + break; + case RoomObjectLogicType.FURNITURE_STICKIE: + logic = FurnitureStickieLogic; + break; + case RoomObjectLogicType.FURNITURE_TROPHY: + logic = FurnitureTrophyLogic; + break; + case RoomObjectLogicType.FURNITURE_VOTE_COUNTER: + logic = FurnitureVoteCounterLogic; + break; + case RoomObjectLogicType.FURNITURE_VOTE_MAJORITY: + logic = FurnitureVoteMajorityLogic; + break; + case RoomObjectLogicType.FURNITURE_WINDOW: + logic = FurnitureWindowLogic; + break; + case RoomObjectLogicType.FURNITURE_LOVELOCK: + logic = FurnitureLoveLockLogic; + break; + case RoomObjectLogicType.FURNITURE_YOUTUBE: + logic = FurnitureYoutubeLogic; + break; + case RoomObjectLogicType.FURNITURE_CRAFTING_GIZMO: + logic = FurnitureCraftingGizmoLogic; + break; + case RoomObjectLogicType.FURNITURE_RENTABLE_SPACE: + logic = FurnitureRentableSpaceLogic; + break; + case RoomObjectLogicType.FURNITURE_EFFECTBOX: + logic = FurnitureEffectBoxLogic; + break; + case RoomObjectLogicType.FURNITURE_MONSTERPLANT_SEED: + logic = FurnitureMonsterplantSeedLogic; + break; + case RoomObjectLogicType.FURNITURE_MYSTERYBOX: + logic = FurnitureMysteryBoxLogic; + break; + case RoomObjectLogicType.FURNITURE_MYSTERYTROPHY: + logic = FurnitureMysteryTrophyLogic; + break; + case RoomObjectLogicType.FURNITURE_RANDOM_TELEPORT: + logic = FurnitureRandomTeleportLogic; + break; + case RoomObjectLogicType.FURNITURE_CLOTHING_CHANGE: + logic = FurnitureClothingChangeLogic; + break; + case RoomObjectLogicType.FURNITURE_CUCKOO_CLOCK: + logic = FurnitureCuckooClockLogic; + break; + case RoomObjectLogicType.FURNITURE_ECOTRON_BOX: + logic = FurnitureEcotronBoxLogic; + break; + case RoomObjectLogicType.FURNITURE_GROUP_FORUM_TERMINAL: + logic = FurnitureGroupForumTerminalLogic; + break; + case RoomObjectLogicType.FURNITURE_HWEEN_LOVELOCK: + logic = FurnitureHweenLovelockLogic; + break; + case RoomObjectLogicType.FURNITURE_INTERNAL_LINK: + logic = FurnitureInternalLinkLogic; + break; + case RoomObjectLogicType.FURNITURE_JUKEBOX: + logic = FurnitureJukeboxLogic; + break; + case RoomObjectLogicType.FURNITURE_PLACEHOLDER: + logic = FurniturePlaceholderLogic; + break; + case RoomObjectLogicType.FURNITURE_PLANET_SYSTEM: + logic = FurniturePlanetSystemLogic; + break; + case RoomObjectLogicType.FURNITURE_RANDOMSTATE: + logic = FurnitureRandomStateLogic; + break; + case RoomObjectLogicType.FURNITURE_SONG_DISK: + logic = FurnitureSongDiskLogic; + break; + case RoomObjectLogicType.FURNITURE_SOUND_MACHINE: + logic = FurnitureSoundMachineLogic; + break; + case RoomObjectLogicType.FURNITURE_WELCOME_GIFT: + logic = FurnitureWelcomeGiftLogic; + break; + case RoomObjectLogicType.FURNITURE_ACHIEVEMENT_RESOLUTION: + logic = FurnitureAchievementResolutionLogic; + break; + case RoomObjectLogicType.FURNITURE_HABBOWHEEL: + logic = FurnitureHabboWheelLogic; + break; + default: + logic = FurnitureLogic; + break; + } + + if(!logic) + { + NitroLogger.warn('Unknown Logic', type); + + return null; + } + + return logic; + } + + public get events(): IEventDispatcher + { + return this._events; + } +} diff --git a/submodules/renderer/src/nitro/room/RoomVariableEnum.ts b/submodules/renderer/src/nitro/room/RoomVariableEnum.ts new file mode 100644 index 0000000..e41e8b7 --- /dev/null +++ b/submodules/renderer/src/nitro/room/RoomVariableEnum.ts @@ -0,0 +1,14 @@ +export class RoomVariableEnum +{ + public static ROOM_MIN_X: string = 'room_min_x'; + public static ROOM_MAX_X: string = 'room_max_x'; + public static ROOM_MIN_Y: string = 'room_min_y'; + public static ROOM_MAX_Y: string = 'room_max_y'; + public static ROOM_IS_PUBLIC: string = 'room_is_public'; + public static ROOM_Z_SCALE: string = 'room_z_scale'; + public static AD_DISPLAY_DELAY: string = 'ad_display_delay'; + public static IS_PLAYING_GAME: string = 'is_playing_game'; + public static RESTRICTS_DRAGGING: string = 'restricts_dragging'; + public static RESTRICTS_SCALING: string = 'restricts_scaling'; + public static RESTRICTED_SCALE: string = 'room_scale'; +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/index.ts b/submodules/renderer/src/nitro/room/index.ts new file mode 100644 index 0000000..6cb04dd --- /dev/null +++ b/submodules/renderer/src/nitro/room/index.ts @@ -0,0 +1,12 @@ +export * from './ImageResult'; +export * from './messages'; +export * from './object'; +export * from './PetColorResult'; +export * from './preview'; +export * from './RoomContentLoader'; +export * from './RoomEngine'; +export * from './RoomMessageHandler'; +export * from './RoomObjectEventHandler'; +export * from './RoomObjectLogicFactory'; +export * from './RoomVariableEnum'; +export * from './utils'; diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAdUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAdUpdateMessage.ts new file mode 100644 index 0000000..4f842c0 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAdUpdateMessage.ts @@ -0,0 +1,21 @@ +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectAdUpdateMessage extends RoomObjectUpdateMessage +{ + public static IMAGE_LOADED: string = 'ROAUM_IMAGE_LOADED'; + public static IMAGE_LOADING_FAILED: string = 'ROAUM_IMAGE_FAILED'; + + private _type: string; + + constructor(type: string) + { + super(null, null); + + this._type = type; + } + + public get type(): string + { + return this._type; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarCarryObjectUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarCarryObjectUpdateMessage.ts new file mode 100644 index 0000000..4671751 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarCarryObjectUpdateMessage.ts @@ -0,0 +1,25 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarCarryObjectUpdateMessage extends ObjectStateUpdateMessage +{ + private _itemType: number; + private _itemName: string; + + constructor(itemType: number, itemName: string) + { + super(); + + this._itemType = itemType; + this._itemName = itemName; + } + + public get itemType(): number + { + return this._itemType; + } + + public get itemName(): string + { + return this._itemName; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarChatUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarChatUpdateMessage.ts new file mode 100644 index 0000000..91b9834 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarChatUpdateMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarChatUpdateMessage extends ObjectStateUpdateMessage +{ + private _numberOfWords: number; + + constructor(numberOfWords: number = 0) + { + super(); + + this._numberOfWords = numberOfWords; + } + + public get numberOfWords(): number + { + return this._numberOfWords; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarDanceUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarDanceUpdateMessage.ts new file mode 100644 index 0000000..395739f --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarDanceUpdateMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarDanceUpdateMessage extends ObjectStateUpdateMessage +{ + private _danceStyle: number; + + constructor(danceStyle: number = 0) + { + super(); + + this._danceStyle = danceStyle; + } + + public get danceStyle(): number + { + return this._danceStyle; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarEffectUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarEffectUpdateMessage.ts new file mode 100644 index 0000000..99c82a0 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarEffectUpdateMessage.ts @@ -0,0 +1,25 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarEffectUpdateMessage extends ObjectStateUpdateMessage +{ + private _effect: number; + private _delayMilliseconds: number; + + constructor(effect: number, delayMilliseconds: number = 0) + { + super(); + + this._effect = effect; + this._delayMilliseconds = delayMilliseconds; + } + + public get effect(): number + { + return this._effect; + } + + public get delayMilliseconds(): number + { + return this._delayMilliseconds; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarExperienceUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarExperienceUpdateMessage.ts new file mode 100644 index 0000000..ba082a9 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarExperienceUpdateMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarExperienceUpdateMessage extends ObjectStateUpdateMessage +{ + private _gainedExperience: number; + + constructor(amount: number) + { + super(); + + this._gainedExperience = amount; + } + + public get gainedExperience(): number + { + return this._gainedExperience; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarExpressionUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarExpressionUpdateMessage.ts new file mode 100644 index 0000000..8a33d15 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarExpressionUpdateMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarExpressionUpdateMessage extends ObjectStateUpdateMessage +{ + private _expressionType: number; + + constructor(expressionType: number = 0) + { + super(); + + this._expressionType = expressionType; + } + + public get expressionType(): number + { + return this._expressionType; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarFigureUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarFigureUpdateMessage.ts new file mode 100644 index 0000000..004e0ae --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarFigureUpdateMessage.ts @@ -0,0 +1,39 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarFigureUpdateMessage extends ObjectStateUpdateMessage +{ + private _figure: string; + private _gender: string; + private _subType: string; + private _isRiding: boolean; + + constructor(figure: string, gender: string = null, subType: string = null, isRiding: boolean = false) + { + super(); + + this._figure = figure; + this._gender = gender; + this._subType = subType; + this._isRiding = isRiding; + } + + public get figure(): string + { + return this._figure; + } + + public get gender(): string + { + return this._gender; + } + + public get subType(): string + { + return this._subType; + } + + public get isRiding(): boolean + { + return this._isRiding; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarFlatControlUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarFlatControlUpdateMessage.ts new file mode 100644 index 0000000..5134488 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarFlatControlUpdateMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarFlatControlUpdateMessage extends ObjectStateUpdateMessage +{ + private _level: number; + + constructor(level: number = 0) + { + super(); + + this._level = level; + } + + public get level(): number + { + return this._level; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarGestureUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarGestureUpdateMessage.ts new file mode 100644 index 0000000..ad810f8 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarGestureUpdateMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarGestureUpdateMessage extends ObjectStateUpdateMessage +{ + private _gesture: number; + + constructor(gesture: number = 0) + { + super(); + + this._gesture = gesture; + } + + public get gesture(): number + { + return this._gesture; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarGuideStatusUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarGuideStatusUpdateMessage.ts new file mode 100644 index 0000000..bf5bd04 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarGuideStatusUpdateMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarGuideStatusUpdateMessage extends ObjectStateUpdateMessage +{ + private _guideStatus: number; + + constructor(value: number) + { + super(); + + this._guideStatus = value; + } + + public get guideStatus(): number + { + return this._guideStatus; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarMutedUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarMutedUpdateMessage.ts new file mode 100644 index 0000000..548aa16 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarMutedUpdateMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarMutedUpdateMessage extends ObjectStateUpdateMessage +{ + private _isMuted: boolean; + + constructor(isMuted: boolean = false) + { + super(); + + this._isMuted = isMuted; + } + + public get isMuted(): boolean + { + return this._isMuted; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarOwnMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarOwnMessage.ts new file mode 100644 index 0000000..cbdeeaf --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarOwnMessage.ts @@ -0,0 +1,4 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarOwnMessage extends ObjectStateUpdateMessage +{} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarPetGestureUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarPetGestureUpdateMessage.ts new file mode 100644 index 0000000..c4f52da --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarPetGestureUpdateMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarPetGestureUpdateMessage extends ObjectStateUpdateMessage +{ + private _gesture: string; + + constructor(gesture: string) + { + super(); + + this._gesture = gesture; + } + + public get gesture(): string + { + return this._gesture; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarPlayerValueUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarPlayerValueUpdateMessage.ts new file mode 100644 index 0000000..af74ee0 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarPlayerValueUpdateMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarPlayerValueUpdateMessage extends ObjectStateUpdateMessage +{ + private _value: number; + + constructor(value: number) + { + super(); + + this._value = value; + } + + public get value(): number + { + return this._value; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarPlayingGameUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarPlayingGameUpdateMessage.ts new file mode 100644 index 0000000..d18ff82 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarPlayingGameUpdateMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarPlayingGameUpdateMessage extends ObjectStateUpdateMessage +{ + private _isPlayingGame: boolean; + + constructor(flag: boolean) + { + super(); + + this._isPlayingGame = flag; + } + + public get isPlayingGame(): boolean + { + return this._isPlayingGame; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarPostureUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarPostureUpdateMessage.ts new file mode 100644 index 0000000..b7e5ec0 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarPostureUpdateMessage.ts @@ -0,0 +1,25 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarPostureUpdateMessage extends ObjectStateUpdateMessage +{ + private _postureType: string; + private _parameter: string; + + constructor(postureType: string, parameter: string = '') + { + super(); + + this._postureType = postureType; + this._parameter = parameter; + } + + public get postureType(): string + { + return this._postureType; + } + + public get parameter(): string + { + return this._parameter; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarSelectedMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarSelectedMessage.ts new file mode 100644 index 0000000..dc7ac65 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarSelectedMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarSelectedMessage extends ObjectStateUpdateMessage +{ + private _selected: boolean; + + constructor(selected: boolean) + { + super(); + + this._selected = selected; + } + + public get selected(): boolean + { + return this._selected; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarSignUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarSignUpdateMessage.ts new file mode 100644 index 0000000..bfb63b8 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarSignUpdateMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarSignUpdateMessage extends ObjectStateUpdateMessage +{ + private _signType: number; + + constructor(signType: number = 0) + { + super(); + + this._signType = signType; + } + + public get signType(): number + { + return this._signType; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarSleepUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarSleepUpdateMessage.ts new file mode 100644 index 0000000..747fd13 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarSleepUpdateMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarSleepUpdateMessage extends ObjectStateUpdateMessage +{ + private _isSleeping: boolean; + + constructor(isSleeping: boolean = false) + { + super(); + + this._isSleeping = isSleeping; + } + + public get isSleeping(): boolean + { + return this._isSleeping; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarTypingUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarTypingUpdateMessage.ts new file mode 100644 index 0000000..0038f76 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarTypingUpdateMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarTypingUpdateMessage extends ObjectStateUpdateMessage +{ + private _isTyping: boolean; + + constructor(isTyping: boolean = false) + { + super(); + + this._isTyping = isTyping; + } + + public get isTyping(): boolean + { + return this._isTyping; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarUpdateMessage.ts new file mode 100644 index 0000000..4a3b528 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarUpdateMessage.ts @@ -0,0 +1,33 @@ +import { IVector3D } from '../../../api'; +import { ObjectMoveUpdateMessage } from './ObjectMoveUpdateMessage'; + +export class ObjectAvatarUpdateMessage extends ObjectMoveUpdateMessage +{ + private _headDirection: number; + private _canStandUp: boolean; + private _baseY: number; + + constructor(location: IVector3D, targetLocation: IVector3D, direction: IVector3D, headDirection: number, canStandUp: boolean, baseY: number) + { + super(location, targetLocation, direction); + + this._headDirection = headDirection; + this._canStandUp = canStandUp; + this._baseY = baseY; + } + + public get headDirection(): number + { + return this._headDirection; + } + + public get canStandUp(): boolean + { + return this._canStandUp; + } + + public get baseY(): number + { + return this._baseY; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectAvatarUseObjectUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectAvatarUseObjectUpdateMessage.ts new file mode 100644 index 0000000..6997a70 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectAvatarUseObjectUpdateMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectAvatarUseObjectUpdateMessage extends ObjectStateUpdateMessage +{ + private _itemType: number; + + constructor(itemType: number) + { + super(); + + this._itemType = itemType; + } + + public get itemType(): number + { + return this._itemType; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectDataUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectDataUpdateMessage.ts new file mode 100644 index 0000000..93cbc7a --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectDataUpdateMessage.ts @@ -0,0 +1,33 @@ +import { IObjectData } from '../../../api'; +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectDataUpdateMessage extends RoomObjectUpdateMessage +{ + private _state: number; + private _data: IObjectData; + private _extra: number; + + constructor(state: number, data: IObjectData, extra: number = null) + { + super(null, null); + + this._state = state; + this._data = data; + this._extra = extra; + } + + public get state(): number + { + return this._state; + } + + public get data(): IObjectData + { + return this._data; + } + + public get extra(): number + { + return this._extra; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectGroupBadgeUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectGroupBadgeUpdateMessage.ts new file mode 100644 index 0000000..228842b --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectGroupBadgeUpdateMessage.ts @@ -0,0 +1,27 @@ +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectGroupBadgeUpdateMessage extends RoomObjectUpdateMessage +{ + public static BADGE_LOADED: string = 'ROGBUM_BADGE_LOADED'; + + private _badgeId: string; + private _assetName: string; + + constructor(badgeId: string, assetName: string) + { + super(null, null); + + this._badgeId = badgeId; + this._assetName = assetName; + } + + public get badgeId(): string + { + return this._badgeId; + } + + public get assetName(): string + { + return this._assetName; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectHeightUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectHeightUpdateMessage.ts new file mode 100644 index 0000000..756babb --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectHeightUpdateMessage.ts @@ -0,0 +1,19 @@ +import { IVector3D } from '../../../api'; +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectHeightUpdateMessage extends RoomObjectUpdateMessage +{ + private _height: number; + + constructor(location: IVector3D, direction: IVector3D, height: number) + { + super(location, direction); + + this._height = height; + } + + public get height(): number + { + return this._height; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectItemDataUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectItemDataUpdateMessage.ts new file mode 100644 index 0000000..512f1bd --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectItemDataUpdateMessage.ts @@ -0,0 +1,18 @@ +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectItemDataUpdateMessage extends RoomObjectUpdateMessage +{ + private _data: string; + + constructor(data: string) + { + super(null, null); + + this._data = data; + } + + public get data(): string + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectModelDataUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectModelDataUpdateMessage.ts new file mode 100644 index 0000000..19f7df2 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectModelDataUpdateMessage.ts @@ -0,0 +1,25 @@ +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectModelDataUpdateMessage extends RoomObjectUpdateMessage +{ + private _numberKey: string; + private _numberValue: number; + + constructor(numberKey: string, numberValue: number) + { + super(null, null); + + this._numberKey = numberKey; + this._numberValue = numberValue; + } + + public get numberKey(): string + { + return this._numberKey; + } + + public get numberValue(): number + { + return this._numberValue; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectMoveUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectMoveUpdateMessage.ts new file mode 100644 index 0000000..f352cca --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectMoveUpdateMessage.ts @@ -0,0 +1,28 @@ +import { IVector3D } from '../../../api'; +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectMoveUpdateMessage extends RoomObjectUpdateMessage +{ + private _targetLocation: IVector3D; + private _isSlide: boolean; + + constructor(location: IVector3D, targetLocation: IVector3D, direction: IVector3D, isSlide: boolean = false) + { + super(location, direction); + + this._targetLocation = targetLocation; + this._isSlide = isSlide; + } + + public get targetLocation(): IVector3D + { + if(!this._targetLocation) return this.location; + + return this._targetLocation; + } + + public get isSlide(): boolean + { + return this._isSlide; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectRoomColorUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectRoomColorUpdateMessage.ts new file mode 100644 index 0000000..a9a4037 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectRoomColorUpdateMessage.ts @@ -0,0 +1,41 @@ +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectRoomColorUpdateMessage extends RoomObjectUpdateMessage +{ + public static BACKGROUND_COLOR: string = 'RORCUM_BACKGROUND_COLOR'; + + private _type: string; + private _color: number; + private _light: number; + private _backgroundOnly: boolean; + + constructor(type: string, color: number, light: number, backgroundOnly: boolean) + { + super(null, null); + + this._type = type; + this._color = color; + this._light = light; + this._backgroundOnly = backgroundOnly; + } + + public get type(): string + { + return this._type; + } + + public get color(): number + { + return this._color; + } + + public get light(): number + { + return this._light; + } + + public get backgroundOnly(): boolean + { + return this._backgroundOnly; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectRoomFloorHoleUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectRoomFloorHoleUpdateMessage.ts new file mode 100644 index 0000000..184849c --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectRoomFloorHoleUpdateMessage.ts @@ -0,0 +1,56 @@ +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectRoomFloorHoleUpdateMessage extends RoomObjectUpdateMessage +{ + public static ADD: string = 'ORPFHUM_ADD'; + public static REMOVE: string = 'ORPFHUM_REMOVE'; + + private _type: string; + private _id: number; + private _x: number; + private _y: number; + private _width: number; + private _height: number; + + constructor(type: string, id: number, x: number = 0, y: number = 0, width: number = 0, height: number = 0) + { + super(null, null); + + this._type = type; + this._id = id; + this._x = x; + this._y = y; + this._width = width; + this._height = height; + } + + public get type(): string + { + return this._type; + } + + public get id(): number + { + return this._id; + } + + public get x(): number + { + return this._x; + } + + public get y(): number + { + return this._y; + } + + public get width(): number + { + return this._width; + } + + public get height(): number + { + return this._height; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectRoomMapUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectRoomMapUpdateMessage.ts new file mode 100644 index 0000000..d93115e --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectRoomMapUpdateMessage.ts @@ -0,0 +1,28 @@ +import { RoomObjectUpdateMessage } from '../../../room'; +import { RoomMapData } from '../object'; + +export class ObjectRoomMapUpdateMessage extends RoomObjectUpdateMessage +{ + public static UPDATE_MAP: string = 'RORMUM_UPDATE_MAP'; + + private _type: string; + private _mapData: RoomMapData; + + constructor(mapData: RoomMapData) + { + super(null, null); + + this._type = ObjectRoomMapUpdateMessage.UPDATE_MAP; + this._mapData = mapData; + } + + public get type(): string + { + return this._type; + } + + public get mapData(): RoomMapData + { + return this._mapData; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectRoomMaskUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectRoomMaskUpdateMessage.ts new file mode 100644 index 0000000..562edaf --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectRoomMaskUpdateMessage.ts @@ -0,0 +1,53 @@ +import { IVector3D, Vector3d } from '../../../api'; +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectRoomMaskUpdateMessage extends RoomObjectUpdateMessage +{ + public static ADD_MASK: string = 'RORMUM_ADD_MASK'; + public static REMOVE_MASK: string = 'RORMUM_ADD_MASK'; + public static DOOR: string = 'door'; + public static WINDOW: string = 'window'; + public static HOLE: string = 'hole'; + + private _type: string; + private _maskId: string; + private _maskType: string; + private _maskLocation: Vector3d; + private _maskCategory: string; + + constructor(type: string, maskId: string, maskType: string = null, maskLocation: IVector3D = null, maskCategory: string = 'window') + { + super(null, null); + + this._type = type; + this._maskId = maskId; + this._maskType = maskType; + this._maskLocation = maskLocation ? new Vector3d(maskLocation.x, maskLocation.y, maskLocation.z) : null; + this._maskCategory = maskCategory; + } + + public get type(): string + { + return this._type; + } + + public get maskId(): string + { + return this._maskId; + } + + public get maskType(): string + { + return this._maskType; + } + + public get maskLocation(): IVector3D + { + return this._maskLocation; + } + + public get maskCategory(): string + { + return this._maskCategory; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectRoomPlanePropertyUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectRoomPlanePropertyUpdateMessage.ts new file mode 100644 index 0000000..10731e7 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectRoomPlanePropertyUpdateMessage.ts @@ -0,0 +1,28 @@ +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectRoomPlanePropertyUpdateMessage extends RoomObjectUpdateMessage +{ + public static WALL_THICKNESS: string = 'RORPPUM_WALL_THICKNESS'; + public static FLOOR_THICKNESS: string = 'RORPVUM_FLOOR_THICKNESS'; + + private _type: string; + private _value: number; + + constructor(type: string, value: number) + { + super(null, null); + + this._type = type; + this._value = value; + } + + public get type(): string + { + return this._type; + } + + public get value(): number + { + return this._value; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectRoomPlaneVisibilityUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectRoomPlaneVisibilityUpdateMessage.ts new file mode 100644 index 0000000..cca2cc9 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectRoomPlaneVisibilityUpdateMessage.ts @@ -0,0 +1,28 @@ +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectRoomPlaneVisibilityUpdateMessage extends RoomObjectUpdateMessage +{ + public static WALL_VISIBILITY: string = 'RORPVUM_WALL_VISIBILITY'; + public static FLOOR_VISIBILITY: string = 'RORPVUM_FLOOR_VISIBILITY'; + + private _type: string; + private _visible: boolean; + + constructor(type: string, visible: boolean) + { + super(null, null); + + this._type = type; + this._visible = visible; + } + + public get type(): string + { + return this._type; + } + + public get visible(): boolean + { + return this._visible; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectRoomUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectRoomUpdateMessage.ts new file mode 100644 index 0000000..d50a9da --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectRoomUpdateMessage.ts @@ -0,0 +1,29 @@ +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectRoomUpdateMessage extends RoomObjectUpdateMessage +{ + public static ROOM_WALL_UPDATE: string = 'RORUM_ROOM_WALL_UPDATE'; + public static ROOM_FLOOR_UPDATE: string = 'RORUM_ROOM_FLOOR_UPDATE'; + public static ROOM_LANDSCAPE_UPDATE: string = 'RORUM_ROOM_LANDSCAPE_UPDATE'; + + private _type: string; + private _value: string; + + constructor(type: string, value: string) + { + super(null, null); + + this._type = type; + this._value = value; + } + + public get type(): string + { + return this._type; + } + + public get value(): string + { + return this._value; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectSelectedMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectSelectedMessage.ts new file mode 100644 index 0000000..e807613 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectSelectedMessage.ts @@ -0,0 +1,18 @@ +import { ObjectStateUpdateMessage } from './ObjectStateUpdateMessage'; + +export class ObjectSelectedMessage extends ObjectStateUpdateMessage +{ + private _selected: boolean; + + constructor(selected: boolean) + { + super(); + + this._selected = selected; + } + + public get selected(): boolean + { + return this._selected; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/messages/ObjectStateUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectStateUpdateMessage.ts new file mode 100644 index 0000000..64084d4 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectStateUpdateMessage.ts @@ -0,0 +1,9 @@ +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectStateUpdateMessage extends RoomObjectUpdateMessage +{ + constructor() + { + super(null, null); + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectTileCursorUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectTileCursorUpdateMessage.ts new file mode 100644 index 0000000..4557350 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectTileCursorUpdateMessage.ts @@ -0,0 +1,40 @@ +import { Vector3d } from '../../../api'; +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectTileCursorUpdateMessage extends RoomObjectUpdateMessage +{ + private _height: number; + private _sourceEventId: string; + private _visible: boolean; + private _toggleVisibility: boolean; + + constructor(k: Vector3d, height: number, visible: boolean, sourceEventId: string, toggleVisibility: boolean = false) + { + super(k, null); + + this._height = height; + this._visible = visible; + this._sourceEventId = sourceEventId; + this._toggleVisibility = toggleVisibility; + } + + public get height(): number + { + return this._height; + } + + public get visible(): boolean + { + return this._visible; + } + + public get sourceEventId(): string + { + return this._sourceEventId; + } + + public get toggleVisibility(): boolean + { + return this._toggleVisibility; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/ObjectVisibilityUpdateMessage.ts b/submodules/renderer/src/nitro/room/messages/ObjectVisibilityUpdateMessage.ts new file mode 100644 index 0000000..b739ab6 --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/ObjectVisibilityUpdateMessage.ts @@ -0,0 +1,21 @@ +import { RoomObjectUpdateMessage } from '../../../room'; + +export class ObjectVisibilityUpdateMessage extends RoomObjectUpdateMessage +{ + public static ENABLED: string = 'ROVUM_ENABLED'; + public static DISABLED: string = 'ROVUM_DISABLED'; + + private _type: string; + + constructor(type: string) + { + super(null, null); + + this._type = type; + } + + public get type(): string + { + return this._type; + } +} diff --git a/submodules/renderer/src/nitro/room/messages/index.ts b/submodules/renderer/src/nitro/room/messages/index.ts new file mode 100644 index 0000000..826176e --- /dev/null +++ b/submodules/renderer/src/nitro/room/messages/index.ts @@ -0,0 +1,40 @@ +export * from './ObjectAdUpdateMessage'; +export * from './ObjectAvatarCarryObjectUpdateMessage'; +export * from './ObjectAvatarChatUpdateMessage'; +export * from './ObjectAvatarDanceUpdateMessage'; +export * from './ObjectAvatarEffectUpdateMessage'; +export * from './ObjectAvatarExperienceUpdateMessage'; +export * from './ObjectAvatarExpressionUpdateMessage'; +export * from './ObjectAvatarFigureUpdateMessage'; +export * from './ObjectAvatarFlatControlUpdateMessage'; +export * from './ObjectAvatarGestureUpdateMessage'; +export * from './ObjectAvatarGuideStatusUpdateMessage'; +export * from './ObjectAvatarMutedUpdateMessage'; +export * from './ObjectAvatarOwnMessage'; +export * from './ObjectAvatarPetGestureUpdateMessage'; +export * from './ObjectAvatarPlayerValueUpdateMessage'; +export * from './ObjectAvatarPlayingGameUpdateMessage'; +export * from './ObjectAvatarPostureUpdateMessage'; +export * from './ObjectAvatarSelectedMessage'; +export * from './ObjectAvatarSignUpdateMessage'; +export * from './ObjectAvatarSleepUpdateMessage'; +export * from './ObjectAvatarTypingUpdateMessage'; +export * from './ObjectAvatarUpdateMessage'; +export * from './ObjectAvatarUseObjectUpdateMessage'; +export * from './ObjectDataUpdateMessage'; +export * from './ObjectGroupBadgeUpdateMessage'; +export * from './ObjectHeightUpdateMessage'; +export * from './ObjectItemDataUpdateMessage'; +export * from './ObjectModelDataUpdateMessage'; +export * from './ObjectMoveUpdateMessage'; +export * from './ObjectRoomColorUpdateMessage'; +export * from './ObjectRoomFloorHoleUpdateMessage'; +export * from './ObjectRoomMapUpdateMessage'; +export * from './ObjectRoomMaskUpdateMessage'; +export * from './ObjectRoomPlanePropertyUpdateMessage'; +export * from './ObjectRoomPlaneVisibilityUpdateMessage'; +export * from './ObjectRoomUpdateMessage'; +export * from './ObjectSelectedMessage'; +export * from './ObjectStateUpdateMessage'; +export * from './ObjectTileCursorUpdateMessage'; +export * from './ObjectVisibilityUpdateMessage'; diff --git a/submodules/renderer/src/nitro/room/object/RoomFloorHole.ts b/submodules/renderer/src/nitro/room/object/RoomFloorHole.ts new file mode 100644 index 0000000..456dfd5 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/RoomFloorHole.ts @@ -0,0 +1,35 @@ +export class RoomFloorHole +{ + private _x: number; + private _y: number; + private _width: number; + private _height: number; + + constructor(x: number, y: number, width: number, height: number) + { + this._x = x; + this._y = y; + this._width = width; + this._height = height; + } + + public get x(): number + { + return this._x; + } + + public get y(): number + { + return this._y; + } + + public get width(): number + { + return this._width; + } + + public get height(): number + { + return this._height; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/RoomMapData.ts b/submodules/renderer/src/nitro/room/object/RoomMapData.ts new file mode 100644 index 0000000..6cf0dd2 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/RoomMapData.ts @@ -0,0 +1,126 @@ +import { IRoomMapData } from '../../../api'; + +export class RoomMapData implements IRoomMapData +{ + private _width: number; + private _height: number; + private _wallHeight: number; + private _fixedWallsHeight: number; + private _tileMap: { height: number }[][]; + private _holeMap: { id: number, x: number, y: number, width: number, height: number }[]; + private _doors: { x: number, y: number, z: number, dir: number }[]; + private _dimensions: { minX: number, maxX: number, minY: number, maxY: number }; + private _restrictsDragging: boolean; + private _restrictsScaling: boolean; + private _restrictedScale: number; + + constructor() + { + this._width = 0; + this._height = 0; + this._wallHeight = 0; + this._fixedWallsHeight = 0; + this._tileMap = []; + this._holeMap = []; + this._doors = []; + this._dimensions = { + minX: 0, + maxX: 0, + minY: 0, + maxY: 0 + }; + this._restrictsDragging = false; + this._restrictedScale = 1; + this._restrictsScaling = false; + } + + public get width(): number + { + return this._width; + } + + public set width(width: number) + { + this._width = width; + } + + public get height(): number + { + return this._height; + } + + public set height(height: number) + { + this._height = height; + } + + public get wallHeight(): number + { + return this._wallHeight; + } + + public set wallHeight(wallHeight: number) + { + this._wallHeight = wallHeight; + } + + public get fixedWallsHeight(): number + { + return this._fixedWallsHeight; + } + + public set fixedWallsHeight(fixedWallsHeight: number) + { + this._fixedWallsHeight = fixedWallsHeight; + } + + public get tileMap(): { height: number }[][] + { + return this._tileMap; + } + + public get holeMap(): { id: number, x: number, y: number, width: number, height: number }[] + { + return this._holeMap; + } + + public get doors(): { x: number, y: number, z: number, dir: number }[] + { + return this._doors; + } + + public get dimensions(): { minX: number, maxX: number, minY: number, maxY: number } + { + return this._dimensions; + } + + public get restrictsDragging(): boolean + { + return this._restrictsDragging; + } + + public set restrictsDragging(flag: boolean) + { + this._restrictsDragging = flag; + } + + public get restrictsScaling(): boolean + { + return this._restrictsScaling; + } + + public set restrictsScaling(flag: boolean) + { + this._restrictsScaling = flag; + } + + public get restrictedScale(): number + { + return this._restrictedScale; + } + + public set restrictedScale(scale: number) + { + this._restrictedScale = scale; + } +} diff --git a/submodules/renderer/src/nitro/room/object/RoomMapMaskData.ts b/submodules/renderer/src/nitro/room/object/RoomMapMaskData.ts new file mode 100644 index 0000000..c95c980 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/RoomMapMaskData.ts @@ -0,0 +1,16 @@ +import { IVector3D } from '../../../api'; + +export class RoomMapMaskData +{ + private _masks: { id: string, type: string, category: string, locations: IVector3D[] }[]; + + constructor() + { + this._masks = []; + } + + public get masks(): { id: string, type: string, category: string, locations: IVector3D[] }[] + { + return this._masks; + } +} diff --git a/submodules/renderer/src/nitro/room/object/RoomObjectVisualizationFactory.ts b/submodules/renderer/src/nitro/room/object/RoomObjectVisualizationFactory.ts new file mode 100644 index 0000000..671cf7f --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/RoomObjectVisualizationFactory.ts @@ -0,0 +1,231 @@ +import { IAssetData, IObjectVisualizationData, IRoomObjectGraphicVisualization, IRoomObjectVisualizationFactory, NitroLogger, RoomObjectVisualizationType } from '../../../api'; +import { RoomObjectSpriteVisualization } from '../../../room'; +import { Nitro } from '../../Nitro'; +import { AvatarVisualization, AvatarVisualizationData, FurnitureAnimatedVisualization, FurnitureAnimatedVisualizationData, FurnitureBadgeDisplayVisualization, FurnitureBBVisualization, FurnitureBottleVisualization, FurnitureBuilderPlaceholderVisualization, FurnitureCounterClockVisualization, FurnitureCuboidVisualization, FurnitureExternalImageVisualization, FurnitureFireworksVisualization, FurnitureGiftWrappedFireworksVisualization, FurnitureGiftWrappedVisualization, FurnitureGuildCustomizedVisualization, FurnitureGuildIsometricBadgeVisualization, FurnitureHabboWheelVisualization, FurnitureIsometricBBVisualization, FurnitureMannequinVisualization, FurnitureMannequinVisualizationData, FurniturePartyBeamerVisualization, FurniturePlanetSystemVisualization, FurniturePosterVisualization, FurnitureQueueTileVisualization, FurnitureResettingAnimatedVisualization, FurnitureRoomBackgroundVisualization, FurnitureScoreBoardVisualization, FurnitureSoundBlockVisualization, FurnitureStickieVisualization, FurnitureValRandomizerVisualization, FurnitureVisualization, FurnitureVisualizationData, FurnitureVoteCounterVisualization, FurnitureVoteMajorityVisualization, FurnitureWaterAreaVisualization, FurnitureYoutubeVisualization, PetVisualization, PetVisualizationData, RoomVisualization, RoomVisualizationData, TileCursorVisualization } from './visualization'; + +export class RoomObjectVisualizationFactory implements IRoomObjectVisualizationFactory +{ + private static CACHING_ENABLED: boolean = true; + + private _visualizationDatas: Map; + + constructor() + { + this._visualizationDatas = new Map(); + } + + public getVisualization(type: string): IRoomObjectGraphicVisualization + { + const visualization = this.getVisualizationType(type); + + if(!visualization) return null; + + return new visualization(); + } + + public getVisualizationType(type: string): typeof RoomObjectSpriteVisualization + { + if(!type) return null; + + let visualization: typeof RoomObjectSpriteVisualization = null; + + switch(type) + { + case RoomObjectVisualizationType.ROOM: + visualization = RoomVisualization; + break; + case RoomObjectVisualizationType.TILE_CURSOR: + visualization = TileCursorVisualization; + break; + case RoomObjectVisualizationType.USER: + case RoomObjectVisualizationType.BOT: + case RoomObjectVisualizationType.RENTABLE_BOT: + visualization = AvatarVisualization; + break; + case RoomObjectVisualizationType.PET_ANIMATED: + visualization = PetVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_STATIC: + visualization = FurnitureVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_ANIMATED: + visualization = FurnitureAnimatedVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_RESETTING_ANIMATED: + visualization = FurnitureResettingAnimatedVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_BADGE_DISPLAY: + visualization = FurnitureBadgeDisplayVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_BG: + visualization = FurnitureRoomBackgroundVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_BB: + visualization = FurnitureBBVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_ISOMETRIC_BB: + visualization = FurnitureIsometricBBVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_BOTTLE: + visualization = FurnitureBottleVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_BUILDER_PLACEHOLDER: + visualization = FurnitureBuilderPlaceholderVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_COUNTER_CLOCK: + visualization = FurnitureCounterClockVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_CUBOID: + visualization = FurnitureCuboidVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_EXTERNAL_IMAGE: + visualization = FurnitureExternalImageVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_FIREWORKS: + visualization = FurnitureFireworksVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_GIFT_WRAPPED_FIREWORKS: + visualization = FurnitureGiftWrappedFireworksVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_GIFT_WRAPPED: + visualization = FurnitureGiftWrappedVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_GUILD_CUSTOMIZED: + visualization = FurnitureGuildCustomizedVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_GUILD_ISOMETRIC_BADGE: + visualization = FurnitureGuildIsometricBadgeVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_HABBOWHEEL: + visualization = FurnitureHabboWheelVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_MANNEQUIN: + visualization = FurnitureMannequinVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_PARTY_BEAMER: + visualization = FurniturePartyBeamerVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_PLANET_SYSTEM: + visualization = FurniturePlanetSystemVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_POSTER: + visualization = FurniturePosterVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_QUEUE_TILE: + visualization = FurnitureQueueTileVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_SCORE_BOARD: + visualization = FurnitureScoreBoardVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_SOUNDBLOCK: + visualization = FurnitureSoundBlockVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_STICKIE: + visualization = FurnitureStickieVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_VAL_RANDOMIZER: + visualization = FurnitureValRandomizerVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_VOTE_COUNTER: + visualization = FurnitureVoteCounterVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_VOTE_MAJORITY: + visualization = FurnitureVoteMajorityVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_WATER_AREA: + visualization = FurnitureWaterAreaVisualization; + break; + case RoomObjectVisualizationType.FURNITURE_YOUTUBE: + visualization = FurnitureYoutubeVisualization; + break; + } + + if(!visualization) + { + NitroLogger.log('Unknown Visualization', type); + + return null; + } + + return visualization; + } + + public getVisualizationData(type: string, visualization: string, asset: IAssetData): IObjectVisualizationData + { + const existing = this._visualizationDatas.get(type); + + if(existing) return existing; + + let visualizationData: IObjectVisualizationData = null; + + switch(visualization) + { + case RoomObjectVisualizationType.FURNITURE_STATIC: + case RoomObjectVisualizationType.FURNITURE_GIFT_WRAPPED: + case RoomObjectVisualizationType.FURNITURE_BB: + case RoomObjectVisualizationType.FURNITURE_ISOMETRIC_BB: + case RoomObjectVisualizationType.FURNITURE_BG: + case RoomObjectVisualizationType.FURNITURE_STICKIE: + case RoomObjectVisualizationType.FURNITURE_BUILDER_PLACEHOLDER: + visualizationData = new FurnitureVisualizationData(); + break; + case RoomObjectVisualizationType.FURNITURE_ANIMATED: + case RoomObjectVisualizationType.FURNITURE_RESETTING_ANIMATED: + case RoomObjectVisualizationType.FURNITURE_POSTER: + case RoomObjectVisualizationType.FURNITURE_HABBOWHEEL: + case RoomObjectVisualizationType.FURNITURE_VAL_RANDOMIZER: + case RoomObjectVisualizationType.FURNITURE_BOTTLE: + case RoomObjectVisualizationType.FURNITURE_PLANET_SYSTEM: + case RoomObjectVisualizationType.FURNITURE_QUEUE_TILE: + case RoomObjectVisualizationType.FURNITURE_PARTY_BEAMER: + case RoomObjectVisualizationType.FURNITURE_COUNTER_CLOCK: + case RoomObjectVisualizationType.FURNITURE_WATER_AREA: + case RoomObjectVisualizationType.FURNITURE_SCORE_BOARD: + case RoomObjectVisualizationType.FURNITURE_FIREWORKS: + case RoomObjectVisualizationType.FURNITURE_GIFT_WRAPPED_FIREWORKS: + case RoomObjectVisualizationType.FURNITURE_GUILD_CUSTOMIZED: + case RoomObjectVisualizationType.FURNITURE_GUILD_ISOMETRIC_BADGE: + case RoomObjectVisualizationType.FURNITURE_VOTE_COUNTER: + case RoomObjectVisualizationType.FURNITURE_VOTE_MAJORITY: + case RoomObjectVisualizationType.FURNITURE_SOUNDBLOCK: + case RoomObjectVisualizationType.FURNITURE_BADGE_DISPLAY: + case RoomObjectVisualizationType.FURNITURE_EXTERNAL_IMAGE: + case RoomObjectVisualizationType.FURNITURE_YOUTUBE: + case RoomObjectVisualizationType.TILE_CURSOR: + visualizationData = new FurnitureAnimatedVisualizationData(); + break; + case RoomObjectVisualizationType.FURNITURE_MANNEQUIN: + visualizationData = new FurnitureMannequinVisualizationData(); + break; + case RoomObjectVisualizationType.ROOM: + visualizationData = new RoomVisualizationData(); + break; + case RoomObjectVisualizationType.USER: + case RoomObjectVisualizationType.BOT: + case RoomObjectVisualizationType.RENTABLE_BOT: + visualizationData = new AvatarVisualizationData(); + break; + case RoomObjectVisualizationType.PET_ANIMATED: + visualizationData = new PetVisualizationData(); + break; + } + + if(!visualizationData) return null; + + if(!visualizationData.initialize(asset)) + { + visualizationData.dispose(); + + return null; + } + + if((visualizationData instanceof AvatarVisualizationData) || (visualizationData instanceof FurnitureMannequinVisualizationData)) + { + visualizationData.avatarManager = Nitro.instance.avatar; + } + + if(RoomObjectVisualizationFactory.CACHING_ENABLED) this._visualizationDatas.set(type, visualizationData); + + return visualizationData; + } +} diff --git a/submodules/renderer/src/nitro/room/object/RoomPlaneBitmapMaskData.ts b/submodules/renderer/src/nitro/room/object/RoomPlaneBitmapMaskData.ts new file mode 100644 index 0000000..dfa299a --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/RoomPlaneBitmapMaskData.ts @@ -0,0 +1,55 @@ +import { IVector3D, Vector3d } from '../../../api'; + +export class RoomPlaneBitmapMaskData +{ + public static WINDOW: string = 'window'; + public static HOLE: string = 'hole'; + + private _loc: Vector3d; + private _type: string; + private _category: string; + + constructor(type: string, loc: IVector3D, category: string) + { + this.type = type; + this.loc = loc; + this.category = category; + } + + public get loc(): IVector3D + { + return this._loc; + } + + public set loc(k: IVector3D) + { + if(!this._loc) this._loc = new Vector3d(); + + this._loc.assign(k); + } + + public get type(): string + { + return this._type; + } + + public set type(type: string) + { + this._type = type; + } + + public get category(): string + { + return this._category; + } + + public set category(category: string) + { + this._category = category; + } + + public dispose(): void + { + this._loc = null; + } +} diff --git a/submodules/renderer/src/nitro/room/object/RoomPlaneBitmapMaskParser.ts b/submodules/renderer/src/nitro/room/object/RoomPlaneBitmapMaskParser.ts new file mode 100644 index 0000000..d4f84fb --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/RoomPlaneBitmapMaskParser.ts @@ -0,0 +1,147 @@ +import { IVector3D } from '../../../api'; +import { RoomMapMaskData } from './RoomMapMaskData'; +import { RoomPlaneBitmapMaskData } from './RoomPlaneBitmapMaskData'; + +export class RoomPlaneBitmapMaskParser +{ + private _masks: Map; + + constructor() + { + this._masks = new Map(); + } + + public get maskCount(): number + { + return this._masks.size; + } + + public dispose(): void + { + if(this._masks) + { + this.reset(); + + this._masks = null; + } + } + + public initialize(k: RoomMapMaskData): boolean + { + if(!k) return false; + + this._masks.clear(); + + if(k.masks.length) + { + for(const mask of k.masks) + { + if(!mask) continue; + + const location = mask.locations.length ? mask.locations[0] : null; + + if(!location) continue; + + this._masks.set(mask.id, new RoomPlaneBitmapMaskData(mask.type, location, mask.category)); + } + } + + return true; + } + + public reset(): void + { + for(const mask of this._masks.values()) + { + if(!mask) continue; + + mask.dispose(); + } + + this._masks.clear(); + } + + public addMask(k: string, _arg_2: string, _arg_3: IVector3D, _arg_4: string): void + { + const mask = new RoomPlaneBitmapMaskData(_arg_2, _arg_3, _arg_4); + + this._masks.delete(k); + this._masks.set(k, mask); + } + + public removeMask(k: string): boolean + { + const existing = this._masks.get(k); + + if(existing) + { + this._masks.delete(k); + + existing.dispose(); + + return true; + } + + return false; + } + + public getXML(): RoomMapMaskData + { + const data = new RoomMapMaskData(); + + for(const [key, mask] of this._masks.entries()) + { + if(!mask) continue; + + const type = this.getMaskType(mask); + const category = this.getMaskCategory(mask); + const location = this.getMaskLocation(mask); + + if(type && category && location) + { + const newMask: any = { + id: key, + type: type, + category: category, + locations: [ + { + x: location.x, + y: location.y, + z: location.z + } + ] + }; + + data.masks.push(newMask); + } + } + + return data; + } + + public getMaskLocation(mask: RoomPlaneBitmapMaskData): IVector3D + { + if(!mask) return null; + + return mask.loc; + } + + public getMaskType(mask: RoomPlaneBitmapMaskData): string + { + if(!mask) return null; + + return mask.type; + } + + public getMaskCategory(mask: RoomPlaneBitmapMaskData): string + { + if(!mask) return null; + + return mask.category; + } + + public get masks(): Map + { + return this._masks; + } +} diff --git a/submodules/renderer/src/nitro/room/object/RoomPlaneData.ts b/submodules/renderer/src/nitro/room/object/RoomPlaneData.ts new file mode 100644 index 0000000..db26460 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/RoomPlaneData.ts @@ -0,0 +1,201 @@ +import { IVector3D, Vector3d } from '../../../api'; +import { RoomPlaneMaskData } from './RoomPlaneMaskData'; + +export class RoomPlaneData +{ + public static PLANE_UNDEFINED: number = 0; + public static PLANE_FLOOR: number = 1; + public static PLANE_WALL: number = 2; + public static PLANE_LANDSCAPE: number = 3; + public static PLANE_BILLBOARD: number = 4; + + private _type: number = 0; + private _loc: Vector3d = null; + private _leftSide: Vector3d = null; + private _rightSide: Vector3d = null; + private _normal: Vector3d = null; + private _normalDirection: Vector3d = null; + private _secondaryNormals: Vector3d[]; + private _masks: RoomPlaneMaskData[]; + + constructor(k: number, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: IVector3D[]) + { + let _local_6: number; + let _local_7: number; + let _local_8: number; + let _local_9: number; + let _local_10: number; + let _local_11: number; + let _local_12: IVector3D; + let _local_13: Vector3d; + this._secondaryNormals = []; + this._masks = []; + this._loc = new Vector3d(); + this._loc.assign(_arg_2); + this._leftSide = new Vector3d(); + this._leftSide.assign(_arg_3); + this._rightSide = new Vector3d(); + this._rightSide.assign(_arg_4); + this._type = k; + if(((!(_arg_3 == null)) && (!(_arg_4 == null)))) + { + this._normal = Vector3d.crossProduct(_arg_3, _arg_4); + _local_6 = 0; + _local_7 = 0; + _local_8 = 0; + _local_9 = 0; + _local_10 = 0; + if(((!(this.normal.x == 0)) || (!(this.normal.y == 0)))) + { + _local_9 = this.normal.x; + _local_10 = this.normal.y; + _local_6 = (360 + ((Math.atan2(_local_10, _local_9) / Math.PI) * 180)); + if(_local_6 >= 360) + { + _local_6 = (_local_6 - 360); + } + _local_9 = Math.sqrt(((this.normal.x * this.normal.x) + (this.normal.y * this.normal.y))); + _local_10 = this.normal.z; + _local_7 = (360 + ((Math.atan2(_local_10, _local_9) / Math.PI) * 180)); + if(_local_7 >= 360) + { + _local_7 = (_local_7 - 360); + } + } + else + { + if(this.normal.z < 0) + { + _local_7 = 90; + } + else + { + _local_7 = 270; + } + } + this._normalDirection = new Vector3d(_local_6, _local_7, _local_8); + } + if(((!(_arg_5 == null)) && (_arg_5.length > 0))) + { + _local_11 = 0; + while(_local_11 < _arg_5.length) + { + _local_12 = _arg_5[_local_11]; + if(((!(_local_12 == null)) && (_local_12.length > 0))) + { + _local_13 = new Vector3d(); + _local_13.assign(_local_12); + _local_13.multiply((1 / _local_13.length)); + this._secondaryNormals.push(_local_13); + } + _local_11++; + } + } + } + + public get type(): number + { + return this._type; + } + + public get loc(): IVector3D + { + return this._loc; + } + + public get leftSide(): IVector3D + { + return this._leftSide; + } + + public get rightSide(): IVector3D + { + return this._rightSide; + } + + public get normal(): IVector3D + { + return this._normal; + } + + public get normalDirection(): IVector3D + { + return this._normalDirection; + } + + public get secondaryNormalCount(): number + { + return this._secondaryNormals.length; + } + + public get maskCount(): number + { + return this._masks.length; + } + + public getSecondaryNormal(k: number): IVector3D + { + if(((k < 0) || (k >= this.secondaryNormalCount))) + { + return null; + } + const _local_2: Vector3d = new Vector3d(); + _local_2.assign((this._secondaryNormals[k] as IVector3D)); + return _local_2; + } + + public addMask(k: number, _arg_2: number, _arg_3: number, _arg_4: number): void + { + const _local_5: RoomPlaneMaskData = new RoomPlaneMaskData(k, _arg_2, _arg_3, _arg_4); + this._masks.push(_local_5); + } + + private getMask(k: number): RoomPlaneMaskData + { + if(((k < 0) || (k >= this.maskCount))) + { + return null; + } + return this._masks[k]; + } + + public getMaskLeftSideLoc(k: number): number + { + const _local_2: RoomPlaneMaskData = this.getMask(k); + if(_local_2 != null) + { + return _local_2.leftSideLoc; + } + return -1; + } + + public getMaskRightSideLoc(k: number): number + { + const _local_2: RoomPlaneMaskData = this.getMask(k); + if(_local_2 != null) + { + return _local_2.rightSideLoc; + } + return -1; + } + + public getMaskLeftSideLength(k: number): number + { + const _local_2: RoomPlaneMaskData = this.getMask(k); + if(_local_2 != null) + { + return _local_2.leftSideLength; + } + return -1; + } + + public getMaskRightSideLength(k: number): number + { + const _local_2: RoomPlaneMaskData = this.getMask(k); + if(_local_2 != null) + { + return _local_2.rightSideLength; + } + return -1; + } +} diff --git a/submodules/renderer/src/nitro/room/object/RoomPlaneMaskData.ts b/submodules/renderer/src/nitro/room/object/RoomPlaneMaskData.ts new file mode 100644 index 0000000..7baf59c --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/RoomPlaneMaskData.ts @@ -0,0 +1,35 @@ +export class RoomPlaneMaskData +{ + private _leftSideLoc: number = 0; + private _rightSideLoc: number = 0; + private _leftSideLength: number = 0; + private _rightSideLength: number = 0; + + constructor(k: number, _arg_2: number, _arg_3: number, _arg_4: number) + { + this._leftSideLoc = k; + this._rightSideLoc = _arg_2; + this._leftSideLength = _arg_3; + this._rightSideLength = _arg_4; + } + + public get leftSideLoc(): number + { + return this._leftSideLoc; + } + + public get rightSideLoc(): number + { + return this._rightSideLoc; + } + + public get leftSideLength(): number + { + return this._leftSideLength; + } + + public get rightSideLength(): number + { + return this._rightSideLength; + } +} diff --git a/submodules/renderer/src/nitro/room/object/RoomPlaneParser.ts b/submodules/renderer/src/nitro/room/object/RoomPlaneParser.ts new file mode 100644 index 0000000..1a070eb --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/RoomPlaneParser.ts @@ -0,0 +1,1699 @@ +import { Point } from '@pixi/math'; +import { IVector3D, Vector3d } from '../../../api'; +import { RoomFloorHole } from './RoomFloorHole'; +import { RoomMapData } from './RoomMapData'; +import { RoomPlaneData } from './RoomPlaneData'; +import { RoomWallData } from './RoomWallData'; + +export class RoomPlaneParser +{ + private static FLOOR_THICKNESS: number = 0.25; + private static WALL_THICKNESS: number = 0.25; + private static MAX_WALL_ADDITIONAL_HEIGHT: number = 20; + + public static TILE_BLOCKED: number = -110; + public static TILE_HOLE: number = -100; + + private _tileMatrix: number[][]; + private _tileMatrixOriginal: number[][]; + private _width: number = 0; + private _height: number = 0; + private _minX: number = 0; + private _maxX: number = 0; + private _minY: number = 0; + private _maxY: number = 0; + private _planes: RoomPlaneData[]; + private _wallHeight: number; + private _wallThicknessMultiplier: number; + private _floorThicknessMultiplier: number; + private _fixedWallHeight: number = -1; + private _floorHeight: number = 0; + private _floorHoles: Map; + private _floorHoleMatrix: boolean[][]; + private _restrictsDragging: boolean; + private _restrictsScaling: boolean = false; + private _restrictedScale: number = 1; + + constructor() + { + this._tileMatrix = []; + this._tileMatrixOriginal = []; + this._planes = []; + this._floorHoleMatrix = []; + this._wallHeight = 3.6; + this._wallThicknessMultiplier = 1; + this._floorThicknessMultiplier = 1; + this._floorHoles = new Map(); + } + + private static getFloorHeight(matricies: number[][]): number + { + const length = matricies.length; + + if(!length) return 0; + + let tileHeight = 0; + + let i = 0; + + while(i < length) + { + const matrix = matricies[i]; + + let j = 0; + + while(j < matrix.length) + { + const height = matrix[j]; + + if(height > tileHeight) tileHeight = height; + + j++; + } + + i++; + } + + return tileHeight; + } + + private static findEntranceTile(matricies: number[][]): Point + { + if(!matricies) return null; + + const length = matricies.length; + + if(!length) return null; + + const _local_6: number[] = []; + + let i = 0; + + while(i < length) + { + const matrix = matricies[i]; + + if(!matrix || !matrix.length) return null; + + let j = 0; + + while(j < matrix.length) + { + if(matrix[j] >= 0) + { + _local_6.push(j); + + break; + } + + j++; + } + + if(_local_6.length < (i + 1)) _local_6.push((matrix.length + 1)); + + i++; + } + + i = 1; + + while(i < (_local_6.length - 1)) + { + if(((Math.trunc(_local_6[i]) <= (Math.trunc(_local_6[(i - 1)]) - 1)) && (Math.trunc(_local_6[i]) <= (Math.trunc(_local_6[(i + 1)]) - 1)))) return new Point(Math.trunc((_local_6[i]) | 0), i); + + i++; + } + + return null; + } + + private static expandFloorTiles(k: number[][]): number[][] + { + let _local_5: number; + let _local_6: number; + let _local_7: number; + let _local_8: number; + let _local_10: number; + let _local_11: number; + let _local_12: number; + let _local_13: number; + let _local_14: number; + let _local_15: number; + let _local_16: number; + let _local_17: number; + const _local_2 = k.length; + const _local_3: number = k[0].length; + const _local_4: number[][] = []; + _local_6 = 0; + while(_local_6 < (_local_2 * 4)) + { + _local_4[_local_6] = []; + _local_6++; + } + let _local_9 = 0; + _local_6 = 0; + while(_local_6 < _local_2) + { + _local_10 = 0; + _local_5 = 0; + while(_local_5 < _local_3) + { + _local_11 = k[_local_6][_local_5]; + if(((_local_11 < 0) || (_local_11 <= 0xFF))) + { + _local_8 = 0; + while(_local_8 < 4) + { + _local_7 = 0; + while(_local_7 < 4) + { + if(_local_4[(_local_9 + _local_8)] === undefined) _local_4[(_local_9 + _local_8)] = []; + + _local_4[(_local_9 + _local_8)][(_local_10 + _local_7)] = ((_local_11 < 0) ? _local_11 : (_local_11 * 4)); + _local_7++; + } + _local_8++; + } + } + else + { + _local_12 = ((_local_11 & 0xFF) * 4); + _local_13 = (_local_12 + (((_local_11 >> 11) & 0x01) * 3)); + _local_14 = (_local_12 + (((_local_11 >> 10) & 0x01) * 3)); + _local_15 = (_local_12 + (((_local_11 >> 9) & 0x01) * 3)); + _local_16 = (_local_12 + (((_local_11 >> 8) & 0x01) * 3)); + _local_7 = 0; + while(_local_7 < 3) + { + _local_17 = (_local_7 + 1); + _local_4[_local_9][(_local_10 + _local_7)] = (((_local_13 * (3 - _local_7)) + (_local_14 * _local_7)) / 3); + _local_4[(_local_9 + 3)][(_local_10 + _local_17)] = (((_local_15 * (3 - _local_17)) + (_local_16 * _local_17)) / 3); + _local_4[(_local_9 + _local_17)][_local_10] = (((_local_13 * (3 - _local_17)) + (_local_15 * _local_17)) / 3); + _local_4[(_local_9 + _local_7)][(_local_10 + 3)] = (((_local_14 * (3 - _local_7)) + (_local_16 * _local_7)) / 3); + _local_7++; + } + _local_4[(_local_9 + 1)][(_local_10 + 1)] = ((_local_13 > _local_12) ? (_local_12 + 2) : (_local_12 + 1)); + _local_4[(_local_9 + 1)][(_local_10 + 2)] = ((_local_14 > _local_12) ? (_local_12 + 2) : (_local_12 + 1)); + _local_4[(_local_9 + 2)][(_local_10 + 1)] = ((_local_15 > _local_12) ? (_local_12 + 2) : (_local_12 + 1)); + _local_4[(_local_9 + 2)][(_local_10 + 2)] = ((_local_16 > _local_12) ? (_local_12 + 2) : (_local_12 + 1)); + } + _local_10 = (_local_10 + 4); + _local_5++; + } + _local_9 = (_local_9 + 4); + _local_6++; + } + return _local_4; + } + + private static addTileTypes(k: number[][]): void + { + let _local_4: number; + let _local_5: number; + let _local_6: number; + let _local_7: number; + let _local_8: number; + let _local_9: number; + let _local_10: number; + let _local_11: number; + let _local_12: number; + let _local_13: number; + let _local_14: number; + let _local_15: number; + let _local_16: number; + let _local_17: number; + const _local_2: number = (k.length - 1); + const _local_3: number = (k[0].length - 1); + _local_5 = 1; + while(_local_5 < _local_2) + { + _local_4 = 1; + while(_local_4 < _local_3) + { + _local_6 = k[_local_5][_local_4]; + if(_local_6 < 0) + { + // + } + else + { + _local_7 = (k[(_local_5 - 1)][(_local_4 - 1)] & 0xFF); + _local_8 = (k[(_local_5 - 1)][_local_4] & 0xFF); + _local_9 = (k[(_local_5 - 1)][(_local_4 + 1)] & 0xFF); + _local_10 = (k[_local_5][(_local_4 - 1)] & 0xFF); + _local_11 = (k[_local_5][(_local_4 + 1)] & 0xFF); + _local_12 = (k[(_local_5 + 1)][(_local_4 - 1)] & 0xFF); + _local_13 = (k[(_local_5 + 1)][_local_4] & 0xFF); + _local_14 = (k[(_local_5 + 1)][(_local_4 + 1)] & 0xFF); + _local_15 = (_local_6 + 1); + _local_16 = (_local_6 - 1); + _local_17 = (((((((_local_7 == _local_15) || (_local_8 == _local_15)) || (_local_10 == _local_15)) ? 8 : 0) | ((((_local_9 == _local_15) || (_local_8 == _local_15)) || (_local_11 == _local_15)) ? 4 : 0)) | ((((_local_12 == _local_15) || (_local_13 == _local_15)) || (_local_10 == _local_15)) ? 2 : 0)) | ((((_local_14 == _local_15) || (_local_13 == _local_15)) || (_local_11 == _local_15)) ? 1 : 0)); + if(_local_17 == 15) + { + _local_17 = 0; + } + k[_local_5][_local_4] = (_local_6 | (_local_17 << 8)); + } + _local_4++; + } + _local_5++; + } + } + + private static unpadHeightMap(k: number[][]): void + { + k.shift(); + k.pop(); + + for(const _local_2 of k) + { + _local_2.shift(); + _local_2.pop(); + } + } + + private static padHeightMap(k: number[][]): void + { + const _local_2: number[] = []; + const _local_3: number[] = []; + for(const _local_4 of k) + { + _local_4.push(RoomPlaneParser.TILE_BLOCKED); + _local_4.unshift(RoomPlaneParser.TILE_BLOCKED); + } + for(const _local_5 of k[0]) + { + _local_2.push(RoomPlaneParser.TILE_BLOCKED); + _local_3.push(RoomPlaneParser.TILE_BLOCKED); + } + k.push(_local_3); + k.unshift(_local_2); + } + + + public get minX(): number + { + return this._minX; + } + + public get maxX(): number + { + return this._maxX; + } + + public get minY(): number + { + return this._minY; + } + + public get maxY(): number + { + return this._maxY; + } + + public get tileMapWidth(): number + { + return this._width; + } + + public get tileMapHeight(): number + { + return this._height; + } + + public get planeCount(): number + { + return this._planes.length; + } + + public get floorHeight(): number + { + if(this._fixedWallHeight != -1) + { + return this._fixedWallHeight; + } + return this._floorHeight; + } + + public get wallHeight(): number + { + if(this._fixedWallHeight != -1) + { + return this._fixedWallHeight + 3.6; + } + return this._wallHeight; + } + + public set wallHeight(k: number) + { + if(k < 0) + { + k = 0; + } + this._wallHeight = k; + } + + public get wallThicknessMultiplier(): number + { + return this._wallThicknessMultiplier; + } + + public set wallThicknessMultiplier(k: number) + { + if(k < 0) + { + k = 0; + } + this._wallThicknessMultiplier = k; + } + + public get floorThicknessMultiplier(): number + { + return this._floorThicknessMultiplier; + } + + public set floorThicknessMultiplier(k: number) + { + if(k < 0) + { + k = 0; + } + this._floorThicknessMultiplier = k; + } + + public dispose(): void + { + this._planes = null; + this._tileMatrix = null; + this._tileMatrixOriginal = null; + this._floorHoleMatrix = null; + if(this._floorHoles != null) + { + this._floorHoles.clear(); + this._floorHoles = null; + } + } + + public reset(): void + { + this._planes = []; + this._tileMatrix = []; + this._tileMatrixOriginal = []; + this._width = 0; + this._height = 0; + this._minX = 0; + this._maxX = 0; + this._minY = 0; + this._maxY = 0; + this._floorHeight = 0; + this._floorHoleMatrix = []; + } + + public initializeTileMap(width: number, height: number): boolean + { + if(width < 0) width = 0; + + if(height < 0) height = 0; + + this._tileMatrix = []; + this._tileMatrixOriginal = []; + this._floorHoleMatrix = []; + + let y = 0; + + while(y < height) + { + const tileMatrix = []; + const tileMatrixOriginal = []; + const floorHoleMatrix = []; + + let x = 0; + + while(x < width) + { + tileMatrix[x] = RoomPlaneParser.TILE_BLOCKED; + tileMatrixOriginal[x] = RoomPlaneParser.TILE_BLOCKED; + floorHoleMatrix[x] = false; + + x++; + } + + this._tileMatrix.push(tileMatrix); + this._tileMatrixOriginal.push(tileMatrixOriginal); + this._floorHoleMatrix.push(floorHoleMatrix); + + y++; + } + + this._width = width; + this._height = height; + this._minX = this._width; + this._maxX = -1; + this._minY = this._height; + this._maxY = -1; + + return true; + } + + public setTileHeight(k: number, _arg_2: number, _arg_3: number): boolean + { + let _local_4: number[]; + let _local_5: boolean; + let _local_6: number; + let _local_7: boolean; + let _local_8: number; + if(((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height))) + { + _local_4 = this._tileMatrix[_arg_2]; + + _local_4[k] = _arg_3; + if(_arg_3 >= 0) + { + if(k < this._minX) + { + this._minX = k; + } + if(k > this._maxX) + { + this._maxX = k; + } + if(_arg_2 < this._minY) + { + this._minY = _arg_2; + } + if(_arg_2 > this._maxY) + { + this._maxY = _arg_2; + } + } + else + { + if(((k == this._minX) || (k == this._maxX))) + { + _local_5 = false; + _local_6 = this._minY; + while(_local_6 < this._maxY) + { + if(this.getTileHeightInternal(k, _local_6) >= 0) + { + _local_5 = true; + break; + } + _local_6++; + } + if(!_local_5) + { + if(k == this._minX) + { + this._minX++; + } + if(k == this._maxX) + { + this._maxX--; + } + } + } + if(((_arg_2 == this._minY) || (_arg_2 == this._maxY))) + { + _local_7 = false; + _local_8 = this._minX; + while(_local_8 < this._maxX) + { + if(this.getTileHeight(_local_8, _arg_2) >= 0) + { + _local_7 = true; + break; + } + _local_8++; + } + if(!_local_7) + { + if(_arg_2 == this._minY) + { + this._minY++; + } + if(_arg_2 == this._maxY) + { + this._maxY--; + } + } + } + } + return true; + } + return false; + } + + public getTileHeight(k: number, _arg_2: number): number + { + if(((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) + { + return RoomPlaneParser.TILE_BLOCKED; + } + + const _local_3 = this._tileMatrix[_arg_2]; + + if(_local_3[k] === undefined) return 0; + + return Math.abs(_local_3[k]); + } + + private getTileHeightOriginal(k: number, _arg_2: number): number + { + if(((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) + { + return RoomPlaneParser.TILE_BLOCKED; + } + if(this._floorHoleMatrix[_arg_2][k]) + { + return RoomPlaneParser.TILE_HOLE; + } + const _local_3 = this._tileMatrixOriginal[_arg_2]; + return _local_3[k]; + } + + private getTileHeightInternal(k: number, _arg_2: number): number + { + if(((((k < 0) || (k >= this._width)) || (_arg_2 < 0)) || (_arg_2 >= this._height))) + { + return RoomPlaneParser.TILE_BLOCKED; + } + const _local_3 = this._tileMatrix[_arg_2]; + return _local_3[k]; + } + + public initializeFromTileData(k: number = -1): boolean + { + let _local_2: number; + let _local_3: number; + this._fixedWallHeight = k; + _local_3 = 0; + while(_local_3 < this._height) + { + _local_2 = 0; + while(_local_2 < this._width) + { + if(this._tileMatrixOriginal[_local_3] === undefined) this._tileMatrixOriginal[_local_3] = []; + this._tileMatrixOriginal[_local_3][_local_2] = this._tileMatrix[_local_3][_local_2]; + _local_2++; + } + _local_3++; + } + const _local_4: Point = RoomPlaneParser.findEntranceTile(this._tileMatrix); + + _local_3 = 0; + while(_local_3 < this._height) + { + _local_2 = 0; + while(_local_2 < this._width) + { + if(this._floorHoleMatrix[_local_3] === undefined) this._floorHoleMatrix[_local_3] = []; + if(this._floorHoleMatrix[_local_3][_local_2]) + { + this.setTileHeight(_local_2, _local_3, RoomPlaneParser.TILE_HOLE); + } + _local_2++; + } + _local_3++; + } + + return this.initialize(_local_4); + } + + private initialize(k: Point): boolean + { + let _local_2 = 0; + if(k != null) + { + _local_2 = this.getTileHeight(k.x, k.y); + this.setTileHeight(k.x, k.y, RoomPlaneParser.TILE_BLOCKED); + } + this._floorHeight = RoomPlaneParser.getFloorHeight(this._tileMatrix); + this.createWallPlanes(); + const _local_3: number[][] = []; + + for(const _local_4 of this._tileMatrix) _local_3.push(_local_4.concat()); + + RoomPlaneParser.padHeightMap(_local_3); + RoomPlaneParser.addTileTypes(_local_3); + RoomPlaneParser.unpadHeightMap(_local_3); + const _local_5 = RoomPlaneParser.expandFloorTiles(_local_3); + this.extractPlanes(_local_5); + if(k != null) + { + this.setTileHeight(k.x, k.y, _local_2); + this.addFloor(new Vector3d((k.x + 0.5), (k.y + 0.5), _local_2), new Vector3d(-1, 0, 0), new Vector3d(0, -1, 0), false, false, false, false); + } + + return true; + } + + private generateWallData(k: Point, _arg_2: boolean): RoomWallData + { + let _local_8: boolean; + let _local_9: boolean; + let _local_10: number; + let _local_11: Point; + let _local_12: number; + const _local_3: RoomWallData = new RoomWallData(); + const _local_4: Function[] = [this.extractTopWall.bind(this), this.extractRightWall.bind(this), this.extractBottomWall.bind(this), this.extractLeftWall.bind(this)]; + let _local_5 = 0; + let _local_6: Point = new Point(k.x, k.y); + let _local_7 = 0; + while(_local_7++ < 1000) + { + _local_8 = false; + _local_9 = false; + _local_10 = _local_5; + if(((((_local_6.x < this.minX) || (_local_6.x > this.maxX)) || (_local_6.y < this.minY)) || (_local_6.y > this.maxY))) + { + _local_8 = true; + } + _local_11 = _local_4[_local_5](_local_6, _arg_2); + if(_local_11 == null) + { + return null; + } + _local_12 = (Math.abs((_local_11.x - _local_6.x)) + Math.abs((_local_11.y - _local_6.y))); + if(((_local_6.x == _local_11.x) || (_local_6.y == _local_11.y))) + { + _local_5 = (((_local_5 - 1) + _local_4.length) % _local_4.length); + _local_12 = (_local_12 + 1); + _local_9 = true; + } + else + { + _local_5 = ((_local_5 + 1) % _local_4.length); + _local_12--; + } + _local_3.addWall(_local_6, _local_10, _local_12, _local_8, _local_9); + if((((_local_11.x == k.x) && (_local_11.y == k.y)) && ((!(_local_11.x == _local_6.x)) || (!(_local_11.y == _local_6.y))))) + { + break; + } + _local_6 = _local_11; + } + if(_local_3.count == 0) + { + return null; + } + return _local_3; + } + + private hidePeninsulaWallChains(k: RoomWallData): void + { + let _local_5: number; + let _local_6: number; + let _local_7: boolean; + let _local_8: number; + let _local_2 = 0; + const _local_3: number = k.count; + while(_local_2 < _local_3) + { + const _local_4 = _local_2; + + _local_5 = _local_2; + _local_6 = 0; + _local_7 = false; + while(((!(k.getBorder(_local_2))) && (_local_2 < _local_3))) + { + if(k.getLeftTurn(_local_2)) + { + _local_6++; + } + else + { + if(_local_6 > 0) + { + _local_6--; + } + } + if(_local_6 > 1) + { + _local_7 = true; + } + _local_5 = _local_2; + _local_2++; + } + if(_local_7) + { + _local_8 = _local_4; + while(_local_8 <= _local_5) + { + k.setHideWall(_local_8, true); + _local_8++; + } + } + _local_2++; + } + } + + private updateWallsNextToHoles(k: RoomWallData): void + { + let _local_4: Point; + let _local_5: number; + let _local_6: number; + let _local_7: IVector3D; + let _local_8: IVector3D; + let _local_9: number; + let _local_10: number; + const _local_2: number = k.count; + let _local_3 = 0; + while(_local_3 < _local_2) + { + if(!k.getHideWall(_local_3)) + { + _local_4 = k.getCorner(_local_3); + _local_5 = k.getDirection(_local_3); + _local_6 = k.getLength(_local_3); + _local_7 = RoomWallData.WALL_DIRECTION_VECTORS[_local_5]; + _local_8 = RoomWallData.WALL_NORMAL_VECTORS[_local_5]; + _local_9 = 0; + _local_10 = 0; + while(_local_10 < _local_6) + { + if(this.getTileHeightInternal(((_local_4.x + (_local_10 * _local_7.x)) - _local_8.x), ((_local_4.y + (_local_10 * _local_7.y)) - _local_8.y)) == RoomPlaneParser.TILE_HOLE) + { + if(((_local_10 > 0) && (_local_9 == 0))) + { + k.setLength(_local_3, _local_10); + break; + } + _local_9++; + } + else + { + if(_local_9 > 0) + { + k.moveCorner(_local_3, _local_9); + break; + } + } + _local_10++; + } + if(_local_9 == _local_6) + { + k.setHideWall(_local_3, true); + } + } + _local_3++; + } + } + + private resolveOriginalWallIndex(k: Point, _arg_2: Point, _arg_3: RoomWallData): number + { + let _local_10: Point; + let _local_11: Point; + let _local_12: number; + let _local_13: number; + let _local_14: number; + let _local_15: number; + const _local_4: number = Math.min(k.y, _arg_2.y); + const _local_5: number = Math.max(k.y, _arg_2.y); + const _local_6: number = Math.min(k.x, _arg_2.x); + const _local_7: number = Math.max(k.x, _arg_2.x); + const _local_8: number = _arg_3.count; + let _local_9 = 0; + while(_local_9 < _local_8) + { + _local_10 = _arg_3.getCorner(_local_9); + _local_11 = _arg_3.getEndPoint(_local_9); + if(k.x == _arg_2.x) + { + if(((_local_10.x == k.x) && (_local_11.x == k.x))) + { + _local_12 = Math.min(_local_10.y, _local_11.y); + _local_13 = Math.max(_local_10.y, _local_11.y); + if(((_local_12 <= _local_4) && (_local_5 <= _local_13))) + { + return _local_9; + } + } + } + else + { + if(k.y == _arg_2.y) + { + if(((_local_10.y == k.y) && (_local_11.y == k.y))) + { + _local_14 = Math.min(_local_10.x, _local_11.x); + _local_15 = Math.max(_local_10.x, _local_11.x); + if(((_local_14 <= _local_6) && (_local_7 <= _local_15))) + { + return _local_9; + } + } + } + } + _local_9++; + } + return -1; + } + + private hideOriginallyHiddenWalls(k: RoomWallData, _arg_2: RoomWallData): void + { + let _local_5: Point; + let _local_6: Point; + let _local_7: IVector3D; + let _local_8: number; + let _local_9: number; + const _local_3: number = k.count; + let _local_4 = 0; + while(_local_4 < _local_3) + { + if(!k.getHideWall(_local_4)) + { + _local_5 = k.getCorner(_local_4); + _local_6 = new Point(_local_5.x, _local_5.y); + _local_7 = RoomWallData.WALL_DIRECTION_VECTORS[k.getDirection(_local_4)]; + _local_8 = k.getLength(_local_4); + _local_6.x = (_local_6.x + (_local_7.x * _local_8)); + _local_6.y = (_local_6.y + (_local_7.y * _local_8)); + _local_9 = this.resolveOriginalWallIndex(_local_5, _local_6, _arg_2); + if(_local_9 >= 0) + { + if(_arg_2.getHideWall(_local_9)) + { + k.setHideWall(_local_4, true); + } + } + else + { + k.setHideWall(_local_4, true); + } + } + _local_4++; + } + } + + private checkWallHiding(k: RoomWallData, _arg_2: RoomWallData): void + { + this.hidePeninsulaWallChains(_arg_2); + this.updateWallsNextToHoles(k); + this.hideOriginallyHiddenWalls(k, _arg_2); + } + + private addWalls(k: RoomWallData, _arg_2: RoomWallData): void + { + const _local_3 = k.count; + const _local_4 = _arg_2.count; + let _local_7 = 0; + + while(_local_7 < _local_3) + { + if(!k.getHideWall(_local_7)) + { + const _local_8 = k.getCorner(_local_7); + const _local_9 = k.getDirection(_local_7); + const _local_10 = k.getLength(_local_7); + const _local_11 = RoomWallData.WALL_DIRECTION_VECTORS[_local_9]; + const _local_12 = RoomWallData.WALL_NORMAL_VECTORS[_local_9]; + let _local_13 = -1; + let _local_14 = 0; + + while(_local_14 < _local_10) + { + const _local_27 = this.getTileHeightInternal(((_local_8.x + (_local_14 * _local_11.x)) + _local_12.x), ((_local_8.y + (_local_14 * _local_11.y)) + _local_12.y)); + + if(((_local_27 >= 0) && ((_local_27 < _local_13) || (_local_13 < 0)))) + { + _local_13 = _local_27; + } + + _local_14++; + } + + const _local_15 = _local_13; + + let _local_16 = new Vector3d(_local_8.x, _local_8.y, _local_15); + _local_16 = Vector3d.sum(_local_16, Vector3d.product(_local_12, 0.5)); + _local_16 = Vector3d.sum(_local_16, Vector3d.product(_local_11, -0.5)); + + const _local_17 = ((this.wallHeight + Math.min(RoomPlaneParser.MAX_WALL_ADDITIONAL_HEIGHT, this.floorHeight)) - _local_13); + const _local_18 = Vector3d.product(_local_11, -(_local_10)); + const _local_19 = new Vector3d(0, 0, _local_17); + + _local_16 = Vector3d.dif(_local_16, _local_18); + + const _local_20 = this.resolveOriginalWallIndex(_local_8, k.getEndPoint(_local_7), _arg_2); + + let _local_5 = 0; + let _local_6 = 0; + + if(_local_20 >= 0) + { + _local_5 = _arg_2.getDirection(((_local_20 + 1) % _local_4)); + _local_6 = _arg_2.getDirection((((_local_20 - 1) + _local_4) % _local_4)); + } + else + { + _local_5 = k.getDirection(((_local_7 + 1) % _local_3)); + _local_6 = k.getDirection((((_local_7 - 1) + _local_3) % _local_3)); + } + + let _local_21 = null; + + if((((_local_5 - _local_9) + 4) % 4) == 3) + { + _local_21 = RoomWallData.WALL_NORMAL_VECTORS[_local_5]; + } + else + { + if((((_local_9 - _local_6) + 4) % 4) == 3) + { + _local_21 = RoomWallData.WALL_NORMAL_VECTORS[_local_6]; + } + } + + const _local_22 = k.getLeftTurn(_local_7); + const _local_23 = k.getLeftTurn((((_local_7 - 1) + _local_3) % _local_3)); + const _local_24 = k.getHideWall(((_local_7 + 1) % _local_3)); + const _local_25 = k.getManuallyLeftCut(_local_7); + const _local_26 = k.getManuallyRightCut(_local_7); + + this.addWall(_local_16, _local_18, _local_19, _local_21, ((!(_local_23)) || (_local_25)), ((!(_local_22)) || (_local_26)), (!(_local_24))); + } + + _local_7++; + } + } + + private createWallPlanes(): boolean + { + let _local_13: number; + let _local_14: number; + const k = this._tileMatrix; + if(k == null) + { + return false; + } + let _local_2: number; + let _local_3: number; + let _local_4: number[]; + const _local_5: number = k.length; + let _local_6 = 0; + if(_local_5 == 0) + { + return false; + } + _local_2 = 0; + while(_local_2 < _local_5) + { + _local_4 = k[_local_2]; + if(((_local_4 == null) || (_local_4.length == 0))) + { + return false; + } + if(_local_6 > 0) + { + _local_6 = Math.min(_local_6, _local_4.length); + } + else + { + _local_6 = _local_4.length; + } + _local_2++; + } + const _local_7: number = Math.min(RoomPlaneParser.MAX_WALL_ADDITIONAL_HEIGHT, ((this._fixedWallHeight != -1) ? this._fixedWallHeight : RoomPlaneParser.getFloorHeight(k))); + const _local_8: number = this.minX; + let _local_9: number = this.minY; + _local_9 = this.minY; + while(_local_9 <= this.maxY) + { + if(this.getTileHeightInternal(_local_8, _local_9) > RoomPlaneParser.TILE_HOLE) + { + _local_9--; + break; + } + _local_9++; + } + if(_local_9 > this.maxY) + { + return false; + } + const _local_10: Point = new Point(_local_8, _local_9); + const _local_11: RoomWallData = this.generateWallData(_local_10, true); + const _local_12: RoomWallData = this.generateWallData(_local_10, false); + if(_local_11 != null) + { + _local_13 = _local_11.count; + _local_14 = _local_12.count; + this.checkWallHiding(_local_11, _local_12); + this.addWalls(_local_11, _local_12); + } + _local_3 = 0; + while(_local_3 < this.tileMapHeight) + { + _local_2 = 0; + while(_local_2 < this.tileMapWidth) + { + if(this.getTileHeightInternal(_local_2, _local_3) < 0) + { + this.setTileHeight(_local_2, _local_3, -(_local_7 + this.wallHeight)); + } + _local_2++; + } + _local_3++; + } + return true; + } + + private extractTopWall(k: Point, _arg_2: boolean): Point + { + if(k == null) + { + return null; + } + let _local_3 = 1; + let _local_4: number = RoomPlaneParser.TILE_HOLE; + if(!_arg_2) + { + _local_4 = RoomPlaneParser.TILE_BLOCKED; + } + while(_local_3 < 1000) + { + if(this.getTileHeightInternal((k.x + _local_3), k.y) > _local_4) + { + return new Point(((k.x + _local_3) - 1), k.y); + } + if(this.getTileHeightInternal((k.x + _local_3), (k.y + 1)) <= _local_4) + { + return new Point((k.x + _local_3), (k.y + 1)); + } + _local_3++; + } + return null; + } + + private extractRightWall(k: Point, _arg_2: boolean): Point + { + if(k == null) + { + return null; + } + let _local_3 = 1; + let _local_4: number = RoomPlaneParser.TILE_HOLE; + if(!_arg_2) + { + _local_4 = RoomPlaneParser.TILE_BLOCKED; + } + while(_local_3 < 1000) + { + if(this.getTileHeightInternal(k.x, (k.y + _local_3)) > _local_4) + { + return new Point(k.x, (k.y + (_local_3 - 1))); + } + if(this.getTileHeightInternal((k.x - 1), (k.y + _local_3)) <= _local_4) + { + return new Point((k.x - 1), (k.y + _local_3)); + } + _local_3++; + } + return null; + } + + private extractBottomWall(k: Point, _arg_2: boolean): Point + { + if(k == null) + { + return null; + } + let _local_3 = 1; + let _local_4: number = RoomPlaneParser.TILE_HOLE; + if(!_arg_2) + { + _local_4 = RoomPlaneParser.TILE_BLOCKED; + } + while(_local_3 < 1000) + { + if(this.getTileHeightInternal((k.x - _local_3), k.y) > _local_4) + { + return new Point((k.x - (_local_3 - 1)), k.y); + } + if(this.getTileHeightInternal((k.x - _local_3), (k.y - 1)) <= _local_4) + { + return new Point((k.x - _local_3), (k.y - 1)); + } + _local_3++; + } + return null; + } + + private extractLeftWall(k: Point, _arg_2: boolean): Point + { + if(k == null) + { + return null; + } + let _local_3 = 1; + let _local_4: number = RoomPlaneParser.TILE_HOLE; + if(!_arg_2) + { + _local_4 = RoomPlaneParser.TILE_BLOCKED; + } + while(_local_3 < 1000) + { + if(this.getTileHeightInternal(k.x, (k.y - _local_3)) > _local_4) + { + return new Point(k.x, (k.y - (_local_3 - 1))); + } + if(this.getTileHeightInternal((k.x + 1), (k.y - _local_3)) <= _local_4) + { + return new Point((k.x + 1), (k.y - _local_3)); + } + _local_3++; + } + return null; + } + + private addWall(k: IVector3D, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: boolean, _arg_6: boolean, _arg_7: boolean): void + { + this.addPlane(RoomPlaneData.PLANE_WALL, k, _arg_2, _arg_3, [_arg_4]); + this.addPlane(RoomPlaneData.PLANE_LANDSCAPE, k, _arg_2, _arg_3, [_arg_4]); + const _local_8: number = (RoomPlaneParser.WALL_THICKNESS * this._wallThicknessMultiplier); + const _local_9: number = (RoomPlaneParser.FLOOR_THICKNESS * this._floorThicknessMultiplier); + const _local_10: Vector3d = Vector3d.crossProduct(_arg_2, _arg_3); + const _local_11: Vector3d = Vector3d.product(_local_10, ((1 / _local_10.length) * -(_local_8))); + this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(k, _arg_3), _arg_2, _local_11, [_local_10, _arg_4]); + if(_arg_5) + { + this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(Vector3d.sum(k, _arg_2), _arg_3), Vector3d.product(_arg_3, (-(_arg_3.length + _local_9) / _arg_3.length)), _local_11, [_local_10, _arg_4]); + } + if(_arg_6) + { + this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(k, Vector3d.product(_arg_3, (-(_local_9) / _arg_3.length))), Vector3d.product(_arg_3, ((_arg_3.length + _local_9) / _arg_3.length)), _local_11, [_local_10, _arg_4]); + if(_arg_7) + { + const _local_12 = Vector3d.product(_arg_2, (_local_8 / _arg_2.length)); + this.addPlane(RoomPlaneData.PLANE_WALL, Vector3d.sum(Vector3d.sum(k, _arg_3), Vector3d.product(_local_12, -1)), _local_12, _local_11, [_local_10, _arg_2, _arg_4]); + } + } + } + + private addFloor(k: IVector3D, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: boolean, _arg_5: boolean, _arg_6: boolean, _arg_7: boolean): void + { + let _local_9: number; + let _local_10: Vector3d; + let _local_11: Vector3d; + const _local_8: RoomPlaneData = this.addPlane(RoomPlaneData.PLANE_FLOOR, k, _arg_2, _arg_3); + if(_local_8 != null) + { + _local_9 = (RoomPlaneParser.FLOOR_THICKNESS * this._floorThicknessMultiplier); + _local_10 = new Vector3d(0, 0, _local_9); + _local_11 = Vector3d.dif(k, _local_10); + if(_arg_6) + { + this.addPlane(RoomPlaneData.PLANE_FLOOR, _local_11, _arg_2, _local_10); + } + if(_arg_7) + { + this.addPlane(RoomPlaneData.PLANE_FLOOR, Vector3d.sum(_local_11, Vector3d.sum(_arg_2, _arg_3)), Vector3d.product(_arg_2, -1), _local_10); + } + if(_arg_4) + { + this.addPlane(RoomPlaneData.PLANE_FLOOR, Vector3d.sum(_local_11, _arg_3), Vector3d.product(_arg_3, -1), _local_10); + } + if(_arg_5) + { + this.addPlane(RoomPlaneData.PLANE_FLOOR, Vector3d.sum(_local_11, _arg_2), _arg_3, _local_10); + } + } + } + + public initializeFromMapData(data: RoomMapData): boolean + { + if(!data) return false; + + this.reset(); + + this.resetFloorHoles(); + + const width = data.width; + const height = data.height; + const wallHeight = data.wallHeight; + const fixedWallsHeight = data.fixedWallsHeight; + + this.initializeTileMap(width, height); + + if(data.tileMap) + { + let y = 0; + + while(y < data.tileMap.length) + { + const row = data.tileMap[y]; + + if(row) + { + let x = 0; + + while(x < row.length) + { + const column = row[x]; + + if(column) this.setTileHeight(x, y, column.height); + + x++; + } + } + + y++; + } + } + + if(data.holeMap && data.holeMap.length) + { + let index = 0; + + while(index < data.holeMap.length) + { + const hole = data.holeMap[index]; + + if(!hole) continue; + + this.addFloorHole(hole.id, hole.x, hole.y, hole.width, hole.height); + + index++; + } + + this.initializeHoleMap(); + } + + this.wallHeight = wallHeight; + this.restrictsDragging = data.restrictsDragging; + this.restrictsScaling = data.restrictsScaling; + this.restrictedScale = data.restrictedScale; + + this.initializeFromTileData(fixedWallsHeight); + + return true; + } + + private addPlane(k: number, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: IVector3D[] = null): RoomPlaneData + { + if(((_arg_3.length == 0) || (_arg_4.length == 0))) + { + return null; + } + const _local_6: RoomPlaneData = new RoomPlaneData(k, _arg_2, _arg_3, _arg_4, _arg_5); + this._planes.push(_local_6); + return _local_6; + } + + public getMapData(): RoomMapData + { + const data = new RoomMapData(); + + data.width = this._width; + data.height = this._height; + data.wallHeight = this._wallHeight; + data.fixedWallsHeight = this._fixedWallHeight; + data.dimensions.minX = this.minX; + data.dimensions.maxX = this.maxX; + data.dimensions.minY = this.minY; + data.dimensions.maxY = this.maxY; + data.restrictsDragging = this.restrictsDragging; + data.restrictsScaling = this.restrictsScaling; + data.restrictedScale = this.restrictedScale; + + let y = 0; + + while(y < this._height) + { + const tileRow: { height: number }[] = []; + const tileMatrix = this._tileMatrixOriginal[y]; + + let x = 0; + + while(x < this._width) + { + const tileHeight = tileMatrix[x]; + + tileRow.push({ height: tileHeight }); + + x++; + } + + data.tileMap.push(tileRow); + + y++; + } + + for(const [holeId, holeData] of this._floorHoles.entries()) + { + if(!holeData) continue; + + data.holeMap.push({ + id: holeId, + x: holeData.x, + y: holeData.y, + width: holeData.width, + height: holeData.height + }); + } + + return data; + } + + public getPlaneLocation(k: number): IVector3D + { + if(((k < 0) || (k >= this.planeCount))) return null; + + const planeData = this._planes[k]; + + if(!planeData) return null; + + return planeData.loc; + } + + public getPlaneNormal(k: number): IVector3D + { + if(((k < 0) || (k >= this.planeCount))) return null; + + const planeData = this._planes[k]; + + if(!planeData) return null; + + return planeData.normal; + } + + public getPlaneLeftSide(k: number): IVector3D + { + if(((k < 0) || (k >= this.planeCount))) return null; + + const planeData = this._planes[k]; + + if(!planeData) return null; + + return planeData.leftSide; + } + + public getPlaneRightSide(k: number): IVector3D + { + if(((k < 0) || (k >= this.planeCount))) return null; + + const planeData = this._planes[k]; + + if(!planeData) return null; + + return planeData.rightSide; + } + + public getPlaneNormalDirection(k: number): IVector3D + { + if(((k < 0) || (k >= this.planeCount))) return null; + + const planeData = this._planes[k]; + + if(!planeData) return null; + + return planeData.normalDirection; + } + + public getPlaneSecondaryNormals(k: number): IVector3D[] + { + let _local_3: IVector3D[]; + let _local_4: number; + if(((k < 0) || (k >= this.planeCount))) + { + return null; + } + const _local_2: RoomPlaneData = (this._planes[k] as RoomPlaneData); + if(_local_2 != null) + { + _local_3 = []; + _local_4 = 0; + while(_local_4 < _local_2.secondaryNormalCount) + { + _local_3.push(_local_2.getSecondaryNormal(_local_4)); + _local_4++; + } + return _local_3; + } + return null; + } + + public getPlaneType(k: number): number + { + if(((k < 0) || (k >= this.planeCount))) return RoomPlaneData.PLANE_UNDEFINED; + + const planeData = this._planes[k]; + + if(!planeData) return RoomPlaneData.PLANE_UNDEFINED; + + return planeData.type; + } + + public getPlaneMaskCount(k: number): number + { + if(((k < 0) || (k >= this.planeCount))) return 0; + + const planeData = this._planes[k]; + + if(!planeData) return 0; + + return planeData.maskCount; + } + + public getPlaneMaskLeftSideLoc(k: number, _arg_2: number): number + { + if(((k < 0) || (k >= this.planeCount))) return -1; + + const planeData = this._planes[k]; + + if(!planeData) return -1; + + return planeData.getMaskLeftSideLoc(_arg_2); + } + + public getPlaneMaskRightSideLoc(k: number, _arg_2: number): number + { + if(((k < 0) || (k >= this.planeCount))) return -1; + + const planeData = this._planes[k]; + + if(!planeData) return -1; + + return planeData.getMaskRightSideLoc(_arg_2); + } + + public getPlaneMaskLeftSideLength(k: number, _arg_2: number): number + { + if(((k < 0) || (k >= this.planeCount))) return -1; + + const planeData = this._planes[k]; + + if(!planeData) return -1; + + return planeData.getMaskLeftSideLength(_arg_2); + } + + public getPlaneMaskRightSideLength(k: number, _arg_2: number): number + { + if(((k < 0) || (k >= this.planeCount))) return -1; + + const planeData = this._planes[k]; + + if(!planeData) return -1; + + return planeData.getMaskRightSideLength(_arg_2); + } + + public addFloorHole(k: number, _arg_2: number, _arg_3: number, _arg_4: number, _arg_5: number): void + { + this.removeFloorHole(k); + + this._floorHoles.set(k, new RoomFloorHole(_arg_2, _arg_3, _arg_4, _arg_5)); + } + + public removeFloorHole(k: number): void + { + this._floorHoles.delete(k); + } + + public resetFloorHoles(): void + { + this._floorHoles.clear(); + } + + private initializeHoleMap(): void + { + let k: number; + let _local_2: number; + let _local_3: boolean[]; + let _local_5: RoomFloorHole; + let _local_6: number; + let _local_7: number; + let _local_8: number; + let _local_9: number; + _local_2 = 0; + while(_local_2 < this._height) + { + _local_3 = this._floorHoleMatrix[_local_2]; + k = 0; + while(k < this._width) + { + _local_3[k] = false; + k++; + } + _local_2++; + } + for(const _local_4 of this._floorHoles.values()) + { + _local_5 = _local_4; + if(_local_5 != null) + { + _local_6 = _local_5.x; + _local_7 = ((_local_5.x + _local_5.width) - 1); + _local_8 = _local_5.y; + _local_9 = ((_local_5.y + _local_5.height) - 1); + _local_6 = ((_local_6 < 0) ? 0 : _local_6); + _local_7 = ((_local_7 >= this._width) ? (this._width - 1) : _local_7); + _local_8 = ((_local_8 < 0) ? 0 : _local_8); + _local_9 = ((_local_9 >= this._height) ? (this._height - 1) : _local_9); + _local_2 = _local_8; + while(_local_2 <= _local_9) + { + _local_3 = this._floorHoleMatrix[_local_2]; + k = _local_6; + while(k <= _local_7) + { + _local_3[k] = true; + k++; + } + _local_2++; + } + } + } + } + + private extractPlanes(k: number[][]): void + { + let _local_7: number; + let _local_8: number; + let _local_9: number; + let _local_10: number; + let _local_11: boolean; + let _local_12: boolean; + let _local_13: boolean; + let _local_14: boolean; + let _local_15: number; + let _local_16: number; + let _local_17: boolean; + let _local_18: number; + let _local_19: number; + let _local_20: number; + let _local_21: number; + + const _local_2 = k.length; + + const _local_3: number = k[0].length; + const _local_4: boolean[][] = []; + let _local_5 = 0; + while(_local_5 < _local_2) + { + _local_4[_local_5] = []; + _local_5++; + } + let _local_6 = 0; + while(_local_6 < _local_2) + { + _local_7 = 0; + while(_local_7 < _local_3) + { + _local_8 = k[_local_6][_local_7]; + if(((_local_8 < 0) || (_local_4[_local_6][_local_7]))) + { + // + } + else + { + _local_11 = ((_local_7 == 0) || (!(k[_local_6][(_local_7 - 1)] == _local_8))); + _local_12 = ((_local_6 == 0) || (!(k[(_local_6 - 1)][_local_7] == _local_8))); + _local_9 = (_local_7 + 1); + while(_local_9 < _local_3) + { + if((((!(k[_local_6][_local_9] == _local_8)) || (_local_4[_local_6][_local_9])) || ((_local_6 > 0) && ((k[(_local_6 - 1)][_local_9] == _local_8) == _local_12)))) + { + break; + } + _local_9++; + } + _local_13 = ((_local_9 == _local_3) || (!(k[_local_6][_local_9] == _local_8))); + _local_17 = false; + _local_10 = (_local_6 + 1); + while(((_local_10 < _local_2) && (!(_local_17)))) + { + _local_14 = (!(k[_local_10][_local_7] == _local_8)); + _local_17 = (((_local_14) || ((_local_7 > 0) && ((k[_local_10][(_local_7 - 1)] == _local_8) == _local_11))) || ((_local_9 < _local_3) && ((k[_local_10][_local_9] == _local_8) == _local_13))); + _local_15 = _local_7; + while(_local_15 < _local_9) + { + if((k[_local_10][_local_15] == _local_8) == _local_14) + { + _local_17 = true; + _local_9 = _local_15; + break; + } + _local_15++; + } + if(_local_17) + { + break; + } + _local_10++; + } + _local_14 = ((_local_14) || (_local_10 == _local_2)); + _local_13 = ((_local_9 == _local_3) || (!(k[_local_6][_local_9] == _local_8))); + _local_16 = _local_6; + while(_local_16 < _local_10) + { + _local_15 = _local_7; + while(_local_15 < _local_9) + { + _local_4[_local_16][_local_15] = true; + _local_15++; + } + _local_16++; + } + _local_18 = ((_local_7 / 4) - 0.5); + _local_19 = ((_local_6 / 4) - 0.5); + _local_20 = ((_local_9 - _local_7) / 4); + _local_21 = ((_local_10 - _local_6) / 4); + this.addFloor(new Vector3d((_local_18 + _local_20), (_local_19 + _local_21), (_local_8 / 4)), new Vector3d(-(_local_20), 0, 0), new Vector3d(0, -(_local_21), 0), _local_13, _local_11, _local_14, _local_12); + } + _local_7++; + } + _local_6++; + } + } + + public get restrictsDragging(): boolean + { + return this._restrictsDragging; + } + + public set restrictsDragging(flag: boolean) + { + this._restrictsDragging = flag; + } + + public get restrictsScaling(): boolean + { + return this._restrictsScaling; + } + + public set restrictsScaling(flag: boolean) + { + this._restrictsScaling = flag; + } + + public get restrictedScale(): number + { + return this._restrictedScale; + } + + public set restrictedScale(scale: number) + { + this._restrictedScale = scale; + } +} diff --git a/submodules/renderer/src/nitro/room/object/RoomWallData.ts b/submodules/renderer/src/nitro/room/object/RoomWallData.ts new file mode 100644 index 0000000..e15dacc --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/RoomWallData.ts @@ -0,0 +1,181 @@ +import { Point } from '@pixi/math'; +import { IVector3D, Vector3d } from '../../../api'; + +export class RoomWallData +{ + public static WALL_DIRECTION_VECTORS: Vector3d[] = [ + new Vector3d(1, 0, 0), + new Vector3d(0, 1, 0), + new Vector3d(-1, 0, 0), + new Vector3d(0, -1, 0) + ]; + + public static WALL_NORMAL_VECTORS: Vector3d[] = [ + new Vector3d(0, 1, 0), + new Vector3d(-1, 0, 0), + new Vector3d(0, -1, 0), + new Vector3d(1, 0, 0) + ]; + + private _corners: Point[]; + private _endPoints: Point[]; + private _directions: number[]; + private _lengths: number[]; + private _leftTurns: boolean[]; + private _borders: boolean[]; + private _hideWalls: boolean[]; + private _manuallyLeftCut: boolean[]; + private _manuallyRightCut: boolean[]; + private _addDuplicates: boolean; + private _count: number; + + constructor() + { + this._corners = []; + this._endPoints = []; + this._directions = []; + this._lengths = []; + this._leftTurns = []; + this._borders = []; + this._hideWalls = []; + this._manuallyLeftCut = []; + this._manuallyRightCut = []; + this._addDuplicates = false; + this._count = 0; + } + + public addWall(k: Point, _arg_2: number, _arg_3: number, _arg_4: boolean, _arg_5: boolean): void + { + if(((this._addDuplicates) || (this.checkIsNotDuplicate(k, _arg_2, _arg_3, _arg_4, _arg_5)))) + { + this._corners.push(k); + this._directions.push(_arg_2); + this._lengths.push(_arg_3); + this._borders.push(_arg_4); + this._leftTurns.push(_arg_5); + this._hideWalls.push(false); + this._manuallyLeftCut.push(false); + this._manuallyRightCut.push(false); + this._count++; + } + } + + private checkIsNotDuplicate(k: Point, _arg_2: number, _arg_3: number, _arg_4: boolean, _arg_5: boolean): boolean + { + let _local_6 = 0; + + while(_local_6 < this._count) + { + if(((((((this._corners[_local_6].x == k.x) && (this._corners[_local_6].y == k.y)) && (this._directions[_local_6] == _arg_2)) && (this._lengths[_local_6] == _arg_3)) && (this._borders[_local_6] == _arg_4)) && (this._leftTurns[_local_6] == _arg_5))) + { + return false; + } + _local_6++; + } + return true; + } + + public get count(): number + { + return this._count; + } + + public getCorner(k: number): Point + { + return this._corners[k]; + } + + public getEndPoint(k: number): Point + { + this.calculateWallEndPoints(); + return this._endPoints[k]; + } + + public getLength(k: number): number + { + return this._lengths[k]; + } + + public getDirection(k: number): number + { + return this._directions[k]; + } + + public getBorder(k: number): boolean + { + return this._borders[k]; + } + + public getHideWall(k: number): boolean + { + return this._hideWalls[k]; + } + + public getLeftTurn(k: number): boolean + { + return this._leftTurns[k]; + } + + public getManuallyLeftCut(k: number): boolean + { + return this._manuallyLeftCut[k]; + } + + public getManuallyRightCut(k: number): boolean + { + return this._manuallyRightCut[k]; + } + + public setHideWall(k: number, _arg_2: boolean): void + { + this._hideWalls[k] = _arg_2; + } + + public setLength(k: number, _arg_2: number): void + { + if(_arg_2 < this._lengths[k]) + { + this._lengths[k] = _arg_2; + this._manuallyRightCut[k] = true; + } + } + + public moveCorner(k: number, _arg_2: number): void + { + let _local_3: IVector3D; + if(((_arg_2 > 0) && (_arg_2 < this._lengths[k]))) + { + const corner = this._corners[k]; + + _local_3 = RoomWallData.WALL_DIRECTION_VECTORS[this.getDirection(k)]; + this._corners[k] = new Point((corner.x + (_arg_2 * _local_3.x)), (corner.y + (_arg_2 * _local_3.y))); + this._lengths[k] = (this._lengths[k] - _arg_2); + this._manuallyLeftCut[k] = true; + } + } + + private calculateWallEndPoints(): void + { + let k: number; + let _local_2: Point; + let _local_3: Point; + let _local_4: IVector3D; + let _local_5: number; + if(this._endPoints.length != this.count) + { + this._endPoints = []; + k = 0; + while(k < this.count) + { + _local_2 = this.getCorner(k); + _local_3 = new Point(_local_2.x, _local_2.y); + _local_4 = RoomWallData.WALL_DIRECTION_VECTORS[this.getDirection(k)]; + _local_5 = this.getLength(k); + _local_3.x = (_local_3.x + (_local_4.x * _local_5)); + _local_3.y = (_local_3.y + (_local_4.y * _local_5)); + this._endPoints.push(_local_3); + k++; + } + } + } +} diff --git a/submodules/renderer/src/nitro/room/object/index.ts b/submodules/renderer/src/nitro/room/object/index.ts new file mode 100644 index 0000000..8d30eb3 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/index.ts @@ -0,0 +1,27 @@ +export * from './logic'; +export * from './logic/avatar'; +export * from './logic/furniture'; +export * from './logic/pet'; +export * from './logic/room'; +export * from './RoomFloorHole'; +export * from './RoomMapData'; +export * from './RoomMapMaskData'; +export * from './RoomObjectVisualizationFactory'; +export * from './RoomPlaneBitmapMaskData'; +export * from './RoomPlaneBitmapMaskParser'; +export * from './RoomPlaneData'; +export * from './RoomPlaneMaskData'; +export * from './RoomPlaneParser'; +export * from './RoomWallData'; +export * from './visualization'; +export * from './visualization/avatar'; +export * from './visualization/avatar/additions'; +export * from './visualization/data'; +export * from './visualization/furniture'; +export * from './visualization/pet'; +export * from './visualization/room'; +export * from './visualization/room/mask'; +export * from './visualization/room/rasterizer'; +export * from './visualization/room/rasterizer/animated'; +export * from './visualization/room/rasterizer/basic'; +export * from './visualization/room/utils'; diff --git a/submodules/renderer/src/nitro/room/object/logic/MovingObjectLogic.ts b/submodules/renderer/src/nitro/room/object/logic/MovingObjectLogic.ts new file mode 100644 index 0000000..ac3907b --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/MovingObjectLogic.ts @@ -0,0 +1,147 @@ +import { IRoomObjectController, IRoomObjectUpdateMessage, IVector3D, RoomObjectVariable, Vector3d } from '../../../../api'; +import { RoomObjectLogicBase } from '../../../../room'; +import { ObjectMoveUpdateMessage } from '../../messages'; + +export class MovingObjectLogic extends RoomObjectLogicBase +{ + public static DEFAULT_UPDATE_INTERVAL: number = 500; + private static TEMP_VECTOR: Vector3d = new Vector3d(); + + private _liftAmount: number; + + private _location: Vector3d; + private _locationDelta: Vector3d; + private _lastUpdateTime: number; + private _changeTime: number; + private _updateInterval: number; + + constructor() + { + super(); + + this._liftAmount = 0; + + this._location = new Vector3d(); + this._locationDelta = new Vector3d(); + this._lastUpdateTime = 0; + this._changeTime = 0; + this._updateInterval = MovingObjectLogic.DEFAULT_UPDATE_INTERVAL; + } + + protected onDispose(): void + { + this._liftAmount = 0; + + super.onDispose(); + } + + public update(time: number): void + { + super.update(time); + + const locationOffset = this.getLocationOffset(); + const model = this.object && this.object.model; + + if(model) + { + if(locationOffset) + { + if(this._liftAmount !== locationOffset.z) + { + this._liftAmount = locationOffset.z; + + model.setValue(RoomObjectVariable.FURNITURE_LIFT_AMOUNT, this._liftAmount); + } + } + else + { + if(this._liftAmount !== 0) + { + this._liftAmount = 0; + + model.setValue(RoomObjectVariable.FURNITURE_LIFT_AMOUNT, this._liftAmount); + } + } + } + + if((this._locationDelta.length > 0) || locationOffset) + { + const vector = MovingObjectLogic.TEMP_VECTOR; + + let difference = (this.time - this._changeTime); + + if(difference === (this._updateInterval >> 1)) difference++; + + if(difference > this._updateInterval) difference = this._updateInterval; + + if(this._locationDelta.length > 0) + { + vector.assign(this._locationDelta); + vector.multiply((difference / this._updateInterval)); + vector.add(this._location); + } + else + { + vector.assign(this._location); + } + + if(locationOffset) vector.add(locationOffset); + + this.object.setLocation(vector); + + if(difference === this._updateInterval) + { + this._locationDelta.x = 0; + this._locationDelta.y = 0; + this._locationDelta.z = 0; + } + } + + this._lastUpdateTime = this.time; + } + + public setObject(object: IRoomObjectController): void + { + super.setObject(object); + + if(object) this._location.assign(object.getLocation()); + } + + public processUpdateMessage(message: IRoomObjectUpdateMessage): void + { + if(!message) return; + + super.processUpdateMessage(message); + + if(message.location) this._location.assign(message.location); + + if(message instanceof ObjectMoveUpdateMessage) return this.processMoveMessage(message); + } + + private processMoveMessage(message: ObjectMoveUpdateMessage): void + { + if(!message || !this.object || !message.location) return; + + this._changeTime = this._lastUpdateTime; + + this._locationDelta.assign(message.targetLocation); + this._locationDelta.subtract(this._location); + } + + protected getLocationOffset(): IVector3D + { + return null; + } + + protected get lastUpdateTime(): number + { + return this._lastUpdateTime; + } + + protected set updateInterval(interval: number) + { + if(interval <= 0) interval = 1; + + this._updateInterval = interval; + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/avatar/AvatarLogic.ts b/submodules/renderer/src/nitro/room/object/logic/avatar/AvatarLogic.ts new file mode 100644 index 0000000..66f7c7d --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/avatar/AvatarLogic.ts @@ -0,0 +1,505 @@ + +import { AvatarAction, IRoomGeometry, IRoomObjectModel, MouseEventType, RoomObjectVariable, Vector3d } from '../../../../../api'; +import { RoomObjectFurnitureActionEvent, RoomObjectMouseEvent, RoomObjectMoveEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { GetTickerTime } from '../../../../../pixi-proxy'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectAvatarCarryObjectUpdateMessage, ObjectAvatarChatUpdateMessage, ObjectAvatarDanceUpdateMessage, ObjectAvatarEffectUpdateMessage, ObjectAvatarExpressionUpdateMessage, ObjectAvatarFigureUpdateMessage, ObjectAvatarFlatControlUpdateMessage, ObjectAvatarGestureUpdateMessage, ObjectAvatarMutedUpdateMessage, ObjectAvatarOwnMessage, ObjectAvatarPlayerValueUpdateMessage, ObjectAvatarPlayingGameUpdateMessage, ObjectAvatarPostureUpdateMessage, ObjectAvatarSelectedMessage, ObjectAvatarSignUpdateMessage, ObjectAvatarSleepUpdateMessage, ObjectAvatarTypingUpdateMessage, ObjectAvatarUpdateMessage, ObjectAvatarUseObjectUpdateMessage } from '../../../messages'; +import { MovingObjectLogic } from '../MovingObjectLogic'; + +export class AvatarLogic extends MovingObjectLogic +{ + private static MAX_HAND_ID: number = 999999999; + private static MAX_HAND_USE_ID: number = 999; + private static EFFECT_TYPE_SPLASH: number = 28; + private static EFFECT_SPLASH_LENGTH: number = 500; + private static EFFECT_TYPE_SWIM: number = 29; + private static EFFECT_TYPE_SPLASH_DARK: number = 184; + private static EFFECT_TYPE_SWIM_DARK: number = 185; + + private _selected: boolean; + private _reportedLocation: Vector3d; + private _effectChangeTimeStamp: number; + private _newEffect: number; + private _blinkingStartTimestamp: number; + private _blinkingEndTimestamp: number; + private _talkingEndTimestamp: number; + private _talkingPauseStartTimestamp: number; + private _talkingPauseEndTimestamp: number; + private _carryObjectStartTimestamp: number; + private _carryObjectEndTimestamp: number; + private _allowUseCarryObject: boolean; + private _animationEndTimestamp: number; + private _signEndTimestamp: number; + private _gestureEndTimestamp: number; + private _numberValueEndTimestamp: number; + + constructor() + { + super(); + + this._selected = false; + this._reportedLocation = null; + this._effectChangeTimeStamp = 0; + this._newEffect = 0; + this._blinkingStartTimestamp = GetTickerTime() + this.randomBlinkStartTimestamp(); + this._blinkingEndTimestamp = 0; + this._talkingEndTimestamp = 0; + this._talkingPauseStartTimestamp = 0; + this._talkingPauseEndTimestamp = 0; + this._carryObjectStartTimestamp = 0; + this._carryObjectEndTimestamp = 0; + this._allowUseCarryObject = false; + this._animationEndTimestamp = 0; + this._signEndTimestamp = 0; + this._gestureEndTimestamp = 0; + this._numberValueEndTimestamp = 0; + } + + public getEventTypes(): string[] + { + const types = [RoomObjectMouseEvent.CLICK, RoomObjectMouseEvent.DOUBLE_CLICK, RoomObjectMoveEvent.POSITION_CHANGED, RoomObjectMouseEvent.MOUSE_ENTER, RoomObjectMouseEvent.MOUSE_LEAVE, RoomObjectFurnitureActionEvent.MOUSE_BUTTON, RoomObjectFurnitureActionEvent.MOUSE_ARROW]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public dispose(): void + { + if(this._selected && this.object) + { + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.OBJECT_REMOVED, this.object)); + } + + super.dispose(); + + this._reportedLocation = null; + } + + public update(time: number): void + { + super.update(time); + + if(this._selected && this.object) + { + if(this.eventDispatcher) + { + const location = this.object.getLocation(); + + if(((!this._reportedLocation || (this._reportedLocation.x !== location.x)) || (this._reportedLocation.y !== location.y)) || (this._reportedLocation.z !== location.z)) + { + if(!this._reportedLocation) this._reportedLocation = new Vector3d(); + + this._reportedLocation.assign(location); + + this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.POSITION_CHANGED, this.object)); + } + } + } + + const model = this.object && this.object.model; + + if(model) this.updateModel(this.time, model); + } + + private updateModel(time: number, model: IRoomObjectModel): void + { + if(this._talkingEndTimestamp > 0) + { + if(time > this._talkingEndTimestamp) + { + model.setValue(RoomObjectVariable.FIGURE_TALK, 0); + + this._talkingEndTimestamp = 0; + this._talkingPauseStartTimestamp = 0; + this._talkingPauseEndTimestamp = 0; + } + else + { + if(!this._talkingPauseEndTimestamp && !this._talkingPauseStartTimestamp) + { + this._talkingPauseStartTimestamp = time + this.randomTalkingPauseStartTimestamp(); + this._talkingPauseEndTimestamp = this._talkingPauseStartTimestamp + this.randomTalkingPauseEndTimestamp(); + } + else + { + if((this._talkingPauseStartTimestamp > 0) && (time > this._talkingPauseStartTimestamp)) + { + model.setValue(RoomObjectVariable.FIGURE_TALK, 0); + + this._talkingPauseStartTimestamp = 0; + } + else + { + if((this._talkingPauseEndTimestamp > 0) && (time > this._talkingPauseEndTimestamp)) + { + model.setValue(RoomObjectVariable.FIGURE_TALK, 1); + + this._talkingPauseEndTimestamp = 0; + } + } + } + } + } + + if((this._animationEndTimestamp > 0) && (time > this._animationEndTimestamp)) + { + model.setValue(RoomObjectVariable.FIGURE_EXPRESSION, 0); + + this._animationEndTimestamp = 0; + } + + if((this._gestureEndTimestamp > 0) && (time > this._gestureEndTimestamp)) + { + model.setValue(RoomObjectVariable.FIGURE_GESTURE, 0); + + this._gestureEndTimestamp = 0; + } + + if((this._signEndTimestamp > 0) && (time > this._signEndTimestamp)) + { + model.setValue(RoomObjectVariable.FIGURE_SIGN, -1); + + this._signEndTimestamp = 0; + } + + if(this._carryObjectEndTimestamp > 0) + { + if(time > this._carryObjectEndTimestamp) + { + model.setValue(RoomObjectVariable.FIGURE_CARRY_OBJECT, 0); + model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 0); + + this._carryObjectStartTimestamp = 0; + this._carryObjectEndTimestamp = 0; + this._allowUseCarryObject = false; + } + } + + if(this._allowUseCarryObject) + { + if((time - this._carryObjectStartTimestamp) > 5000) + { + if(((time - this._carryObjectStartTimestamp) % 10000) < 1000) + { + model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 1); + } + else + { + model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 0); + } + } + } + + if((this._blinkingStartTimestamp > -1) && (time > this._blinkingStartTimestamp)) + { + model.setValue(RoomObjectVariable.FIGURE_BLINK, 1); + + this._blinkingStartTimestamp = time + this.randomBlinkStartTimestamp(); + this._blinkingEndTimestamp = time + this.randomBlinkEndTimestamp(); + } + + if((this._blinkingEndTimestamp > 0) && (time > this._blinkingEndTimestamp)) + { + model.setValue(RoomObjectVariable.FIGURE_BLINK, 0); + + this._blinkingEndTimestamp = 0; + } + + if((this._effectChangeTimeStamp > 0) && (time > this._effectChangeTimeStamp)) + { + model.setValue(RoomObjectVariable.FIGURE_EFFECT, this._newEffect); + + this._effectChangeTimeStamp = 0; + } + + if((this._numberValueEndTimestamp > 0) && (time > this._numberValueEndTimestamp)) + { + model.setValue(RoomObjectVariable.FIGURE_NUMBER_VALUE, 0); + + this._numberValueEndTimestamp = 0; + } + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + if(!message || !this.object) return; + + super.processUpdateMessage(message); + + const model = this.object && this.object.model; + + if(!model) return; + + if(message instanceof ObjectAvatarPostureUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_POSTURE, message.postureType); + model.setValue(RoomObjectVariable.FIGURE_POSTURE_PARAMETER, message.parameter); + + return; + } + + if(message instanceof ObjectAvatarChatUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_TALK, 1); + + this._talkingEndTimestamp = (this.time + (message.numberOfWords * 1000)); + + return; + } + + if(message instanceof ObjectAvatarTypingUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_IS_TYPING, message.isTyping ? 1 : 0); + + return; + } + + if(message instanceof ObjectAvatarMutedUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_IS_MUTED, (message.isMuted ? 1 : 0)); + + return; + } + + if(message instanceof ObjectAvatarPlayingGameUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_IS_PLAYING_GAME, (message.isPlayingGame ? 1 : 0)); + + return; + } + + if(message instanceof ObjectAvatarUpdateMessage) + { + model.setValue(RoomObjectVariable.HEAD_DIRECTION, message.headDirection); + model.setValue(RoomObjectVariable.FIGURE_CAN_STAND_UP, message.canStandUp); + model.setValue(RoomObjectVariable.FIGURE_VERTICAL_OFFSET, message.baseY); + + return; + } + + if(message instanceof ObjectAvatarGestureUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_GESTURE, message.gesture); + + this._gestureEndTimestamp = (this.time + 3000); + + return; + } + + if(message instanceof ObjectAvatarExpressionUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_EXPRESSION, message.expressionType); + + this._animationEndTimestamp = AvatarAction.getExpressionTimeout(model.getValue(RoomObjectVariable.FIGURE_EXPRESSION)); + + if(this._animationEndTimestamp > -1) this._animationEndTimestamp += this.time; + + return; + } + + if(message instanceof ObjectAvatarDanceUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_DANCE, message.danceStyle); + + return; + } + + if(message instanceof ObjectAvatarSleepUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_SLEEP, message.isSleeping ? 1 : 0); + + if(message.isSleeping) this._blinkingStartTimestamp = -1; + else this._blinkingStartTimestamp = (this.time + this.randomBlinkStartTimestamp()); + + return; + } + + if(message instanceof ObjectAvatarPlayerValueUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_NUMBER_VALUE, message.value); + + this._numberValueEndTimestamp = (this.time + 3000); + + return; + } + + if(message instanceof ObjectAvatarEffectUpdateMessage) + { + this.updateAvatarEffect(message.effect, message.delayMilliseconds, model); + + return; + } + + if(message instanceof ObjectAvatarCarryObjectUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_CARRY_OBJECT, message.itemType); + model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 0); + + if(message.itemType === 0) + { + this._carryObjectStartTimestamp = 0; + this._carryObjectEndTimestamp = 0; + this._allowUseCarryObject = false; + } + else + { + this._carryObjectStartTimestamp = this.time; + + if(message.itemType < AvatarLogic.MAX_HAND_ID) + { + this._carryObjectEndTimestamp = 0; + this._allowUseCarryObject = message.itemType <= AvatarLogic.MAX_HAND_USE_ID; + } + else + { + this._carryObjectEndTimestamp = this._carryObjectStartTimestamp + 1500; + this._allowUseCarryObject = false; + } + } + + return; + } + + if(message instanceof ObjectAvatarUseObjectUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, message.itemType); + + return; + } + + if(message instanceof ObjectAvatarSignUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_SIGN, message.signType); + + this._signEndTimestamp = (this.time + 5000); + + return; + } + + if(message instanceof ObjectAvatarFlatControlUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_FLAT_CONTROL, message.level); + + return; + } + + if(message instanceof ObjectAvatarFigureUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE, message.figure); + model.setValue(RoomObjectVariable.GENDER, message.gender); + + return; + } + + if(message instanceof ObjectAvatarSelectedMessage) + { + this._selected = message.selected; + this._reportedLocation = null; + + return; + } + + if(message instanceof ObjectAvatarOwnMessage) + { + model.setValue(RoomObjectVariable.OWN_USER, 1); + + return; + } + } + + private updateAvatarEffect(effect: number, delay: number, model: IRoomObjectModel): void + { + if(effect === AvatarLogic.EFFECT_TYPE_SPLASH) + { + this._effectChangeTimeStamp = (GetTickerTime() + AvatarLogic.EFFECT_SPLASH_LENGTH); + this._newEffect = AvatarLogic.EFFECT_TYPE_SWIM; + } + + else if(effect === AvatarLogic.EFFECT_TYPE_SPLASH_DARK) + { + this._effectChangeTimeStamp = (GetTickerTime() + AvatarLogic.EFFECT_SPLASH_LENGTH); + this._newEffect = AvatarLogic.EFFECT_TYPE_SWIM_DARK; + } + + else if(model.getValue(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM) + { + this._effectChangeTimeStamp = (GetTickerTime() + AvatarLogic.EFFECT_SPLASH_LENGTH); + this._newEffect = effect; + + effect = AvatarLogic.EFFECT_TYPE_SPLASH; + } + + else if(model.getValue(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM_DARK) + { + this._effectChangeTimeStamp = (GetTickerTime() + AvatarLogic.EFFECT_SPLASH_LENGTH); + this._newEffect = effect; + + effect = AvatarLogic.EFFECT_TYPE_SPLASH_DARK; + } + + else if(delay === 0) + { + this._effectChangeTimeStamp = 0; + } + + else + { + this._effectChangeTimeStamp = (GetTickerTime() + delay); + this._newEffect = effect; + + return; + } + + model.setValue(RoomObjectVariable.FIGURE_EFFECT, effect); + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + let eventType: string = null; + + switch(event.type) + { + case MouseEventType.MOUSE_CLICK: + eventType = RoomObjectMouseEvent.CLICK; + break; + case MouseEventType.DOUBLE_CLICK: + eventType = RoomObjectMouseEvent.DOUBLE_CLICK; + break; + case MouseEventType.ROLL_OVER: + eventType = RoomObjectMouseEvent.MOUSE_ENTER; + + if(this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 1); + + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object)); + break; + case MouseEventType.ROLL_OUT: + eventType = RoomObjectMouseEvent.MOUSE_LEAVE; + + if(this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 0); + + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_ARROW, this.object)); + break; + } + + if(eventType && this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(eventType, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown)); + } + + private randomTalkingPauseStartTimestamp(): number + { + return 100 + (Math.random() * 200); + } + + private randomTalkingPauseEndTimestamp(): number + { + return 75 + (Math.random() * 75); + } + + private randomBlinkStartTimestamp(): number + { + return 4500 + (Math.random() * 1000); + } + + private randomBlinkEndTimestamp(): number + { + return 50 + (Math.random() * 200); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/avatar/index.ts b/submodules/renderer/src/nitro/room/object/logic/avatar/index.ts new file mode 100644 index 0000000..7fb1410 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/avatar/index.ts @@ -0,0 +1 @@ +export * from './AvatarLogic'; diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureAchievementResolutionLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureAchievementResolutionLogic.ts new file mode 100644 index 0000000..60047df --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureAchievementResolutionLogic.ts @@ -0,0 +1,72 @@ +import { RoomObjectVariable } from '../../../../../api'; +import { RoomObjectBadgeAssetEvent, RoomObjectEvent, RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectGroupBadgeUpdateMessage, ObjectSelectedMessage } from '../../../messages'; +import { FurnitureBadgeDisplayLogic } from './FurnitureBadgeDisplayLogic'; + +export class FurnitureAchievementResolutionLogic extends FurnitureBadgeDisplayLogic +{ + public static STATE_RESOLUTION_NOT_STARTED: number = 0; + public static STATE_RESOLUTION_IN_PROGRESS: number = 1; + public static STATE_RESOLUTION_ACHIEVED: number = 2; + public static STATE_RESOLUTION_FAILED: number = 3; + private static ACH_NOT_SET: string = 'ach_0'; + private static BADGE_VISIBLE_IN_STATE: number = 2; + + public getEventTypes(): string[] + { + const types = [RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_OPEN, RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_ENGRAVING, RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_FAILED, RoomObjectBadgeAssetEvent.LOAD_BADGE]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(message instanceof ObjectGroupBadgeUpdateMessage) + { + if(message.assetName !== 'loading_icon') + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_VISIBLE_IN_STATE, FurnitureAchievementResolutionLogic.BADGE_VISIBLE_IN_STATE); + } + } + + if(message instanceof ObjectSelectedMessage) + { + if(!this.eventDispatcher || !this.object) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object)); + } + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + let event: RoomObjectEvent = null; + + switch(this.object.getState(0)) + { + case FurnitureAchievementResolutionLogic.STATE_RESOLUTION_NOT_STARTED: + case FurnitureAchievementResolutionLogic.STATE_RESOLUTION_IN_PROGRESS: + event = new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_OPEN, this.object); + break; + case FurnitureAchievementResolutionLogic.STATE_RESOLUTION_ACHIEVED: + event = new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_ENGRAVING, this.object); + break; + case FurnitureAchievementResolutionLogic.STATE_RESOLUTION_FAILED: + event = new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.ACHIEVEMENT_RESOLUTION_FAILED, this.object); + break; + } + + if(event) this.eventDispatcher.dispatchEvent(event); + } + + protected updateBadge(badgeId: string): void + { + if(badgeId === FurnitureAchievementResolutionLogic.ACH_NOT_SET) return; + + super.updateBadge(badgeId); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureBadgeDisplayLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureBadgeDisplayLogic.ts new file mode 100644 index 0000000..b92d698 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureBadgeDisplayLogic.ts @@ -0,0 +1,64 @@ +import { RoomObjectVariable, StringDataType } from '../../../../../api'; +import { RoomObjectBadgeAssetEvent, RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { GetTickerTime } from '../../../../../pixi-proxy'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage, ObjectGroupBadgeUpdateMessage } from '../../../messages'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureBadgeDisplayLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [RoomObjectWidgetRequestEvent.BADGE_DISPLAY_ENGRAVING, RoomObjectBadgeAssetEvent.LOAD_BADGE]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(!this.object) return; + + if(message instanceof ObjectDataUpdateMessage) + { + const data = message.data; + + if(data instanceof StringDataType) this.updateBadge(data.getValue(1)); + + return; + } + + if(message instanceof ObjectGroupBadgeUpdateMessage) + { + if(message.assetName !== 'loading_icon') + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_ASSET_NAME, message.assetName); + this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS, 1); + + this.update(GetTickerTime()); + } + + return; + } + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.BADGE_DISPLAY_ENGRAVING, this.object)); + } + + protected updateBadge(badgeId: string): void + { + if(badgeId === '') return; + + if(this.eventDispatcher) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS, -1); + + this.eventDispatcher.dispatchEvent(new RoomObjectBadgeAssetEvent(RoomObjectBadgeAssetEvent.LOAD_BADGE, this.object, badgeId, false)); + } + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureChangeStateWhenStepOnLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureChangeStateWhenStepOnLogic.ts new file mode 100644 index 0000000..14cec74 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureChangeStateWhenStepOnLogic.ts @@ -0,0 +1,53 @@ +import { IAssetData, RoomObjectVariable } from '../../../../../api'; +import { RoomToObjectOwnAvatarMoveEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureChangeStateWhenStepOnLogic extends FurnitureLogic +{ + constructor() + { + super(); + + this.onRoomToObjectOwnAvatarMoveEvent = this.onRoomToObjectOwnAvatarMoveEvent.bind(this); + } + + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + if(this.eventDispatcher) this.eventDispatcher.addEventListener(RoomToObjectOwnAvatarMoveEvent.ROAME_MOVE_TO, this.onRoomToObjectOwnAvatarMoveEvent); + } + + public tearDown(): void + { + if(this.eventDispatcher) this.eventDispatcher.removeEventListener(RoomToObjectOwnAvatarMoveEvent.ROAME_MOVE_TO, this.onRoomToObjectOwnAvatarMoveEvent); + + super.tearDown(); + } + + private onRoomToObjectOwnAvatarMoveEvent(event: RoomToObjectOwnAvatarMoveEvent): void + { + if(!event || !this.object) return; + + const location = this.object.getLocation(); + const targetLocation = event.targetLocation; + + if(!targetLocation) return; + + let sizeX = this.object.model.getValue(RoomObjectVariable.FURNITURE_SIZE_X); + let sizeY = this.object.model.getValue(RoomObjectVariable.FURNITURE_SIZE_Y); + + const direction = (((Math.floor(this.object.getDirection().x) + 45) % 360) / 90); + + if((direction === 1) || (direction === 3)) [sizeX, sizeY] = [sizeY, sizeX]; + + if(((targetLocation.x >= location.x) && (targetLocation.x < (location.x + sizeX))) && ((targetLocation.y >= location.y) && (targetLocation.y < (location.y + sizeY)))) + { + this.object.setState(1, 0); + } + else + { + this.object.setState(0, 0); + } + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureClothingChangeLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureClothingChangeLogic.ts new file mode 100644 index 0000000..385e2e0 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureClothingChangeLogic.ts @@ -0,0 +1,48 @@ +import { IAssetData, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureClothingChangeLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [RoomObjectWidgetRequestEvent.CLOTHING_CHANGE]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + const furniData = this.object.model.getValue(RoomObjectVariable.FURNITURE_DATA); + + this.updateClothingData(furniData); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(message instanceof ObjectDataUpdateMessage) message.data && this.updateClothingData(message.data.getLegacyString()); + } + + private updateClothingData(furnitureData: string): void + { + if(!furnitureData || !furnitureData.length) return; + + const [boyClothing, girlClothing] = furnitureData.split(','); + + if(boyClothing && boyClothing.length) this.object.model.setValue(RoomObjectVariable.FURNITURE_CLOTHING_BOY, boyClothing); + if(girlClothing && girlClothing.length) this.object.model.setValue(RoomObjectVariable.FURNITURE_CLOTHING_GIRL, girlClothing); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOTHING_CHANGE, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCounterClockLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCounterClockLogic.ts new file mode 100644 index 0000000..908e385 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCounterClockLogic.ts @@ -0,0 +1,51 @@ +import { IRoomGeometry, MouseEventType } from '../../../../../api'; +import { RoomObjectEvent, RoomObjectStateChangedEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureCounterClockLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [RoomObjectStateChangedEvent.STATE_CHANGE]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + if(!event || !geometry || !this.object) return; + + let objectEvent: RoomObjectEvent = null; + + switch(event.type) + { + case MouseEventType.DOUBLE_CLICK: + switch(event.spriteTag) + { + case 'start_stop': + objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 1); + break; + case 'reset': + objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 2); + break; + } + + if(this.eventDispatcher && objectEvent) + { + this.eventDispatcher.dispatchEvent(objectEvent); + + return; + } + break; + } + + super.mouseEvent(event, geometry); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 1)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCrackableLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCrackableLogic.ts new file mode 100644 index 0000000..244f7c5 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCrackableLogic.ts @@ -0,0 +1,18 @@ +import { RoomObjectVariable, RoomWidgetEnumItemExtradataParameter } from '../../../../../api'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureCrackableLogic extends FurnitureLogic +{ + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(!this.object) return; + + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + { + this.object.model.setValue(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, RoomWidgetEnumItemExtradataParameter.CRACKABLE_FURNI); + } + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCraftingGizmoLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCraftingGizmoLogic.ts new file mode 100644 index 0000000..7edc201 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCraftingGizmoLogic.ts @@ -0,0 +1,10 @@ +import { RoomWidgetEnum } from '../../../../../api'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureCraftingGizmoLogic extends FurnitureLogic +{ + public get widget(): string + { + return RoomWidgetEnum.CRAFTING; + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCreditLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCreditLogic.ts new file mode 100644 index 0000000..aa313fa --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCreditLogic.ts @@ -0,0 +1,38 @@ +import { IAssetData, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureCreditLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [ + RoomObjectWidgetRequestEvent.CREDITFURNI + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + let creditValue = 0; + + if(asset.logic) + { + if(asset.logic.credits && (asset.logic.credits !== '') && (asset.logic.credits.length > 0)) creditValue = parseInt(asset.logic.credits); + } + + this.object.model.setValue(RoomObjectVariable.FURNITURE_CREDIT_VALUE, creditValue); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CREDITFURNI, this.object)); + + super.useObject(); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCuckooClockLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCuckooClockLogic.ts new file mode 100644 index 0000000..3d4cf05 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCuckooClockLogic.ts @@ -0,0 +1,38 @@ +import { RoomObjectPlaySoundIdEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureCuckooClockLogic extends FurnitureMultiStateLogic +{ + private _state: number = 1; + + public getEventTypes(): string[] + { + const types = [RoomObjectPlaySoundIdEvent.PLAY_SOUND_AT_PITCH]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(message instanceof ObjectDataUpdateMessage) + { + if((this._state !== -1) && (message.state !== this._state)) + { + this.dispatchSoundEvent(this.object.location.z); + } + + this._state = message.state; + } + } + + private dispatchSoundEvent(height: number): void + { + const pitch = Math.pow(2, (height - 1.2)); + + this.eventDispatcher.dispatchEvent(new RoomObjectPlaySoundIdEvent(RoomObjectPlaySoundIdEvent.PLAY_SOUND_AT_PITCH, this.object, 'FURNITURE_cuckoo_clock', pitch)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCustomStackHeightLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCustomStackHeightLogic.ts new file mode 100644 index 0000000..d902d54 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureCustomStackHeightLogic.ts @@ -0,0 +1,31 @@ +import { IAssetData, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureCustomStackHeightLogic extends FurnitureMultiStateLogic +{ + public getEventTypes(): string[] + { + const types = [ + RoomObjectWidgetRequestEvent.STACK_HEIGHT + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + if(this.object && this.object.model) this.object.model.setValue(RoomObjectVariable.FURNITURE_ALWAYS_STACKABLE, 1); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.STACK_HEIGHT, this.object)); + + super.useObject(); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureDiceLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureDiceLogic.ts new file mode 100644 index 0000000..ffdec1a --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureDiceLogic.ts @@ -0,0 +1,69 @@ +import { IRoomGeometry, MouseEventType } from '../../../../../api'; +import { RoomObjectEvent, RoomObjectFurnitureActionEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureDiceLogic extends FurnitureLogic +{ + private _noTags: boolean; + private _noTagsLastStateActivate: boolean; + + constructor() + { + super(); + + this._noTags = false; + this._noTagsLastStateActivate = false; + } + + public getEventTypes(): string[] + { + const types = [RoomObjectFurnitureActionEvent.DICE_ACTIVATE, RoomObjectFurnitureActionEvent.DICE_OFF]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + if(!event || !geometry || !this.object) return; + + let objectEvent: RoomObjectEvent = null; + + switch(event.type) + { + case MouseEventType.DOUBLE_CLICK: + if(this._noTags) + { + if(((!(this._noTagsLastStateActivate)) || (this.object.getState(0) === 0)) || (this.object.getState(0) === 100)) + { + objectEvent = new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.DICE_ACTIVATE, this.object); + + this._noTagsLastStateActivate = true; + } + else + { + objectEvent = new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.DICE_OFF, this.object); + + this._noTagsLastStateActivate = false; + } + } + else + { + if(((event.spriteTag === 'activate') || (this.object.getState(0) === 0)) || (this.object.getState(0) === 100)) + { + objectEvent = new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.DICE_ACTIVATE, this.object); + } + + else if(event.spriteTag === 'deactivate') + { + objectEvent = new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.DICE_OFF, this.object); + } + } + + if(objectEvent && this.eventDispatcher) this.eventDispatcher.dispatchEvent(objectEvent); + + return; + } + + super.mouseEvent(event, geometry); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureEcotronBoxLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureEcotronBoxLogic.ts new file mode 100644 index 0000000..e4b3214 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureEcotronBoxLogic.ts @@ -0,0 +1,21 @@ +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureEcotronBoxLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [ + RoomObjectWidgetRequestEvent.ECOTRONBOX + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.ECOTRONBOX, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureEditableInternalLinkLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureEditableInternalLinkLogic.ts new file mode 100644 index 0000000..282673b --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureEditableInternalLinkLogic.ts @@ -0,0 +1,82 @@ +import { IAssetData, IRoomGeometry, MouseEventType, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureEditableInternalLinkLogic extends FurnitureLogic +{ + private _showStateOnceRendered: boolean; + private _updateCount: number; + + constructor() + { + super(); + + this._showStateOnceRendered = false; + this._updateCount = 0; + } + + public getEventTypes(): string[] + { + const types = [RoomObjectWidgetRequestEvent.INERNAL_LINK]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + if(asset.logic) + { + if(asset.logic.action) + { + if(asset.logic.action.startState === 1) this._showStateOnceRendered = true; + } + } + } + + public update(time: number): void + { + super.update(time); + + if(!this._showStateOnceRendered) return; + + this._updateCount++; + + if(this._showStateOnceRendered && (this._updateCount > 20)) + { + this.setAutomaticStateIndex(1); + + this._showStateOnceRendered = false; + } + } + + private setAutomaticStateIndex(state: number): void + { + if(!this.object) return; + + if(this.object.model) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX, state); + } + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + if(!event || !geometry) return; + + if(event.type === MouseEventType.DOUBLE_CLICK) + { + this.setAutomaticStateIndex(0); + } + + super.mouseEvent(event, geometry); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.INERNAL_LINK, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureEditableRoomLinkLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureEditableRoomLinkLogic.ts new file mode 100644 index 0000000..f7c1eee --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureEditableRoomLinkLogic.ts @@ -0,0 +1,76 @@ +import { IAssetData, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureEditableRoomLinkLogic extends FurnitureLogic +{ + private _timer: any; + + public getEventTypes(): string[] + { + const types = [RoomObjectWidgetRequestEvent.ROOM_LINK]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + if(asset.logic) + { + if(asset.logic.action) + { + if(asset.logic.action.link && (asset.logic.action.link !== '') && (asset.logic.action.link.length > 0)) + { + (this.object && this.object.model && this.object.model.setValue(RoomObjectVariable.FURNITURE_INTERNAL_LINK, asset.logic.action.link)); + } + } + } + } + + protected onDispose(): void + { + if(this._timer) + { + clearTimeout(this._timer); + + this._timer = null; + } + + super.onDispose(); + } + + private setAutomaticStateIndex(state: number): void + { + if(!this.object) return; + + if(this.object.model) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX, state); + } + } + + public useObject(): void + { + this.setAutomaticStateIndex(1); + + if(this._timer) + { + clearTimeout(this._timer); + + this._timer = null; + } + + this._timer = setTimeout(() => + { + this.setAutomaticStateIndex(0); + + this._timer = null; + }, 2500); + + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.ROOM_LINK, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureEffectBoxLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureEffectBoxLogic.ts new file mode 100644 index 0000000..5b92580 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureEffectBoxLogic.ts @@ -0,0 +1,27 @@ +import { ContextMenuEnum } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureEffectBoxLogic extends FurnitureLogic +{ + private _timer: any; + + public getEventTypes(): string[] + { + const types = [RoomObjectWidgetRequestEvent.EFFECTBOX_OPEN_DIALOG]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.EFFECTBOX_OPEN_DIALOG, this.object)); + } + + public get contextMenu(): string + { + return ContextMenuEnum.EFFECT_BOX; + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureExternalImageLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureExternalImageLogic.ts new file mode 100644 index 0000000..e2bfdb5 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureExternalImageLogic.ts @@ -0,0 +1,44 @@ +import { IAssetData, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureExternalImageLogic extends FurnitureMultiStateLogic +{ + public getEventTypes(): string[] + { + const types = [ + RoomObjectWidgetRequestEvent.EXTERNAL_IMAGE + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + if(!asset) return; + + if(this.object && this.object.model) + { + let maskType = ''; + + if(asset.logic) + { + if(asset.logic.maskType && (asset.logic.maskType !== '') && (asset.logic.maskType.length > 0)) maskType = asset.logic.maskType; + } + + this.object.model.setValue(RoomObjectVariable.FURNITURE_USES_PLANE_MASK, 0); + this.object.model.setValue(RoomObjectVariable.FURNITURE_PLANE_MASK_TYPE, maskType); + } + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.EXTERNAL_IMAGE, this.object)); + + super.useObject(); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureFireworksLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureFireworksLogic.ts new file mode 100644 index 0000000..40698ba --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureFireworksLogic.ts @@ -0,0 +1,64 @@ +import { IAssetData, IParticleSystem, IRoomGeometry, MouseEventType, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectEvent, RoomObjectStateChangedEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureFireworksLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [RoomObjectStateChangedEvent.STATE_CHANGE]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + if(asset.logic) + { + if(asset.logic.particleSystems && asset.logic.particleSystems.length) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_FIREWORKS_DATA, asset.logic.particleSystems); + } + } + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + if(!event || !geometry || !this.object) return; + + let objectEvent: RoomObjectEvent = null; + + switch(event.type) + { + case MouseEventType.DOUBLE_CLICK: + switch(event.spriteTag) + { + case 'start_stop': + objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 1); + break; + case 'reset': + objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 2); + break; + } + + if(this.eventDispatcher && objectEvent) + { + this.eventDispatcher.dispatchEvent(objectEvent); + + return; + } + break; + } + + super.mouseEvent(event, geometry); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 0)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureFloorHoleLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureFloorHoleLogic.ts new file mode 100644 index 0000000..37fb615 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureFloorHoleLogic.ts @@ -0,0 +1,109 @@ +import { RoomObjectVariable, Vector3d } from '../../../../../api'; +import { RoomObjectFloorHoleEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureFloorHoleLogic extends FurnitureMultiStateLogic +{ + private static STATE_HOLE: number = 0; + + private _currentState: number; + private _currentLocation: Vector3d; + + constructor() + { + super(); + + this._currentState = -1; + this._currentLocation = null; + } + + public getEventTypes(): string[] + { + const types = [RoomObjectFloorHoleEvent.ADD_HOLE, RoomObjectFloorHoleEvent.REMOVE_HOLE]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + protected onDispose(): void + { + if(this._currentState === FurnitureFloorHoleLogic.STATE_HOLE) + { + this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.REMOVE_HOLE, this.object)); + } + + super.onDispose(); + } + + public update(time: number): void + { + super.update(time); + + this.handleAutomaticStateUpdate(); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(!this.object) return; + + if(message instanceof ObjectDataUpdateMessage) + { + this.handleStateUpdate(this.object.getState(0)); + } + + const location = this.object.getLocation(); + + if(!this._currentLocation) + { + this._currentLocation = new Vector3d(); + } + else + { + if((location.x !== this._currentLocation.x) || (location.y !== this._currentLocation.y)) + { + if(this._currentState === FurnitureFloorHoleLogic.STATE_HOLE) + { + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.ADD_HOLE, this.object)); + } + } + } + + this._currentLocation.assign(location); + } + + private handleStateUpdate(state: number): void + { + if(state === this._currentState) return; + + if(this.eventDispatcher) + { + if(state === FurnitureFloorHoleLogic.STATE_HOLE) + { + this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.ADD_HOLE, this.object)); + } + + else if(this._currentState === FurnitureFloorHoleLogic.STATE_HOLE) + { + this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.REMOVE_HOLE, this.object)); + } + } + + this._currentState = state; + } + + private handleAutomaticStateUpdate(): void + { + if(!this.object) return; + + const model = this.object.model; + + if(!model) return; + + const stateIndex = model.getValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX); + + if(!isNaN(stateIndex)) this.handleStateUpdate((stateIndex % 2)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureFriendFurniLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureFriendFurniLogic.ts new file mode 100644 index 0000000..2b024b7 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureFriendFurniLogic.ts @@ -0,0 +1,71 @@ +import { ContextMenuEnum, IAssetData, RoomObjectVariable, StringDataType } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureFriendFurniLogic extends FurnitureMultiStateLogic +{ + private static readonly STATE_UNINITIALIZED: number = -1; + private static readonly STATE_UNLOCKED: number = 0; + private static readonly STATE_LOCKED: number = 1; + + private _state: number = -1; + + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + if(this.object) this.object.model.setValue(RoomObjectVariable.FURNITURE_FRIENDFURNI_ENGRAVING, this.engravingDialogType); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + if(message instanceof ObjectDataUpdateMessage) + { + const data = (message.data as StringDataType); + + if(data) + { + this._state = data.state; + } + else + { + this._state = message.state; + } + } + + super.processUpdateMessage(message); + } + + public getEventTypes(): string[] + { + const types = [RoomObjectWidgetRequestEvent.FRIEND_FURNITURE_ENGRAVING]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + if(this._state === FurnitureFriendFurniLogic.STATE_LOCKED) + { + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.FRIEND_FURNITURE_ENGRAVING, this.object)); + } + else + { + super.useObject(); + } + } + + public get engravingDialogType(): number + { + return 0; + } + + public get contextMenu(): string + { + return ((this._state === FurnitureFriendFurniLogic.STATE_UNLOCKED) ? ContextMenuEnum.FRIEND_FURNITURE : ContextMenuEnum.DUMMY); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureGroupForumTerminalLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureGroupForumTerminalLogic.ts new file mode 100644 index 0000000..405db1f --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureGroupForumTerminalLogic.ts @@ -0,0 +1,31 @@ +import { RoomObjectVariable } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { FurnitureGuildCustomizedLogic } from './FurnitureGuildCustomizedLogic'; + +export class FurnitureGroupForumTerminalLogic extends FurnitureGuildCustomizedLogic +{ + public getEventTypes(): string[] + { + const types = [ + RoomObjectWidgetRequestEvent.INERNAL_LINK + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + protected updateGroupId(id: string): void + { + super.updateGroupId(id); + + this.object.model.setValue(RoomObjectVariable.FURNITURE_INTERNAL_LINK, `groupforum/${id}`); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.INERNAL_LINK, this.object)); + + super.useObject(); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureGuildCustomizedLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureGuildCustomizedLogic.ts new file mode 100644 index 0000000..f97483a --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureGuildCustomizedLogic.ts @@ -0,0 +1,94 @@ +import { IRoomGeometry, MouseEventType, RoomObjectVariable, StringDataType } from '../../../../../api'; +import { RoomObjectBadgeAssetEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { GetTickerTime } from '../../../../../pixi-proxy'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage, ObjectGroupBadgeUpdateMessage, ObjectSelectedMessage } from '../../../messages'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic +{ + public static GROUPID_KEY: number = 1; + public static BADGE_KEY: number = 2; + public static COLOR1_KEY: number = 3; + public static COLOR2_KEY: number = 4; + + public getEventTypes(): string[] + { + const types = [ + RoomObjectBadgeAssetEvent.LOAD_BADGE, + RoomObjectWidgetRequestEvent.GUILD_FURNI_CONTEXT_MENU, + RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(message instanceof ObjectDataUpdateMessage) + { + const data = message.data; + + if(data instanceof StringDataType) + { + this.updateGroupId(data.getValue(FurnitureGuildCustomizedLogic.GROUPID_KEY)); + this.updateBadge(data.getValue(FurnitureGuildCustomizedLogic.BADGE_KEY)); + this.updateColors(data.getValue(FurnitureGuildCustomizedLogic.COLOR1_KEY), data.getValue(FurnitureGuildCustomizedLogic.COLOR2_KEY)); + } + } + + else if(message instanceof ObjectGroupBadgeUpdateMessage) + { + if(message.assetName !== 'loading_icon') + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME, message.assetName); + + this.update(GetTickerTime()); + } + } + + else if(message instanceof ObjectSelectedMessage) + { + if(!message.selected) + { + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object)); + } + } + } + + protected updateGroupId(id: string): void + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_GUILD_ID, parseInt(id)); + } + + private updateBadge(badge: string): void + { + this.eventDispatcher.dispatchEvent(new RoomObjectBadgeAssetEvent(RoomObjectBadgeAssetEvent.LOAD_BADGE, this.object, badge, true)); + } + + public updateColors(color1: string, color2: string): void + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_1, parseInt(color1, 16)); + this.object.model.setValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_2, parseInt(color2, 16)); + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + if(!event || !geometry || !this.object) return; + + switch(event.type) + { + case MouseEventType.MOUSE_CLICK: + this.openContextMenu(); + } + + super.mouseEvent(event, geometry); + } + + private openContextMenu(): void + { + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.GUILD_FURNI_CONTEXT_MENU, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureHabboWheelLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureHabboWheelLogic.ts new file mode 100644 index 0000000..344e4da --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureHabboWheelLogic.ts @@ -0,0 +1,19 @@ +import { RoomObjectFurnitureActionEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureHabboWheelLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [RoomObjectFurnitureActionEvent.USE_HABBOWHEEL]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.USE_HABBOWHEEL, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureHighScoreLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureHighScoreLogic.ts new file mode 100644 index 0000000..7aae7b4 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureHighScoreLogic.ts @@ -0,0 +1,48 @@ +import { RoomObjectVariable } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureHighScoreLogic extends FurnitureLogic +{ + private static SHOW_WIDGET_IN_STATE = 1; + + private _state = -1; + + public getEventTypes(): string[] + { + return [RoomObjectWidgetRequestEvent.HIGH_SCORE_DISPLAY, RoomObjectWidgetRequestEvent.HIDE_HIGH_SCORE_DISPLAY]; + } + + public tearDown(): void + { + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + { + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.HIDE_HIGH_SCORE_DISPLAY, this.object)); + } + + super.tearDown(); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return; + + if(message instanceof ObjectDataUpdateMessage) + { + if(message.state === FurnitureHighScoreLogic.SHOW_WIDGET_IN_STATE) + { + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.HIGH_SCORE_DISPLAY, this.object)); + } + else + { + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.HIDE_HIGH_SCORE_DISPLAY, this.object)); + } + + this._state = message.state; + } + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureHockeyScoreLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureHockeyScoreLogic.ts new file mode 100644 index 0000000..4a30641 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureHockeyScoreLogic.ts @@ -0,0 +1,59 @@ +import { IRoomGeometry, MouseEventType } from '../../../../../api'; +import { RoomObjectEvent, RoomObjectStateChangedEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureHockeyScoreLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [RoomObjectStateChangedEvent.STATE_CHANGE]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + if(!event || !geometry || !this.object) return; + + let objectEvent: RoomObjectEvent = null; + + switch(event.type) + { + case MouseEventType.DOUBLE_CLICK: + switch(event.spriteTag) + { + case 'off': + objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 3); + break; + } + break; + case MouseEventType.MOUSE_CLICK: + switch(event.spriteTag) + { + case 'inc': + objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 2); + break; + case 'dec': + objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 1); + break; + } + break; + } + + if(this.eventDispatcher && objectEvent) + { + this.eventDispatcher.dispatchEvent(objectEvent); + + return; + } + + super.mouseEvent(event, geometry); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 3)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureHweenLovelockLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureHweenLovelockLogic.ts new file mode 100644 index 0000000..2e73e1c --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureHweenLovelockLogic.ts @@ -0,0 +1,10 @@ +import { FriendFurniEngravingWidgetType } from '../../../../../api'; +import { FurnitureFriendFurniLogic } from './FurnitureFriendFurniLogic'; + +export class FurnitureHweenLovelockLogic extends FurnitureFriendFurniLogic +{ + public get engravingDialogType(): number + { + return FriendFurniEngravingWidgetType.HABBOWEEN; + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureIceStormLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureIceStormLogic.ts new file mode 100644 index 0000000..fb876df --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureIceStormLogic.ts @@ -0,0 +1,72 @@ +import { LegacyDataType } from '../../../../../api'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureIceStormLogic extends FurnitureMultiStateLogic +{ + private _nextState: number; + private _nextStateExtra: number; + private _nextStateTimestamp: number; + + constructor() + { + super(); + + this._nextState = 0; + this._nextStateTimestamp = 0; + } + + public update(totalTimeRunning: number): void + { + if((this._nextStateTimestamp > 0) && (totalTimeRunning >= this._nextStateTimestamp)) + { + this._nextStateTimestamp = 0; + + const data = new LegacyDataType(); + + data.setString(this._nextState.toString()); + + super.processUpdateMessage(new ObjectDataUpdateMessage(this._nextState, data, this._nextStateExtra)); + } + + super.update(totalTimeRunning); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + if(message instanceof ObjectDataUpdateMessage) + { + this.processUpdate(message); + + return; + } + + super.processUpdateMessage(message); + } + + private processUpdate(message: ObjectDataUpdateMessage): void + { + if(!message) return; + + const state = ~~(message.state / 1000); + const time = ~~(message.state % 1000); + + if(!time) + { + this._nextStateTimestamp = 0; + + const data = new LegacyDataType(); + + data.setString(state.toString()); + + super.processUpdateMessage(new ObjectDataUpdateMessage(state, data, message.extra)); + } + else + { + this._nextState = state; + this._nextStateExtra = message.extra; + this._nextStateTimestamp = this.time + time; + } + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureInternalLinkLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureInternalLinkLogic.ts new file mode 100644 index 0000000..6287123 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureInternalLinkLogic.ts @@ -0,0 +1,78 @@ +import { IAssetData, IRoomGeometry, MouseEventType, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureInternalLinkLogic extends FurnitureLogic +{ + private _showStateOnceRendered: boolean = false; + private _updateCount: number = 0; + + public getEventTypes(): string[] + { + const types = [ + RoomObjectWidgetRequestEvent.INERNAL_LINK + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + if(asset.logic) + { + if(asset.logic.action) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_INTERNAL_LINK, asset.logic.action.link); + + if(asset.logic.action.startState === 1) this._showStateOnceRendered = true; + } + } + } + + public update(time: number): void + { + super.update(time); + + if(!this._showStateOnceRendered) return; + + this._updateCount++; + + if(this._showStateOnceRendered && (this._updateCount === 20)) + { + this.setAutomaticStateIndex(1); + + this._showStateOnceRendered = false; + } + } + + private setAutomaticStateIndex(state: number): void + { + if(!this.object) return; + + if(this.object.model) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX, state); + } + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + if(!event || !geometry) return; + + if((event.type === MouseEventType.DOUBLE_CLICK) && this._showStateOnceRendered) + { + this.setAutomaticStateIndex(0); + } + + super.mouseEvent(event, geometry); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.INERNAL_LINK, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureJukeboxLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureJukeboxLogic.ts new file mode 100644 index 0000000..3e315f2 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureJukeboxLogic.ts @@ -0,0 +1,98 @@ +import { RoomObjectVariable, RoomWidgetEnumItemExtradataParameter } from '../../../../../api'; +import { RoomObjectFurnitureActionEvent, RoomObjectStateChangedEvent, RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureJukeboxLogic extends FurnitureMultiStateLogic +{ + private _disposeEventsAllowed: boolean = false; + private _isInitialized: boolean = false; + private _currentState: number = -1; + + public getEventTypes(): string[] + { + const types = [ + RoomObjectFurnitureActionEvent.JUKEBOX_START, + RoomObjectFurnitureActionEvent.JUKEBOX_MACHINE_STOP, + RoomObjectFurnitureActionEvent.JUKEBOX_DISPOSE, + RoomObjectFurnitureActionEvent.JUKEBOX_INIT, + RoomObjectWidgetRequestEvent.JUKEBOX_PLAYLIST_EDITOR + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + protected onDispose(): void + { + this.requestDispose(); + + super.onDispose(); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return; + + if(!this._isInitialized) this.requestInit(); + + this.object.model.setValue(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, RoomWidgetEnumItemExtradataParameter.JUKEBOX); + + if(message instanceof ObjectDataUpdateMessage) + { + const state = this.object.getState(0); + + if(state !== this._currentState) + { + this._currentState = state; + + if(state === 1) this.requestPlayList(); + else if(state === 0) this.requestStopPlaying(); + } + } + } + + private requestInit(): void + { + if(!this.object || !this.eventDispatcher) return; + + this._disposeEventsAllowed = true; + + this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.JUKEBOX_INIT, this.object)); + + this._isInitialized = true; + } + + private requestPlayList(): void + { + if(!this.object || !this.eventDispatcher) return; + + this._disposeEventsAllowed = true; + + this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.JUKEBOX_START, this.object)); + } + + private requestStopPlaying(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.JUKEBOX_MACHINE_STOP, this.object)); + } + + private requestDispose(): void + { + if(!this._disposeEventsAllowed || !this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.JUKEBOX_DISPOSE, this.object)); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.JUKEBOX_PLAYLIST_EDITOR, this.object)); + this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, -1)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureLogic.ts new file mode 100644 index 0000000..9e82af8 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureLogic.ts @@ -0,0 +1,423 @@ +import { IAssetData, IRoomGeometry, IRoomObjectController, IRoomObjectModel, IVector3D, MouseEventType, NitroConfiguration, RoomObjectVariable, Vector3d } from '../../../../../api'; +import { RoomObjectMouseEvent, RoomObjectRoomAdEvent, RoomObjectStateChangedEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage, ObjectHeightUpdateMessage, ObjectItemDataUpdateMessage, ObjectMoveUpdateMessage, ObjectSelectedMessage } from '../../../messages'; +import { MovingObjectLogic } from '../MovingObjectLogic'; + +export class FurnitureLogic extends MovingObjectLogic +{ + private static BOUNCING_STEPS: number = -1; + private static BOUNCING_Z: number = -1; + + private _sizeX: number; + private _sizeY: number; + private _sizeZ: number; + private _centerX: number; + private _centerY: number; + private _centerZ: number; + + private _directions: number[]; + + private _mouseOver: boolean; + + private _locationOffset: IVector3D; + private _bouncingStep: number; + private _storedRotateMessage: RoomObjectUpdateMessage; + private _directionInitialized: boolean; + + constructor() + { + super(); + + this._sizeX = 0; + this._sizeY = 0; + this._sizeZ = 0; + this._centerX = 0; + this._centerY = 0; + this._centerZ = 0; + + this._directions = []; + + this._mouseOver = false; + + this._locationOffset = new Vector3d(); + this._bouncingStep = 0; + this._storedRotateMessage = null; + this._directionInitialized = false; + + if(FurnitureLogic.BOUNCING_STEPS === -1) + { + FurnitureLogic.BOUNCING_STEPS = NitroConfiguration.getValue('furni.rotation.bounce.steps', 8); + } + + if(FurnitureLogic.BOUNCING_Z === -1) + { + FurnitureLogic.BOUNCING_Z = NitroConfiguration.getValue('furni.rotation.bounce.height', 0.0625); + } + } + + public getEventTypes(): string[] + { + const types = [ + RoomObjectStateChangedEvent.STATE_CHANGE, + RoomObjectMouseEvent.CLICK, + RoomObjectMouseEvent.MOUSE_DOWN, + RoomObjectMouseEvent.MOUSE_DOWN_LONG, + RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_SHOW, + RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE, + RoomObjectRoomAdEvent.ROOM_AD_FURNI_DOUBLE_CLICK, + RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK]; + + if(this.widget) types.push(RoomObjectWidgetRequestEvent.OPEN_WIDGET, RoomObjectWidgetRequestEvent.CLOSE_WIDGET); + + if(this.contextMenu) types.push(RoomObjectWidgetRequestEvent.OPEN_FURNI_CONTEXT_MENU, RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU); + + return this.mergeTypes(super.getEventTypes(), types); + } + + public initialize(asset: IAssetData): void + { + if(!asset) return; + + const model = this.object && this.object.model; + + if(!model) return; + + if(asset.logic) + { + if(asset.logic.model) + { + const dimensions = asset.logic.model.dimensions; + + if(dimensions) + { + this._sizeX = dimensions.x; + this._sizeY = dimensions.y; + this._sizeZ = dimensions.z; + + this._centerX = (this._sizeX / 2); + this._centerY = (this._sizeY / 2); + this._centerZ = (this._sizeZ / 2); + } + + const directions = asset.logic.model.directions; + + if(directions && directions.length) + { + for(const direction of directions) this._directions.push(direction); + + this._directions.sort((a, b) => (a - b)); + } + } + + if(asset.logic.customVars) + { + const variables = asset.logic.customVars.variables; + + if(variables && variables.length) + { + model.setValue(RoomObjectVariable.FURNITURE_CUSTOM_VARIABLES, variables); + } + } + } + + model.setValue(RoomObjectVariable.FURNITURE_SIZE_X, this._sizeX); + model.setValue(RoomObjectVariable.FURNITURE_SIZE_Y, this._sizeY); + model.setValue(RoomObjectVariable.FURNITURE_SIZE_Z, this._sizeZ); + model.setValue(RoomObjectVariable.FURNITURE_CENTER_X, this._centerX); + model.setValue(RoomObjectVariable.FURNITURE_CENTER_Y, this._centerY); + model.setValue(RoomObjectVariable.FURNITURE_CENTER_Z, this._centerZ); + model.setValue(RoomObjectVariable.FURNITURE_ALLOWED_DIRECTIONS, this._directions); + model.setValue(RoomObjectVariable.FURNITURE_ALPHA_MULTIPLIER, 1); + } + + protected onDispose(): void + { + this._storedRotateMessage = null; + this._directions = null; + + super.onDispose(); + } + + public setObject(object: IRoomObjectController): void + { + super.setObject(object); + + if(object && object.getLocation().length) this._directionInitialized = true; + } + + protected getAdClickUrl(model: IRoomObjectModel): string + { + return model.getValue(RoomObjectVariable.FURNITURE_AD_URL); + } + + protected handleAdClick(objectId: number, objectType: string, clickUrl: string): void + { + if(!this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK, this.object)); + } + + public update(time: number): void + { + super.update(time); + + if(this._bouncingStep > 0) + { + this._bouncingStep++; + + if(this._bouncingStep > FurnitureLogic.BOUNCING_STEPS) this._bouncingStep = 0; + } + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + if(message instanceof ObjectDataUpdateMessage) + { + this.processDataUpdateMessage(message); + + return; + } + + if(message instanceof ObjectHeightUpdateMessage) + { + this.processObjectHeightUpdateMessage(message); + + return; + } + + if(message instanceof ObjectItemDataUpdateMessage) + { + this.processItemDataUpdateMessage(message); + + return; + } + + this._mouseOver = false; + + if(message.location && message.direction) + { + if(!(message instanceof ObjectMoveUpdateMessage)) + { + const direction = this.object.getDirection(); + const location = this.object.getLocation(); + + if((direction.x !== message.direction.x) && this._directionInitialized) + { + if((location.x === message.location.x) && (location.y === message.location.y) && (location.z === message.location.z)) + { + this._bouncingStep = 1; + this._storedRotateMessage = new RoomObjectUpdateMessage(message.location, message.direction); + + message = null; + } + } + } + + this._directionInitialized = true; + } + + if(message instanceof ObjectSelectedMessage) + { + if(this.contextMenu && this.eventDispatcher && this.object) + { + const eventType = (message.selected) ? RoomObjectWidgetRequestEvent.OPEN_FURNI_CONTEXT_MENU : RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(eventType, this.object)); + } + } + + super.processUpdateMessage(message); + } + + private processDataUpdateMessage(message: ObjectDataUpdateMessage): void + { + if(!message) return; + + this.object.setState(message.state, 0); + + if(message.data) message.data.writeRoomObjectModel(this.object.model); + + if(message.extra !== null) this.object.model.setValue(RoomObjectVariable.FURNITURE_EXTRAS, message.extra.toString()); + + this.object.model.setValue(RoomObjectVariable.FURNITURE_STATE_UPDATE_TIME, this.lastUpdateTime); + } + + private processObjectHeightUpdateMessage(message: ObjectHeightUpdateMessage): void + { + if(!message) return; + + this.object.model.setValue(RoomObjectVariable.FURNITURE_SIZE_Z, message.height); + } + + private processItemDataUpdateMessage(message: ObjectItemDataUpdateMessage): void + { + if(!message) return; + + this.object.model.setValue(RoomObjectVariable.FURNITURE_ITEMDATA, message.data); + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + const adUrl = this.getAdClickUrl(this.object.model); + + switch(event.type) + { + case MouseEventType.MOUSE_MOVE: + if(this.eventDispatcher) + { + const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_MOVE, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); + + mouseEvent.localX = event.localX; + mouseEvent.localY = event.localY; + mouseEvent.spriteOffsetX = event.spriteOffsetX; + mouseEvent.spriteOffsetY = event.spriteOffsetY; + + this.eventDispatcher.dispatchEvent(mouseEvent); + } + return; + case MouseEventType.ROLL_OVER: + if(!this._mouseOver) + { + if(this.eventDispatcher) + { + if(adUrl && (adUrl.indexOf('http') === 0)) + { + this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_SHOW, this.object)); + } + + const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_ENTER, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); + + mouseEvent.localX = event.localX; + mouseEvent.localY = event.localY; + mouseEvent.spriteOffsetX = event.spriteOffsetX; + mouseEvent.spriteOffsetY = event.spriteOffsetY; + + this.eventDispatcher.dispatchEvent(mouseEvent); + } + + this._mouseOver = true; + } + return; + case MouseEventType.ROLL_OUT: + if(this._mouseOver) + { + if(this.eventDispatcher) + { + if(adUrl && (adUrl.indexOf('http') === 0)) + { + this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE, this.object)); + } + + const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_LEAVE, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); + + mouseEvent.localX = event.localX; + mouseEvent.localY = event.localY; + mouseEvent.spriteOffsetX = event.spriteOffsetX; + mouseEvent.spriteOffsetY = event.spriteOffsetY; + + this.eventDispatcher.dispatchEvent(mouseEvent); + } + + this._mouseOver = false; + } + return; + case MouseEventType.DOUBLE_CLICK: + this.useObject(); + return; + case MouseEventType.MOUSE_CLICK: + if(this.eventDispatcher) + { + const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.CLICK, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); + + mouseEvent.localX = event.localX; + mouseEvent.localY = event.localY; + mouseEvent.spriteOffsetX = event.spriteOffsetX; + mouseEvent.spriteOffsetY = event.spriteOffsetY; + + this.eventDispatcher.dispatchEvent(mouseEvent); + + if(adUrl && (adUrl.indexOf('http') === 0)) + { + this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE, this.object)); + } + + if(adUrl && adUrl.length) this.handleAdClick(this.object.id, this.object.type, adUrl); + } + return; + case MouseEventType.MOUSE_DOWN: + if(this.eventDispatcher) + { + const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_DOWN, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); + + this.eventDispatcher.dispatchEvent(mouseEvent); + } + return; + case MouseEventType.MOUSE_DOWN_LONG: + if(this.eventDispatcher) + { + const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_DOWN_LONG, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); + + this.eventDispatcher.dispatchEvent(mouseEvent); + } + return; + } + } + + protected getLocationOffset(): IVector3D + { + if(this._bouncingStep <= 0) return null; + + this._locationOffset.x = 0; + this._locationOffset.y = 0; + + if(this._bouncingStep <= (FurnitureLogic.BOUNCING_STEPS / 2)) + { + this._locationOffset.z = FurnitureLogic.BOUNCING_Z * this._bouncingStep; + } + else + { + if(this._bouncingStep <= FurnitureLogic.BOUNCING_STEPS) + { + if(this._storedRotateMessage) + { + super.processUpdateMessage(this._storedRotateMessage); + + this._storedRotateMessage = null; + } + + this._locationOffset.z = FurnitureLogic.BOUNCING_Z * (FurnitureLogic.BOUNCING_STEPS - this._bouncingStep); + } + } + + return this._locationOffset; + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + const clickUrl = this.getAdClickUrl(this.object.model); + + if(clickUrl && clickUrl.length) + { + this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_FURNI_DOUBLE_CLICK, this.object, null, clickUrl)); + } + + if(this.widget) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.OPEN_WIDGET, this.object)); + + this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object)); + } + + public tearDown(): void + { + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + { + if(this.widget) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_WIDGET, this.object)); + + if(this.contextMenu) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object)); + } + + super.tearDown(); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureLoveLockLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureLoveLockLogic.ts new file mode 100644 index 0000000..3493ca6 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureLoveLockLogic.ts @@ -0,0 +1,10 @@ +import { FriendFurniEngravingWidgetType } from '../../../../../api'; +import { FurnitureFriendFurniLogic } from './FurnitureFriendFurniLogic'; + +export class FurnitureLoveLockLogic extends FurnitureFriendFurniLogic +{ + public get engravingDialogType(): number + { + return FriendFurniEngravingWidgetType.LOVE_LOCK; + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMannequinLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMannequinLogic.ts new file mode 100644 index 0000000..8517ce2 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMannequinLogic.ts @@ -0,0 +1,51 @@ +import { MapDataType, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureMannequinLogic extends FurnitureLogic +{ + private static GENDER: string = 'GENDER'; + private static FIGURE: string = 'FIGURE'; + private static OUTFIT_NAME: string = 'OUTFIT_NAME'; + + public getEventTypes(): string[] + { + const types = [RoomObjectWidgetRequestEvent.MANNEQUIN]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(message instanceof ObjectDataUpdateMessage) + { + message.data.writeRoomObjectModel(this.object.model); + + this.processObjectData(); + } + } + + private processObjectData(): void + { + if(!this.object || !this.object.model) return; + + const data = new MapDataType(); + + data.initializeFromRoomObjectModel(this.object.model); + + this.object.model.setValue(RoomObjectVariable.FURNITURE_MANNEQUIN_GENDER, data.getValue(FurnitureMannequinLogic.GENDER)); + this.object.model.setValue(RoomObjectVariable.FURNITURE_MANNEQUIN_FIGURE, data.getValue(FurnitureMannequinLogic.FIGURE)); + this.object.model.setValue(RoomObjectVariable.FURNITURE_MANNEQUIN_NAME, data.getValue(FurnitureMannequinLogic.OUTFIT_NAME)); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MANNEQUIN, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMonsterplantSeedLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMonsterplantSeedLogic.ts new file mode 100644 index 0000000..9079050 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMonsterplantSeedLogic.ts @@ -0,0 +1,25 @@ +import { ContextMenuEnum } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureMonsterplantSeedLogic extends FurnitureMultiStateLogic +{ + public getEventTypes(): string[] + { + const types = [RoomObjectWidgetRequestEvent.MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG, this.object)); + } + + public get contextMenu(): string + { + return ContextMenuEnum.MONSTERPLANT_SEED; + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMultiHeightLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMultiHeightLogic.ts new file mode 100644 index 0000000..078fc6d --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMultiHeightLogic.ts @@ -0,0 +1,12 @@ +import { IAssetData, RoomObjectVariable } from '../../../../../api'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureMultiHeightLogic extends FurnitureMultiStateLogic +{ + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + if(this.object && this.object.model) this.object.model.setValue(RoomObjectVariable.FURNITURE_IS_VARIABLE_HEIGHT, 1); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMultiStateLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMultiStateLogic.ts new file mode 100644 index 0000000..cc5f438 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMultiStateLogic.ts @@ -0,0 +1,30 @@ +import { IRoomGeometry, MouseEventType } from '../../../../../api'; +import { RoomObjectFurnitureActionEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureMultiStateLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [RoomObjectFurnitureActionEvent.MOUSE_BUTTON, RoomObjectFurnitureActionEvent.MOUSE_ARROW]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + if(!event || !geometry || !this.object) return; + + switch(event.type) + { + case MouseEventType.ROLL_OVER: + this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object)); + break; + case MouseEventType.ROLL_OUT: + this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_ARROW, this.object)); + break; + } + + super.mouseEvent(event, geometry); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMysteryBoxLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMysteryBoxLogic.ts new file mode 100644 index 0000000..ae94007 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMysteryBoxLogic.ts @@ -0,0 +1,25 @@ +import { ContextMenuEnum } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureMysteryBoxLogic extends FurnitureMultiStateLogic +{ + public getEventTypes(): string[] + { + const types = [RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG, this.object)); + } + + public get contextMenu(): string + { + return ContextMenuEnum.MYSTERY_BOX; + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMysteryTrophyLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMysteryTrophyLogic.ts new file mode 100644 index 0000000..a35e818 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureMysteryTrophyLogic.ts @@ -0,0 +1,25 @@ +import { ContextMenuEnum } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureMysteryTrophyLogic extends FurnitureMultiStateLogic +{ + public getEventTypes(): string[] + { + const types = [RoomObjectWidgetRequestEvent.MYSTERYTROPHY_OPEN_DIALOG]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MYSTERYTROPHY_OPEN_DIALOG, this.object)); + } + + public get contextMenu(): string + { + return ContextMenuEnum.MYSTERY_TROPHY; + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureOneWayDoorLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureOneWayDoorLogic.ts new file mode 100644 index 0000000..bd08589 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureOneWayDoorLogic.ts @@ -0,0 +1,19 @@ +import { RoomObjectFurnitureActionEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureOneWayDoorLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [RoomObjectFurnitureActionEvent.ENTER_ONEWAYDOOR]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.ENTER_ONEWAYDOOR, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePetCustomizationLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePetCustomizationLogic.ts new file mode 100644 index 0000000..c28d882 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePetCustomizationLogic.ts @@ -0,0 +1,33 @@ +import { RoomObjectVariable, RoomWidgetEnumItemExtradataParameter } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurniturePetCustomizationLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [RoomObjectWidgetRequestEvent.PET_PRODUCT_MENU]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(!this.object) return; + + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + { + this.object.model.setValue(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, RoomWidgetEnumItemExtradataParameter.USABLE_PRODUCT); + } + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PET_PRODUCT_MENU, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePlaceholderLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePlaceholderLogic.ts new file mode 100644 index 0000000..1aa4082 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePlaceholderLogic.ts @@ -0,0 +1,21 @@ +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurniturePlaceholderLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [ + RoomObjectWidgetRequestEvent.PLACEHOLDER + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PLACEHOLDER, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePlanetSystemLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePlanetSystemLogic.ts new file mode 100644 index 0000000..54802a7 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePlanetSystemLogic.ts @@ -0,0 +1,18 @@ +import { IAssetData, IAssetLogicPlanetSystem, RoomObjectVariable } from '../../../../../api'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurniturePlanetSystemLogic extends FurnitureLogic +{ + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + if(asset.logic) + { + if(asset.logic.planetSystems) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_PLANETSYSTEM_DATA, asset.logic.planetSystems); + } + } + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts new file mode 100644 index 0000000..9700c8c --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePresentLogic.ts @@ -0,0 +1,112 @@ +import { IAssetData, IParticleSystem, IRoomGeometry, MapDataType, MouseEventType, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectFurnitureActionEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage, ObjectModelDataUpdateMessage } from '../../../messages'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurniturePresentLogic extends FurnitureLogic +{ + private static MESSAGE: string = 'MESSAGE'; + private static PRODUCT_CODE: string = 'PRODUCT_CODE'; + private static EXTRA_PARAM: string = 'EXTRA_PARAM'; + private static PURCHASER_NAME: string = 'PURCHASER_NAME'; + private static PURCHASER_FIGURE: string = 'PURCHASER_FIGURE'; + + public getEventTypes(): string[] + { + const types = [ + RoomObjectWidgetRequestEvent.PRESENT + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + if(asset.logic) + { + if(asset.logic.particleSystems && asset.logic.particleSystems.length) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_FIREWORKS_DATA, asset.logic.particleSystems); + } + } + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(message instanceof ObjectDataUpdateMessage) + { + message.data.writeRoomObjectModel(this.object.model); + + this.updateStuffData(); + } + + if(message instanceof ObjectModelDataUpdateMessage) + { + if(message.numberKey === RoomObjectVariable.FURNITURE_DISABLE_PICKING_ANIMATION) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_DISABLE_PICKING_ANIMATION, message.numberValue); + } + } + } + + private updateStuffData(): void + { + if(!this.object || !this.object.model) return; + + const stuffData = new MapDataType(); + + stuffData.initializeFromRoomObjectModel(this.object.model); + + const message = stuffData.getValue(FurniturePresentLogic.MESSAGE); + const data = this.object.model.getValue(RoomObjectVariable.FURNITURE_DATA); + + if(!message && (typeof data === 'string')) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_DATA, data.substr(1)); + } + else + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_DATA, stuffData.getValue(FurniturePresentLogic.MESSAGE)); + } + + this.writeToModel(RoomObjectVariable.FURNITURE_TYPE_ID, stuffData.getValue(FurniturePresentLogic.PRODUCT_CODE)); + this.writeToModel(RoomObjectVariable.FURNITURE_PURCHASER_NAME, stuffData.getValue(FurniturePresentLogic.PURCHASER_NAME)); + this.writeToModel(RoomObjectVariable.FURNITURE_PURCHASER_FIGURE, stuffData.getValue(FurniturePresentLogic.PURCHASER_FIGURE)); + } + + private writeToModel(key: string, value: string): void + { + if(!value) return; + + this.object.model.setValue(key, value); + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + if(!event || !geometry || !this.object) return; + + switch(event.type) + { + case MouseEventType.ROLL_OVER: + this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object)); + break; + case MouseEventType.ROLL_OUT: + this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_ARROW, this.object)); + break; + } + + super.mouseEvent(event, geometry); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PRESENT, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePurchaseableClothingLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePurchaseableClothingLogic.ts new file mode 100644 index 0000000..b20df93 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePurchaseableClothingLogic.ts @@ -0,0 +1,28 @@ +import { ContextMenuEnum } from '../../../../../api'; +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurniturePurchaseableClothingLogic extends FurnitureMultiStateLogic +{ + + public getEventTypes(): string[] + { + const types = [ + RoomObjectWidgetRequestEvent.PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG, + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG, this.object)); + } + + public get contextMenu(): string + { + return ContextMenuEnum.PURCHASABLE_CLOTHING; + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePushableLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePushableLogic.ts new file mode 100644 index 0000000..be6c733 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurniturePushableLogic.ts @@ -0,0 +1,113 @@ +import { LegacyDataType, Vector3d } from '../../../../../api'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage, ObjectMoveUpdateMessage } from '../../../messages'; +import { MovingObjectLogic } from '../MovingObjectLogic'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurniturePushableLogic extends FurnitureMultiStateLogic +{ + private static ANIMATION_NOT_MOVING: number = 0; + private static ANIMATION_MOVING: number = 1; + private static MAX_ANIMATION_COUNT: number = 10; + + private _oldLocation: Vector3d; + + constructor() + { + super(); + + this.updateInterval = MovingObjectLogic.DEFAULT_UPDATE_INTERVAL; + this._oldLocation = new Vector3d(); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + if(!message) return; + + const isMoveMessage = (message instanceof ObjectMoveUpdateMessage); + + if(this.object && !isMoveMessage && message.location) + { + const location = this.object.getLocation(); + const difference = Vector3d.dif(message.location, location); + + if(difference) + { + if((Math.abs(difference.x) < 2) && (Math.abs(difference.y) < 2)) + { + let prevLocation = location; + + if((Math.abs(difference.x) > 1) || (Math.abs(difference.y) > 1)) + { + prevLocation = Vector3d.sum(location, Vector3d.product(difference, 0.5)); + } + + super.processUpdateMessage(new ObjectMoveUpdateMessage(prevLocation, message.location, message.direction)); + + return; + } + } + } + + if(message.location && !isMoveMessage) super.processUpdateMessage(new ObjectMoveUpdateMessage(message.location, message.location, message.direction)); + + if(message instanceof ObjectDataUpdateMessage) + { + if(message.state > 0) + { + this.updateInterval = MovingObjectLogic.DEFAULT_UPDATE_INTERVAL / this.getUpdateIntervalValue(message.state); + } + else + { + this.updateInterval = 1; + } + + this.handleDataUpdate(message); + + return; + } + + if(isMoveMessage && message.isSlide) this.updateInterval = MovingObjectLogic.DEFAULT_UPDATE_INTERVAL; + + super.processUpdateMessage(message); + } + + protected getUpdateIntervalValue(value: number) + { + return (value / FurniturePushableLogic.MAX_ANIMATION_COUNT); + } + + protected getAnimationValue(value: number) + { + return (value % FurniturePushableLogic.MAX_ANIMATION_COUNT); + } + + private handleDataUpdate(message: ObjectDataUpdateMessage): void + { + const animation = this.getAnimationValue(message.state); + + if(animation !== message.state) + { + const legacyStuff = new LegacyDataType(); + + legacyStuff.setString(animation.toString()); + + message = new ObjectDataUpdateMessage(animation, legacyStuff, message.extra); + } + + super.processUpdateMessage(message); + } + + public update(time: number): void + { + if(!this.object) return; + + this._oldLocation.assign(this.object.getLocation()); + + super.update(time); + + if(Vector3d.dif(this.object.getLocation(), this._oldLocation).length !== 0) return; + + if(this.object.getState(0) !== FurniturePushableLogic.ANIMATION_NOT_MOVING) this.object.setState(FurniturePushableLogic.ANIMATION_NOT_MOVING, 0); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRandomStateLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRandomStateLogic.ts new file mode 100644 index 0000000..be73b9c --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRandomStateLogic.ts @@ -0,0 +1,21 @@ +import { RoomObjectStateChangedEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureRandomStateLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [ + RoomObjectStateChangedEvent.STATE_RANDOM + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_RANDOM, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRandomTeleportLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRandomTeleportLogic.ts new file mode 100644 index 0000000..8a0a4b4 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRandomTeleportLogic.ts @@ -0,0 +1,10 @@ +import { ContextMenuEnum } from '../../../../../api'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureRandomTeleportLogic extends FurnitureMultiStateLogic +{ + public get contextMenu(): string + { + return ContextMenuEnum.RANDOM_TELEPORT; + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRentableSpaceLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRentableSpaceLogic.ts new file mode 100644 index 0000000..f860696 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRentableSpaceLogic.ts @@ -0,0 +1,46 @@ +import { RoomObjectVariable, RoomWidgetEnum } from '../../../../../api'; +import { RoomObjectDataRequestEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureRentableSpaceLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [ + RoomObjectDataRequestEvent.RODRE_CURRENT_USER_ID, + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public update(time: number): void + { + super.update(time); + + if(this.object && this.object.model) + { + if(!this.object.model.getValue(RoomObjectVariable.SESSION_CURRENT_USER_ID)) + { + this.eventDispatcher.dispatchEvent(new RoomObjectDataRequestEvent(RoomObjectDataRequestEvent.RODRE_CURRENT_USER_ID, this.object)); + } + + const renterId = this.object.model.getValue(RoomObjectVariable.FURNITURE_DATA)['renterId']; + const userId = this.object.model.getValue(RoomObjectVariable.SESSION_CURRENT_USER_ID); + + if(renterId) + { + if(parseInt(renterId) === userId) this.object.setState(2, 0); + else this.object.setState(1, 0); + } + else + { + this.object.setState(0, 0); + } + } + } + + public get widget(): string + { + return RoomWidgetEnum.RENTABLESPACE; + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundColorLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundColorLogic.ts new file mode 100644 index 0000000..7877388 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundColorLogic.ts @@ -0,0 +1,106 @@ +import { IRoomGeometry, MouseEventType, NumberDataType, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectHSLColorEnableEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic +{ + + private _roomColorUpdated: boolean; + + constructor() + { + super(); + + this._roomColorUpdated = false; + } + + public getEventTypes(): string[] + { + const types = [ + RoomObjectWidgetRequestEvent.BACKGROUND_COLOR, + RoomObjectHSLColorEnableEvent.ROOM_BACKGROUND_COLOR + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + protected onDispose(): void + { + if(this._roomColorUpdated) + { + if(this.eventDispatcher && this.object) + { + const realRoomObject = this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT); + + if(realRoomObject === 1) + { + this.eventDispatcher.dispatchEvent(new RoomObjectHSLColorEnableEvent(RoomObjectHSLColorEnableEvent.ROOM_BACKGROUND_COLOR, this.object, false, 0, 0, 0)); + } + } + + this._roomColorUpdated = false; + } + + super.onDispose(); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(message instanceof ObjectDataUpdateMessage) + { + message.data.writeRoomObjectModel(this.object.model); + + const realRoomObject = this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT); + + if(realRoomObject === 1) this.processColorUpdate(); + } + } + + private processColorUpdate(): void + { + if(!this.object || !this.object.model) return; + + const numberData = new NumberDataType(); + + numberData.initializeFromRoomObjectModel(this.object.model); + + const state = numberData.getValue(0); + const hue = numberData.getValue(1); + const saturation = numberData.getValue(2); + const lightness = numberData.getValue(3); + + if((state > -1) && (hue > -1) && (saturation > -1) && (lightness > -1)) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_ROOM_BACKGROUND_COLOR_HUE, hue); + this.object.model.setValue(RoomObjectVariable.FURNITURE_ROOM_BACKGROUND_COLOR_SATURATION, saturation); + this.object.model.setValue(RoomObjectVariable.FURNITURE_ROOM_BACKGROUND_COLOR_LIGHTNESS, lightness); + + this.object.setState(state, 0); + + if(this.eventDispatcher) + { + this.eventDispatcher.dispatchEvent(new RoomObjectHSLColorEnableEvent(RoomObjectHSLColorEnableEvent.ROOM_BACKGROUND_COLOR, this.object, (state === 1), hue, saturation, lightness)); + } + + this._roomColorUpdated = true; + } + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + if(!event || !geometry || !this.object) return; + + switch(event.type) + { + case MouseEventType.DOUBLE_CLICK: + (this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.BACKGROUND_COLOR, this.object))); + return; + } + + super.mouseEvent(event, geometry); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundLogic.ts new file mode 100644 index 0000000..d40a8c3 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRoomBackgroundLogic.ts @@ -0,0 +1,10 @@ +import { IRoomObjectModel } from '../../../../../api'; +import { FurnitureRoomBrandingLogic } from './FurnitureRoomBrandingLogic'; + +export class FurnitureRoomBackgroundLogic extends FurnitureRoomBrandingLogic +{ + protected getAdClickUrl(model: IRoomObjectModel): string + { + return null; + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRoomBillboardLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRoomBillboardLogic.ts new file mode 100644 index 0000000..176a127 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRoomBillboardLogic.ts @@ -0,0 +1,31 @@ +import { IRoomObjectModel, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectRoomAdEvent } from '../../../../../events'; +import { HabboWebTools } from '../../../../utils'; +import { FurnitureRoomBrandingLogic } from './FurnitureRoomBrandingLogic'; + +export class FurnitureRoomBillboardLogic extends FurnitureRoomBrandingLogic +{ + constructor() + { + super(); + + this._hasClickUrl = true; + } + + protected getAdClickUrl(model: IRoomObjectModel): string + { + return model.getValue(RoomObjectVariable.FURNITURE_BRANDING_URL); + } + + protected handleAdClick(objectId: number, objectType: string, clickUrl: string): void + { + if(clickUrl.indexOf('http') === 0) + { + HabboWebTools.openWebPage(clickUrl); + + return; + } + + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK, this.object, '', clickUrl)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRoomBrandingLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRoomBrandingLogic.ts new file mode 100644 index 0000000..ad0862d --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRoomBrandingLogic.ts @@ -0,0 +1,236 @@ +import { BaseTexture, Texture } from '@pixi/core'; +import { decompressFrames, parseGIF } from 'gifuct-js'; +import { GetAssetManager, IAssetData, IRoomGeometry, MapDataType, MouseEventType, RoomObjectVariable, RoomWidgetEnumItemExtradataParameter } from '../../../../../api'; +import { RoomObjectRoomAdEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { Nitro } from '../../../../Nitro'; +import { ObjectAdUpdateMessage, ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureRoomBrandingLogic extends FurnitureLogic +{ + public static STATE: string = 'state'; + public static IMAGEURL_KEY: string = 'imageUrl'; + public static CLICKURL_KEY: string = 'clickUrl'; + public static OFFSETX_KEY: string = 'offsetX'; + public static OFFSETY_KEY: string = 'offsetY'; + public static OFFSETZ_KEY: string = 'offsetZ'; + + protected _disableFurnitureSelection: boolean; + protected _hasClickUrl: boolean; + + constructor() + { + super(); + + this._disableFurnitureSelection = true; + this._hasClickUrl = false; + } + + public getEventTypes(): string[] + { + const types = [RoomObjectRoomAdEvent.ROOM_AD_LOAD_IMAGE]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + if(this._disableFurnitureSelection) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_SELECTION_DISABLED, 1); + } + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(message instanceof ObjectDataUpdateMessage) this.processAdDataUpdateMessage(message); + + if(message instanceof ObjectAdUpdateMessage) this.processAdUpdate(message); + } + + private processAdDataUpdateMessage(message: ObjectDataUpdateMessage): void + { + if(!message) return; + + const objectData = new MapDataType(); + + objectData.initializeFromRoomObjectModel(this.object.model); + + const state = parseInt(objectData.getValue(FurnitureRoomBrandingLogic.STATE)); + + if(!isNaN(state) && (this.object.getState(0) !== state)) this.object.setState(state, 0); + + const imageUrl = objectData.getValue(FurnitureRoomBrandingLogic.IMAGEURL_KEY); + const existingUrl = this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_URL); + + if(!existingUrl || (existingUrl !== imageUrl)) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_URL, imageUrl); + this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_STATUS, 0); + + this.downloadBackground(); + } + + const clickUrl = objectData.getValue(FurnitureRoomBrandingLogic.CLICKURL_KEY); + + if(clickUrl) + { + const existingUrl = this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_URL); + + if(!existingUrl || existingUrl !== clickUrl) + { + if(this.object.model) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_URL, clickUrl); + } + } + + const offsetX = parseInt(objectData.getValue(FurnitureRoomBrandingLogic.OFFSETX_KEY)); + const offsetY = parseInt(objectData.getValue(FurnitureRoomBrandingLogic.OFFSETY_KEY)); + const offsetZ = parseInt(objectData.getValue(FurnitureRoomBrandingLogic.OFFSETZ_KEY)); + + if(!isNaN(offsetX)) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_X, offsetX); + if(!isNaN(offsetY)) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_Y, offsetY); + if(!isNaN(offsetZ)) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_Z, offsetZ); + + let options = (((FurnitureRoomBrandingLogic.IMAGEURL_KEY + '=') + ((imageUrl !== null) ? imageUrl : '')) + '\t'); + + if(this._hasClickUrl) + { + options = (options + (((FurnitureRoomBrandingLogic.CLICKURL_KEY + '=') + ((clickUrl !== null) ? clickUrl : '')) + '\t')); + } + + options = (options + (((FurnitureRoomBrandingLogic.OFFSETX_KEY + '=') + offsetX) + '\t')); + options = (options + (((FurnitureRoomBrandingLogic.OFFSETY_KEY + '=') + offsetY) + '\t')); + options = (options + (((FurnitureRoomBrandingLogic.OFFSETZ_KEY + '=') + offsetZ) + '\t')); + + this.object.model.setValue(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, (RoomWidgetEnumItemExtradataParameter.BRANDING_OPTIONS + options)); + } + + private processAdUpdate(message: ObjectAdUpdateMessage): void + { + if(!message || !this.object) return; + + switch(message.type) + { + case ObjectAdUpdateMessage.IMAGE_LOADED: + this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_STATUS, 1); + break; + case ObjectAdUpdateMessage.IMAGE_LOADING_FAILED: + this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_STATUS, -1); + break; + } + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + if(!event || !geometry) return; + + if((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.DOUBLE_CLICK)) return; + + super.mouseEvent(event, geometry); + } + + private async downloadBackground(): Promise + { + const model = this.object && this.object.model; + + if(!model) return; + + const imageUrl = model.getValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_URL); + const imageStatus = model.getValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_STATUS); + + if(!imageUrl || (imageUrl === '') || (imageStatus === 1)) return; + + if(imageUrl.endsWith('.gif')) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_IS_ANIMATED, true); + + fetch(imageUrl) + .then(resp => resp.arrayBuffer()) + .then(buff => parseGIF(buff)) + .then(gif => + { + const width = gif.lsd.width; + const height = gif.lsd.height; + const wh = width * height; + const frames = decompressFrames(gif, false); + const textures = []; + const durations = []; + + let frame = new Uint8Array(wh * 4); + + for(let ind = 0; ind < frames.length; ind++) + { + if(ind > 0) frame = frame.slice(0); + + const pixels = frames[ind].pixels; + const colorTable = frames[ind].colorTable; + const trans = frames[ind].transparentIndex; + const dims = frames[ind].dims; + + for(let j = 0; j < dims.height; j++) + { + for(let i = 0; i < dims.width; i++) + { + const pixel = pixels[j * dims.width + i]; + const coord = (j + dims.top) * width + (i + dims.left); + + if(trans !== pixel) + { + const c = colorTable[pixel]; + + frame[4 * coord] = c[0]; + frame[4 * coord + 1] = c[1]; + frame[4 * coord + 2] = c[2]; + frame[4 * coord + 3] = 255; + } + } + } + + const baseTexture = BaseTexture.fromBuffer(frame, width, height); + + textures.push(new Texture(baseTexture)); + durations.push(frames[ind].delay); + } + + Nitro.instance.roomEngine.roomContentLoader.createGifCollection(imageUrl, textures, durations); + + this.processUpdateMessage(new ObjectAdUpdateMessage(ObjectAdUpdateMessage.IMAGE_LOADED)); + }) + .catch(error => + { + this.processUpdateMessage(new ObjectAdUpdateMessage(ObjectAdUpdateMessage.IMAGE_LOADING_FAILED)); + }); + } + else + { + const asset = GetAssetManager(); + + if(!asset) return; + + const texture = asset.getTexture(imageUrl); + + if(!texture) + { + const status = await asset.downloadAsset(imageUrl); + + if(!status) + { + this.processUpdateMessage(new ObjectAdUpdateMessage(ObjectAdUpdateMessage.IMAGE_LOADING_FAILED)); + } + else + { + this.processUpdateMessage(new ObjectAdUpdateMessage(ObjectAdUpdateMessage.IMAGE_LOADED)); + } + + return; + } + + this.processUpdateMessage(new ObjectAdUpdateMessage(ObjectAdUpdateMessage.IMAGE_LOADED)); + } + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRoomDimmerLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRoomDimmerLogic.ts new file mode 100644 index 0000000..de04b42 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureRoomDimmerLogic.ts @@ -0,0 +1,141 @@ +import { RoomObjectVariable } from '../../../../../api'; +import { RoomObjectDimmerStateUpdateEvent, RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureRoomDimmerLogic extends FurnitureLogic +{ + private _roomColorUpdated: boolean; + + constructor() + { + super(); + + this._roomColorUpdated = false; + } + + public getEventTypes(): string[] + { + const types = [ + RoomObjectWidgetRequestEvent.DIMMER, + RoomObjectWidgetRequestEvent.WIDGET_REMOVE_DIMMER, + RoomObjectDimmerStateUpdateEvent.DIMMER_STATE + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + protected onDispose(): void + { + if(this._roomColorUpdated) + { + if(this.eventDispatcher && this.object) + { + const realRoomObject = this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT); + + if(realRoomObject === 1) + { + this.eventDispatcher.dispatchEvent(new RoomObjectDimmerStateUpdateEvent(this.object, 0, 1, 1, 0xFFFFFF, 0xFF)); + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.WIDGET_REMOVE_DIMMER, this.object)); + } + + this._roomColorUpdated = false; + } + } + + super.onDispose(); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + if(message instanceof ObjectDataUpdateMessage) + { + if(message.data) + { + const extra = message.data.getLegacyString(); + + const realRoomObject = this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT); + + if(realRoomObject === 1) this.processDimmerData(extra); + + super.processUpdateMessage(new ObjectDataUpdateMessage(this.getStateFromDimmerData(extra), message.data)); + } + + return; + } + + super.processUpdateMessage(message); + } + + private getStateFromDimmerData(data: string): number + { + if(!data) return 0; + + const parts = data.split(','); + + if(parts.length >= 5) return (parseInt(parts[0]) - 1); + + return 0; + } + + private processDimmerData(data: string): void + { + if(!data) return; + + const parts = data.split(','); + + if(parts.length >= 5) + { + const state = this.getStateFromDimmerData(data); + const presetId = parseInt(parts[1]); + const effectId = parseInt(parts[2]); + const color = parts[3]; + + let colorCode = parseInt(color.substr(1), 16); + let brightness = parseInt(parts[4]); + + if(!state) + { + colorCode = 0xFFFFFF; + brightness = 0xFF; + } + + if(this.eventDispatcher && this.object) + { + this.eventDispatcher.dispatchEvent(new RoomObjectDimmerStateUpdateEvent(this.object, state, presetId, effectId, colorCode, brightness)); + + this._roomColorUpdated = true; + } + } + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.DIMMER, this.object)); + } + + public update(time: number): void + { + super.update(time); + + // if(this.object && this.object.model) + // { + // const realRoomObject = this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT); + + // if(realRoomObject === 1) + // { + // const data = this.object.model.getValue(RoomObjectVariable.FURNITURE_DATA); + + // if(data && data.length > 0) + // { + // this.object.model.setValue(RoomObjectVariable.FURNITURE_DATA, ''); + + // this.processDimmerData(data); + // } + // } + // } + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureScoreLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureScoreLogic.ts new file mode 100644 index 0000000..416b737 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureScoreLogic.ts @@ -0,0 +1,71 @@ +import { GetTickerTime } from '../../../../../pixi-proxy'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureScoreLogic extends FurnitureLogic +{ + private static UPDATE_INTERVAL: number = 50; + private static MAX_UPDATE_TIME: number = 3000; + + private _score: number; + private _scoreIncreaser: number; + private _scoreTimer: number; + + constructor() + { + super(); + + this._score = 0; + this._scoreIncreaser = 50; + this._scoreTimer = 0; + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + if(message instanceof ObjectDataUpdateMessage) return this.updateScore(message.state); + + super.processUpdateMessage(message); + } + + private updateScore(count: number): void + { + this._score = count; + + const currentScore = this.object.getState(0); + + if(this._score !== currentScore) + { + let difference = (this._score - currentScore); + + if(difference < 0) difference = -(difference); + + if((difference * FurnitureScoreLogic.UPDATE_INTERVAL) > FurnitureScoreLogic.MAX_UPDATE_TIME) this._scoreIncreaser = (FurnitureScoreLogic.MAX_UPDATE_TIME / difference); + else this._scoreIncreaser = FurnitureScoreLogic.UPDATE_INTERVAL; + + this._scoreTimer = GetTickerTime(); + } + } + + public update(time: number): void + { + super.update(time); + + const currentScore = this.object.getState(0); + + if((currentScore !== this._score) && (time >= (this._scoreTimer + this._scoreIncreaser))) + { + const _local_3 = (time - this._scoreTimer); + let _local_4 = (_local_3 / this._scoreIncreaser); + let _local_5 = 1; + + if(this._score < currentScore) _local_5 = -1; + + if(_local_4 > (_local_5 * (this._score - currentScore))) _local_4 = (_local_5 * (this._score - currentScore)); + + this.object.setState((currentScore + (_local_5 * _local_4)), 0); + + this._scoreTimer = (time - (_local_3 - (_local_4 * this._scoreIncreaser))); + } + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureSongDiskLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureSongDiskLogic.ts new file mode 100644 index 0000000..355c7dc --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureSongDiskLogic.ts @@ -0,0 +1,19 @@ +import { RoomObjectVariable, RoomWidgetEnumItemExtradataParameter } from '../../../../../api'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureSongDiskLogic extends FurnitureLogic +{ + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + { + const extras = this.object.model.getValue(RoomObjectVariable.FURNITURE_EXTRAS); + const diskId = parseInt(extras); + + this.object.model.setValue(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, (RoomWidgetEnumItemExtradataParameter.SONGDISK + diskId)); + } + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureSoundBlockLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureSoundBlockLogic.ts new file mode 100644 index 0000000..70d87b2 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureSoundBlockLogic.ts @@ -0,0 +1,120 @@ +import { IAssetData, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectSamplePlaybackEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureSoundBlockLogic extends FurnitureMultiStateLogic +{ + private static HIGHEST_SEMITONE: number = 12; + private static LOWEST_SEMITONE: number = -12; + private static STATE_UNINITIALIZED: number = -1; + + private _state: number = -1; + private _sampleId: number = -1; + private _noPitch: boolean = false; + private _lastLocZ: number = 0; + + public getEventTypes(): string[] + { + const types = [ + RoomObjectSamplePlaybackEvent.ROOM_OBJECT_INITIALIZED, + RoomObjectSamplePlaybackEvent.ROOM_OBJECT_DISPOSED, + RoomObjectSamplePlaybackEvent.PLAY_SAMPLE, + RoomObjectSamplePlaybackEvent.CHANGE_PITCH + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + if(asset.logic) + { + if(asset.logic.soundSample) + { + this._sampleId = asset.logic.soundSample.id; + this._noPitch = asset.logic.soundSample.noPitch; + } + } + + this.object.model.setValue(RoomObjectVariable.FURNITURE_SOUNDBLOCK_RELATIVE_ANIMATION_SPEED, 1); + } + + protected onDispose(): void + { + if(this._state !== FurnitureSoundBlockLogic.STATE_UNINITIALIZED) + { + this.eventDispatcher.dispatchEvent(new RoomObjectSamplePlaybackEvent(RoomObjectSamplePlaybackEvent.ROOM_OBJECT_DISPOSED, this.object, this._sampleId)); + } + + super.onDispose(); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(message instanceof ObjectDataUpdateMessage) this.updateSoundBlockMessage(message); + } + + private updateSoundBlockMessage(message: ObjectDataUpdateMessage): void + { + if(!message) return; + + const model = this.object && this.object.model; + const location = this.object && this.object.location; + + if(!model || !location) return; + + if(this._state === FurnitureSoundBlockLogic.STATE_UNINITIALIZED && model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + { + this._lastLocZ = location.z; + this.eventDispatcher.dispatchEvent(new RoomObjectSamplePlaybackEvent(RoomObjectSamplePlaybackEvent.ROOM_OBJECT_INITIALIZED, this.object, this._sampleId, this.getPitchForHeight(location.z))); + } + + if(this._state !== FurnitureSoundBlockLogic.STATE_UNINITIALIZED && model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1) + { + if(this._lastLocZ !== location.z) + { + this._lastLocZ = location.z; + this.eventDispatcher.dispatchEvent(new RoomObjectSamplePlaybackEvent(RoomObjectSamplePlaybackEvent.CHANGE_PITCH, this.object, this._sampleId, this.getPitchForHeight(location.z))); + } + + } + + if(this._state !== FurnitureSoundBlockLogic.STATE_UNINITIALIZED && message.state !== this._state) + { + this.playSoundAt(location.z); + } + + this._state = message.state; + } + + private playSoundAt(height: number): void + { + if(!this.object) return; + + const pitch: number = this.getPitchForHeight(height); + + this.object.model.setValue(RoomObjectVariable.FURNITURE_SOUNDBLOCK_RELATIVE_ANIMATION_SPEED, pitch); + + this.eventDispatcher.dispatchEvent(new RoomObjectSamplePlaybackEvent(RoomObjectSamplePlaybackEvent.PLAY_SAMPLE, this.object, this._sampleId, pitch)); + } + + private getPitchForHeight(height: number): number + { + if(this._noPitch) return 1; + + let heightScaled: number = (height * 2); + + if(heightScaled > FurnitureSoundBlockLogic.HIGHEST_SEMITONE) + { + heightScaled = Math.min(0, (FurnitureSoundBlockLogic.LOWEST_SEMITONE + ((heightScaled - FurnitureSoundBlockLogic.HIGHEST_SEMITONE) - 1))); + } + + return Math.pow(2, (heightScaled / 12)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureSoundMachineLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureSoundMachineLogic.ts new file mode 100644 index 0000000..fee543b --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureSoundMachineLogic.ts @@ -0,0 +1,89 @@ +import { RoomObjectVariable, RoomWidgetEnumItemExtradataParameter } from '../../../../../api'; +import { RoomObjectFurnitureActionEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureSoundMachineLogic extends FurnitureMultiStateLogic +{ + private _disposeEventsAllowed: boolean = false; + private _isInitialized: boolean = false; + private _currentState: number = -1; + + public getEventTypes(): string[] + { + const types = [ + RoomObjectFurnitureActionEvent.SOUND_MACHINE_START, + RoomObjectFurnitureActionEvent.SOUND_MACHINE_STOP, + RoomObjectFurnitureActionEvent.SOUND_MACHINE_DISPOSE, + RoomObjectFurnitureActionEvent.SOUND_MACHINE_INIT + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + protected onDispose(): void + { + this.requestDispose(); + + super.onDispose(); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return; + + if(!this._isInitialized) this.requestInit(); + + this.object.model.setValue(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, RoomWidgetEnumItemExtradataParameter.JUKEBOX); + + if(message instanceof ObjectDataUpdateMessage) + { + const state = this.object.getState(0); + + if(state !== this._currentState) + { + this._currentState = state; + + if(state === 1) this.requestPlayList(); + else if(state === 0) this.requestStopPlaying(); + } + } + } + + private requestInit(): void + { + if(!this.object || !this.eventDispatcher) return; + + this._disposeEventsAllowed = true; + + this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.SOUND_MACHINE_INIT, this.object)); + + this._isInitialized = true; + } + + private requestPlayList(): void + { + if(!this.object || !this.eventDispatcher) return; + + this._disposeEventsAllowed = true; + + this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.SOUND_MACHINE_START, this.object)); + } + + private requestStopPlaying(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.SOUND_MACHINE_STOP, this.object)); + } + + private requestDispose(): void + { + if(!this._disposeEventsAllowed || !this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.SOUND_MACHINE_DISPOSE, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureStickieLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureStickieLogic.ts new file mode 100644 index 0000000..b1194e1 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureStickieLogic.ts @@ -0,0 +1,61 @@ +import { IAssetData, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectFurnitureActionEvent, RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectItemDataUpdateMessage } from '../../../messages'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureStickieLogic extends FurnitureLogic +{ + private static STICKIE_COLORS: string[] = ['9CCEFF', 'FF9CFF', '9CFF9C', 'FFFF33']; + + public getEventTypes(): string[] + { + const types = [ + RoomObjectWidgetRequestEvent.STICKIE, + RoomObjectFurnitureActionEvent.STICKIE + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + this.updateColor(); + + if(this.object) this.object.model.setValue(RoomObjectVariable.FURNITURE_IS_STICKIE, ''); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(message instanceof ObjectItemDataUpdateMessage) + { + this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.STICKIE, this.object)); + } + + this.updateColor(); + } + + protected updateColor(): void + { + if(!this.object) return; + + const furnitureData = this.object.model.getValue(RoomObjectVariable.FURNITURE_DATA); + + let colorIndex = FurnitureStickieLogic.STICKIE_COLORS.indexOf(furnitureData); + + if(colorIndex < 0) colorIndex = 3; + + this.object.model.setValue(RoomObjectVariable.FURNITURE_COLOR, (colorIndex + 1)); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.STICKIE, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureTrophyLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureTrophyLogic.ts new file mode 100644 index 0000000..621f337 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureTrophyLogic.ts @@ -0,0 +1,19 @@ +import { RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureTrophyLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [RoomObjectWidgetRequestEvent.TROPHY]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.TROPHY, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureVoteCounterLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureVoteCounterLogic.ts new file mode 100644 index 0000000..2716346 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureVoteCounterLogic.ts @@ -0,0 +1,96 @@ +import { RoomObjectVariable, VoteDataType } from '../../../../../api'; +import { GetTickerTime } from '../../../../../pixi-proxy'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureVoteCounterLogic extends FurnitureMultiStateLogic +{ + private static UPDATE_INTERVAL: number = 33; + private static MAX_UPDATE_TIME: number = 1000; + + private _total: number; + private _lastUpdate: number; + private _interval: number; + + constructor() + { + super(); + + this._total = 0; + this._lastUpdate = 0; + this._interval = 33; + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(message instanceof ObjectDataUpdateMessage) + { + const stuffData = (message.data as VoteDataType); + + if(!stuffData) return; + + this.updateTotal(stuffData.result); + } + } + + private updateTotal(k: number): void + { + this._total = k; + + if(!this._lastUpdate) + { + this.object.model.setValue(RoomObjectVariable.FURNITURE_VOTE_COUNTER_COUNT, k); + + this._lastUpdate = GetTickerTime(); + + return; + } + + if(this._total !== this.currentTotal) + { + const difference = Math.abs((this._total - this.currentTotal)); + + if((difference * FurnitureVoteCounterLogic.UPDATE_INTERVAL) > FurnitureVoteCounterLogic.MAX_UPDATE_TIME) + { + this._interval = (FurnitureVoteCounterLogic.MAX_UPDATE_TIME / difference); + } + else + { + this._interval = FurnitureVoteCounterLogic.UPDATE_INTERVAL; + } + + this._lastUpdate = GetTickerTime(); + } + } + + public update(time: number): void + { + super.update(time); + + if(this.object) + { + if((this.currentTotal !== this._total) && (time >= (this._lastUpdate + this._interval))) + { + const _local_2 = (time - this._lastUpdate); + let _local_3 = (_local_2 / this._interval); + let _local_4 = 1; + + if(this._total < this.currentTotal) _local_4 = -1; + + if(_local_3 > (_local_4 * (this._total - this.currentTotal))) _local_3 = (_local_4 * (this._total - this.currentTotal)); + + this.object.model.setValue(RoomObjectVariable.FURNITURE_VOTE_COUNTER_COUNT, (this.currentTotal + (_local_4 * _local_3))); + + this._lastUpdate = (time - (_local_2 - (_local_3 * this._interval))); + } + } + } + + private get currentTotal(): number + { + return this.object.model.getValue(RoomObjectVariable.FURNITURE_VOTE_COUNTER_COUNT); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureVoteMajorityLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureVoteMajorityLogic.ts new file mode 100644 index 0000000..cd7bae5 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureVoteMajorityLogic.ts @@ -0,0 +1,21 @@ +import { RoomObjectVariable, VoteDataType } from '../../../../../api'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectDataUpdateMessage } from '../../../messages'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureVoteMajorityLogic extends FurnitureMultiStateLogic +{ + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(!this.object) return; + + if(message instanceof ObjectDataUpdateMessage) + { + const data = message.data; + + if(data instanceof VoteDataType) this.object.model.setValue(RoomObjectVariable.FURNITURE_VOTE_MAJORITY_RESULT, data.result); + } + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureWelcomeGiftLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureWelcomeGiftLogic.ts new file mode 100644 index 0000000..943e256 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureWelcomeGiftLogic.ts @@ -0,0 +1,18 @@ +import { IRoomGeometry, MouseEventType } from '../../../../../api'; +import { RoomObjectStateChangedEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureWelcomeGiftLogic extends FurnitureMultiStateLogic +{ + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + if(!event || !geometry) return; + + if(event.type === MouseEventType.DOUBLE_CLICK) + { + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object)); + } + + super.mouseEvent(event, geometry); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureWindowLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureWindowLogic.ts new file mode 100644 index 0000000..b4739b2 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureWindowLogic.ts @@ -0,0 +1,20 @@ +import { IAssetData, RoomObjectVariable } from '../../../../../api'; +import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; + +export class FurnitureWindowLogic extends FurnitureMultiStateLogic +{ + public initialize(asset: IAssetData): void + { + super.initialize(asset); + + let maskType = ''; + + if(asset.logic) + { + if(asset.logic.maskType && (asset.logic.maskType !== '') && (asset.logic.maskType.length > 0)) maskType = asset.logic.maskType; + } + + this.object.model.setValue(RoomObjectVariable.FURNITURE_USES_PLANE_MASK, 1); + this.object.model.setValue(RoomObjectVariable.FURNITURE_PLANE_MASK_TYPE, maskType); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureYoutubeLogic.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureYoutubeLogic.ts new file mode 100644 index 0000000..94fcd2d --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/FurnitureYoutubeLogic.ts @@ -0,0 +1,33 @@ +import { RoomObjectVariable } from '../../../../../api'; +import { RoomObjectDataRequestEvent, RoomObjectWidgetRequestEvent } from '../../../../../events'; +import { FurnitureLogic } from './FurnitureLogic'; + +export class FurnitureYoutubeLogic extends FurnitureLogic +{ + public getEventTypes(): string[] + { + const types = [ + RoomObjectWidgetRequestEvent.YOUTUBE, + RoomObjectDataRequestEvent.RODRE_URL_PREFIX + ]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public update(time: number): void + { + super.update(time); + + if(!this.object.model.getValue(RoomObjectVariable.SESSION_URL_PREFIX)) + { + this.eventDispatcher.dispatchEvent(new RoomObjectDataRequestEvent(RoomObjectDataRequestEvent.RODRE_URL_PREFIX, this.object)); + } + } + + public useObject(): void + { + if(!this.object || !this.eventDispatcher) return; + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.YOUTUBE, this.object)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/furniture/index.ts b/submodules/renderer/src/nitro/room/object/logic/furniture/index.ts new file mode 100644 index 0000000..d548e94 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/furniture/index.ts @@ -0,0 +1,62 @@ +export * from './FurnitureAchievementResolutionLogic'; +export * from './FurnitureBadgeDisplayLogic'; +export * from './FurnitureChangeStateWhenStepOnLogic'; +export * from './FurnitureClothingChangeLogic'; +export * from './FurnitureCounterClockLogic'; +export * from './FurnitureCrackableLogic'; +export * from './FurnitureCraftingGizmoLogic'; +export * from './FurnitureCreditLogic'; +export * from './FurnitureCuckooClockLogic'; +export * from './FurnitureCustomStackHeightLogic'; +export * from './FurnitureDiceLogic'; +export * from './FurnitureEcotronBoxLogic'; +export * from './FurnitureEditableInternalLinkLogic'; +export * from './FurnitureEditableRoomLinkLogic'; +export * from './FurnitureEffectBoxLogic'; +export * from './FurnitureExternalImageLogic'; +export * from './FurnitureFireworksLogic'; +export * from './FurnitureFloorHoleLogic'; +export * from './FurnitureFriendFurniLogic'; +export * from './FurnitureGroupForumTerminalLogic'; +export * from './FurnitureGuildCustomizedLogic'; +export * from './FurnitureHabboWheelLogic'; +export * from './FurnitureHighScoreLogic'; +export * from './FurnitureHockeyScoreLogic'; +export * from './FurnitureHweenLovelockLogic'; +export * from './FurnitureIceStormLogic'; +export * from './FurnitureInternalLinkLogic'; +export * from './FurnitureJukeboxLogic'; +export * from './FurnitureLogic'; +export * from './FurnitureLoveLockLogic'; +export * from './FurnitureMannequinLogic'; +export * from './FurnitureMonsterplantSeedLogic'; +export * from './FurnitureMultiHeightLogic'; +export * from './FurnitureMultiStateLogic'; +export * from './FurnitureMysteryBoxLogic'; +export * from './FurnitureMysteryTrophyLogic'; +export * from './FurnitureOneWayDoorLogic'; +export * from './FurniturePetCustomizationLogic'; +export * from './FurniturePlaceholderLogic'; +export * from './FurniturePlanetSystemLogic'; +export * from './FurniturePresentLogic'; +export * from './FurniturePurchaseableClothingLogic'; +export * from './FurniturePushableLogic'; +export * from './FurnitureRandomStateLogic'; +export * from './FurnitureRandomTeleportLogic'; +export * from './FurnitureRentableSpaceLogic'; +export * from './FurnitureRoomBackgroundColorLogic'; +export * from './FurnitureRoomBackgroundLogic'; +export * from './FurnitureRoomBillboardLogic'; +export * from './FurnitureRoomBrandingLogic'; +export * from './FurnitureRoomDimmerLogic'; +export * from './FurnitureScoreLogic'; +export * from './FurnitureSongDiskLogic'; +export * from './FurnitureSoundBlockLogic'; +export * from './FurnitureSoundMachineLogic'; +export * from './FurnitureStickieLogic'; +export * from './FurnitureTrophyLogic'; +export * from './FurnitureVoteCounterLogic'; +export * from './FurnitureVoteMajorityLogic'; +export * from './FurnitureWelcomeGiftLogic'; +export * from './FurnitureWindowLogic'; +export * from './FurnitureYoutubeLogic'; diff --git a/submodules/renderer/src/nitro/room/object/logic/index.ts b/submodules/renderer/src/nitro/room/object/logic/index.ts new file mode 100644 index 0000000..6c1891a --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/index.ts @@ -0,0 +1,5 @@ +export * from './avatar'; +export * from './furniture'; +export * from './MovingObjectLogic'; +export * from './pet'; +export * from './room'; diff --git a/submodules/renderer/src/nitro/room/object/logic/pet/PetLogic.ts b/submodules/renderer/src/nitro/room/object/logic/pet/PetLogic.ts new file mode 100644 index 0000000..1dc732f --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/pet/PetLogic.ts @@ -0,0 +1,239 @@ +import { IAssetData, IRoomGeometry, IRoomObjectModel, MouseEventType, PetType, RoomObjectVariable, Vector3d } from '../../../../../api'; +import { RoomObjectMouseEvent, RoomObjectMoveEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { RoomObjectUpdateMessage } from '../../../../../room'; +import { PetFigureData } from '../../../../avatar'; +import { ObjectAvatarChatUpdateMessage, ObjectAvatarExperienceUpdateMessage, ObjectAvatarFigureUpdateMessage, ObjectAvatarPetGestureUpdateMessage, ObjectAvatarPostureUpdateMessage, ObjectAvatarSelectedMessage, ObjectAvatarSleepUpdateMessage, ObjectAvatarUpdateMessage } from '../../../messages'; +import { MovingObjectLogic } from '../MovingObjectLogic'; + +export class PetLogic extends MovingObjectLogic +{ + private _selected: boolean; + private _reportedLocation: Vector3d; + private _postureIndex: number; + private _gestureIndex: number; + private _headDirectionDelta: number; + private _directions: number[]; + + private _talkingEndTimestamp: number; + private _gestureEndTimestamp: number; + private _expressionEndTimestamp: number; + + constructor() + { + super(); + + this._selected = false; + this._reportedLocation = null; + this._postureIndex = 0; + this._gestureIndex = 0; + this._headDirectionDelta = 0; + this._directions = []; + + this._talkingEndTimestamp = 0; + this._gestureEndTimestamp = 0; + this._expressionEndTimestamp = 0; + } + + public getEventTypes(): string[] + { + const types = [RoomObjectMouseEvent.CLICK, RoomObjectMoveEvent.POSITION_CHANGED]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public initialize(asset: IAssetData): void + { + if(!asset) return; + + const model = this.object && this.object.model; + + if(!model) return; + + if(asset.logic) + { + if(asset.logic.model) + { + const directions = asset.logic.model.directions; + + if(directions && directions.length) + { + for(const direction of directions) this._directions.push(direction); + + this._directions.sort(); + } + } + } + + model.setValue(RoomObjectVariable.PET_ALLOWED_DIRECTIONS, this._directions); + } + + public dispose(): void + { + if(this._selected && this.object) + { + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.OBJECT_REMOVED, this.object)); + } + + this._directions = null; + this._reportedLocation = null; + } + + public update(totalTimeRunning: number): void + { + super.update(totalTimeRunning); + + if(this._selected && this.object) + { + if(this.eventDispatcher) + { + const location = this.object.getLocation(); + + if(((!this._reportedLocation || (this._reportedLocation.x !== location.x)) || (this._reportedLocation.y !== location.y)) || (this._reportedLocation.z !== location.z)) + { + if(!this._reportedLocation) this._reportedLocation = new Vector3d(); + + this._reportedLocation.assign(location); + + this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.POSITION_CHANGED, this.object)); + } + } + } + + if(this.object && this.object.model) this.updateModel(totalTimeRunning, this.object.model); + } + + private updateModel(time: number, model: IRoomObjectModel): void + { + if((this._gestureEndTimestamp > 0) && (time > this._gestureEndTimestamp)) + { + model.setValue(RoomObjectVariable.FIGURE_GESTURE, null); + + this._gestureEndTimestamp = 0; + } + + if(this._talkingEndTimestamp > 0) + { + if(time > this._talkingEndTimestamp) + { + model.setValue(RoomObjectVariable.FIGURE_TALK, 0); + + this._talkingEndTimestamp = 0; + } + } + + if((this._expressionEndTimestamp > 0) && (time > this._expressionEndTimestamp)) + { + model.setValue(RoomObjectVariable.FIGURE_EXPRESSION, 0); + + this._expressionEndTimestamp = 0; + } + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + if(!message || !this.object) return; + + super.processUpdateMessage(message); + + const model = this.object && this.object.model; + + if(!model) return; + + if(message instanceof ObjectAvatarUpdateMessage) + { + model.setValue(RoomObjectVariable.HEAD_DIRECTION, message.headDirection); + + return; + } + + if(message instanceof ObjectAvatarFigureUpdateMessage) + { + const petFigureData = new PetFigureData(message.figure); + + model.setValue(RoomObjectVariable.FIGURE, message.figure); + model.setValue(RoomObjectVariable.RACE, message.subType); + model.setValue(RoomObjectVariable.PET_PALETTE_INDEX, petFigureData.paletteId); + model.setValue(RoomObjectVariable.PET_COLOR, petFigureData.color); + model.setValue(RoomObjectVariable.PET_TYPE, petFigureData.typeId); + model.setValue(RoomObjectVariable.PET_CUSTOM_LAYER_IDS, petFigureData.customLayerIds); + model.setValue(RoomObjectVariable.PET_CUSTOM_PARTS_IDS, petFigureData.customPartIds); + model.setValue(RoomObjectVariable.PET_CUSTOM_PALETTE_IDS, petFigureData.customPaletteIds); + model.setValue(RoomObjectVariable.PET_IS_RIDING, (message.isRiding ? 1 : 0)); + + return; + } + + if(message instanceof ObjectAvatarPostureUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_POSTURE, message.postureType); + + return; + } + + if(message instanceof ObjectAvatarChatUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_TALK, 1); + + this._talkingEndTimestamp = this.time + (message.numberOfWords * 1000); + + return; + } + + if(message instanceof ObjectAvatarSleepUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_SLEEP, message.isSleeping ? 1 : 0); + + return; + } + + if(message instanceof ObjectAvatarPetGestureUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_GESTURE, message.gesture); + + this._gestureEndTimestamp = this.time + 3000; + + return; + } + + if(message instanceof ObjectAvatarSelectedMessage) + { + this._selected = message.selected; + this._reportedLocation = null; + + return; + } + + if(message instanceof ObjectAvatarExperienceUpdateMessage) + { + model.setValue(RoomObjectVariable.FIGURE_EXPERIENCE_TIMESTAMP, this.time); + model.setValue(RoomObjectVariable.FIGURE_GAINED_EXPERIENCE, message.gainedExperience); + + return; + } + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + let eventType: string = null; + + switch(event.type) + { + case MouseEventType.MOUSE_CLICK: + eventType = RoomObjectMouseEvent.CLICK; + break; + case MouseEventType.DOUBLE_CLICK: + break; + case MouseEventType.MOUSE_DOWN: { + const petType = this.object.model.getValue(RoomObjectVariable.PET_TYPE); + + if(petType === PetType.MONSTERPLANT) + { + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_DOWN, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown)); + } + break; + } + } + + if(eventType && this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(eventType, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown)); + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/pet/index.ts b/submodules/renderer/src/nitro/room/object/logic/pet/index.ts new file mode 100644 index 0000000..987a9cb --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/pet/index.ts @@ -0,0 +1 @@ +export * from './PetLogic'; diff --git a/submodules/renderer/src/nitro/room/object/logic/room/RoomLogic.ts b/submodules/renderer/src/nitro/room/object/logic/room/RoomLogic.ts new file mode 100644 index 0000000..c63a953 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/room/RoomLogic.ts @@ -0,0 +1,451 @@ +import { Point } from '@pixi/math'; +import { IRoomGeometry, IRoomObjectModel, MouseEventType, NitroConfiguration, RoomObjectVariable, Vector3d } from '../../../../../api'; +import { RoomObjectEvent, RoomObjectMouseEvent, RoomObjectTileMouseEvent, RoomObjectWallMouseEvent, RoomSpriteMouseEvent } from '../../../../../events'; +import { ColorConverter, RoomObjectLogicBase, RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectRoomColorUpdateMessage, ObjectRoomFloorHoleUpdateMessage, ObjectRoomMapUpdateMessage, ObjectRoomMaskUpdateMessage, ObjectRoomPlanePropertyUpdateMessage, ObjectRoomPlaneVisibilityUpdateMessage, ObjectRoomUpdateMessage } from '../../../messages'; +import { RoomMapData } from '../../RoomMapData'; +import { RoomPlaneBitmapMaskData } from '../../RoomPlaneBitmapMaskData'; +import { RoomPlaneBitmapMaskParser } from '../../RoomPlaneBitmapMaskParser'; +import { RoomPlaneData } from '../../RoomPlaneData'; +import { RoomPlaneParser } from '../../RoomPlaneParser'; + +export class RoomLogic extends RoomObjectLogicBase +{ + private _planeParser: RoomPlaneParser; + private _planeBitmapMaskParser: RoomPlaneBitmapMaskParser; + private _color: number; + private _light: number; + private _originalColor: number; + private _originalLight: number; + private _targetColor: number; + private _targetLight: number; + private _colorChangedTime: number; + private _colorTransitionLength: number; + private _lastHoleUpdate: number; + private _needsMapUpdate: boolean; + private _skipColorTransition: boolean; + + constructor() + { + super(); + + this._planeParser = new RoomPlaneParser(); + this._planeBitmapMaskParser = new RoomPlaneBitmapMaskParser(); + this._color = 0xFFFFFF; + this._light = 0xFF; + this._originalColor = 0xFFFFFF; + this._originalLight = 0xFF; + this._targetColor = 0xFFFFFF; + this._targetLight = 0xFF; + this._colorChangedTime = 0; + this._colorTransitionLength = 1500; + this._lastHoleUpdate = 0; + this._needsMapUpdate = false; + this._skipColorTransition = false; + } + + public getEventTypes(): string[] + { + const types = [RoomObjectMouseEvent.MOUSE_MOVE, RoomObjectMouseEvent.CLICK]; + + return this.mergeTypes(super.getEventTypes(), types); + } + + public dispose(): void + { + super.dispose(); + + if(this._planeParser) + { + this._planeParser.dispose(); + + this._planeParser = null; + } + + if(this._planeBitmapMaskParser) + { + this._planeBitmapMaskParser.dispose(); + + this._planeBitmapMaskParser = null; + } + } + + public initialize(roomMap: RoomMapData): void + { + if(!roomMap || !this.object) return; + + if(!(roomMap instanceof RoomMapData)) return; + + if(!this._planeParser.initializeFromMapData(roomMap)) return; + + this.object.model.setValue(RoomObjectVariable.ROOM_MAP_DATA, roomMap); + this.object.model.setValue(RoomObjectVariable.ROOM_BACKGROUND_COLOR, 0xFFFFFF); + this.object.model.setValue(RoomObjectVariable.ROOM_FLOOR_VISIBILITY, 1); + this.object.model.setValue(RoomObjectVariable.ROOM_WALL_VISIBILITY, 1); + this.object.model.setValue(RoomObjectVariable.ROOM_LANDSCAPE_VISIBILITY, 1); + + this._skipColorTransition = (NitroConfiguration.getValue('room.color.skip.transition') === true); + } + + public update(time: number): void + { + super.update(time); + + this.updateBackgroundColor(time); + + if(this._needsMapUpdate) + { + if(this._lastHoleUpdate && (time - this._lastHoleUpdate) < 5) return; + + const model = this.object && this.object.model; + + if(model) + { + const mapData = this._planeParser.getMapData(); + + model.setValue(RoomObjectVariable.ROOM_MAP_DATA, mapData); + model.setValue(RoomObjectVariable.ROOM_FLOOR_HOLE_UPDATE_TIME, time); + + this._planeParser.initializeFromMapData(mapData); + } + + this._lastHoleUpdate = 0; + this._needsMapUpdate = false; + } + + } + + private updateBackgroundColor(k: number): void + { + if(!this.object || !this._colorChangedTime) return; + + let color = this._color; + let newColor = this._light; + + if((k - this._colorChangedTime) >= this._colorTransitionLength) + { + color = this._targetColor; + newColor = this._targetLight; + + this._colorChangedTime = 0; + } + else + { + let _local_7 = ((this._originalColor >> 16) & 0xFF); + let _local_8 = ((this._originalColor >> 8) & 0xFF); + let _local_9 = (this._originalColor & 0xFF); + + const _local_10 = ((this._targetColor >> 16) & 0xFF); + const _local_11 = ((this._targetColor >> 8) & 0xFF); + const _local_12 = (this._targetColor & 0xFF); + const _local_13 = ((k - this._colorChangedTime) / this._colorTransitionLength); + + _local_7 = (_local_7 + ((_local_10 - _local_7) * _local_13)); + _local_8 = (_local_8 + ((_local_11 - _local_8) * _local_13)); + _local_9 = (_local_9 + ((_local_12 - _local_9) * _local_13)); + + color = (((_local_7 << 16) + (_local_8 << 8)) + _local_9); + newColor = (this._originalLight + ((this._targetLight - this._originalLight) * _local_13)); + + this._color = color; + this._light = newColor; + } + + let _local_5 = ColorConverter.rgbToHSL(color); + + _local_5 = ((_local_5 & 0xFFFF00) + newColor); + color = ColorConverter.hslToRGB(_local_5); + + if(this.object.model) this.object.model.setValue(RoomObjectVariable.ROOM_BACKGROUND_COLOR, color); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + if(!message || !this.object) return; + + const model = this.object.model; + + if(!model) return; + + if(message instanceof ObjectRoomUpdateMessage) + { + this.onObjectRoomUpdateMessage(message, model); + + return; + } + + if(message instanceof ObjectRoomMaskUpdateMessage) + { + this.onObjectRoomMaskUpdateMessage(message, model); + + return; + } + + if(message instanceof ObjectRoomPlaneVisibilityUpdateMessage) + { + this.onObjectRoomPlaneVisibilityUpdateMessage(message, model); + + return; + } + + if(message instanceof ObjectRoomPlanePropertyUpdateMessage) + { + this.onObjectRoomPlanePropertyUpdateMessage(message, model); + + return; + } + + if(message instanceof ObjectRoomFloorHoleUpdateMessage) + { + this.onObjectRoomFloorHoleUpdateMessage(message, model); + + return; + } + + if(message instanceof ObjectRoomColorUpdateMessage) + { + this.onObjectRoomColorUpdateMessage(message, model); + + return; + } + + if(message instanceof ObjectRoomMapUpdateMessage) + { + this.onObjectRoomMapUpdateMessage(message); + } + } + + private onObjectRoomUpdateMessage(message: ObjectRoomUpdateMessage, model: IRoomObjectModel): void + { + switch(message.type) + { + case ObjectRoomUpdateMessage.ROOM_FLOOR_UPDATE: + model.setValue(RoomObjectVariable.ROOM_FLOOR_TYPE, message.value); + return; + case ObjectRoomUpdateMessage.ROOM_WALL_UPDATE: + model.setValue(RoomObjectVariable.ROOM_WALL_TYPE, message.value); + return; + case ObjectRoomUpdateMessage.ROOM_LANDSCAPE_UPDATE: + model.setValue(RoomObjectVariable.ROOM_LANDSCAPE_TYPE, message.value); + return; + } + } + + private onObjectRoomMaskUpdateMessage(message: ObjectRoomMaskUpdateMessage, _arg_2: IRoomObjectModel): void + { + let maskType: string = null; + let update = false; + + switch(message.type) + { + case ObjectRoomMaskUpdateMessage.ADD_MASK: + maskType = RoomPlaneBitmapMaskData.WINDOW; + + if(message.maskCategory === ObjectRoomMaskUpdateMessage.HOLE) maskType = RoomPlaneBitmapMaskData.HOLE; + + this._planeBitmapMaskParser.addMask(message.maskId, message.maskType, message.maskLocation, maskType); + + update = true; + break; + case ObjectRoomMaskUpdateMessage.REMOVE_MASK: + update = this._planeBitmapMaskParser.removeMask(message.maskId); + break; + + } + + if(update) _arg_2.setValue(RoomObjectVariable.ROOM_PLANE_MASK_XML, this._planeBitmapMaskParser.getXML()); + } + + private onObjectRoomPlaneVisibilityUpdateMessage(message: ObjectRoomPlaneVisibilityUpdateMessage, model: IRoomObjectModel): void + { + let visible = 0; + + if(message.visible) visible = 1; + + switch(message.type) + { + case ObjectRoomPlaneVisibilityUpdateMessage.FLOOR_VISIBILITY: + model.setValue(RoomObjectVariable.ROOM_FLOOR_VISIBILITY, visible); + return; + case ObjectRoomPlaneVisibilityUpdateMessage.WALL_VISIBILITY: + model.setValue(RoomObjectVariable.ROOM_WALL_VISIBILITY, visible); + model.setValue(RoomObjectVariable.ROOM_LANDSCAPE_VISIBILITY, visible); + return; + } + } + + private onObjectRoomPlanePropertyUpdateMessage(message: ObjectRoomPlanePropertyUpdateMessage, model: IRoomObjectModel): void + { + switch(message.type) + { + case ObjectRoomPlanePropertyUpdateMessage.FLOOR_THICKNESS: + model.setValue(RoomObjectVariable.ROOM_FLOOR_THICKNESS, message.value); + return; + case ObjectRoomPlanePropertyUpdateMessage.WALL_THICKNESS: + model.setValue(RoomObjectVariable.ROOM_WALL_THICKNESS, message.value); + return; + } + } + + private onObjectRoomFloorHoleUpdateMessage(message: ObjectRoomFloorHoleUpdateMessage, model: IRoomObjectModel): void + { + switch(message.type) + { + case ObjectRoomFloorHoleUpdateMessage.ADD: + this._planeParser.addFloorHole(message.id, message.x, message.y, message.width, message.height); + this._needsMapUpdate = true; + return; + case ObjectRoomFloorHoleUpdateMessage.REMOVE: + this._planeParser.removeFloorHole(message.id); + this._needsMapUpdate = true; + return; + } + + this._lastHoleUpdate = this.time; + } + + private onObjectRoomColorUpdateMessage(message: ObjectRoomColorUpdateMessage, model: IRoomObjectModel): void + { + if(!message || !model) return; + + this._originalColor = this._color; + this._originalLight = this._light; + this._targetColor = message.color; + this._targetLight = message.light; + this._colorChangedTime = this.time; + + if(this._skipColorTransition) + this._colorTransitionLength = 0; + else + this._colorTransitionLength = 1500; + + model.setValue(RoomObjectVariable.ROOM_COLORIZE_BG_ONLY, message.backgroundOnly); + } + + private onObjectRoomMapUpdateMessage(message: ObjectRoomMapUpdateMessage): void + { + if(!message || !message.mapData) return; + + this.object.model.setValue(RoomObjectVariable.ROOM_MAP_DATA, message.mapData); + this.object.model.setValue(RoomObjectVariable.ROOM_FLOOR_HOLE_UPDATE_TIME, this.time); + + this._planeParser.initializeFromMapData(message.mapData); + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + if(!event || !geometry || !this.object || !this.object.model) return; + + const tag = event.spriteTag; + + let planeId = 0; + + if(tag && (tag.indexOf('@') >= 0)) + { + planeId = parseInt(tag.substr(tag.indexOf('@') + 1)); + } + + if((planeId < 1) || (planeId > this._planeParser.planeCount)) + { + if(event.type === MouseEventType.ROLL_OUT) + { + this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, 0); + } + + return; + } + + planeId--; + + let planePosition: Point = null; + + const planeLocation = this._planeParser.getPlaneLocation(planeId); + const planeLeftSide = this._planeParser.getPlaneLeftSide(planeId); + const planeRightSide = this._planeParser.getPlaneRightSide(planeId); + const planeNormalDirection = this._planeParser.getPlaneNormalDirection(planeId); + const planeType = this._planeParser.getPlaneType(planeId); + + if(((((planeLocation == null) || (planeLeftSide == null)) || (planeRightSide == null)) || (planeNormalDirection == null))) return; + + const leftSideLength = planeLeftSide.length; + const rightSideLength = planeRightSide.length; + + if(((leftSideLength == 0) || (rightSideLength == 0))) return; + + const screenX = event.screenX; + const screenY = event.screenY; + const screenPoint = new Point(screenX, screenY); + + planePosition = geometry.getPlanePosition(screenPoint, planeLocation, planeLeftSide, planeRightSide); + + if(!planePosition) + { + this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, 0); + + return; + } + + const _local_18 = Vector3d.product(planeLeftSide, (planePosition.x / leftSideLength)); + + _local_18.add(Vector3d.product(planeRightSide, (planePosition.y / rightSideLength))); + _local_18.add(planeLocation); + + const tileX = _local_18.x; + const tileY = _local_18.y; + const tileZ = _local_18.z; + + if(((((planePosition.x >= 0) && (planePosition.x < leftSideLength)) && (planePosition.y >= 0)) && (planePosition.y < rightSideLength))) + { + this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_X, tileX); + this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Y, tileY); + this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Z, tileZ); + this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, (planeId + 1)); + } + else + { + this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, 0); + + return; + } + + let eventType: string = null; + + if((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.ROLL_OVER)) eventType = RoomObjectMouseEvent.MOUSE_MOVE; + else if((event.type === MouseEventType.MOUSE_CLICK)) eventType = RoomObjectMouseEvent.CLICK; + + switch(event.type) + { + case MouseEventType.MOUSE_MOVE: + case MouseEventType.ROLL_OVER: + case MouseEventType.MOUSE_CLICK: { + let newEvent: RoomObjectEvent = null; + + if(planeType === RoomPlaneData.PLANE_FLOOR) + { + newEvent = new RoomObjectTileMouseEvent(eventType, this.object, event.eventId, tileX, tileY, tileZ, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); + } + + else if((planeType === RoomPlaneData.PLANE_WALL) || (planeType === RoomPlaneData.PLANE_LANDSCAPE)) + { + let direction = 90; + + if(planeNormalDirection) + { + direction = (planeNormalDirection.x + 90); + + if(direction > 360) direction -= 360; + } + + const _local_27 = ((planeLeftSide.length * planePosition.x) / leftSideLength); + const _local_28 = ((planeRightSide.length * planePosition.y) / rightSideLength); + + newEvent = new RoomObjectWallMouseEvent(eventType, this.object, event.eventId, planeLocation, planeLeftSide, planeRightSide, _local_27, _local_28, direction, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); + } + + if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(newEvent); + + return; + } + } + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/room/SelectionArrowLogic.ts b/submodules/renderer/src/nitro/room/object/logic/room/SelectionArrowLogic.ts new file mode 100644 index 0000000..515f4ba --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/room/SelectionArrowLogic.ts @@ -0,0 +1,35 @@ +import { IAssetData, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectLogicBase, RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectVisibilityUpdateMessage } from '../../../messages'; + +export class SelectionArrowLogic extends RoomObjectLogicBase +{ + public initialize(data: IAssetData): void + { + if(!this.object) return; + + this.object.model.setValue(RoomObjectVariable.FURNITURE_ALPHA_MULTIPLIER, 1); + + this.object.setState(1, 0); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + super.processUpdateMessage(message); + + if(!(message instanceof ObjectVisibilityUpdateMessage)) return; + + if(this.object) + { + switch(message.type) + { + case ObjectVisibilityUpdateMessage.ENABLED: + this.object.setState(0, 0); + return; + case ObjectVisibilityUpdateMessage.DISABLED: + this.object.setState(1, 0); + return; + } + } + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/room/TileCursorLogic.ts b/submodules/renderer/src/nitro/room/object/logic/room/TileCursorLogic.ts new file mode 100644 index 0000000..c850c8c --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/room/TileCursorLogic.ts @@ -0,0 +1,64 @@ +import { IAssetData, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectLogicBase, RoomObjectUpdateMessage } from '../../../../../room'; +import { ObjectTileCursorUpdateMessage } from '../../../messages'; + +export class TileCursorLogic extends RoomObjectLogicBase +{ + private static CURSOR_VISIBLE_STATE: number = 0; + private static CURSOR_HIDDEN_STATE: number = 1; + private static CURSOR_HEIGHT_STATE: number = 6; + + private _lastEventId: string; + private _isHidden: boolean; + + constructor() + { + super(); + + this._lastEventId = null; + this._isHidden = false; + } + + public initialize(data: IAssetData): void + { + if(!this.object) return; + + this.object.model.setValue(RoomObjectVariable.FURNITURE_ALPHA_MULTIPLIER, 1); + + this.object.setState(TileCursorLogic.CURSOR_HIDDEN_STATE, 0); + } + + public processUpdateMessage(message: RoomObjectUpdateMessage): void + { + if(!(message instanceof ObjectTileCursorUpdateMessage)) return; + + if(this._lastEventId && (this._lastEventId === message.sourceEventId)) return; + + if(message.toggleVisibility) this._isHidden = !this._isHidden; + + super.processUpdateMessage(message); + + if(this.object) + { + if(this._isHidden) + { + this.object.setState(TileCursorLogic.CURSOR_HIDDEN_STATE, 0); + } + else + { + if(!message.visible) + { + this.object.setState(TileCursorLogic.CURSOR_HIDDEN_STATE, 0); + } + else + { + this.object.model.setValue(RoomObjectVariable.TILE_CURSOR_HEIGHT, message.height); + + this.object.setState((message.height > 0.8) ? TileCursorLogic.CURSOR_HEIGHT_STATE : TileCursorLogic.CURSOR_VISIBLE_STATE); + } + } + } + + this._lastEventId = message.sourceEventId; + } +} diff --git a/submodules/renderer/src/nitro/room/object/logic/room/index.ts b/submodules/renderer/src/nitro/room/object/logic/room/index.ts new file mode 100644 index 0000000..6860062 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/logic/room/index.ts @@ -0,0 +1,3 @@ +export * from './RoomLogic'; +export * from './SelectionArrowLogic'; +export * from './TileCursorLogic'; diff --git a/submodules/renderer/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts new file mode 100644 index 0000000..83f1712 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts @@ -0,0 +1,1135 @@ +import { BLEND_MODES } from '@pixi/constants'; +import { Resource, Texture } from '@pixi/core'; +import { AdvancedMap, AlphaTolerance, AvatarAction, AvatarGuideStatus, AvatarSetType, IAdvancedMap, IAvatarEffectListener, IAvatarImage, IAvatarImageListener, IGraphicAsset, IObjectVisualizationData, IRoomGeometry, IRoomObject, IRoomObjectModel, RoomObjectSpriteType, RoomObjectVariable } from '../../../../../api'; +import { RoomObjectSpriteVisualization } from '../../../../../room'; +import { ExpressionAdditionFactory, FloatingIdleZAddition, GameClickTargetAddition, GuideStatusBubbleAddition, IAvatarAddition, MutedBubbleAddition, NumberBubbleAddition, TypingBubbleAddition } from './additions'; +import { AvatarVisualizationData } from './AvatarVisualizationData'; + +export class AvatarVisualization extends RoomObjectSpriteVisualization implements IAvatarImageListener, IAvatarEffectListener +{ + private static AVATAR: string = 'avatar'; + private static FLOATING_IDLE_Z_ID: number = 1; + private static TYPING_BUBBLE_ID: number = 2; + private static EXPRESSION_ID: number = 3; + private static NUMBER_BUBBLE_ID: number = 4; + private static GAME_CLICK_TARGET_ID: number = 5; + private static MUTED_BUBBLE_ID: number = 6; + private static GUIDE_BUBBLE_ID: number = 7; + private static OWN_USER_ID: number = 4; + private static UPDATE_TIME_INCREASER: number = 41; + private static AVATAR_LAYER_ID: number = 0; + private static SHADOW_LAYER_ID: number = 1; + private static SNOWBOARDING_EFFECT: number = 97; + private static INITIAL_RESERVED_SPRITES: number = 2; + private static ANIMATION_FRAME_UPDATE_INTERVAL: number = 2; + private static DEFAULT_CANVAS_OFFSETS: number[] = [0, 0, 0]; + private static MAX_EFFECT_CACHE: number = 2; + private static SPRITE_INDEX_AVATAR: number = 0; + private static BASE_Y_SCALE: number = 1000; + private static AVATAR_SPRITE_DEFAULT_DEPTH: number = -0.01; + private static AVATAR_OWN_DEPTH_ADJUST: number = 0.001; + private static AVATAR_SPRITE_LAYING_DEPTH: number = -0.409; + + protected _data: AvatarVisualizationData; + + private _avatarImage: IAvatarImage; + private _cachedAvatars: IAdvancedMap; + private _cachedAvatarEffects: IAdvancedMap; + private _shadow: IGraphicAsset; + private _lastUpdate: number; + private _disposed: boolean; + + private _figure: string; + private _gender: string; + private _direction: number; + private _headDirection: number; + private _posture: string; + private _postureParameter: string; + private _canStandUp: boolean; + private _postureOffset: number; + private _verticalOffset: number; + private _angle: number; + private _headAngle: number; + private _talk: boolean; + private _expression: number; + private _sleep: boolean; + private _blink: boolean; + private _gesture: number; + private _sign: number; + private _highlightEnabled: boolean; + private _highlight: boolean; + private _dance: number; + private _effect: number; + private _carryObject: number; + private _useObject: number; + private _ownUser: boolean; + + private _isLaying: boolean; + private _layInside: boolean; + private _isAnimating: boolean; + private _extraSpritesStartIndex: number; + private _forcedAnimFrames: number; + private _updatesUntilFrameUpdate: number; + + private _isAvatarReady: boolean; + private _needsUpdate: boolean; + private _geometryUpdateCounter: number; + + private _additions: Map; + + constructor() + { + super(); + + this._data = null; + + this._avatarImage = null; + this._cachedAvatars = new AdvancedMap(); + this._cachedAvatarEffects = new AdvancedMap(); + this._shadow = null; + this._lastUpdate = -1000; + this._disposed = false; + + this._figure = null; + this._gender = null; + this._direction = -1; + this._headDirection = -1; + this._posture = ''; + this._postureParameter = ''; + this._canStandUp = false; + this._postureOffset = 0; + this._verticalOffset = 0; + this._angle = -1; + this._headAngle = -1; + this._talk = false; + this._expression = 0; + this._sleep = false; + this._blink = false; + this._gesture = 0; + this._sign = -1; + this._highlightEnabled = false; + this._highlight = false; + this._dance = 0; + this._effect = 0; + this._carryObject = 0; + this._useObject = 0; + this._ownUser = false; + + this._isLaying = false; + this._layInside = false; + this._isAnimating = false; + this._extraSpritesStartIndex = 2; + this._forcedAnimFrames = 0; + this._updatesUntilFrameUpdate = 0; + + this._isAvatarReady = false; + this._needsUpdate = false; + this._geometryUpdateCounter = -1; + + this._additions = new Map(); + } + + public initialize(data: IObjectVisualizationData): boolean + { + if(!(data instanceof AvatarVisualizationData)) return false; + + this._data = data; + + this.createSprites(AvatarVisualization.INITIAL_RESERVED_SPRITES); + + super.initialize(data); + + return true; + } + + public dispose(): void + { + if(this._disposed) return; + + super.dispose(); + + if(this._avatarImage) this._avatarImage.dispose(); + + this._shadow = null; + this._disposed = true; + } + + public update(geometry: IRoomGeometry, time: number, update: boolean, skipUpdate: boolean): void + { + if(!this.object || !geometry || !this._data) return; + + if(time < (this._lastUpdate + AvatarVisualization.UPDATE_TIME_INCREASER)) return; + + this._lastUpdate += AvatarVisualization.UPDATE_TIME_INCREASER; + + if((this._lastUpdate + AvatarVisualization.UPDATE_TIME_INCREASER) < time) this._lastUpdate = (time - AvatarVisualization.UPDATE_TIME_INCREASER); + + const model = this.object.model; + const scale = geometry.scale; + const effect = this._effect; + + let didScaleUpdate = false; + let didEffectUpdate = false; + let otherUpdate = false; + let objectUpdate = false; + + const updateModel = this.updateModel(model, scale); + + if((updateModel || (scale !== this._scale)) || !this._avatarImage) + { + if(scale !== this._scale) + { + didScaleUpdate = true; + + this.updateScale(scale); + } + + if(effect !== this._effect) didEffectUpdate = true; + + if(didScaleUpdate || !this._avatarImage || didEffectUpdate) + { + this._avatarImage = this.createAvatarImage(scale, this._effect); + + if(!this._avatarImage) return; + + otherUpdate = true; + + const sprite = this.getSprite(AvatarVisualization.AVATAR_LAYER_ID); + + if((sprite && this._avatarImage) && this._avatarImage.isPlaceholder()) + { + sprite.alpha = 150; + } + + else if(sprite) + { + sprite.alpha = 255; + } + } + + if(!this._avatarImage) return; + + if(didEffectUpdate && this._avatarImage.animationHasResetOnToggle) this._avatarImage.resetAnimationFrameCounter(); + + this.updateShadow(scale); + + objectUpdate = this.updateObject(this.object, geometry, update, true); + + this.processActionsForAvatar(this._avatarImage); + + if(this._additions) + { + let index = this._extraSpritesStartIndex; + + for(const addition of this._additions.values()) + { + addition.update(this.getSprite(index++), scale); + } + } + + this._scale = scale; + } + else + { + objectUpdate = this.updateObject(this.object, geometry, update); + } + + if(this._additions) + { + let index = this._extraSpritesStartIndex; + + for(const addition of this._additions.values()) + { + if(addition.animate(this.getSprite(index++))) this.updateSpriteCounter++; + } + } + + const update1 = (objectUpdate || updateModel || didScaleUpdate); + const update2 = ((this._isAnimating || (this._forcedAnimFrames > 0)) && update); + + if(update1) this._forcedAnimFrames = AvatarVisualization.ANIMATION_FRAME_UPDATE_INTERVAL; + + if(update1 || update2) + { + this.updateSpriteCounter++; + + this._forcedAnimFrames--; + this._updatesUntilFrameUpdate--; + + if((((this._updatesUntilFrameUpdate <= 0) || didScaleUpdate) || updateModel) || otherUpdate) + { + this._avatarImage.updateAnimationByFrames(1); + + this._updatesUntilFrameUpdate = AvatarVisualization.ANIMATION_FRAME_UPDATE_INTERVAL; + } + else + { + return; + } + + let _local_20 = this._avatarImage.getCanvasOffsets(); + + if(!_local_20 || (_local_20.length < 3)) _local_20 = AvatarVisualization.DEFAULT_CANVAS_OFFSETS; + + const sprite = this.getSprite(AvatarVisualization.SPRITE_INDEX_AVATAR); + + if(sprite) + { + const highlightEnabled = ((this.object.model.getValue(RoomObjectVariable.FIGURE_HIGHLIGHT_ENABLE) === 1) && (this.object.model.getValue(RoomObjectVariable.FIGURE_HIGHLIGHT) === 1)); + + const avatarImage = this._avatarImage.getImage(AvatarSetType.FULL, highlightEnabled); + + if(avatarImage) + { + sprite.texture = avatarImage; + + if(highlightEnabled) + { + // sprite.filters = [ + // new GlowFilter({ + // color: 0xFFFFFF, + // distance: 6 + // }) + // ]; + } + else + { + sprite.filters = []; + } + } + + if(sprite.texture) + { + sprite.offsetX = ((((-1 * scale) / 2) + _local_20[0]) - ((sprite.texture.width - scale) / 2)); + sprite.offsetY = (((-(sprite.texture.height) + (scale / 4)) + _local_20[1]) + this._postureOffset); + } + + if(this._isLaying) + { + if(this._layInside) sprite.relativeDepth = -0.5; + else sprite.relativeDepth = (AvatarVisualization.AVATAR_SPRITE_LAYING_DEPTH + _local_20[2]); + } + else + { + sprite.relativeDepth = (AvatarVisualization.AVATAR_SPRITE_DEFAULT_DEPTH + _local_20[2]); + } + + if(this._ownUser) + { + sprite.relativeDepth -= AvatarVisualization.AVATAR_OWN_DEPTH_ADJUST; + sprite.spriteType = RoomObjectSpriteType.AVATAR_OWN; + } + else + { + sprite.spriteType = RoomObjectSpriteType.AVATAR; + } + } + + const typingBubble = this.getAddition(AvatarVisualization.TYPING_BUBBLE_ID) as TypingBubbleAddition; + + if(typingBubble) + { + if(!this._isLaying) typingBubble.relativeDepth = ((AvatarVisualization.AVATAR_SPRITE_DEFAULT_DEPTH - 0.01) + _local_20[2]); + else typingBubble.relativeDepth = ((AvatarVisualization.AVATAR_SPRITE_LAYING_DEPTH - 0.01) + _local_20[2]); + } + + this._isAnimating = this._avatarImage.isAnimating(); + + let _local_21 = AvatarVisualization.INITIAL_RESERVED_SPRITES; + const direction = this._avatarImage.getDirection(); + + for(const spriteData of this._avatarImage.getSprites()) + { + if(spriteData.id === AvatarVisualization.AVATAR) + { + const sprite = this.getSprite(AvatarVisualization.SPRITE_INDEX_AVATAR); + + if(sprite) + { + const layerData = this._avatarImage.getLayerData(spriteData); + + let offsetX = spriteData.getDirectionOffsetX(direction); + let offsetY = spriteData.getDirectionOffsetY(direction); + + if(layerData) + { + offsetX += layerData.dx; + offsetY += layerData.dy; + } + + if(scale < 48) + { + offsetX /= 2; + offsetY /= 2; + } + + if(!this._canStandUp) + { + sprite.offsetX += offsetX; + sprite.offsetY += offsetY; + } + } + } + else + { + const sprite = this.getSprite(_local_21); + + if(sprite) + { + sprite.alphaTolerance = AlphaTolerance.MATCH_NOTHING; + sprite.visible = true; + + const layerData = this._avatarImage.getLayerData(spriteData); + + let frameNumber = 0; + let offsetX = spriteData.getDirectionOffsetX(direction); + let offsetY = spriteData.getDirectionOffsetY(direction); + const offsetZ = spriteData.getDirectionOffsetZ(direction); + let dd = 0; + + if(spriteData.hasDirections) dd = direction; + + if(layerData) + { + frameNumber = layerData.animationFrame; + offsetX += layerData.dx; + offsetY += layerData.dy; + dd += layerData.dd; + } + + if(scale < 48) + { + offsetX /= 2; + offsetY /= 2; + } + + if(dd < 0) dd += 8; + else + { + if(dd > 7) dd -= 8; + } + + const assetName = ((((((this._avatarImage.getScale() + '_') + spriteData.member) + '_') + dd) + '_') + frameNumber); + + const asset = this._avatarImage.getAsset(assetName); + + if(!asset) continue; + + sprite.texture = asset.texture; + sprite.offsetX = ((asset.offsetX - (scale / 2)) + offsetX); + sprite.offsetY = (asset.offsetY + offsetY); + sprite.flipH = asset.flipH; + + if(spriteData.hasStaticY) + { + sprite.offsetY += ((this._verticalOffset * scale) / (2 * AvatarVisualization.BASE_Y_SCALE)); + } + else + { + sprite.offsetY += this._postureOffset; + } + + if(this._isLaying) + { + sprite.relativeDepth = (AvatarVisualization.AVATAR_SPRITE_LAYING_DEPTH - ((0.001 * this.totalSprites) * offsetZ)); + } + else + { + sprite.relativeDepth = (AvatarVisualization.AVATAR_SPRITE_DEFAULT_DEPTH - ((0.001 * this.totalSprites) * offsetZ)); + } + + if(spriteData.ink === 33) sprite.blendMode = BLEND_MODES.ADD; + else sprite.blendMode = BLEND_MODES.NORMAL; + } + + _local_21++; + } + } + } + } + + private createAvatarImage(scale: number, effectId: number): IAvatarImage + { + let cachedImage: IAvatarImage = null; + let imageName = 'avatarImage' + scale.toString(); + + if(!effectId) + { + cachedImage = this._cachedAvatars.getValue(imageName); + } + else + { + imageName += '-' + effectId; + + cachedImage = this._cachedAvatarEffects.getValue(imageName); + } + + if(!cachedImage) + { + cachedImage = this._data.createAvatarImage(this._figure, scale, this._gender, this, this); + + if(cachedImage) + { + if(!effectId) + { + this._cachedAvatars.add(imageName, cachedImage); + } + + else + { + if(this._cachedAvatarEffects.length >= AvatarVisualization.MAX_EFFECT_CACHE) + { + const cached = this._cachedAvatarEffects.remove(this._cachedAvatarEffects.getKey(0)); + + if(cached) cached.dispose(); + } + + this._cachedAvatarEffects.add(imageName, cachedImage); + } + } + } + + return cachedImage; + } + + protected updateObject(object: IRoomObject, geometry: IRoomGeometry, update: boolean, _arg_4: boolean = false): boolean + { + if((!_arg_4 && (this.updateObjectCounter === object.updateCounter)) && (this._geometryUpdateCounter === geometry.updateId)) return false; + + let direction = (object.getDirection().x - geometry.direction.x); + let headDirection = (this._headDirection - geometry.direction.x); + + if(this._posture === 'float') headDirection = direction; + + direction = (((direction % 360) + 360) % 360); + headDirection = (((headDirection % 360) + 360) % 360); + + if((this._posture === 'sit') && this._canStandUp) + { + direction -= ((direction % 90) - 45); + headDirection -= ((headDirection % 90) - 45); + } + + if((direction !== this._angle) || _arg_4) + { + update = true; + + this._angle = direction; + + direction = (direction - (135 - 22.5)); + direction = ((direction + 360) % 360); + + this._avatarImage.setDirectionAngle(AvatarSetType.FULL, direction); + } + + if((headDirection !== this._headAngle) || _arg_4) + { + update = true; + + this._headAngle = headDirection; + + if(this._headAngle !== this._angle) + { + headDirection = (headDirection - (135 - 22.5)); + headDirection = ((headDirection + 360) % 360); + + this._avatarImage.setDirectionAngle(AvatarSetType.HEAD, headDirection); + } + } + + this._geometryUpdateCounter = geometry.updateId; + + this.updateObjectCounter = this.object.updateCounter; + + return update; + } + + protected updateModel(model: IRoomObjectModel, scale: number): boolean + { + if(!model) return false; + + if(this.updateModelCounter === model.updateCounter) return false; + + let needsUpdate = false; + + const talk = (model.getValue(RoomObjectVariable.FIGURE_TALK) > 0); + + if(talk !== this._talk) + { + this._talk = talk; + + needsUpdate = true; + } + + const expression = model.getValue(RoomObjectVariable.FIGURE_EXPRESSION); + + if(expression !== this._expression) + { + this._expression = expression; + + needsUpdate = true; + } + + const sleep = (model.getValue(RoomObjectVariable.FIGURE_SLEEP) > 0); + + if(sleep !== this._sleep) + { + this._sleep = sleep; + + needsUpdate = true; + } + + const blink = (model.getValue(RoomObjectVariable.FIGURE_BLINK) > 0); + + if(blink !== this._blink) + { + this._blink = blink; + + needsUpdate = true; + } + + const gesture = (model.getValue(RoomObjectVariable.FIGURE_GESTURE) || 0); + + if(gesture !== this._gesture) + { + this._gesture = gesture; + + needsUpdate = true; + } + + const posture = model.getValue(RoomObjectVariable.FIGURE_POSTURE); + + if(posture !== this._posture) + { + this._posture = posture; + + needsUpdate = true; + } + + const postureParameter = model.getValue(RoomObjectVariable.FIGURE_POSTURE_PARAMETER); + + if(postureParameter !== this._postureParameter) + { + this._postureParameter = postureParameter; + + needsUpdate = true; + } + + const canStandUp = model.getValue(RoomObjectVariable.FIGURE_CAN_STAND_UP); + + if(canStandUp !== this._canStandUp) + { + this._canStandUp = canStandUp; + + needsUpdate = true; + } + + const verticalOffset = (model.getValue(RoomObjectVariable.FIGURE_VERTICAL_OFFSET) * AvatarVisualization.BASE_Y_SCALE); + + if(verticalOffset !== this._verticalOffset) + { + this._verticalOffset = verticalOffset; + + needsUpdate = true; + } + + const dance = (model.getValue(RoomObjectVariable.FIGURE_DANCE) || 0); + + if(dance !== this._dance) + { + this._dance = dance; + + needsUpdate = true; + } + + const effect = (model.getValue(RoomObjectVariable.FIGURE_EFFECT) || 0); + + if(effect !== this._effect) + { + this._effect = effect; + + needsUpdate = true; + } + + const carryObject = (model.getValue(RoomObjectVariable.FIGURE_CARRY_OBJECT) || 0); + + if(carryObject !== this._carryObject) + { + this._carryObject = carryObject; + + needsUpdate = true; + } + + const useObject = (model.getValue(RoomObjectVariable.FIGURE_USE_OBJECT) || 0); + + if(useObject !== this._useObject) + { + this._useObject = useObject; + + needsUpdate = true; + } + + const headDirection = model.getValue(RoomObjectVariable.HEAD_DIRECTION); + + if(headDirection !== this._headDirection) + { + this._headDirection = headDirection; + + needsUpdate = true; + } + + if((this._carryObject > 0) && (useObject > 0)) + { + if(this._useObject !== this._carryObject) + { + this._useObject = this._carryObject; + + needsUpdate = true; + } + } + else + { + if(this._useObject !== 0) + { + this._useObject = 0; + + needsUpdate = true; + } + } + + let idleAddition = this.getAddition(AvatarVisualization.FLOATING_IDLE_Z_ID); + + if(this._sleep) + { + if(!idleAddition) idleAddition = this.addAddition(new FloatingIdleZAddition(AvatarVisualization.FLOATING_IDLE_Z_ID, this)); + + needsUpdate = true; + } + else + { + if(idleAddition) this.removeAddition(AvatarVisualization.FLOATING_IDLE_Z_ID); + } + + const isMuted = (model.getValue(RoomObjectVariable.FIGURE_IS_MUTED) > 0); + + let mutedAddition = this.getAddition(AvatarVisualization.MUTED_BUBBLE_ID); + + if(isMuted) + { + if(!mutedAddition) mutedAddition = this.addAddition(new MutedBubbleAddition(AvatarVisualization.MUTED_BUBBLE_ID, this)); + + needsUpdate = true; + } + else + { + if(mutedAddition) + { + this.removeAddition(AvatarVisualization.MUTED_BUBBLE_ID); + + needsUpdate = true; + } + + const isTyping = (model.getValue(RoomObjectVariable.FIGURE_IS_TYPING) > 0); + + let typingAddition = this.getAddition(AvatarVisualization.TYPING_BUBBLE_ID); + + if(isTyping) + { + if(!typingAddition) typingAddition = this.addAddition(new TypingBubbleAddition(AvatarVisualization.TYPING_BUBBLE_ID, this)); + + needsUpdate = true; + } + else + { + if(typingAddition) + { + this.removeAddition(AvatarVisualization.TYPING_BUBBLE_ID); + + needsUpdate = true; + } + } + } + + const guideStatusValue = (model.getValue(RoomObjectVariable.FIGURE_GUIDE_STATUS) || 0); + + if(guideStatusValue !== AvatarGuideStatus.NONE) + { + this.removeAddition(AvatarVisualization.GUIDE_BUBBLE_ID); + this.addAddition(new GuideStatusBubbleAddition(AvatarVisualization.GUIDE_BUBBLE_ID, this, guideStatusValue)); + + needsUpdate = true; + } + else + { + if(this.getAddition(AvatarVisualization.GUIDE_BUBBLE_ID)) + { + this.removeAddition(AvatarVisualization.GUIDE_BUBBLE_ID); + + needsUpdate = true; + } + } + + const isPlayingGame = (model.getValue(RoomObjectVariable.FIGURE_IS_PLAYING_GAME) > 0); + + let gameClickAddition = this.getAddition(AvatarVisualization.GAME_CLICK_TARGET_ID); + + if(isPlayingGame) + { + if(!gameClickAddition) gameClickAddition = this.addAddition(new GameClickTargetAddition(AvatarVisualization.GAME_CLICK_TARGET_ID)); + + needsUpdate = true; + } + else + { + if(gameClickAddition) this.removeAddition(AvatarVisualization.GAME_CLICK_TARGET_ID); + } + + const numberValue = model.getValue(RoomObjectVariable.FIGURE_NUMBER_VALUE); + + let numberAddition = this.getAddition(AvatarVisualization.NUMBER_BUBBLE_ID); + + if(numberValue > 0) + { + if(!numberAddition) numberAddition = this.addAddition(new NumberBubbleAddition(AvatarVisualization.NUMBER_BUBBLE_ID, numberValue, this)); + + needsUpdate = true; + } + else + { + if(numberAddition) this.removeAddition(AvatarVisualization.NUMBER_BUBBLE_ID); + } + + let expressionAddition = this.getAddition(AvatarVisualization.EXPRESSION_ID); + + if(this._expression > 0) + { + if(!expressionAddition) + { + expressionAddition = ExpressionAdditionFactory.getExpressionAddition(AvatarVisualization.EXPRESSION_ID, this._expression, this); + + if(expressionAddition) this.addAddition(expressionAddition); + } + } + else + { + if(expressionAddition) this.removeAddition(AvatarVisualization.EXPRESSION_ID); + } + + this.updateScale(scale); + + const gender = model.getValue(RoomObjectVariable.GENDER); + + if(gender !== this._gender) + { + this._gender = gender; + + needsUpdate = true; + } + + if(this.updateFigure(model.getValue(RoomObjectVariable.FIGURE))) needsUpdate = true; + + let sign = model.getValue(RoomObjectVariable.FIGURE_SIGN); + + if(sign === null) sign = -1; + + if(this._sign !== sign) + { + this._sign = sign; + + needsUpdate = true; + } + + const highlightEnabled = (model.getValue(RoomObjectVariable.FIGURE_HIGHLIGHT_ENABLE) > 0); + + if(highlightEnabled !== this._highlightEnabled) + { + this._highlightEnabled = highlightEnabled; + + needsUpdate = true; + } + + if(this._highlightEnabled) + { + const highlight = (model.getValue(RoomObjectVariable.FIGURE_HIGHLIGHT) > 0); + + if(highlight !== this._highlight) + { + this._highlight = highlight; + + needsUpdate = true; + } + } + + const ownUser = (model.getValue(RoomObjectVariable.OWN_USER) > 0); + + if(ownUser !== this._ownUser) + { + this._ownUser = ownUser; + + needsUpdate = true; + } + + this.updateModelCounter = model.updateCounter; + + return needsUpdate; + } + + protected setDirection(direction: number): void + { + if(this._direction === direction) return; + + this._direction = direction; + + this._needsUpdate = true; + } + + private updateScale(scale: number): void + { + if(scale < 48) this._blink = false; + + if((this._posture === 'sit') || (this._posture === 'lay')) + { + this._postureOffset = (scale / 2); + } + else + { + this._postureOffset = 0; + } + + this._layInside = false; + this._isLaying = false; + + if(this._posture === 'lay') + { + this._isLaying = true; + + const _local_2 = parseInt(this._postureParameter); + + if(_local_2 < 0) this._layInside = true; + } + } + + private processActionsForAvatar(avatar: IAvatarImage): void + { + if(!avatar) return; + + avatar.initActionAppends(); + + avatar.appendAction(AvatarAction.POSTURE, this._posture, this._postureParameter); + + if(this._gesture > 0) this._avatarImage.appendAction(AvatarAction.GESTURE, AvatarAction.getGesture(this._gesture)); + + if(this._dance > 0) this._avatarImage.appendAction(AvatarAction.DANCE, this._dance); + + if(this._sign > -1) this._avatarImage.appendAction(AvatarAction.SIGN, this._sign); + + if(this._carryObject > 0) this._avatarImage.appendAction(AvatarAction.CARRY_OBJECT, this._carryObject); + + if(this._useObject > 0) this._avatarImage.appendAction(AvatarAction.USE_OBJECT, this._useObject); + + if(this._talk) this._avatarImage.appendAction(AvatarAction.TALK); + + if(this._sleep || this._blink) this._avatarImage.appendAction(AvatarAction.SLEEP); + + if(this._expression > 0) + { + const expression = AvatarAction.getExpression(this._expression); + + if(expression !== '') + { + switch(expression) + { + case AvatarAction.DANCE: + this._avatarImage.appendAction(AvatarAction.DANCE, 2); + break; + default: + this._avatarImage.appendAction(expression); + break; + } + } + } + + if(this._effect > 0) this._avatarImage.appendAction(AvatarAction.EFFECT, this._effect); + + avatar.endActionAppends(); + + this._isAnimating = avatar.isAnimating(); + + let spriteCount = AvatarVisualization.INITIAL_RESERVED_SPRITES; + + for(const sprite of this._avatarImage.getSprites()) + { + if(sprite.id !== AvatarVisualization.AVATAR) spriteCount++; + } + + if(spriteCount !== this.totalSprites) this.createSprites(spriteCount); + + this._extraSpritesStartIndex = spriteCount; + + if(this._additions) + { + for(const addition of this._additions.values()) this.createSprite(); + } + } + + private updateFigure(figure: string): boolean + { + if(this._figure === figure) return false; + + this._figure = figure; + + this.clearAvatar(); + + return true; + } + + public resetFigure(figure: string): void + { + this.clearAvatar(); + } + + public resetEffect(effect: number): void + { + this.clearAvatar(); + } + + private clearAvatar(): void + { + for(const avatar of this._cachedAvatars.getValues()) avatar && avatar.dispose(); + + for(const avatar of this._cachedAvatarEffects.getValues()) avatar && avatar.dispose(); + + this._cachedAvatars.reset(); + this._cachedAvatarEffects.reset(); + + this._avatarImage = null; + + const sprite = this.getSprite(AvatarVisualization.AVATAR_LAYER_ID); + + if(sprite) + { + sprite.texture = Texture.EMPTY; + sprite.alpha = 255; + } + } + + private getAddition(id: number): IAvatarAddition + { + if(!this._additions) return null; + + const existing = this._additions.get(id); + + if(!existing) return null; + + return existing; + } + + private addAddition(addition: IAvatarAddition): IAvatarAddition + { + const existing = this.getAddition(addition.id); + + if(existing) return; + + this._additions.set(addition.id, addition); + + return addition; + } + + private removeAddition(id: number): void + { + const addition = this.getAddition(id); + + if(!addition) return; + + this._additions.delete(addition.id); + + addition.dispose(); + } + + private updateShadow(scale: number): void + { + this._shadow = null; + + const sprite = this.getSprite(AvatarVisualization.SHADOW_LAYER_ID); + + if(!sprite) return; + + let hasShadow = (((this._posture === 'mv') || (this._posture === 'std')) || ((this._posture === 'sit') && this._canStandUp)); + + if(this._effect === AvatarVisualization.SNOWBOARDING_EFFECT) hasShadow = false; + + if(hasShadow) + { + sprite.visible = true; + + if(!this._shadow || (scale !== this._scale)) + { + let offsetX = 0; + let offsetY = 0; + + if(scale < 48) + { + sprite.libraryAssetName = 'sh_std_sd_1_0_0'; + + this._shadow = this._avatarImage.getAsset(sprite.libraryAssetName); + + offsetX = -8; + offsetY = ((this._canStandUp) ? 6 : -3); + } + else + { + sprite.libraryAssetName = 'h_std_sd_1_0_0'; + + this._shadow = this._avatarImage.getAsset(sprite.libraryAssetName); + + offsetX = -17; + offsetY = ((this._canStandUp) ? 10 : -7); + } + + if(this._shadow) + { + sprite.texture = this._shadow.texture; + sprite.offsetX = offsetX; + sprite.offsetY = offsetY; + sprite.alpha = 50; + sprite.relativeDepth = 1; + } + else + { + sprite.visible = false; + } + } + } + else + { + this._shadow = null; + + sprite.visible = false; + } + } + + public getAvatarRenderAsset(name: string): Texture + { + return this._data ? this._data.getAvatarRendererAsset(name) : null; + } + + public get direction(): number + { + return this._direction; + } + + public get posture(): string + { + return this._posture; + } + + public get angle(): number + { + return this._angle; + } + + public get disposed(): boolean + { + return this._disposed; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/avatar/AvatarVisualizationData.ts b/submodules/renderer/src/nitro/room/object/visualization/avatar/AvatarVisualizationData.ts new file mode 100644 index 0000000..a5ca370 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/avatar/AvatarVisualizationData.ts @@ -0,0 +1,55 @@ +import { Resource, Texture } from '@pixi/core'; +import { AvatarScaleType, IAssetData, IAvatarEffectListener, IAvatarImage, IAvatarImageListener, IAvatarRenderManager, IObjectVisualizationData } from '../../../../../api'; +import { Disposable } from '../../../../../core'; + +export class AvatarVisualizationData extends Disposable implements IObjectVisualizationData +{ + private _avatarRenderer: IAvatarRenderManager; + + constructor() + { + super(); + } + + public initialize(asset: IAssetData): boolean + { + return true; + } + + public onDispose(): void + { + this._avatarRenderer = null; + } + + public createAvatarImage(figure: string, size: number, gender: string = null, avatarListener: IAvatarImageListener = null, effectListener: IAvatarEffectListener = null): IAvatarImage + { + let avatarImage: IAvatarImage = null; + + if(size > 48) avatarImage = this._avatarRenderer.createAvatarImage(figure, AvatarScaleType.LARGE, gender, avatarListener, effectListener); + else avatarImage = this._avatarRenderer.createAvatarImage(figure, AvatarScaleType.SMALL, gender, avatarListener, effectListener); + + return avatarImage; + } + + public getAvatarRendererAsset(name: string): Texture + { + if(!this._avatarRenderer) return null; + + return this._avatarRenderer.assets.getTexture(name); + } + + public get avatarManager(): IAvatarRenderManager + { + return this._avatarRenderer; + } + + public set avatarManager(renderer: IAvatarRenderManager) + { + this._avatarRenderer = renderer; + } + + public get layerCount(): number + { + return 0; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/ExpressionAddition.ts b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/ExpressionAddition.ts new file mode 100644 index 0000000..bee5db7 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/ExpressionAddition.ts @@ -0,0 +1,47 @@ +import { IRoomObjectSprite } from '../../../../../../api'; +import { AvatarVisualization } from '../AvatarVisualization'; +import { IExpressionAddition } from './IExpressionAddition'; + +export class ExpressionAddition implements IExpressionAddition +{ + private _id: number; + private _type: number; + private _visualization: AvatarVisualization; + + constructor(id: number, type: number, visualization: AvatarVisualization) + { + this._id = id; + this._type = type; + this._visualization = visualization; + } + + public dispose(): void + { + this._visualization = null; + } + + public update(sprite: IRoomObjectSprite, scale: number): void + { + return; + } + + public animate(sprite: IRoomObjectSprite): boolean + { + return false; + } + + public get id(): number + { + return this._id; + } + + public get type(): number + { + return this._type; + } + + public get visualization(): AvatarVisualization + { + return this._visualization; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/ExpressionAdditionFactory.ts b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/ExpressionAdditionFactory.ts new file mode 100644 index 0000000..7276544 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/ExpressionAdditionFactory.ts @@ -0,0 +1,22 @@ +import { AvatarVisualization } from '../AvatarVisualization'; +import { ExpressionAddition } from './ExpressionAddition'; +import { FloatingHeartAddition } from './FloatingHeartAddition'; +import { IExpressionAddition } from './IExpressionAddition'; + +export class ExpressionAdditionFactory +{ + public static WAVE: number = 1; + public static BLOW: number = 2; + public static LAUGH: number = 3; + public static CRY: number = 4; + public static IDLE: number = 5; + + public static getExpressionAddition(id: number, type: number, visualization: AvatarVisualization): IExpressionAddition + { + switch(type) + { + case this.BLOW: return new FloatingHeartAddition(id, this.BLOW, visualization); + default: return new ExpressionAddition(id, type, visualization); + } + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/FloatingHeartAddition.ts b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/FloatingHeartAddition.ts new file mode 100644 index 0000000..c17de99 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/FloatingHeartAddition.ts @@ -0,0 +1,169 @@ +import { Resource, Texture } from '@pixi/core'; +import { AvatarAction, IRoomObjectSprite } from '../../../../../../api'; +import { GetTickerTime } from '../../../../../../pixi-proxy'; +import { AvatarVisualization } from '../AvatarVisualization'; +import { ExpressionAddition } from './ExpressionAddition'; + +export class FloatingHeartAddition extends ExpressionAddition +{ + private static DELAY_BEFORE_ANIMATION: number = 300; + private static STATE_DELAY: number = 0; + private static STATE_FADE_IN: number = 1; + private static STATE_FLOAT: number = 2; + private static STATE_COMPLETE: number = 3; + + private _asset: Texture; + private _startTime: number; + private _delta: number; + private _offsetY: number; + private _scale: number; + private _state: number; + + constructor(id: number, type: number, visualization: AvatarVisualization) + { + super(id, type, visualization); + + this._asset = null; + this._startTime = GetTickerTime(); + this._delta = 0; + this._offsetY = 0; + this._scale = 0; + this._state = 0; + } + + public update(sprite: IRoomObjectSprite, scale: number): void + { + if(!sprite) return; + + this._scale = scale; + + let additionScale = 64; + let offsetX = 0; + + if(scale < 48) + { + this._asset = this.visualization.getAvatarRenderAsset('avatar_addition_user_blowkiss_small'); + + if((this.visualization.angle === 90) || (this.visualization.angle === 270)) + { + offsetX = 0; + } + + else if((this.visualization.angle === 135) || (this.visualization.angle === 180) || (this.visualization.angle === 225)) + { + offsetX = 6; + } + + else offsetX = -6; + + this._offsetY = -38; + + additionScale = 32; + } + else + { + this._asset = this.visualization.getAvatarRenderAsset('avatar_addition_user_blowkiss'); + + if((this.visualization.angle === 90) || (this.visualization.angle === 270)) + { + offsetX = -3; + } + + else if((this.visualization.angle === 135) || (this.visualization.angle === 180) || (this.visualization.angle === 225)) + { + offsetX = 22; + } + + else offsetX = -30; + + this._offsetY = -70; + } + + if(this.visualization.posture === AvatarAction.POSTURE_SIT) + { + this._offsetY += (additionScale / 2); + } + + else if(this.visualization.posture === AvatarAction.POSTURE_LAY) + { + this._offsetY += additionScale; + } + + if(this._asset) + { + sprite.texture = this._asset; + sprite.offsetX = offsetX; + sprite.offsetY = this._offsetY; + sprite.relativeDepth = -0.02; + sprite.alpha = 0; + + const delta = this._delta; + + this.animate(sprite); + + this._delta = delta; + } + } + + public animate(sprite: IRoomObjectSprite): boolean + { + if(!sprite) return false; + + if(this._asset) sprite.texture = this._asset; + + if(this._state === FloatingHeartAddition.STATE_DELAY) + { + if((GetTickerTime() - this._startTime) < FloatingHeartAddition.DELAY_BEFORE_ANIMATION) return false; + + this._state = FloatingHeartAddition.STATE_FADE_IN; + + sprite.alpha = 0; + sprite.visible = true; + + this._delta = 0; + + return true; + } + + if(this._state === FloatingHeartAddition.STATE_FADE_IN) + { + this._delta += 0.1; + + sprite.offsetY = this._offsetY; + sprite.alpha = (Math.pow(this._delta, 0.9) * 255); + + if(this._delta >= 1) + { + sprite.alpha = 255; + + this._delta = 0; + this._state = FloatingHeartAddition.STATE_FLOAT; + } + + return true; + } + + if(this._state === FloatingHeartAddition.STATE_FLOAT) + { + const alpha = Math.pow(this._delta, 0.9); + + this._delta += 0.05; + + const offset = ((this._scale < 48) ? -30 : -40); + + sprite.offsetY = (this._offsetY + (((this._delta < 1) ? alpha : 1) * offset)); + sprite.alpha = ((1 - alpha) * 255); + + if(sprite.alpha <= 0) + { + sprite.visible = false; + + this._state = FloatingHeartAddition.STATE_COMPLETE; + } + + return true; + } + + return false; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/FloatingIdleZAddition.ts b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/FloatingIdleZAddition.ts new file mode 100644 index 0000000..0f2fca5 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/FloatingIdleZAddition.ts @@ -0,0 +1,162 @@ +import { Resource, Texture } from '@pixi/core'; +import { AvatarAction, IRoomObjectSprite } from '../../../../../../api'; +import { GetTickerTime } from '../../../../../../pixi-proxy'; +import { AvatarVisualization } from '../AvatarVisualization'; +import { IAvatarAddition } from './IAvatarAddition'; + +export class FloatingIdleZAddition implements IAvatarAddition +{ + private static DELAY_BEFORE_ANIMATION: number = 2000; + private static DELAY_PER_FRAME: number = 2000; + private static STATE_DELAY: number = 0; + private static STATE_FRAME_A: number = 1; + private static STATE_FRAME_B: number = 2; + + private _id: number; + private _visualization: AvatarVisualization; + private _asset: Texture; + private _startTime: number; + private _offsetY: number; + private _scale: number; + private _state: number; + + constructor(id: number, visualization: AvatarVisualization) + { + this._id = id; + this._visualization = visualization; + this._asset = null; + this._startTime = GetTickerTime(); + this._offsetY = 0; + this._scale = 0; + this._state = 0; + } + + public dispose(): void + { + this._visualization = null; + this._asset = null; + } + + private getSpriteAssetName(state: number): string + { + let side = 'left'; + + if((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) side = 'right'; + + return ('avatar_addition_user_idle_' + side + '_' + state + ((this._scale < 48) ? '_small' : '')); + } + + public update(sprite: IRoomObjectSprite, scale: number): void + { + if(!sprite) return; + + this._scale = scale; + this._asset = this._visualization.getAvatarRenderAsset(this.getSpriteAssetName((this._state === FloatingIdleZAddition.STATE_FRAME_A) ? 1 : 2)); + + let additionScale = 64; + let offsetX = 0; + + if(scale < 48) + { + if((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) + { + offsetX = 10; + } + else + { + offsetX = -16; + } + + this._offsetY = -38; + + additionScale = 32; + } + else + { + if((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) + { + offsetX = 22; + } + else + { + offsetX = -30; + } + + this._offsetY = -70; + } + + if(this._visualization.posture === AvatarAction.POSTURE_SIT) + { + this._offsetY += (additionScale / 2); + } + + else if(this._visualization.posture === AvatarAction.POSTURE_LAY) + { + this._offsetY += (additionScale - (0.3 * additionScale)); + } + + if(this._asset) + { + sprite.texture = this._asset; + sprite.offsetX = offsetX; + sprite.offsetY = this._offsetY; + sprite.relativeDepth = -0.02; + sprite.alpha = 0; + } + } + + public animate(sprite: IRoomObjectSprite): boolean + { + if(!sprite) return false; + + const totalTimeRunning = GetTickerTime(); + + if(this._state === FloatingIdleZAddition.STATE_DELAY) + { + if((totalTimeRunning - this._startTime) >= FloatingIdleZAddition.DELAY_BEFORE_ANIMATION) + { + this._state = FloatingIdleZAddition.STATE_FRAME_A; + this._startTime = totalTimeRunning; + this._asset = this._visualization.getAvatarRenderAsset(this.getSpriteAssetName(1)); + } + } + + if(this._state === FloatingIdleZAddition.STATE_FRAME_A) + { + if((totalTimeRunning - this._startTime) >= FloatingIdleZAddition.DELAY_PER_FRAME) + { + this._state = FloatingIdleZAddition.STATE_FRAME_B; + this._startTime = totalTimeRunning; + this._asset = this._visualization.getAvatarRenderAsset(this.getSpriteAssetName(2)); + } + } + + if(this._state === FloatingIdleZAddition.STATE_FRAME_B) + { + if((totalTimeRunning - this._startTime) >= FloatingIdleZAddition.DELAY_PER_FRAME) + { + this._state = FloatingIdleZAddition.STATE_FRAME_A; + this._startTime = totalTimeRunning; + this._asset = this._visualization.getAvatarRenderAsset(this.getSpriteAssetName(1)); + } + } + + if(this._asset) + { + sprite.texture = this._asset; + sprite.alpha = 255; + sprite.visible = true; + } + else + { + sprite.visible = false; + } + + return false; + } + + public get id(): number + { + return this._id; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/GameClickTargetAddition.ts b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/GameClickTargetAddition.ts new file mode 100644 index 0000000..ae85ca3 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/GameClickTargetAddition.ts @@ -0,0 +1,61 @@ +import { Resource, Texture } from '@pixi/core'; +import { Sprite } from '@pixi/sprite'; +import { AlphaTolerance, IRoomObjectSprite } from '../../../../../../api'; +import { TextureUtils } from '../../../../../../pixi-proxy'; +import { IAvatarAddition } from './IAvatarAddition'; + +export class GameClickTargetAddition implements IAvatarAddition +{ + private static WIDTH: number = 46; + private static HEIGHT: number = 60; + private static OFFSET_X: number = -23; + private static OFFSET_Y: number = -48; + + private _id: number; + private _asset: Texture; + private _disposed: boolean; + + constructor(id: number) + { + this._id = id; + this._asset = null; + this._disposed = false; + } + + public dispose(): void + { + this._asset = null; + } + + public update(sprite: IRoomObjectSprite, scale: number): void + { + if(!sprite) return; + + if(!this._asset) + { + const newSprite = new Sprite(Texture.WHITE); + + newSprite.alpha = 0; + newSprite.width = GameClickTargetAddition.WIDTH; + newSprite.height = GameClickTargetAddition.HEIGHT; + + this._asset = TextureUtils.generateTexture(newSprite); + } + + sprite.visible = true; + sprite.texture = this._asset; + sprite.offsetX = GameClickTargetAddition.OFFSET_X; + sprite.offsetY = GameClickTargetAddition.OFFSET_Y; + sprite.alphaTolerance = AlphaTolerance.MATCH_ALL_PIXELS; + } + + public animate(sprite: IRoomObjectSprite): boolean + { + return false; + } + + public get id(): number + { + return this._id; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/GuideStatusBubbleAddition.ts b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/GuideStatusBubbleAddition.ts new file mode 100644 index 0000000..05c8ca4 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/GuideStatusBubbleAddition.ts @@ -0,0 +1,98 @@ +import { Resource, Texture } from '@pixi/core'; +import { AvatarAction, AvatarGuideStatus, IRoomObjectSprite } from '../../../../../../api'; +import { AvatarVisualization } from '../AvatarVisualization'; +import { IAvatarAddition } from './IAvatarAddition'; + +export class GuideStatusBubbleAddition implements IAvatarAddition +{ + private _id: number; + private _visualization: AvatarVisualization; + private _asset: Texture; + private _relativeDepth: number; + private _status: number; + + constructor(id: number, visualization: AvatarVisualization, status: number) + { + this._id = id; + this._visualization = visualization; + this._asset = null; + this._relativeDepth = 0; + this._status = status; + } + + public dispose(): void + { + this._visualization = null; + this._asset = null; + } + + public update(sprite: IRoomObjectSprite, scale: number): void + { + if(!sprite) return; + + sprite.visible = true; + sprite.relativeDepth = this._relativeDepth; + sprite.alpha = 255; + + let additionScale = 64; + let offsetX = 0; + let offsetY = 0; + + this._asset = this._visualization.getAvatarRenderAsset((this._status === AvatarGuideStatus.GUIDE) ? 'avatar_addition_user_guide_bubble' : 'avatar_addition_user_guide_requester_bubble'); + + if(scale < 48) + { + offsetX = -19; + offsetY = -80; + additionScale = 32; + } + else + { + offsetX = -19; + offsetY = -120; + } + + if(this._visualization.posture === AvatarAction.POSTURE_SIT) + { + offsetY += (additionScale / 2); + } + + else if(this._visualization.posture === AvatarAction.POSTURE_LAY) + { + offsetY += scale; + } + + if(this._asset) + { + sprite.texture = this._asset; + sprite.offsetX = offsetX; + sprite.offsetY = offsetY; + sprite.relativeDepth = (-0.02 + 0); + } + } + + public animate(sprite: IRoomObjectSprite): boolean + { + if(this._asset && sprite) + { + sprite.texture = this._asset; + } + + return false; + } + + public get id(): number + { + return this._id; + } + + public get relativeDepth(): number + { + return this._relativeDepth; + } + + public set relativeDepth(depth: number) + { + this._relativeDepth = depth; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/IAvatarAddition.ts b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/IAvatarAddition.ts new file mode 100644 index 0000000..11743f1 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/IAvatarAddition.ts @@ -0,0 +1,9 @@ +import { IRoomObjectSprite } from '../../../../../../api'; + +export interface IAvatarAddition +{ + dispose(): void; + update(sprite: IRoomObjectSprite, scale: number): void; + animate(sprite: IRoomObjectSprite): boolean; + id: number; +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/IExpressionAddition.ts b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/IExpressionAddition.ts new file mode 100644 index 0000000..d13225c --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/IExpressionAddition.ts @@ -0,0 +1,6 @@ +import { IAvatarAddition } from './IAvatarAddition'; + +export interface IExpressionAddition extends IAvatarAddition +{ + type: number; +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/MutedBubbleAddition.ts b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/MutedBubbleAddition.ts new file mode 100644 index 0000000..772bd33 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/MutedBubbleAddition.ts @@ -0,0 +1,80 @@ +import { Resource, Texture } from '@pixi/core'; +import { AvatarAction, IRoomObjectSprite } from '../../../../../../api'; +import { AvatarVisualization } from '../AvatarVisualization'; +import { IAvatarAddition } from './IAvatarAddition'; + +export class MutedBubbleAddition implements IAvatarAddition +{ + private _id: number; + private _visualization: AvatarVisualization; + private _asset: Texture; + + constructor(id: number, visualization: AvatarVisualization) + { + this._id = id; + this._visualization = visualization; + this._asset = null; + } + + public dispose(): void + { + this._visualization = null; + this._asset = null; + } + + public update(sprite: IRoomObjectSprite, scale: number): void + { + if(!sprite) return; + + let additionScale = 64; + let offsetX = 0; + let offsetY = 0; + + if(scale < 48) + { + this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_muted_small'); + + additionScale = 32; + offsetX = -12; + offsetY = -66; + } + else + { + this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_muted'); + + offsetX = -15; + offsetY = -110; + } + + if(this._visualization.posture === AvatarAction.POSTURE_SIT) offsetY += (additionScale / 2); + else if(this._visualization.posture === AvatarAction.POSTURE_LAY) offsetY += scale; + + if(this._asset) + { + sprite.visible = true; + sprite.texture = this._asset; + sprite.offsetX = offsetX; + sprite.offsetY = offsetY; + sprite.relativeDepth = -0.02; + } + else + { + sprite.visible = false; + } + } + + public animate(sprite: IRoomObjectSprite): boolean + { + if(this._asset && sprite) + { + sprite.texture = this._asset; + } + + return false; + } + + public get id(): number + { + return this._id; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/NumberBubbleAddition.ts b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/NumberBubbleAddition.ts new file mode 100644 index 0000000..55da56e --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/NumberBubbleAddition.ts @@ -0,0 +1,183 @@ +import { Resource, Texture } from '@pixi/core'; +import { AvatarAction, IRoomObjectSprite } from '../../../../../../api'; +import { AvatarVisualization } from '../AvatarVisualization'; +import { IAvatarAddition } from './IAvatarAddition'; + +export class NumberBubbleAddition implements IAvatarAddition +{ + private _id: number; + private _visualization: AvatarVisualization; + private _asset: Texture; + private _scale: number; + private _number: number; + private _numberValueFadeDirection: number; + private _numberValueMoving: boolean; + private _numberValueMoveCounter: number; + + constructor(id: number, number: number, visualization: AvatarVisualization) + { + this._id = id; + this._visualization = visualization; + this._asset = null; + this._scale = 0; + this._number = number; + this._numberValueFadeDirection = 0; + this._numberValueMoving = false; + this._numberValueMoveCounter = 0; + } + + public dispose(): void + { + this._visualization = null; + this._asset = null; + } + + public update(sprite: IRoomObjectSprite, scale: number): void + { + if(!sprite) return; + + this._scale = scale; + + let additionScale = 64; + let offsetX = 0; + let offsetY = 0; + + if(this._number > 0) + { + if(scale < 48) + { + this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_number_' + this._number + '_small'); + + additionScale = 32; + offsetX = -6; + offsetY = -52; + } + else + { + this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_number_' + this._number); + + offsetX = -8; + offsetY = -105; + } + + if(this._visualization.posture === AvatarAction.POSTURE_SIT) + { + offsetY += (additionScale / 2); + } + + else if(this._visualization.posture === AvatarAction.POSTURE_LAY) + { + offsetY += scale; + } + + if(this._asset) + { + sprite.visible = true; + sprite.texture = this._asset; + sprite.offsetX = offsetX; + sprite.offsetY = offsetY; + sprite.relativeDepth = -0.01; + sprite.alpha = 0; + + this._numberValueFadeDirection = 1; + this._numberValueMoving = true; + this._numberValueMoveCounter = 0; + } + else + { + sprite.visible = false; + } + } + else + { + if(sprite.visible) this._numberValueFadeDirection = -1; + } + } + + public animate(sprite: IRoomObjectSprite): boolean + { + if(!sprite) return false; + + if(this._asset) + { + sprite.texture = this._asset; + } + + let alpha = sprite.alpha; + let didAnimate = false; + + if(this._numberValueMoving) + { + this._numberValueMoveCounter++; + + if(this._numberValueMoveCounter < 10) return false; + + if(this._numberValueFadeDirection < 0) + { + if(this._scale < 48) + { + sprite.offsetY -= 2; + } + else + { + sprite.offsetY -= 4; + } + } + else + { + let count = 4; + + if(this._scale < 48) count = 8; + + if(!(this._numberValueMoveCounter % count)) + { + sprite.offsetY--; + + didAnimate = true; + } + } + } + + if(this._numberValueFadeDirection > 0) + { + if(alpha < 255) alpha += 32; + + if(alpha >= 255) + { + alpha = 255; + + this._numberValueFadeDirection = 0; + } + + sprite.alpha = alpha; + + return true; + } + + if(this._numberValueFadeDirection < 0) + { + if(alpha >= 0) alpha -= 32; + + if(alpha <= 0) + { + this._numberValueFadeDirection = 0; + this._numberValueMoving = false; + + alpha = 0; + + sprite.visible = false; + } + + sprite.alpha = alpha; + + return true; + } + + return didAnimate; + } + + public get id(): number + { + return this._id; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/TypingBubbleAddition.ts b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/TypingBubbleAddition.ts new file mode 100644 index 0000000..f396a24 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/TypingBubbleAddition.ts @@ -0,0 +1,99 @@ +import { Resource, Texture } from '@pixi/core'; +import { AvatarAction, IRoomObjectSprite } from '../../../../../../api'; +import { AvatarVisualization } from '../AvatarVisualization'; +import { IAvatarAddition } from './IAvatarAddition'; + +export class TypingBubbleAddition implements IAvatarAddition +{ + private _id: number; + private _visualization: AvatarVisualization; + private _asset: Texture; + private _relativeDepth: number; + + constructor(id: number, visualization: AvatarVisualization) + { + this._id = id; + this._visualization = visualization; + this._asset = null; + this._relativeDepth = 0; + } + + public dispose(): void + { + this._visualization = null; + this._asset = null; + } + + public update(sprite: IRoomObjectSprite, scale: number): void + { + if(!sprite) return; + + sprite.visible = true; + sprite.relativeDepth = this._relativeDepth; + sprite.alpha = 255; + + let additionScale = 64; + let offsetX = 0; + let offsetY = 0; + + if(scale < 48) + { + this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_typing_small'); + + offsetX = 3; + offsetY = -42; + + additionScale = 32; + } + else + { + this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_typing'); + + offsetX = 14; + offsetY = -83; + } + + if(this._visualization.posture === AvatarAction.POSTURE_SIT) + { + offsetY += (additionScale / 2); + } + + else if(this._visualization.posture === AvatarAction.POSTURE_LAY) + { + offsetY += scale; + } + + if(this._asset) + { + sprite.texture = this._asset; + sprite.offsetX = offsetX; + sprite.offsetY = offsetY; + sprite.relativeDepth = (-0.02 + 0); + } + } + + public animate(sprite: IRoomObjectSprite): boolean + { + if(this._asset && sprite) + { + sprite.texture = this._asset; + } + + return false; + } + + public get id(): number + { + return this._id; + } + + public get relativeDepth(): number + { + return this._relativeDepth; + } + + public set relativeDepth(depth: number) + { + this._relativeDepth = depth; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/index.ts b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/index.ts new file mode 100644 index 0000000..b2e5dda --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/avatar/additions/index.ts @@ -0,0 +1,11 @@ +export * from './ExpressionAddition'; +export * from './ExpressionAdditionFactory'; +export * from './FloatingHeartAddition'; +export * from './FloatingIdleZAddition'; +export * from './GameClickTargetAddition'; +export * from './GuideStatusBubbleAddition'; +export * from './IAvatarAddition'; +export * from './IExpressionAddition'; +export * from './MutedBubbleAddition'; +export * from './NumberBubbleAddition'; +export * from './TypingBubbleAddition'; diff --git a/submodules/renderer/src/nitro/room/object/visualization/avatar/index.ts b/submodules/renderer/src/nitro/room/object/visualization/avatar/index.ts new file mode 100644 index 0000000..aadc036 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/avatar/index.ts @@ -0,0 +1,3 @@ +export * from './additions'; +export * from './AvatarVisualization'; +export * from './AvatarVisualizationData'; diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/AnimationData.ts b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationData.ts new file mode 100644 index 0000000..32593aa --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationData.ts @@ -0,0 +1,191 @@ +import { IAssetVisualAnimation, IAssetVisualAnimationLayer, IAssetVisualAnimationSequenceFrame } from '../../../../../api'; +import { AnimationFrame } from './AnimationFrame'; +import { AnimationLayerData } from './AnimationLayerData'; +import { DirectionalOffsetData } from './DirectionalOffsetData'; + +export class AnimationData +{ + private static TRANSITION_TO_ANIMATION_OFFSET: number = 1000000; + private static TRANSITION_FROM_ANIMATION_OFFSET: number = 2000000; + + public static DEFAULT_FRAME_NUMBER: number = 0; + + private _layers: Map; + private _frameCount: number; + private _randomStart: boolean; + private _immediateChanges: number[]; + + constructor() + { + this._layers = new Map(); + this._frameCount = -1; + this._randomStart = false; + this._immediateChanges = null; + } + + public static getTransitionToAnimationId(animationId: number): number + { + return AnimationData.TRANSITION_TO_ANIMATION_OFFSET + animationId; + } + + public static getTransitionFromAnimationId(animationId: number): number + { + return AnimationData.TRANSITION_FROM_ANIMATION_OFFSET + animationId; + } + + public static isTransitionToAnimation(animationId: number): boolean + { + return (animationId >= AnimationData.TRANSITION_TO_ANIMATION_OFFSET) && (animationId < AnimationData.TRANSITION_FROM_ANIMATION_OFFSET); + } + + public static isTransitionFromAnimation(animationId: number): boolean + { + return animationId >= AnimationData.TRANSITION_FROM_ANIMATION_OFFSET; + } + + public dispose(): void + { + for(const layer of this._layers.values()) + { + if(!layer) continue; + + layer.dispose(); + } + + this._layers.clear(); + + this._immediateChanges = null; + } + + public setImmediateChanges(k: number[]): void + { + this._immediateChanges = k; + } + + public isImmediateChange(k: number): boolean + { + if(!this._immediateChanges || (this._immediateChanges.indexOf(k) === -1)) return false; + + return true; + } + + public getStartFrame(direction: number): number + { + if(!this._randomStart) return 0; + + return Math.random() * this._frameCount; + } + + public initialize(k: IAssetVisualAnimation): boolean + { + if(k.randomStart) this._randomStart = true; + + if(k.layers) + { + for(const key in k.layers) + { + const layer = k.layers[key]; + + if(!layer) return false; + + const animationId = parseInt(key); + + const loopCount = (layer.loopCount !== undefined) ? layer.loopCount : 1; + const frameRepeat = (layer.frameRepeat !== undefined) ? layer.frameRepeat : 1; + const isRandom = ((layer.random !== undefined) && (layer.random !== 0)) ? true : false; + + if(!this.addLayer(animationId, loopCount, frameRepeat, isRandom, layer)) return false; + } + } + + return true; + } + + private addLayer(animationId: number, loopCount: number, frameRepeat: number, isRandom: boolean, layer: IAssetVisualAnimationLayer): boolean + { + const layerData = new AnimationLayerData(loopCount, frameRepeat, isRandom); + + if(layer.frameSequences) + { + for(const key in layer.frameSequences) + { + const animationSequence = layer.frameSequences[key]; + + if(!animationSequence) continue; + + const loopCount = (animationSequence.loopCount !== undefined) ? animationSequence.loopCount : 1; + const isSequenceRandom = ((animationSequence.random !== undefined) && (animationSequence.random !== 0)) ? true : false; + + const frame = layerData.addFrameSequence(loopCount, isSequenceRandom); + + if(animationSequence.frames) + { + for(const key in animationSequence.frames) + { + const animationFrame = animationSequence.frames[key]; + + if(!animationFrame) + { + layerData.dispose(); + + return false; + } + + frame.addFrame(animationFrame.id, (animationFrame.x || 0), (animationFrame.y || 0), (animationFrame.randomX || 0), (animationFrame.randomY || 0), this.readDirectionalOffsets(animationFrame)); + } + } + + frame.initialize(); + } + } + + layerData.calculateLength(); + + this._layers.set(animationId, layerData); + + const frameCount: number = layerData.frameCount; + + if(frameCount > this._frameCount) this._frameCount = frameCount; + + return true; + } + + private readDirectionalOffsets(frame: IAssetVisualAnimationSequenceFrame): DirectionalOffsetData + { + let directionalOffset: DirectionalOffsetData = null; + + if(frame && frame.offsets) + { + for(const directionId in frame.offsets) + { + const offset = frame.offsets[directionId]; + + if(!offset) continue; + + if(!directionalOffset) directionalOffset = new DirectionalOffsetData(); + + directionalOffset.setDirection(offset.direction, offset.x, offset.y); + } + } + + return directionalOffset; + } + + public getFrame(direction: number, layerId: number, frameCount: number): AnimationFrame + { + const layer = this._layers.get(layerId); + + if(!layer) return null; + + return layer.getFrame(direction, frameCount); + } + + public getFrameFromSequence(direction: number, layerId: number, sequenceId: number, offset: number, frameCount: number): AnimationFrame + { + const layer = this._layers.get(layerId); + + if(!layer) return null; + + return layer.getFrameFromSequence(direction, sequenceId, offset, frameCount); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/AnimationFrame.ts b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationFrame.ts new file mode 100644 index 0000000..53663db --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationFrame.ts @@ -0,0 +1,118 @@ + +export class AnimationFrame +{ + public static FRAME_REPEAT_FOREVER: number = -1; + public static SEQUENCE_NOT_DEFINED: number = -1; + + private static POOL_SIZE_LIMIT: number = 3000; + private static POOL: AnimationFrame[] = []; + + private _id: number; + private _x: number; + private _y: number; + private _repeats: number; + private _frameRepeats: number; + private _remainingFrameRepeats: number; + private _activeSequence: number; + private _activeSequenceOffset: number; + private _isLastFrame: boolean; + private _isRecycled: boolean; + + public static allocate(id: number, x: number, y: number, repeats: number, frameRepeats: number, isLastFrame: boolean, activeSequence: number = -1, sequenceOffset: number = 0): AnimationFrame + { + const frame = (AnimationFrame.POOL.length) ? AnimationFrame.POOL.pop() : new AnimationFrame(); + + if(repeats < 1) repeats = 1; + + if(frameRepeats < 0) frameRepeats = AnimationFrame.FRAME_REPEAT_FOREVER; + + frame._id = id; + frame._x = x || 0; + frame._y = y || 0; + frame._repeats = repeats; + frame._frameRepeats = frameRepeats; + frame._remainingFrameRepeats = frameRepeats; + frame._isLastFrame = isLastFrame; + frame._isRecycled = false; + + if(activeSequence >= 0) + { + frame._activeSequence = activeSequence; + frame._activeSequenceOffset = sequenceOffset; + } + else + { + frame._activeSequence = -1; + frame._activeSequenceOffset = 0; + } + + return frame; + } + + public get id(): number + { + if(this._id >= 0) return this._id; + + return -(this._id) * Math.random(); + } + + public get x(): number + { + return this._x; + } + + public get y(): number + { + return this._y; + } + + public get repeats(): number + { + return this._repeats; + } + + public get frameRepeats(): number + { + return this._frameRepeats; + } + + public get isLastFrame(): boolean + { + return this._isLastFrame; + } + + public get remainingFrameRepeats(): number + { + if(this._frameRepeats < 0) return AnimationFrame.FRAME_REPEAT_FOREVER; + + return this._remainingFrameRepeats; + } + + public set remainingFrameRepeats(k: number) + { + if(k < 0) k = 0; + + if((this._frameRepeats > 0) && (k > this._frameRepeats)) k = this._frameRepeats; + + this._remainingFrameRepeats = k; + } + + public get activeSequence(): number + { + return this._activeSequence; + } + + public get activeSequenceOffset(): number + { + return this._activeSequenceOffset; + } + + public recycle(): void + { + if(this._isRecycled) return; + + this._isRecycled = true; + + if(AnimationFrame.POOL.length < AnimationFrame.POOL_SIZE_LIMIT) AnimationFrame.POOL.push(this); + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/AnimationFrameData.ts b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationFrameData.ts new file mode 100644 index 0000000..6f7b799 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationFrameData.ts @@ -0,0 +1,64 @@ +export class AnimationFrameData +{ + private _id: number = 0; + private _x: number = 0; + private _y: number = 0; + private _randomX: number = 0; + private _randomY: number = 0; + private _repeats: number = 1; + + constructor(id: number, x: number, y: number, randomX: number, randomY: number, repeats: number) + { + this._id = id; + this._x = x; + this._y = y; + this._randomX = randomX; + this._randomY = randomY; + this._repeats = repeats; + } + + public get id(): number + { + return this._id; + } + + public hasDirectionalOffsets(): boolean + { + return false; + } + + public getX(k: number): number + { + return this._x; + } + + public getY(k: number): number + { + return this._y; + } + + public get x(): number + { + return this._x; + } + + public get y(): number + { + return this._x; + } + + public get randomX(): number + { + return this._randomX; + } + + public get randomY(): number + { + return this._randomY; + } + + public get repeats(): number + { + return this._repeats; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/AnimationFrameDirectionalData.ts b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationFrameDirectionalData.ts new file mode 100644 index 0000000..79f5df9 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationFrameDirectionalData.ts @@ -0,0 +1,33 @@ +import { AnimationFrameData } from './AnimationFrameData'; +import { DirectionalOffsetData } from './DirectionalOffsetData'; + +export class AnimationFrameDirectionalData extends AnimationFrameData +{ + private _directionalOffsets: DirectionalOffsetData; + + constructor(id: number, x: number, y: number, randomX: number, randomY: number, offsets: DirectionalOffsetData, repeats: number) + { + super(id, x, y, randomX, randomY, repeats); + + this._directionalOffsets = offsets; + } + + public hasDirectionalOffsets(): boolean + { + return this._directionalOffsets !== null; + } + + public getX(direction: number): number + { + if(!this._directionalOffsets) return super.getX(direction); + + return this._directionalOffsets.getXOffset(direction, super.getX(direction)); + } + + public getY(direction: number): number + { + if(!this._directionalOffsets) return super.getY(direction); + + return this._directionalOffsets.getYOffset(direction, super.getY(direction)); + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/AnimationFrameSequenceData.ts b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationFrameSequenceData.ts new file mode 100644 index 0000000..5522587 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationFrameSequenceData.ts @@ -0,0 +1,111 @@ +import { AnimationFrameData } from './AnimationFrameData'; +import { AnimationFrameDirectionalData } from './AnimationFrameDirectionalData'; +import { DirectionalOffsetData } from './DirectionalOffsetData'; + +export class AnimationFrameSequenceData +{ + private _frames: AnimationFrameData[]; + private _frameIndexes: number[]; + private _frameRepeats: number[]; + private _isRandom: boolean; + private _loopCount: number; + + constructor(loopCount: number, isRandom: boolean) + { + this._frames = []; + this._frameIndexes = []; + this._frameRepeats = []; + this._isRandom = isRandom; + this._loopCount = (loopCount < 1) ? 1 : loopCount; + } + + public get isRandom(): boolean + { + return this._isRandom; + } + + public get frameCount(): number + { + return (this._frameIndexes.length * this._loopCount); + } + + public dispose(): void + { + this._frames = []; + } + + public initialize(): void + { + let frameIndex: number = (this._frameIndexes.length - 1); + let realIndex = -1; + let nextIndex = 1; + + while(frameIndex >= 0) + { + if(this._frameIndexes[frameIndex] === realIndex) + { + nextIndex++; + } + else + { + realIndex = this._frameIndexes[frameIndex]; + nextIndex = 1; + } + + this._frameRepeats[frameIndex] = nextIndex; + + frameIndex--; + } + } + + public addFrame(id: number, x: number, y: number, randomX: number, randomY: number, directionalOffset: DirectionalOffsetData): void + { + let repeats = 1; + + if(this._frames.length > 0) + { + const frame = this._frames[(this._frames.length - 1)]; + + if((((((((frame.id === id) && (!(frame.hasDirectionalOffsets()))) && (frame.x === x)) && (frame.y === y)) && (frame.randomX === randomX)) && (randomX === 0)) && (frame.randomY === randomY)) && (randomY === 0)) + { + repeats += frame.repeats; + + this._frames.pop(); + } + } + + const frame = (directionalOffset) ? new AnimationFrameDirectionalData(id, x, y, randomX, randomY, directionalOffset, repeats) : new AnimationFrameData(id, x, y, randomX, randomY, repeats); + + this._frames.push(frame); + this._frameIndexes.push((this._frames.length - 1)); + this._frameRepeats.push(1); + } + + public getFrame(frameCount: number): AnimationFrameData + { + if((!this._frames.length || (frameCount < 0)) || (frameCount >= this.frameCount)) return null; + + return this._frames[this._frameIndexes[(frameCount % this._frameIndexes.length)]]; + } + + public getFrameIndex(frameCount: number): number + { + if(((frameCount < 0) || (frameCount >= this.frameCount))) return -1; + + if(this._isRandom) + { + frameCount = Math.round((Math.random() * this._frameIndexes.length)); + + if(frameCount === this._frameIndexes.length) frameCount--; + } + + return frameCount; + } + + public getRepeats(frameCount: number): number + { + if(((frameCount < 0) || (frameCount >= this.frameCount))) return 0; + + return this._frameRepeats[(frameCount % this._frameRepeats.length)]; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/AnimationLayerData.ts b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationLayerData.ts new file mode 100644 index 0000000..6271524 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationLayerData.ts @@ -0,0 +1,156 @@ +import { AnimationFrame } from './AnimationFrame'; +import { AnimationFrameSequenceData } from './AnimationFrameSequenceData'; + +export class AnimationLayerData +{ + private _frameSequences: AnimationFrameSequenceData[]; + private _frameCount: number; + private _loopCount: number; + private _frameRepeat: number; + private _isRandom: boolean; + + constructor(loopCount: number, frameRepeat: number, isRandom: boolean) + { + this._frameSequences = []; + this._frameCount = -1; + this._loopCount = (loopCount < 0) ? 0 : loopCount; + this._frameRepeat = (frameRepeat < 1) ? 1 : frameRepeat; + this._isRandom = isRandom; + } + + public get frameCount(): number + { + if(this._frameCount < 0) this.calculateLength(); + + return this._frameCount; + } + + public dispose(): void + { + if(!this._frameSequences || !this._frameSequences.length) return; + + for(const sequence of this._frameSequences) + { + if(!sequence) continue; + + sequence.dispose(); + } + + this._frameSequences = []; + } + + public addFrameSequence(loopCount: number, isRandom: boolean): AnimationFrameSequenceData + { + const sequence = new AnimationFrameSequenceData(loopCount, isRandom); + + this._frameSequences.push(sequence); + + return sequence; + } + + public calculateLength(): void + { + this._frameCount = 0; + + for(const sequence of this._frameSequences) + { + if(!sequence) continue; + + this._frameCount += sequence.frameCount; + } + } + + public getFrame(direction: number, frameCount: number): AnimationFrame + { + if(this._frameCount < 1) return null; + + frameCount = (frameCount / this._frameRepeat); + + if(!this._isRandom) + { + const count = Math.floor(frameCount / this._frameCount); + frameCount = Math.floor(frameCount % this._frameCount); + + let doesRepeat = false; + let sequence: AnimationFrameSequenceData = null; + + if(((this._loopCount > 0) && (count >= this._loopCount)) || ((this._loopCount <= 0) && (this._frameCount === 1))) + { + frameCount = (this._frameCount - 1); + doesRepeat = true; + } + + let sequenceFrameCount = 0; + let sequenceId = 0; + + while(sequenceId < this._frameSequences.length) + { + sequence = this._frameSequences[sequenceId]; + + if(sequence) + { + if(frameCount < (sequenceFrameCount + sequence.frameCount)) break; + + sequenceFrameCount += sequence.frameCount; + } + + sequenceId++; + } + + return this.getFrameFromSpecificSequence(direction, sequence, sequenceId, (frameCount - sequenceFrameCount), doesRepeat); + } + + const sequenceId = Math.trunc(this._frameSequences.length * Math.random()); + const sequence = this._frameSequences[sequenceId]; + + if(sequence.frameCount < 1) return null; + + return this.getFrameFromSpecificSequence(direction, sequence, sequenceId, 0, false); + } + + public getFrameFromSequence(direction: number, sequenceId: number, offset: number, frameCount: number): AnimationFrame + { + if((sequenceId < 0) || (sequenceId >= this._frameSequences.length)) return null; + + const sequence = this._frameSequences[sequenceId]; + + if(!sequence) return null; + + if(offset >= sequence.frameCount) return this.getFrame(direction, frameCount); + + return this.getFrameFromSpecificSequence(direction, sequence, sequenceId, offset, false); + } + + private getFrameFromSpecificSequence(direction: number, sequence: AnimationFrameSequenceData, sequenceId: number, offset: number, doesRepeat: boolean): AnimationFrame + { + if(!sequence) return null; + + const frameIndex = sequence.getFrameIndex(offset); + const frame = sequence.getFrame(frameIndex); + + if(!frame) return null; + + let x = frame.getX(direction); + let y = frame.getY(direction); + const randomX = frame.randomX; + const randomY = frame.randomY; + let repeats = frame.repeats; + let isLastFrame = false; + + if(randomX) x = Math.trunc(x + randomX * Math.random()); + if(randomY) y = Math.trunc(y + randomY * Math.random()); + + if(repeats > 1) repeats = sequence.getRepeats(frameIndex); + + let frameRepeats = (this._frameRepeat * repeats); + + if(doesRepeat) frameRepeats = AnimationFrame.FRAME_REPEAT_FOREVER; + + if(!this._isRandom && !sequence.isRandom) + { + if((sequenceId === (this._frameSequences.length - 1)) && (offset === (sequence.frameCount - 1))) isLastFrame = true; + } + + return AnimationFrame.allocate(frame.id, x, y, repeats, frameRepeats, isLastFrame, sequenceId, offset); + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/AnimationSizeData.ts b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationSizeData.ts new file mode 100644 index 0000000..c2d9d00 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationSizeData.ts @@ -0,0 +1,158 @@ +import { IAssetVisualAnimation } from '../../../../../api'; +import { AnimationData } from './AnimationData'; +import { AnimationFrame } from './AnimationFrame'; +import { SizeData } from './SizeData'; + +export class AnimationSizeData extends SizeData +{ + private _animations: Map; + private _animationIds: number[]; + + constructor(layerCount: number, angle: number) + { + super(layerCount, angle); + + this._animations = new Map(); + this._animationIds = []; + } + + public dispose(): void + { + super.dispose(); + + for(const animation of this._animations.values()) + { + if(!animation) continue; + + animation.dispose(); + } + + this._animations.clear(); + + this._animationIds = []; + } + + public defineAnimations(animations: { [index: string]: IAssetVisualAnimation }): boolean + { + if(!animations) return true; + + for(const key in animations) + { + const animation = animations[key]; + + if(!animation) return false; + + let animationId = parseInt(key.split('_')[0]); + let isTransition = false; + + const transitionTo = animation.transitionTo; + const transitionFrom = animation.transitionFrom; + + if(transitionTo !== undefined) + { + animationId = AnimationData.getTransitionToAnimationId(transitionTo); + isTransition = true; + } + + if(transitionFrom !== undefined) + { + animationId = AnimationData.getTransitionFromAnimationId(transitionFrom); + isTransition = true; + } + + const animationData = this.createAnimationData(); + + if(!animationData.initialize(animation)) + { + animationData.dispose(); + + return false; + } + + const immediateChangeFrom = animation.immediateChangeFrom; + + if(immediateChangeFrom !== undefined) + { + const changes = immediateChangeFrom.split(','); + const changeIds = []; + + for(const change of changes) + { + const changeId = parseInt(change); + + if(changeIds.indexOf(changeId) === -1) changeIds.push(changeId); + } + + animationData.setImmediateChanges(changeIds); + } + + this._animations.set(animationId, animationData); + + if(!isTransition) this._animationIds.push(animationId); + } + + return true; + } + + protected createAnimationData(): AnimationData + { + return new AnimationData(); + } + + public hasAnimation(animationId: number): boolean + { + if(!this._animations.get(animationId)) return false; + + return true; + } + + public getAnimationCount(): number + { + return this._animationIds.length || 0; + } + + public getAnimationId(animationId: number): number + { + const totalAnimations = this.getAnimationCount(); + + if((animationId < 0) || (totalAnimations <= 0)) return 0; + + return this._animationIds[(animationId % totalAnimations)]; + } + + public isImmediateChange(animationId: number, _arg_2: number): boolean + { + const animation = this._animations.get(animationId); + + if(!animation) return false; + + return animation.isImmediateChange(_arg_2); + } + + public getStartFrame(animationId: number, direction: number): number + { + const animation = this._animations.get(animationId); + + if(!animation) return 0; + + return animation.getStartFrame(direction); + } + + public getFrame(animationId: number, direction: number, layerId: number, frameCount: number): AnimationFrame + { + const animation = this._animations.get(animationId); + + if(!animation) return null; + + return animation.getFrame(direction, layerId, frameCount); + } + + public getFrameFromSequence(animationId: number, direction: number, layerId: number, sequenceId: number, offset: number, frameCount: number): AnimationFrame + { + const animation = this._animations.get(animationId); + + if(!animation) return null; + + return animation.getFrameFromSequence(direction, layerId, sequenceId, offset, frameCount); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/AnimationStateData.ts b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationStateData.ts new file mode 100644 index 0000000..ad7a13e --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/AnimationStateData.ts @@ -0,0 +1,184 @@ +import { AnimationFrame } from './AnimationFrame'; + +export class AnimationStateData +{ + private _animationId: number; + private _animationAfterTransitionId: number; + private _animationOver: boolean; + private _frameCounter: number; + private _frames: AnimationFrame[]; + private _lastFramePlayed: boolean[]; + private _animationPlayed: boolean[]; + private _layerCount: number; + + constructor() + { + this._animationId = -1; + this._animationAfterTransitionId = 0; + this._animationOver = false; + this._frameCounter = 0; + this._frames = []; + this._lastFramePlayed = []; + this._animationPlayed = []; + this._layerCount = 0; + } + + public get animationOver(): boolean + { + return this._animationOver; + } + + public set animationOver(k: boolean) + { + this._animationOver = k; + } + + public get frameCounter(): number + { + return this._frameCounter; + } + + public set frameCounter(k: number) + { + this._frameCounter = k; + } + + public get animationId(): number + { + return this._animationId; + } + + public set animationId(animationId: number) + { + if(animationId === this._animationId) return; + + this._animationId = animationId; + + this.resetAnimationFrames(false); + } + + public get animationAfterTransitionId(): number + { + return this._animationAfterTransitionId; + } + + public set animationAfterTransitionId(k: number) + { + this._animationAfterTransitionId = k; + } + + public dispose(): void + { + this.recycleFrames(); + + this._frames = null; + this._lastFramePlayed = null; + this._animationPlayed = null; + } + + public setLayerCount(k: number): void + { + this._layerCount = k; + + this.resetAnimationFrames(); + } + + public resetAnimationFrames(k: boolean = true): void + { + if(k || (!this._frames)) + { + this.recycleFrames(); + + this._frames = []; + } + + this._lastFramePlayed = []; + this._animationPlayed = []; + this._animationOver = false; + this._frameCounter = 0; + + let layerId = 0; + + while(layerId < this._layerCount) + { + if(k || (this._frames.length <= layerId)) + { + this._frames[layerId] = null; + } + else + { + const frame = this._frames[layerId]; + + if(frame) + { + frame.recycle(); + + this._frames[layerId] = AnimationFrame.allocate(frame.id, frame.x, frame.y, frame.repeats, 0, frame.isLastFrame); + } + } + + this._lastFramePlayed[layerId] = false; + this._animationPlayed[layerId] = false; + + layerId++; + } + } + + private recycleFrames(): void + { + if(!this._frames || !this._frames.length) return; + + for(const frame of this._frames) + { + if(!frame) continue; + + frame.recycle(); + } + } + + public getFrame(layerId: number): AnimationFrame + { + if((layerId < 0) || (layerId >= this._layerCount)) return null; + + return this._frames[layerId]; + } + + public setFrame(layerId: number, frame: AnimationFrame): void + { + if((layerId < 0) || (layerId >= this._layerCount)) return; + + const existingFrame = this._frames[layerId]; + + if(existingFrame) existingFrame.recycle(); + + this._frames[layerId] = frame; + } + + public getAnimationPlayed(layerId: number): boolean + { + if((layerId < 0) || (layerId >= this._layerCount)) return true; + + return this._animationPlayed[layerId]; + } + + public setAnimationPlayed(layerId: number, flag: boolean): void + { + if((layerId < 0) || (layerId >= this._layerCount)) return; + + this._animationPlayed[layerId] = flag; + } + + public getLastFramePlayed(layerId: number): boolean + { + if((layerId < 0) || (layerId >= this._layerCount)) return true; + + return this._lastFramePlayed[layerId]; + } + + public setLastFramePlayed(layerId: number, flag: boolean): void + { + if((layerId < 0) || (layerId >= this._layerCount)) return; + + this._lastFramePlayed[layerId] = flag; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/ColorData.ts b/submodules/renderer/src/nitro/room/object/visualization/data/ColorData.ts new file mode 100644 index 0000000..05978b5 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/ColorData.ts @@ -0,0 +1,43 @@ +export class ColorData +{ + public static DEFAULT_COLOR: number = 0xFFFFFF; + + private _colors: number[]; + + constructor(layerCount: number) + { + this._colors = []; + + this.createColors(layerCount); + } + + private createColors(count: number): void + { + if(!count) return; + + for(let i = 0; i < count; i++) this._colors.push(ColorData.DEFAULT_COLOR); + } + + public dispose(): void + { + this._colors = []; + } + + public getLayerColor(layerId: number): number + { + const existing = this._colors[layerId]; + + if(!existing) return ColorData.DEFAULT_COLOR; + + return existing; + } + + public setColorLayer(layerId: number, color: number): void + { + const existing = this._colors[layerId]; + + if(!existing) return; + + this._colors[layerId] = color; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/DirectionData.ts b/submodules/renderer/src/nitro/room/object/visualization/data/DirectionData.ts new file mode 100644 index 0000000..9e25602 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/DirectionData.ts @@ -0,0 +1,196 @@ +import { LayerData } from './LayerData'; + +export class DirectionData +{ + public static USE_DEFAULT_DIRECTION: number = -1; + + private _layers: LayerData[]; + + constructor(layerCount: number) + { + this._layers = []; + + this.createLayers(layerCount); + } + + private createLayers(count: number): void + { + if(!count) return; + + for(let i = 0; i < count; i++) this._layers.push(new LayerData()); + } + + public dispose(): void + { + this._layers = []; + } + + public setFromDirection(directionData: DirectionData): void + { + if(!directionData) return; + + const totalLayers = this.layerCount; + + if(totalLayers !== directionData.layerCount) return; + + for(let i = 0; i < totalLayers; i++) + { + const localLayer = this.getLayer(i); + const directionLayer = directionData.getLayer(i); + + if(!localLayer) continue; + + localLayer.setFromLayer(directionLayer); + } + } + + public getLayer(layerId: number): LayerData + { + const existing = this._layers[layerId]; + + if(!existing) return null; + + return existing; + } + + public getLayerTag(layerId: number): string + { + const existing = this.getLayer(layerId); + + if(!existing) return LayerData.DEFAULT_TAG; + + return existing.tag; + } + + public setLayerTag(layerId: number, tag: string): void + { + const existing = this.getLayer(layerId); + + if(!existing) return; + + existing.tag = tag; + } + + public getLayerInk(layerId: number): number + { + const existing = this.getLayer(layerId); + + if(!existing) return LayerData.DEFAULT_INK; + + return existing.ink; + } + + public setLayerInk(layerId: number, ink: number): void + { + const existing = this.getLayer(layerId); + + if(!existing) return; + + if(isNaN(ink)) return; + + existing.ink = ink; + } + + public getLayerAlpha(layerId: number): number + { + const existing = this.getLayer(layerId); + + if(!existing) return LayerData.DEFAULT_ALPHA; + + return existing.alpha; + } + + public setLayerAlpha(layerId: number, alpha: number): void + { + const existing = this.getLayer(layerId); + + if(!existing) return; + + if(isNaN(alpha)) return; + + existing.alpha = alpha; + } + + public getLayerIgnoreMouse(layerId: number): boolean + { + const existing = this.getLayer(layerId); + + if(!existing) return LayerData.DEFAULT_IGNORE_MOUSE; + + return existing.ignoreMouse; + } + + public setLayerIgnoreMouse(layerId: number, flag: boolean): void + { + const existing = this.getLayer(layerId); + + if(!existing) return; + + existing.ignoreMouse = flag || false; + } + + public getLayerXOffset(layerId: number): number + { + const existing = this.getLayer(layerId); + + if(!existing) return LayerData.DEFAULT_XOFFSET; + + return existing.xOffset; + } + + public setLayerXOffset(layerId: number, offset: number): void + { + const existing = this.getLayer(layerId); + + if(!existing) return; + + if(isNaN(offset)) return; + + existing.xOffset = offset; + } + + public getLayerYOffset(layerId: number): number + { + const existing = this.getLayer(layerId); + + if(!existing) return LayerData.DEFAULT_YOFFSET; + + return existing.yOffset; + } + + public setLayerYOffset(layerId: number, offset: number): void + { + const existing = this.getLayer(layerId); + + if(!existing) return; + + if(isNaN(offset)) return; + + existing.yOffset = offset; + } + + public getLayerZOffset(layerId: number): number + { + const existing = this.getLayer(layerId); + + if(!existing) return LayerData.DEFAULT_ZOFFSET; + + return existing.zOffset; + } + + public setLayerZOffset(layerId: number, offset: number): void + { + const existing = this.getLayer(layerId); + + if(!existing) return; + + if(isNaN(offset)) return; + + existing.zOffset = offset; + } + + public get layerCount(): number + { + return this._layers.length; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/DirectionalOffsetData.ts b/submodules/renderer/src/nitro/room/object/visualization/data/DirectionalOffsetData.ts new file mode 100644 index 0000000..6d1993d --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/DirectionalOffsetData.ts @@ -0,0 +1,35 @@ +export class DirectionalOffsetData +{ + private _offsetX: Map; + private _offsetY: Map; + + constructor() + { + this._offsetX = new Map(); + this._offsetY = new Map(); + } + + public getXOffset(direction: number, defaultX: number): number + { + const existing = this._offsetX.get(direction); + + if(existing === undefined || existing === null) return defaultX; + + return existing; + } + + public getYOffset(direction: number, defaultY: number): number + { + const existing = this._offsetY.get(direction); + + if(existing === undefined || existing === null) return defaultY; + + return existing; + } + + public setDirection(direction: number, offsetX: number, offsetY: number): void + { + this._offsetX.set(direction, offsetX); + this._offsetY.set(direction, offsetY); + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/LayerData.ts b/submodules/renderer/src/nitro/room/object/visualization/data/LayerData.ts new file mode 100644 index 0000000..f7264d6 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/LayerData.ts @@ -0,0 +1,116 @@ +import { BLEND_MODES } from '@pixi/constants'; + +export class LayerData +{ + public static DEFAULT_COUNT: number = 0; + public static DEFAULT_DIRECTION: number = 0; + public static DEFAULT_TAG: string = ''; + public static DEFAULT_INK: number = BLEND_MODES.NORMAL; + public static DEFAULT_ALPHA: number = 255; + public static DEFAULT_IGNORE_MOUSE: boolean = false; + public static DEFAULT_XOFFSET: number = 0; + public static DEFAULT_YOFFSET: number = 0; + public static DEFAULT_ZOFFSET: number = 0; + + private _tag: string; + private _ink: number; + private _alpha: number; + private _ignoreMouse: boolean; + private _xOffset: number; + private _yOffset: number; + private _zOffset: number; + + constructor() + { + this._tag = LayerData.DEFAULT_TAG; + this._ink = LayerData.DEFAULT_INK; + this._alpha = LayerData.DEFAULT_ALPHA; + this._ignoreMouse = LayerData.DEFAULT_IGNORE_MOUSE; + this._xOffset = LayerData.DEFAULT_XOFFSET; + this._yOffset = LayerData.DEFAULT_YOFFSET; + this._zOffset = LayerData.DEFAULT_ZOFFSET; + } + + public setFromLayer(layer: LayerData): void + { + if(!layer) return; + + this._tag = layer.tag; + this._ink = layer.ink; + this._alpha = layer.alpha; + this._ignoreMouse = layer.ignoreMouse; + this._xOffset = layer.xOffset; + this._yOffset = layer.yOffset; + this._zOffset = layer.zOffset; + } + + public get tag(): string + { + return this._tag; + } + + public set tag(tag: string) + { + this._tag = tag; + } + + public get ink(): number + { + return this._ink; + } + + public set ink(ink: number) + { + this._ink = ink; + } + + public get alpha(): number + { + return this._alpha; + } + + public set alpha(alpha: number) + { + this._alpha = alpha; + } + + public get ignoreMouse(): boolean + { + return this._ignoreMouse; + } + + public set ignoreMouse(flag: boolean) + { + this._ignoreMouse = flag; + } + + public get xOffset(): number + { + return this._xOffset; + } + + public set xOffset(offset: number) + { + this._xOffset = offset; + } + + public get yOffset(): number + { + return this._yOffset; + } + + public set yOffset(offset: number) + { + this._yOffset = offset; + } + + public get zOffset(): number + { + return this._zOffset; + } + + public set zOffset(offset: number) + { + this._zOffset = offset; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/ParticleSystemParticle.ts b/submodules/renderer/src/nitro/room/object/visualization/data/ParticleSystemParticle.ts new file mode 100644 index 0000000..0dda906 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/ParticleSystemParticle.ts @@ -0,0 +1,9 @@ +import { IGraphicAsset } from '../../../../../api'; + +export interface ParticleSystemParticle +{ + isEmitter?: boolean; + lifeTime?: number; + fade?: boolean; + frames?: IGraphicAsset[]; +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/PetSizeData.ts b/submodules/renderer/src/nitro/room/object/visualization/data/PetSizeData.ts new file mode 100644 index 0000000..f7263b6 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/PetSizeData.ts @@ -0,0 +1,139 @@ +import { IAssetGesture, IAssetPosture } from '../../../../../api'; +import { AnimationSizeData } from './AnimationSizeData'; + +export class PetSizeData extends AnimationSizeData +{ + public static DEFAULT: number = -1; + + private _posturesToAnimations: Map; + private _gesturesToAnimations: Map; + private _defaultPosture: string; + + constructor(layerCount: number, angle: number) + { + super(layerCount, angle); + + this._posturesToAnimations = new Map(); + this._gesturesToAnimations = new Map(); + this._defaultPosture = null; + } + + public processPostures(postures: { defaultPosture?: string, postures: IAssetPosture[] }): boolean + { + if(!postures) return false; + + if(postures.defaultPosture && postures.defaultPosture.length) this._defaultPosture = postures.defaultPosture; + + if(!postures.postures) return false; + + for(const posture of postures.postures) + { + if(this._posturesToAnimations.get(posture.id)) continue; + + if(this._defaultPosture === null) this._defaultPosture = posture.id; + + this._posturesToAnimations.set(posture.id, posture.animationId); + } + + if(this._posturesToAnimations.get(this._defaultPosture) === undefined) return false; + + return true; + } + + public processGestures(gestures: IAssetGesture[]): boolean + { + if(!gestures) return false; + + for(const gesture of gestures) + { + if(this._gesturesToAnimations.get(gesture.id)) continue; + + this._gesturesToAnimations.set(gesture.id, gesture.animationId); + } + + return true; + } + + public postureToAnimation(posture: string): number + { + if(!this._posturesToAnimations.get(posture)) posture = this._defaultPosture; + + return this._posturesToAnimations.get(posture); + } + + public getGestureDisabled(k: string): boolean + { + if(k === 'ded') return true; + + return false; + } + + public gestureToAnimation(gesture: string): number + { + if(!this._gesturesToAnimations.get(gesture)) return PetSizeData.DEFAULT; + + return this._gesturesToAnimations.get(gesture); + } + + public animationToPosture(k: number, _arg_2: boolean): string + { + if((k >= 0) && (k < this._posturesToAnimations.size)) + { + const keys = this._posturesToAnimations.keys(); + + for(; ;) + { + const key = keys.next(); + + if(key.done) return null; + + if(k <= 0) return key.value; + + --k; + } + } + + return (_arg_2) ? this._defaultPosture : null; + } + + public animationToGesture(index: number): string + { + if((index >= 0) && (index < this._gesturesToAnimations.size)) + { + const keys = this._gesturesToAnimations.keys(); + + for(; ;) + { + const key = keys.next(); + + if(key.done) return null; + + if(index <= 0) return key.value; + + --index; + } + } + + return null; + } + + public getGestureForAnimationId(k: number): string + { + for(const _local_2 of this._gesturesToAnimations.keys()) + { + if(this._gesturesToAnimations.get(_local_2) === k) return _local_2; + } + + return null; + } + + public get totalPostures(): number + { + return this._posturesToAnimations.size; + } + + public get totalGestures(): number + { + return this._gesturesToAnimations.size; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/SizeData.ts b/submodules/renderer/src/nitro/room/object/visualization/data/SizeData.ts new file mode 100644 index 0000000..e37ec68 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/SizeData.ts @@ -0,0 +1,284 @@ +import { IAssetColor, IAssetVisualizationDirection, IAssetVisualizationLayer } from '../../../../../api'; +import { SpriteUtilities } from '../../../../../room'; +import { ColorData } from './ColorData'; +import { DirectionData } from './DirectionData'; +import { LayerData } from './LayerData'; + +export class SizeData +{ + public static MAX_LAYERS: number = 26; + + private _layerCount: number; + private _angle: number; + + private _defaultDirection: DirectionData; + private _directions: Map; + private _colors: ColorData[]; + private _lastDirectionData: DirectionData; + private _lastDirection: number; + + constructor(layerCount: number, angle: number) + { + this._layerCount = ((layerCount < 0) ? 0 : ((layerCount > SizeData.MAX_LAYERS) ? SizeData.MAX_LAYERS : layerCount)); + this._angle = angle < 1 ? 1 : angle > 360 ? 360 : angle; + + this._defaultDirection = new DirectionData(this._layerCount); + this._directions = new Map(); + this._colors = []; + this._lastDirectionData = null; + this._lastDirection = -1; + } + + public dispose(): void + { + if(this._defaultDirection) this._defaultDirection.dispose(); + + for(const direction of this._directions.values()) + { + if(!direction) continue; + + direction.dispose(); + } + + for(const color of this._colors) + { + if(!color) continue; + + color.dispose(); + } + + this.reset(); + } + + protected reset(): void + { + this._defaultDirection = null; + this._colors = []; + this._lastDirectionData = null; + this._lastDirection = -1; + + this._directions.clear(); + } + + public processLayers(layers: { [index: string]: IAssetVisualizationLayer }): boolean + { + if(!layers) return false; + + return this.setDirectionLayers(this._defaultDirection, layers); + } + + public processDirections(directions: { [index: string]: IAssetVisualizationDirection }): boolean + { + if(!directions) return false; + + for(const key in directions) + { + const direction = directions[key]; + + if(!direction) continue; + + const directionNumber = parseInt(key); + + if(this._directions.get(directionNumber)) return false; + + const directionData = new DirectionData(this._layerCount); + + directionData.setFromDirection(this._defaultDirection); + + this.setDirectionLayers(directionData, direction.layers); + + this._directions.set(directionNumber, directionData); + + this._lastDirectionData = null; + this._lastDirection = -1; + } + + return true; + } + + public processColors(colors: { [index: string]: IAssetColor }): boolean + { + if(!colors) return false; + + for(const key in colors) + { + const color = colors[key]; + + if(!color) continue; + + const colorNumber = parseInt(key); + + if(this._colors[colorNumber]) return false; + + const colorData = new ColorData(this._layerCount); + + for(const layer in color.layers) + { + const colorLayer = color.layers[layer]; + + if(!colorLayer) continue; + + const layerId = parseInt(layer); + const colorId = colorLayer.color; + + colorData.setColorLayer(layerId, colorId); + } + + this._colors[colorNumber] = colorData; + } + + return true; + } + + private setDirectionLayers(directionData: DirectionData, layers: { [index: string]: IAssetVisualizationLayer }): boolean + { + if(!directionData || !layers) return false; + + for(const key in layers) + { + const layer = layers[key]; + + if(!layer) continue; + + const layerId = parseInt(key); + + if(layerId < 0 || (layerId >= this._layerCount)) return false; + + if(layer.ink !== undefined) directionData.setLayerInk(layerId, SpriteUtilities.inkToBlendMode(layer.ink)); + + if(layer.tag !== undefined) directionData.setLayerTag(layerId, layer.tag); + + if(layer.alpha !== undefined) directionData.setLayerAlpha(layerId, layer.alpha); + + if(layer.ignoreMouse !== undefined) directionData.setLayerIgnoreMouse(layerId, layer.ignoreMouse); + + if(layer.x !== undefined) directionData.setLayerXOffset(layerId, layer.x); + + if(layer.y !== undefined) directionData.setLayerYOffset(layerId, layer.y); + + if(layer.z !== undefined) directionData.setLayerZOffset(layerId, (layer.z / -1000)); + } + + return true; + } + + public getValidDirection(direction: number): number + { + const existing = this._directions.get(direction); + + if(existing) return direction; + + direction = (((direction % 360) + 360) % 360); + + let currentAngle = -1; + let validDirection = -1; + + for(const key of this._directions.keys()) + { + let angle = ((((key * this._angle) - direction) + 360) % 360); + + if(angle > 180) angle = (360 - angle); + + if((angle < currentAngle) || (currentAngle < 0)) + { + currentAngle = angle; + validDirection = key; + } + } + + if(validDirection >= 0) return Math.trunc(validDirection); + + return 0; + } + + public getDirectionData(direction: number): DirectionData + { + if(direction === this._lastDirection && this._lastDirectionData) return this._lastDirectionData; + + let directionData = this._directions.get(direction); + + if(!directionData) directionData = this._defaultDirection; + + this._lastDirection = direction; + this._lastDirectionData = directionData; + + return this._lastDirectionData; + } + + public getLayerTag(direction: number, layerId: number): string + { + const directionData = this.getDirectionData(direction); + + if(!directionData) return LayerData.DEFAULT_TAG; + + return directionData.getLayerTag(layerId); + } + + public getLayerInk(direction: number, layerId: number): number + { + const directionData = this.getDirectionData(direction); + + if(!directionData) return LayerData.DEFAULT_INK; + + return directionData.getLayerInk(layerId); + } + + public getLayerAlpha(direction: number, layerId: number): number + { + const directionData = this.getDirectionData(direction); + + if(!directionData) return LayerData.DEFAULT_ALPHA; + + return directionData.getLayerAlpha(layerId); + } + + public getLayerColor(layerId: number, colorId: number): number + { + const existing = this._colors[colorId] as ColorData; + + if(!existing) return ColorData.DEFAULT_COLOR; + + return existing.getLayerColor(layerId); + } + + public getLayerIgnoreMouse(direction: number, layerId: number): boolean + { + const directionData = this.getDirectionData(direction); + + if(!directionData) return LayerData.DEFAULT_IGNORE_MOUSE; + + return directionData.getLayerIgnoreMouse(layerId); + } + + public getLayerXOffset(direction: number, layerId: number): number + { + const directionData = this.getDirectionData(direction); + + if(!directionData) return LayerData.DEFAULT_XOFFSET; + + return directionData.getLayerXOffset(layerId); + } + + public getLayerYOffset(direction: number, layerId: number): number + { + const directionData = this.getDirectionData(direction); + + if(!directionData) return LayerData.DEFAULT_YOFFSET; + + return directionData.getLayerYOffset(layerId); + } + + public getLayerZOffset(direction: number, layerId: number): number + { + const directionData = this.getDirectionData(direction); + + if(!directionData) return LayerData.DEFAULT_ZOFFSET; + + return directionData.getLayerZOffset(layerId); + } + + public get layerCount(): number + { + return this._layerCount; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/data/index.ts b/submodules/renderer/src/nitro/room/object/visualization/data/index.ts new file mode 100644 index 0000000..22cf006 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/data/index.ts @@ -0,0 +1,15 @@ +export * from './AnimationData'; +export * from './AnimationFrame'; +export * from './AnimationFrameData'; +export * from './AnimationFrameDirectionalData'; +export * from './AnimationFrameSequenceData'; +export * from './AnimationLayerData'; +export * from './AnimationSizeData'; +export * from './AnimationStateData'; +export * from './ColorData'; +export * from './DirectionalOffsetData'; +export * from './DirectionData'; +export * from './LayerData'; +export * from './ParticleSystemParticle'; +export * from './PetSizeData'; +export * from './SizeData'; diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualization.ts new file mode 100644 index 0000000..2767e5a --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualization.ts @@ -0,0 +1,411 @@ +import { IObjectVisualizationData, RoomObjectVariable, RoomObjectVisualizationType } from '../../../../../api'; +import { AnimationData, AnimationFrame, AnimationStateData } from '../data'; +import { FurnitureAnimatedVisualizationData } from './FurnitureAnimatedVisualizationData'; +import { FurnitureVisualization } from './FurnitureVisualization'; + +export class FurnitureAnimatedVisualization extends FurnitureVisualization +{ + public static TYPE: string = RoomObjectVisualizationType.FURNITURE_ANIMATED; + public static DEFAULT_ANIMATION_ID: number = 0; + + protected _state: number; + protected _frameIncrease: number; + private _animationData: AnimationStateData; + private _animationScale: number; + private _animationChangeTime: number; + private _animatedLayerCount: number; + private _directionChanged: boolean; + + constructor() + { + super(); + + this._state = -1; + this._frameIncrease = 1; + this._animationData = new AnimationStateData(); + this._animationScale = 0; + this._animationChangeTime = 0; + this._animatedLayerCount = 0; + this._directionChanged = false; + } + + public initialize(data: IObjectVisualizationData): boolean + { + if(!(data instanceof FurnitureAnimatedVisualizationData)) return false; + + return super.initialize(data); + } + + public dispose(): void + { + super.dispose(); + + if(this._animationData) + { + this._animationData.dispose(); + + this._animationData = null; + } + } + + protected get animatedLayerCount(): number + { + return this._animatedLayerCount; + } + + public get animationId(): number + { + return this._animationData.animationId; + } + + protected getAnimationId(animationData: AnimationStateData): number + { + if((this.animationId !== FurnitureAnimatedVisualization.DEFAULT_ANIMATION_ID) && this.data.hasAnimation(this._animationScale, this.animationId)) return this.animationId; + + return FurnitureAnimatedVisualization.DEFAULT_ANIMATION_ID; + } + + protected updateObject(scale: number, direction: number): boolean + { + if(super.updateObject(scale, direction)) + { + const state = this.object.getState(0); + + if(state !== this._state) + { + this.setAnimation(state); + + this._state = state; + + this._animationChangeTime = (this.object.model.getValue(RoomObjectVariable.FURNITURE_STATE_UPDATE_TIME) || 0); + } + + return true; + } + + return false; + } + + protected updateModel(scale: number): boolean + { + if(super.updateModel(scale)) + { + if(this.usesAnimationResetting()) + { + const updateTime = this.object.model.getValue(RoomObjectVariable.FURNITURE_STATE_UPDATE_TIME); + + if(updateTime > this._animationChangeTime) + { + this._animationChangeTime = updateTime; + + this.setAnimation(this._state); + } + } + + const state = this.object.model.getValue(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX); + + if(!isNaN(state)) + { + const animationId = this.data.getAnimationId(this._animationScale, state); + + this.setAnimation(animationId); + } + + return true; + } + + return false; + } + + private isPlayingTransition(animationData: AnimationStateData, animationId: number): boolean + { + if(!AnimationData.isTransitionFromAnimation(animationData.animationId) && !AnimationData.isTransitionToAnimation(animationData.animationId)) return false; + + if(animationId !== animationData.animationAfterTransitionId) return false; + + if(animationData.animationOver) return false; + + return true; + } + + private getCurrentState(animationData: AnimationStateData): number + { + const animationId = animationData.animationId; + + if(!AnimationData.isTransitionFromAnimation(animationId) && !AnimationData.isTransitionToAnimation(animationId)) return animationId; + + return animationData.animationAfterTransitionId; + } + + protected setAnimation(animationId: number): void + { + if(!this.data) return; + + this.setSubAnimation(this._animationData, animationId, (this._state >= 0)); + } + + protected setSubAnimation(animationData: AnimationStateData, animationId: number, _arg_3: boolean = true): boolean + { + const currentAnimation = animationData.animationId; + + if(_arg_3) + { + if(this.isPlayingTransition(animationData, animationId)) return false; + + const state = this.getCurrentState(animationData); + + if(animationId !== state) + { + if(!this.data.isImmediateChange(this._animationScale, animationId, state)) + { + let transition = AnimationData.getTransitionFromAnimationId(state); + + if(this.data.hasAnimation(this._animationScale, transition)) + { + animationData.animationAfterTransitionId = animationId; + animationId = transition; + } + else + { + transition = AnimationData.getTransitionToAnimationId(animationId); + + if(this.data.hasAnimation(this._animationScale, transition)) + { + animationData.animationAfterTransitionId = animationId; + animationId = transition; + } + } + } + } + else + { + if(AnimationData.isTransitionFromAnimation(animationData.animationId)) + { + const transition = AnimationData.getTransitionToAnimationId(animationId); + + if(this.data.hasAnimation(this._animationScale, transition)) + { + animationData.animationAfterTransitionId = animationId; + animationId = transition; + } + } + + else if(!AnimationData.isTransitionToAnimation(animationData.animationId)) + { + if(this.usesAnimationResetting()) + { + const transition = AnimationData.getTransitionFromAnimationId(state); + + if(this.data.hasAnimation(this._animationScale, transition)) + { + animationData.animationAfterTransitionId = animationId; + animationId = transition; + } + else + { + const transition = AnimationData.getTransitionToAnimationId(animationId); + + if(this.data.hasAnimation(this._animationScale, transition)) + { + animationData.animationAfterTransitionId = animationId; + animationId = transition; + } + } + } + } + } + } + + if(currentAnimation !== animationId) + { + animationData.animationId = animationId; + + return true; + } + + return false; + } + + protected getLastFramePlayed(layerId: number): boolean + { + return this._animationData.getLastFramePlayed(layerId); + } + + protected resetAllAnimationFrames(): void + { + if(!this._animationData) return; + + this._animationData.setLayerCount(this._animatedLayerCount); + } + + protected updateAnimation(scale: number): number + { + if(!this.data) return 0; + + if(scale !== this._animationScale) + { + this._animationScale = scale; + this._animatedLayerCount = this.data.getLayerCount(scale); + + this.resetAllAnimationFrames(); + } + + const update = this.updateAnimations(scale); + + this._directionChanged = false; + + return update; + } + + protected updateAnimations(scale: number): number + { + if(this._animationData.animationOver && !this._directionChanged) return 0; + + const update = this.updateFramesForAnimation(this._animationData, scale); + + if(this._animationData.animationOver) + { + if((AnimationData.isTransitionFromAnimation(this._animationData.animationId)) || (AnimationData.isTransitionToAnimation(this._animationData.animationId))) + { + this.setAnimation(this._animationData.animationAfterTransitionId); + this._animationData.animationOver = false; + } + } + + return update; + } + + protected updateFramesForAnimation(animationData: AnimationStateData, scale: number): number + { + if(animationData.animationOver && !this._directionChanged) return 0; + + const animationId = this.getAnimationId(animationData); + let frameCount = animationData.frameCounter; + + if(!frameCount) frameCount = this.data.getStartFrame(scale, animationId, this._direction); + + frameCount += this.frameIncrease; + animationData.frameCounter = frameCount; + animationData.animationOver = true; + + let animationPlayed = false; + let layerId = (this._animatedLayerCount - 1); + let update = 0; + let layerUpdate = (1 << (this._animatedLayerCount - 1)); + + while(layerId >= 0) + { + let sequenceId = 0; + + animationPlayed = animationData.getAnimationPlayed(layerId); + + if(!animationPlayed || this._directionChanged) + { + let lastFramePlayed = animationData.getLastFramePlayed(layerId); + let frame = animationData.getFrame(layerId); + + if(frame) + { + if(frame.isLastFrame && (frame.remainingFrameRepeats <= this.frameIncrease)) + { + lastFramePlayed = true; + } + } + + if((this._directionChanged || !frame) || ((frame.remainingFrameRepeats >= 0) && ((frame.remainingFrameRepeats = (frame.remainingFrameRepeats - this.frameIncrease)) <= 0))) + { + sequenceId = AnimationFrame.SEQUENCE_NOT_DEFINED; + + if(frame) sequenceId = frame.activeSequence; + + if(sequenceId === AnimationFrame.SEQUENCE_NOT_DEFINED) + { + frame = this.data.getFrame(scale, animationId, this._direction, layerId, frameCount); + } + else + { + frame = this.data.getFrameFromSequence(scale, animationId, this._direction, layerId, sequenceId, (frame.activeSequenceOffset + frame.repeats), frameCount); + } + + animationData.setFrame(layerId, frame); + + update = (update | layerUpdate); + } + + if(!frame || (frame.remainingFrameRepeats == AnimationFrame.FRAME_REPEAT_FOREVER)) + { + lastFramePlayed = true; + animationPlayed = true; + } + else + { + animationData.animationOver = false; + } + + animationData.setLastFramePlayed(layerId, lastFramePlayed); + animationData.setAnimationPlayed(layerId, animationPlayed); + } + + layerUpdate = (layerUpdate >> 1); + + layerId--; + } + + return update; + } + + protected getFrameNumber(scale: number, layerId: number): number + { + const currentFrame = this._animationData.getFrame(layerId); + + if(!currentFrame) return super.getFrameNumber(scale, layerId); + + return currentFrame.id; + } + + protected getLayerXOffset(scale: number, direction: number, layerId: number): number + { + const offset = super.getLayerXOffset(scale, direction, layerId); + + const currentFrame = this._animationData.getFrame(layerId); + + if(!currentFrame) return offset; + + return (offset + currentFrame.x); + } + + protected getLayerYOffset(scale: number, direction: number, layerId: number): number + { + const offset = super.getLayerYOffset(scale, direction, layerId); + + const currentFrame = this._animationData.getFrame(layerId); + + if(!currentFrame) return offset; + + return (offset + currentFrame.y); + } + + protected usesAnimationResetting(): boolean + { + return false; + } + + protected setDirection(direction: number): void + { + if(this._direction === direction) return; + + super.setDirection(direction); + + this._directionChanged = true; + } + + protected get frameIncrease(): number + { + return this._frameIncrease; + } + + protected get data(): FurnitureAnimatedVisualizationData + { + return this._data as FurnitureAnimatedVisualizationData; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualizationData.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualizationData.ts new file mode 100644 index 0000000..675d19b --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualizationData.ts @@ -0,0 +1,90 @@ +import { AnimationFrame, AnimationSizeData, SizeData } from '../data'; +import { FurnitureVisualizationData } from './FurnitureVisualizationData'; + +export class FurnitureAnimatedVisualizationData extends FurnitureVisualizationData +{ + protected createSizeData(scale: number, layerCount: number, angle: number): SizeData + { + return new AnimationSizeData(layerCount, angle); + } + + protected processVisualElement(sizeData: SizeData, key: string, data: any): boolean + { + if(!sizeData || !key || !data) return false; + + switch(key) + { + case 'animations': + if(!(sizeData instanceof AnimationSizeData) || !sizeData.defineAnimations(data)) return false; + break; + default: + if(!super.processVisualElement(sizeData, key, data)) return false; + break; + } + + return true; + } + + public hasAnimation(scale: number, animationId: number): boolean + { + const size = this.getSizeData(scale) as AnimationSizeData; + + if(!size) return null; + + return size.hasAnimation(animationId); + } + + public getAnimationCount(scale: number): number + { + const size = this.getSizeData(scale) as AnimationSizeData; + + if(!size) return null; + + return size.getAnimationCount(); + } + + public getAnimationId(scale: number, animationId: number): number + { + const size = this.getSizeData(scale) as AnimationSizeData; + + if(!size) return null; + + return size.getAnimationId(animationId); + } + + public isImmediateChange(scale: number, animationId: number, _arg_3: number): boolean + { + const size = this.getSizeData(scale) as AnimationSizeData; + + if(!size) return null; + + return size.isImmediateChange(animationId, _arg_3); + } + + public getStartFrame(scale: number, animationId: number, direction: number): number + { + const size = this.getSizeData(scale) as AnimationSizeData; + + if(!size) return null; + + return size.getStartFrame(animationId, direction); + } + + public getFrame(scale: number, animationId: number, direction: number, layerId: number, frameCount: number): AnimationFrame + { + const size = this.getSizeData(scale) as AnimationSizeData; + + if(!size) return null; + + return size.getFrame(animationId, direction, layerId, frameCount); + } + + public getFrameFromSequence(scale: number, animationId: number, direction: number, layerId: number, sequenceId: number, offset: number, frameCount: number): AnimationFrame + { + const size = this.getSizeData(scale) as AnimationSizeData; + + if(!size) return null; + + return size.getFrameFromSequence(animationId, direction, layerId, sequenceId, offset, frameCount); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureBBVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureBBVisualization.ts new file mode 100644 index 0000000..b534565 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureBBVisualization.ts @@ -0,0 +1,19 @@ +import { FurnitureBrandedImageVisualization } from './FurnitureBrandedImageVisualization'; + +export class FurnitureBBVisualization extends FurnitureBrandedImageVisualization +{ + protected getLayerXOffset(scale: number, direction: number, layerId: number): number + { + return super.getLayerXOffset(scale, direction, layerId) + this._offsetX; + } + + protected getLayerYOffset(scale: number, direction: number, layerId: number): number + { + return super.getLayerYOffset(scale, direction, layerId) + this._offsetY; + } + + protected getLayerZOffset(scale: number, direction: number, layerId: number): number + { + return super.getLayerZOffset(scale, direction, layerId) + this._offsetZ; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureBadgeDisplayVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureBadgeDisplayVisualization.ts new file mode 100644 index 0000000..ba2169b --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureBadgeDisplayVisualization.ts @@ -0,0 +1,99 @@ +import { RoomObjectVariable } from '../../../../../api'; +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class FurnitureBadgeDisplayVisualization extends FurnitureAnimatedVisualization +{ + private static BADGE: string = 'BADGE'; + + private _badgeId: string; + private _badgeAssetNameNormalScale: string; + private _badgeAssetNameSmallScale: string; + private _badgeVisibleInState: number; + + constructor() + { + super(); + + this._badgeId = ''; + this._badgeAssetNameNormalScale = ''; + this._badgeAssetNameSmallScale = ''; + this._badgeVisibleInState = -1; + } + + protected updateModel(scale: number): boolean + { + let updateModel = super.updateModel(scale); + + const badgeStatus = this.object.model.getValue(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS); + const badgeId = this.object.model.getValue(RoomObjectVariable.FURNITURE_BADGE_ASSET_NAME); + + if(badgeStatus === -1) + { + this._badgeAssetNameNormalScale = ''; + this._badgeAssetNameSmallScale = ''; + } + + else if((badgeStatus === 1) && (badgeId !== this._badgeId)) + { + this._badgeId = badgeId; + this._badgeAssetNameNormalScale = this._badgeId; + + if(this._badgeAssetNameSmallScale === '') this._badgeAssetNameSmallScale = this._badgeAssetNameNormalScale + '_32'; + + const visibleInState = this.object.model.getValue(RoomObjectVariable.FURNITURE_BADGE_VISIBLE_IN_STATE); + + if(!isNaN(visibleInState)) this._badgeVisibleInState = visibleInState; + + updateModel = true; + } + + return updateModel; + } + + protected getSpriteAssetName(scale: number, layerId: number): string + { + const tag = this.getLayerTag(scale, this.direction, layerId); + + if((tag !== FurnitureBadgeDisplayVisualization.BADGE) || ((this._badgeVisibleInState !== -1) && (this.object.getState(0) !== this._badgeVisibleInState))) return super.getSpriteAssetName(scale, layerId); + + if(scale === 32) return this._badgeAssetNameSmallScale; + + return this._badgeAssetNameNormalScale; + } + + protected getLayerXOffset(scale: number, direction: number, layerId: number): number + { + let offset = super.getLayerXOffset(scale, direction, layerId); + + if(this.getLayerTag(scale, direction, layerId) === FurnitureBadgeDisplayVisualization.BADGE) + { + const asset = this.getAsset(((scale === 32) ? this._badgeAssetNameSmallScale : this._badgeAssetNameNormalScale), layerId); + + if(asset) + { + if(scale === 64) offset += ((40 - asset.width) / 2); + else offset += ((20 - asset.width) / 2); + } + } + + return offset; + } + + protected getLayerYOffset(scale: number, direction: number, layerId: number): number + { + let offset = super.getLayerYOffset(scale, direction, layerId); + + if(this.getLayerTag(scale, direction, layerId) === FurnitureBadgeDisplayVisualization.BADGE) + { + const asset = this.getAsset(((scale === 32) ? this._badgeAssetNameSmallScale : this._badgeAssetNameNormalScale), layerId); + + if(asset) + { + if(scale === 64) offset += ((40 - asset.height) / 2); + else offset += ((20 - asset.height) / 2); + } + } + + return offset; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureBottleVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureBottleVisualization.ts new file mode 100644 index 0000000..344eefe --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureBottleVisualization.ts @@ -0,0 +1,62 @@ +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class FurnitureBottleVisualization extends FurnitureAnimatedVisualization +{ + private static ANIMATION_ID_OFFSET_SLOW1: number = 20; + private static ANIMATION_ID_OFFSET_SLOW2: number = 9; + private static ANIMATION_ID_ROLL: number = -1; + + private _stateQueue: number[]; + private _running: boolean; + + constructor() + { + super(); + + this._stateQueue = []; + this._running = false; + } + + protected setAnimation(animationId: number): void + { + if(animationId === -1) + { + if(!this._running) + { + this._running = true; + this._stateQueue = []; + + this._stateQueue.push(FurnitureBottleVisualization.ANIMATION_ID_ROLL); + + return; + } + } + + if((animationId >= 0) && (animationId <= 7)) + { + if(this._running) + { + this._running = false; + this._stateQueue = []; + + this._stateQueue.push(FurnitureBottleVisualization.ANIMATION_ID_OFFSET_SLOW1); + this._stateQueue.push(FurnitureBottleVisualization.ANIMATION_ID_OFFSET_SLOW2 + animationId); + this._stateQueue.push(animationId); + + return; + } + + super.setAnimation(animationId); + } + } + + protected updateAnimation(scale: number): number + { + if(this.getLastFramePlayed(0)) + { + if(this._stateQueue.length) super.setAnimation(this._stateQueue.shift()); + } + + return super.updateAnimation(scale); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureBrandedImageVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureBrandedImageVisualization.ts new file mode 100644 index 0000000..a449b28 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureBrandedImageVisualization.ts @@ -0,0 +1,304 @@ +import { Resource, Texture } from '@pixi/core'; +import { GetAssetManager, GraphicAssetGifCollection, RoomObjectVariable } from '../../../../../api'; +import { Nitro } from '../../../../Nitro'; +import { FurnitureVisualization } from './FurnitureVisualization'; + +export class FurnitureBrandedImageVisualization extends FurnitureVisualization +{ + protected static BRANDED_IMAGE: string = 'branded_image'; + protected static STATE_0: number = 0; + protected static STATE_1: number = 1; + protected static STATE_2: number = 2; + protected static STATE_3: number = 3; + + protected _imageUrl: string; + protected _shortUrl: string; + protected _imageReady: boolean; + protected _isAnimated: boolean; + protected _gifCollection: GraphicAssetGifCollection; + + protected _offsetX: number; + protected _offsetY: number; + protected _offsetZ: number; + protected _currentFrame: number; + protected _totalFrames: number; + + constructor() + { + super(); + + this._imageUrl = null; + this._shortUrl = null; + this._imageReady = false; + this._isAnimated = false; + this._gifCollection = null; + + this._offsetX = 0; + this._offsetY = 0; + this._offsetZ = 0; + this._currentFrame = -1; + this._totalFrames = -1; + } + + public dispose(): void + { + super.dispose(); + + if(this._imageUrl) + { + (this.asset && this.asset.disposeAsset(this._imageUrl)); + // dispose all + } + } + + protected updateObject(scale: number, direction: number): boolean + { + if(!super.updateObject(scale, direction)) return false; + + if(this._imageReady) this.checkAndCreateImageForCurrentState(); + + return true; + } + + protected updateModel(scale: number): boolean + { + const flag = super.updateModel(scale); + + if(flag) + { + this._offsetX = (this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_X) || 0); + this._offsetY = (this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_Y) || 0); + this._offsetZ = (this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_Z) || 0); + this._isAnimated = (this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_IS_ANIMATED) || false); + } + + if(!this._imageReady) + { + this._imageReady = this.checkIfImageReady(); + + if(this._imageReady) + { + this.checkAndCreateImageForCurrentState(); + + return true; + } + } + else + { + if(this.checkIfImageChanged()) + { + this._imageReady = false; + this._imageUrl = null; + + return true; + } + } + + return flag; + } + + private checkIfImageChanged(): boolean + { + const imageUrl = this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_URL); + + if(imageUrl && (imageUrl === this._imageUrl)) return false; + + if(this._gifCollection) + { + // + } + + (this.asset && this.asset.disposeAsset(this._imageUrl)); + + // dispose all + + return true; + } + + protected checkIfImageReady(): boolean + { + const model = this.object && this.object.model; + + if(!model) return false; + + const imageUrl = this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_URL); + + if(!imageUrl) return false; + + if(this._imageUrl && (this._imageUrl === imageUrl)) return false; + + const imageStatus = this.object.model.getValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_STATUS); + + if(imageStatus === 1) + { + let texture: Texture = null; + + if(this._isAnimated) + { + const gifCollection = Nitro.instance.roomEngine.roomContentLoader.getGifCollection(imageUrl); + + if(gifCollection) + { + this._gifCollection = gifCollection; + + texture = gifCollection.textures[0]; + } + } + else + { + texture = GetAssetManager().getTexture(imageUrl); + } + + if(!texture) return false; + + this.imageReady(texture, imageUrl); + + return true; + } + + return false; + } + + protected imageReady(texture: Texture, imageUrl: string): void + { + if(!texture) + { + this._imageUrl = null; + + return; + } + + this._imageUrl = imageUrl; + } + + protected checkAndCreateImageForCurrentState(): void + { + if(this._isAnimated) + { + this.buildAssetsForGif(); + + return; + } + + if(!this._imageUrl) return; + + const texture = GetAssetManager().getTexture(this._imageUrl); + + if(!texture) return; + + const state = this.object.getState(0); + + this.addBackgroundAsset(texture, state, 0); + } + + protected buildAssetsForGif(): void + { + if(!this._gifCollection) return; + + const textures = this._gifCollection.textures; + const durations = this._gifCollection.durations; + + if(!textures.length || !durations.length || (textures.length !== durations.length)) return; + + const state = this.object.getState(0); + + for(let i = 0; i < textures.length; i++) + { + const texture = textures[i]; + const duration = durations[i]; + + if(!texture) continue; + + this.addBackgroundAsset(texture, state, i); + } + + this._currentFrame = -1; + this._totalFrames = textures.length; + } + + protected addBackgroundAsset(texture: Texture, state: number, frame: number): void + { + let x = 0; + let y = 0; + let flipH = false; + let flipV = false; + + switch(state) + { + case FurnitureBrandedImageVisualization.STATE_0: + x = 0; + y = 0; + flipH = false; + flipV = false; + break; + case FurnitureBrandedImageVisualization.STATE_1: + x = -(texture.width); + y = 0; + flipH = true; + flipV = false; + break; + case FurnitureBrandedImageVisualization.STATE_2: + x = -(texture.width); + y = -(texture.height); + flipH = true; + flipV = true; + break; + case FurnitureBrandedImageVisualization.STATE_3: + x = 0; + y = -(texture.height); + flipH = false; + flipV = true; + break; + } + + this.asset.addAsset(`${this._imageUrl}_${frame}`, texture, true, x, y, flipH, flipV); + } + + protected getSpriteAssetName(scale: number, layerId: number): string + { + const tag = this.getLayerTag(scale, this._direction, layerId); + + if((tag === FurnitureBrandedImageVisualization.BRANDED_IMAGE) && this._imageUrl) + { + return `${this._imageUrl}_${this.getFrameNumber(scale, layerId)}`; + } + + return super.getSpriteAssetName(scale, layerId); + } + + protected updateAnimation(scale: number): number + { + if(!this._imageReady || !this._isAnimated || (this._totalFrames <= 0)) return 0; + + return 1; + } + + protected getFrameNumber(scale: number, layerId: number): number + { + if(!this._imageReady || !this._isAnimated || (this._totalFrames <= 0)) return 0; + + const tag = this.getLayerTag(scale, this._direction, layerId); + + if((tag === FurnitureBrandedImageVisualization.BRANDED_IMAGE) && this._imageUrl) + { + let newFrame = this._currentFrame; + + if(newFrame < 0) + { + newFrame = 0; + } + else + { + newFrame += 1; + } + + if(newFrame === this._totalFrames) newFrame = 0; + + this._currentFrame = newFrame; + + return this._currentFrame; + } + + return 0; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureBuilderPlaceholderVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureBuilderPlaceholderVisualization.ts new file mode 100644 index 0000000..ce769c0 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureBuilderPlaceholderVisualization.ts @@ -0,0 +1,6 @@ +import { FurnitureVisualization } from './FurnitureVisualization'; + +export class FurnitureBuilderPlaceholderVisualization extends FurnitureVisualization +{ + +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureCounterClockVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureCounterClockVisualization.ts new file mode 100644 index 0000000..22ca401 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureCounterClockVisualization.ts @@ -0,0 +1,29 @@ +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class FurnitureCounterClockVisualization extends FurnitureAnimatedVisualization +{ + private static SECONDS_SPRITE: string = 'seconds_sprite'; + private static TEN_SECONDS_SPRITE: string = 'ten_seconds_sprite'; + private static MINUTES_SPRITE: string = 'minutes_sprite'; + private static TEN_MINUTES_SPRITE: string = 'ten_minutes_sprite'; + + protected getFrameNumber(scale: number, layerId: number): number + { + const tag = this.getLayerTag(scale, this.direction, layerId); + const animation = this.object.getState(0); + + switch(tag) + { + case FurnitureCounterClockVisualization.SECONDS_SPRITE: return Math.floor((animation % 60) % 10); + case FurnitureCounterClockVisualization.TEN_SECONDS_SPRITE: return Math.floor((animation % 60) / 10); + case FurnitureCounterClockVisualization.MINUTES_SPRITE: return Math.floor((animation / 60) % 10); + case FurnitureCounterClockVisualization.TEN_MINUTES_SPRITE: return Math.floor(((animation / 60) / 10) % 10); + default: return super.getFrameNumber(scale, layerId); + } + } + + public get animationId(): number + { + return 0; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureCuboidVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureCuboidVisualization.ts new file mode 100644 index 0000000..41f0e77 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureCuboidVisualization.ts @@ -0,0 +1,6 @@ +import { RoomObjectSpriteVisualization } from '../../../../../room'; + +export class FurnitureCuboidVisualization extends RoomObjectSpriteVisualization +{ + +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureDynamicThumbnailVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureDynamicThumbnailVisualization.ts new file mode 100644 index 0000000..a3b266a --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureDynamicThumbnailVisualization.ts @@ -0,0 +1,57 @@ +import { SCALE_MODES } from '@pixi/constants'; +import { Texture } from '@pixi/core'; +import { IsometricImageFurniVisualization } from './IsometricImageFurniVisualization'; + +export class FurnitureDynamicThumbnailVisualization extends IsometricImageFurniVisualization +{ + private _cachedUrl: string; + + constructor() + { + super(); + + this._cachedUrl = null; + this._hasOutline = true; + } + + protected updateModel(scale: number): boolean + { + if(this.object) + { + const thumbnailUrl = this.getThumbnailURL(); + + if(this._cachedUrl !== thumbnailUrl) + { + this._cachedUrl = thumbnailUrl; + + if(this._cachedUrl && (this._cachedUrl !== '')) + { + const image = new Image(); + + image.src = thumbnailUrl; + image.crossOrigin = '*'; + + image.onload = () => + { + const texture = Texture.from(image); + + texture.baseTexture.scaleMode = SCALE_MODES.LINEAR; + + this.setThumbnailImages(texture); + }; + } + else + { + this.setThumbnailImages(null); + } + } + } + + return super.updateModel(scale); + } + + protected getThumbnailURL(): string + { + throw (new Error('This method must be overridden!')); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureExternalImageVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureExternalImageVisualization.ts new file mode 100644 index 0000000..99efd9f --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureExternalImageVisualization.ts @@ -0,0 +1,51 @@ +import { RoomObjectVariable } from '../../../../../api'; +import { FurnitureDynamicThumbnailVisualization } from './FurnitureDynamicThumbnailVisualization'; + +export class FurnitureExternalImageVisualization extends FurnitureDynamicThumbnailVisualization +{ + private _url: string; + private _typePrefix: string; + + constructor() + { + super(); + + this._url = null; + this._typePrefix = null; + } + + protected getThumbnailURL(): string + { + if(!this.object) return null; + + if(this._url) return this._url; + + const jsonString = this.object.model.getValue(RoomObjectVariable.FURNITURE_DATA); + + if(!jsonString || jsonString === '') return null; + + if(this.object.type.indexOf('') >= 0) + { + this._typePrefix = (this.object.type.indexOf('') >= 0) ? '' : 'postcards/selfie/'; + } + + const json = JSON.parse(jsonString); + + let url = (json.w || ''); + + url = this.buildThumbnailUrl(url); + + this._url = url; + + return this._url; + } + + private buildThumbnailUrl(url: string): string + { + url = url.replace('.png', '_small.png'); + + if(url.indexOf('.png') === -1) url = (url + '_small.png'); + + return url; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts new file mode 100644 index 0000000..a5d7bea --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts @@ -0,0 +1,109 @@ +import { AdvancedMap, IAdvancedMap, IParticleSystem, NitroLogger, RoomObjectVariable } from '../../../../../api'; +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; +import { FurnitureParticleSystem } from './FurnitureParticleSystem'; + +export class FurnitureFireworksVisualization extends FurnitureAnimatedVisualization +{ + private _particleSystems: IAdvancedMap; + private _currentParticleSystem: FurnitureParticleSystem; + + public dispose(): void + { + super.dispose(); + + this._currentParticleSystem = null; + + if(this._particleSystems) + { + for(const particleSystem of this._particleSystems.getValues()) particleSystem.dispose(); + + this._particleSystems = null; + } + } + + protected updateObject(scale: number, direction: number): boolean + { + if(super.updateObject(scale, direction)) + { + if(!this._particleSystems) + { + this.readDefinition(); + + if(this._particleSystems) this._currentParticleSystem = this._particleSystems.getValue(scale); + + else NitroLogger.log('ERROR Particle systems could not be read!', this.object.type); + } + else + { + if((scale !== this._scale) || (this._particleSystems.getValue(scale) !== this._currentParticleSystem)) + { + const particleSystem = this._particleSystems.getValue(scale); + + particleSystem.copyStateFrom(this._currentParticleSystem); + + if(this._currentParticleSystem) this._currentParticleSystem.reset(); + + this._currentParticleSystem = particleSystem; + } + } + + return true; + } + + return false; + } + + protected updateSprites(scale: number, update: boolean, animation: number): void + { + super.updateSprites(scale, update, animation); + + if(this._currentParticleSystem) this._currentParticleSystem.updateSprites(); + } + + protected updateAnimation(scale: number): number + { + if(this._currentParticleSystem) this._currentParticleSystem.updateAnimation(); + + return super.updateAnimation(scale); + } + + protected setAnimation(id: number): void + { + if(this._currentParticleSystem) this._currentParticleSystem.setAnimation(id); + + super.setAnimation(id); + } + + protected getLayerYOffset(scale: number, direction: number, layerId: number): number + { + if(this._currentParticleSystem && this._currentParticleSystem.controlsSprite(layerId)) + { + return this._currentParticleSystem.getLayerYOffset(scale, direction, layerId); + } + + return super.getLayerYOffset(scale, direction, layerId); + } + + private readDefinition(): boolean + { + if(!this.object || !this.object.model) return false; + + const fireworksData = this.object.model.getValue(RoomObjectVariable.FURNITURE_FIREWORKS_DATA); + + if(!fireworksData || !fireworksData.length) return false; + + this._particleSystems = new AdvancedMap(); + + for(const particleData of fireworksData) + { + const size = particleData.size; + const particleSystem = new FurnitureParticleSystem(this); + + particleSystem.parseData(particleData); + + this._particleSystems.add(size, particleSystem); + } + + return true; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedFireworksVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedFireworksVisualization.ts new file mode 100644 index 0000000..66cce6a --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedFireworksVisualization.ts @@ -0,0 +1,78 @@ +import { IRoomGeometry, RoomObjectVariable } from '../../../../../api'; +import { FurnitureFireworksVisualization } from './FurnitureFireworksVisualization'; + +export class FurnitureGiftWrappedFireworksVisualization extends FurnitureFireworksVisualization +{ + private static PRESENT_DEFAULT_STATE: number = 0; + private static MAX_PACKET_TYPE_VALUE: number = 9; + private static MAX_RIBBON_TYPE_VALUE: number = 11; + + private _packetType: number = 0; + private _ribbonType: number = 0; + private _lastAnimationId: number = 0; + + public update(geometry: IRoomGeometry, time: number, update: boolean, skipUpdate: boolean) + { + this.updatePresentWrap(); + + super.update(geometry, time, update, skipUpdate); + } + + private updatePresentWrap(): void + { + if(!this.object) return; + + const local3 = 1000; + const extras = this.object.model.getValue(RoomObjectVariable.FURNITURE_EXTRAS); + + const typeIndex = parseInt(extras); + const packetType = Math.floor((typeIndex / local3)); + const ribbonType = (typeIndex % local3); + + this._packetType = ((packetType > FurnitureGiftWrappedFireworksVisualization.MAX_PACKET_TYPE_VALUE) ? 0 : packetType); + this._ribbonType = ((ribbonType > FurnitureGiftWrappedFireworksVisualization.MAX_RIBBON_TYPE_VALUE) ? 0 : ribbonType); + } + + public getFrameNumber(scale: number, layerId: number): number + { + if(this._lastAnimationId === FurnitureGiftWrappedFireworksVisualization.PRESENT_DEFAULT_STATE) + { + if(layerId <= 1) return this._packetType; + + if(layerId === 2) return this._ribbonType; + } + + return super.getFrameNumber(scale, layerId); + } + + public getSpriteAssetName(scale: number, layerId: number): string + { + const size = this.getValidSize(scale); + + let assetName = this._type; + let layerCode = ''; + + if(layerId < (this.spriteCount - 1)) + { + layerCode = String.fromCharCode(('a'.charCodeAt(0) + layerId)); + } + else + { + layerCode = 'sd'; + } + + const frameNumber = this.getFrameNumber(scale, layerId); + + assetName = (assetName + ((((('_' + size) + '_') + layerCode) + '_') + this.direction)); + assetName = (assetName + ('_' + frameNumber)); + + return assetName; + } + + protected setAnimation(animationId: number): void + { + this._lastAnimationId = animationId; + + super.setAnimation(animationId); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedVisualization.ts new file mode 100644 index 0000000..4826501 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureGiftWrappedVisualization.ts @@ -0,0 +1,60 @@ +import { IRoomGeometry, RoomObjectVariable } from '../../../../../api'; +import { FurnitureVisualization } from './FurnitureVisualization'; + +export class FurnitureGiftWrappedVisualization extends FurnitureVisualization +{ + private _packetType: number = 0; + private _ribbonType: number = 0; + + public update(geometry: IRoomGeometry, time: number, update: boolean, skipUpdate: boolean): void + { + this.updatePresentWrap(); + + super.update(geometry, time, update, skipUpdate); + } + + private updatePresentWrap(): void + { + if(!this.object) return; + + const extras = this.object.model.getValue(RoomObjectVariable.FURNITURE_EXTRAS); + + const local3 = 1000; + const typeIndex = parseInt(extras); + + this._packetType = Math.floor((typeIndex / local3)); + this._ribbonType = (typeIndex % local3); + } + + public getFrameNumber(scale: number, layerId: number): number + { + if(layerId <= 1) return this._packetType; + + return this._ribbonType; + } + + public getSpriteAssetName(scale: number, layerId: number): string + { + const size = this.getValidSize(scale); + + let assetName = this._type; + let layerCode = ''; + + if(layerId < (this.spriteCount - 1)) + { + layerCode = String.fromCharCode(('a'.charCodeAt(0) + layerId)); + } + else + { + layerCode = 'sd'; + } + + const frameNumber = this.getFrameNumber(scale, layerId); + + assetName = (assetName + ((((('_' + size) + '_') + layerCode) + '_') + this.direction)); + assetName = (assetName + ('_' + frameNumber)); + + return assetName; + + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureGuildCustomizedVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureGuildCustomizedVisualization.ts new file mode 100644 index 0000000..0d3bb42 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureGuildCustomizedVisualization.ts @@ -0,0 +1,89 @@ +import { IGraphicAsset, IRoomObjectSprite, RoomObjectVariable } from '../../../../../api'; +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class FurnitureGuildCustomizedVisualization extends FurnitureAnimatedVisualization +{ + public static PRIMARY_COLOUR_SPRITE_TAG: string = 'COLOR1'; + public static SECONDARY_COLOUR_SPRITE_TAG: string = 'COLOR2'; + public static BADGE: string = 'BADGE'; + public static DEFAULT_COLOR_1: number = 0xEEEEEE; + public static DEFAULT_COLOR_2: number = 0x4B4B4B; + + private _color1: number; + private _color2: number; + private _badgeAssetNameNormalScale: string; + private _badgeAssetNameSmallScale: string; + + constructor() + { + super(); + + this._color1 = FurnitureGuildCustomizedVisualization.DEFAULT_COLOR_1; + this._color2 = FurnitureGuildCustomizedVisualization.DEFAULT_COLOR_2; + this._badgeAssetNameNormalScale = ''; + this._badgeAssetNameSmallScale = ''; + } + + protected updateModel(scale: number): boolean + { + const flag = super.updateModel(scale); + + if(this._badgeAssetNameNormalScale === '') + { + const assetName = this.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME); + + if(assetName) + { + this._badgeAssetNameNormalScale = assetName; + this._badgeAssetNameSmallScale = (this._badgeAssetNameNormalScale + '_32'); + } + } + + const color1 = this.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_1); + + this._color1 = color1 ? color1 : FurnitureGuildCustomizedVisualization.DEFAULT_COLOR_1; + + const color2 = this.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_2); + + this._color2 = color2 ? color2 : FurnitureGuildCustomizedVisualization.DEFAULT_COLOR_2; + + return flag; + } + + protected getLayerColor(scale: number, layerId: number, colorId: number): number + { + const tag = this.getLayerTag(scale, this._direction, layerId); + + switch(tag) + { + case FurnitureGuildCustomizedVisualization.PRIMARY_COLOUR_SPRITE_TAG: return this._color1; + case FurnitureGuildCustomizedVisualization.SECONDARY_COLOUR_SPRITE_TAG: return this._color2; + } + + return super.getLayerColor(scale, layerId, colorId); + } + + public getSpriteAssetName(scale: number, layerId: number): string + { + const tag = this.getLayerTag(scale, this._direction, layerId); + + if(tag === FurnitureGuildCustomizedVisualization.BADGE) + { + if(scale === 32) return this._badgeAssetNameSmallScale; + + return this._badgeAssetNameNormalScale; + } + + return super.getSpriteAssetName(scale, layerId); + } + + protected getLibraryAssetNameForSprite(asset: IGraphicAsset, sprite: IRoomObjectSprite): string + { + if(sprite.tag === FurnitureGuildCustomizedVisualization.BADGE) + { + return '%group.badge.url%' + sprite.libraryAssetName.replace('badge_', ''); + } + + return super.getLibraryAssetNameForSprite(asset, sprite); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureGuildIsometricBadgeVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureGuildIsometricBadgeVisualization.ts new file mode 100644 index 0000000..a9469a4 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureGuildIsometricBadgeVisualization.ts @@ -0,0 +1,145 @@ +import { Resource, Texture } from '@pixi/core'; +import { Matrix } from '@pixi/math'; +import { IGraphicAsset, IRoomObjectSprite, RoomObjectVariable } from '../../../../../api'; +import { NitroSprite, TextureUtils } from '../../../../../pixi-proxy'; +import { IsometricImageFurniVisualization } from './IsometricImageFurniVisualization'; + +export class FurnitureGuildIsometricBadgeVisualization extends IsometricImageFurniVisualization +{ + public static PRIMARY_COLOUR_SPRITE_TAG: string = 'COLOR1'; + public static SECONDARY_COLOUR_SPRITE_TAG: string = 'COLOR2'; + public static DEFAULT_COLOR_1: number = 0xEEEEEE; + public static DEFAULT_COLOR_2: number = 0x4B4B4B; + + private _color1: number; + private _color2: number; + + protected updateModel(scale: number): boolean + { + const flag = super.updateModel(scale); + + if(!this.hasThumbnailImage) + { + const assetName = this.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME); + + if(assetName && assetName.length) this.setThumbnailImages(this.getBitmapAsset(assetName)); + } + + const color1 = this.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_1); + + this._color1 = color1 ? color1 : FurnitureGuildIsometricBadgeVisualization.DEFAULT_COLOR_1; + + const color2 = this.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_2); + + this._color2 = color2 ? color2 : FurnitureGuildIsometricBadgeVisualization.DEFAULT_COLOR_2; + + return flag; + } + + protected generateTransformedThumbnail(texture: Texture, asset: IGraphicAsset): Texture + { + const scale = 1.1; + const matrix = new Matrix(); + const difference = (asset.width / texture.width); + + switch(this.direction) + { + case 2: + matrix.a = difference; + matrix.b = (-0.5 * difference); + matrix.c = 0; + matrix.d = (difference * scale); + matrix.tx = 0; + matrix.ty = ((0.5 * difference) * texture.width); + break; + case 0: + case 4: + matrix.a = difference; + matrix.b = (0.5 * difference); + matrix.c = 0; + matrix.d = (difference * scale); + matrix.tx = 0; + matrix.ty = 0; + break; + default: + matrix.a = difference; + matrix.b = 0; + matrix.c = 0; + matrix.d = difference; + matrix.tx = 0; + matrix.ty = 0; + } + + const sprite = new NitroSprite(texture); + + sprite.transform.setFromMatrix(matrix); + + sprite.position.set(0); + + return TextureUtils.generateTexture(sprite); + + /* const renderTexture = RenderTexture.create({ + width: asset.width, + height: asset.height + }); + + PixiApplicationProxy.instance.renderer.render(sprite, { + renderTexture, + clear: true, + }); + + return renderTexture; */ + + /* const sprite = new NitroSprite(texture); + + const renderTexture = RenderTexture.create({ + width: (asset.width + matrix.tx), + height: (asset.height + matrix.ty) + }); + + sprite.position.set(0) + + PixiApplicationProxy.instance.renderer.render(sprite, { + renderTexture, + clear: true, + transform: matrix + }); + + return renderTexture; */ + } + + protected getLayerColor(scale: number, layerId: number, colorId: number): number + { + const tag = this.getLayerTag(scale, this._direction, layerId); + + switch(tag) + { + case FurnitureGuildIsometricBadgeVisualization.PRIMARY_COLOUR_SPRITE_TAG: return this._color1; + case FurnitureGuildIsometricBadgeVisualization.SECONDARY_COLOUR_SPRITE_TAG: return this._color2; + } + + return super.getLayerColor(scale, layerId, colorId); + } + + protected getLibraryAssetNameForSprite(asset: IGraphicAsset, sprite: IRoomObjectSprite): string + { + if(sprite.tag === FurnitureGuildIsometricBadgeVisualization.THUMBNAIL) + { + if(this.object && this.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME)) + { + return '%group.badge.url%' + this.object.model.getValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME); + } + } + + return super.getLibraryAssetNameForSprite(asset, sprite); + } + + private getBitmapAsset(name: string) + { + const asset = this.asset.getAsset(name); + + if(!asset || !asset.texture) return null; + + return asset.texture; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureHabboWheelVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureHabboWheelVisualization.ts new file mode 100644 index 0000000..628d811 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureHabboWheelVisualization.ts @@ -0,0 +1,64 @@ +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class FurnitureHabboWheelVisualization extends FurnitureAnimatedVisualization +{ + private static ANIMATION_ID_OFFSET_SLOW1: number = 10; + private static ANIMATION_ID_OFFSET_SLOW2: number = 20; + private static ANIMATION_ID_START_ROLL: number = 31; + private static ANIMATION_ID_ROLL: number = 32; + + private _stateQueue: number[]; + private _running: boolean; + + constructor() + { + super(); + + this._stateQueue = []; + this._running = false; + } + + protected setAnimation(animationId: number): void + { + if(animationId === -1) + { + if(!this._running) + { + this._running = true; + this._stateQueue = []; + + this._stateQueue.push(FurnitureHabboWheelVisualization.ANIMATION_ID_START_ROLL); + this._stateQueue.push(FurnitureHabboWheelVisualization.ANIMATION_ID_ROLL); + + return; + } + } + + if((animationId > 0) && (animationId <= FurnitureHabboWheelVisualization.ANIMATION_ID_OFFSET_SLOW1)) + { + if(this._running) + { + this._running = false; + this._stateQueue = []; + + this._stateQueue.push(FurnitureHabboWheelVisualization.ANIMATION_ID_OFFSET_SLOW1 + animationId); + this._stateQueue.push(FurnitureHabboWheelVisualization.ANIMATION_ID_OFFSET_SLOW2 + animationId); + this._stateQueue.push(animationId); + + return; + } + + super.setAnimation(animationId); + } + } + + protected updateAnimation(scale: number): number + { + if(this.getLastFramePlayed(1) && this.getLastFramePlayed(2) && this.getLastFramePlayed(3)) + { + if(this._stateQueue.length) super.setAnimation(this._stateQueue.shift()); + } + + return super.updateAnimation(scale); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureIsometricBBVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureIsometricBBVisualization.ts new file mode 100644 index 0000000..36908e4 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureIsometricBBVisualization.ts @@ -0,0 +1,165 @@ +import { RenderTexture, Resource, Texture } from '@pixi/core'; +import { Matrix } from '@pixi/math'; +import { GetAssetManager, IGraphicAsset } from '../../../../../api'; +import { NitroSprite, PixiApplicationProxy } from '../../../../../pixi-proxy'; +import { FurnitureBBVisualization } from './FurnitureBBVisualization'; +import { FurnitureBrandedImageVisualization } from './FurnitureBrandedImageVisualization'; + +export class FurnitureIsometricBBVisualization extends FurnitureBBVisualization +{ + private _needsTransform: boolean = true; + + protected transformGifTextures(asset: IGraphicAsset): void + { + if(!this._gifCollection) return; + + const textures = this._gifCollection.textures; + + if(!textures.length) return; + + for(let i = 0; i < textures.length; i++) + { + const texture = textures[i]; + + if(!texture) continue; + + const existingAsset = this.getAsset(`${this._imageUrl}_${i}`); + + if(!existingAsset) continue; + + const scale = 1.1; + const matrix = new Matrix(); + const difference = (asset.width / texture.width); + + switch(this.direction) + { + case 2: + matrix.a = difference; + matrix.b = (-0.5 * difference); + matrix.c = 0; + matrix.d = (difference * scale); + matrix.tx = 0; + matrix.ty = ((0.5 * difference) * texture.width); + break; + case 0: + case 4: + matrix.a = difference; + matrix.b = (0.5 * difference); + matrix.c = 0; + matrix.d = (difference * scale); + matrix.tx = 0; + matrix.ty = 0; + break; + default: + matrix.a = difference; + matrix.b = 0; + matrix.c = 0; + matrix.d = difference; + matrix.tx = 0; + matrix.ty = 0; + } + + const sprite = new NitroSprite(texture); + + const renderTexture = RenderTexture.create({ + width: (asset.width + matrix.tx), + height: (asset.height + matrix.ty) + }); + + PixiApplicationProxy.instance.renderer.render(sprite, { + renderTexture, + clear: true, + transform: matrix + }); + + this.asset.disposeAsset(`${this._imageUrl}_${i}`); + this.asset.addAsset(`${this._imageUrl}_${i}`, renderTexture, true, asset.x, asset.y, asset.flipH, asset.flipV); + } + + this._needsTransform = false; + } + + protected generateTransformedImage(texture: Texture, asset: IGraphicAsset): void + { + const scale = 1.1; + const matrix = new Matrix(); + const difference = (asset.width / texture.width); + + switch(this.direction) + { + case 2: + matrix.a = difference; + matrix.b = (-0.5 * difference); + matrix.c = 0; + matrix.d = (difference * scale); + matrix.tx = 0; + matrix.ty = ((0.5 * difference) * texture.width); + break; + case 0: + case 4: + matrix.a = difference; + matrix.b = (0.5 * difference); + matrix.c = 0; + matrix.d = (difference * scale); + matrix.tx = 0; + matrix.ty = 0; + break; + default: + matrix.a = difference; + matrix.b = 0; + matrix.c = 0; + matrix.d = difference; + matrix.tx = 0; + matrix.ty = 0; + } + + const sprite = new NitroSprite(texture); + + const renderTexture = RenderTexture.create({ + width: (asset.width + matrix.tx), + height: (asset.height + matrix.ty) + }); + + PixiApplicationProxy.instance.renderer.render(sprite, { + renderTexture, + clear: true, + transform: matrix + }); + + this.asset.disposeAsset(`${this._imageUrl}_0`); + this.asset.addAsset(`${this._imageUrl}_0`, renderTexture, true, sprite.x, sprite.y, asset.flipH, asset.flipV); + + this._needsTransform = false; + } + + protected checkAndCreateImageForCurrentState(): void + { + super.checkAndCreateImageForCurrentState(); + + this._needsTransform = true; + } + + protected getSpriteAssetName(scale: number, layerId: number): string + { + const tag = this.getLayerTag(scale, this._direction, layerId); + + if((tag === FurnitureBrandedImageVisualization.BRANDED_IMAGE) && this._imageUrl) + { + if(this._needsTransform) + { + if(this._isAnimated) + { + this.transformGifTextures(this.getAsset(super.getSpriteAssetName(scale, layerId))); + } + else + { + this.generateTransformedImage(GetAssetManager().getTexture(this._imageUrl), this.getAsset(super.getSpriteAssetName(scale, layerId))); + } + } + + return `${this._imageUrl}_${this.getFrameNumber(scale, layerId)}`; + } + + return super.getSpriteAssetName(scale, layerId); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualization.ts new file mode 100644 index 0000000..db1630b --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualization.ts @@ -0,0 +1,174 @@ +import { AvatarSetType, IAvatarImageListener, IObjectVisualizationData, RoomObjectVariable } from '../../../../../api'; +import { FurnitureMannequinVisualizationData } from './FurnitureMannequinVisualizationData'; +import { FurnitureVisualization } from './FurnitureVisualization'; + +export class FurnitureMannequinVisualization extends FurnitureVisualization implements IAvatarImageListener +{ + private static AVATAR_IMAGE_SPRITE_TAG: string = 'avatar_image'; + + private _mannequinScale: number; + private _figure: string; + private _gender: string; + private _dynamicAssetName: string; + private _needsUpdate: boolean; + + private _placeHolderFigure: string; + + private _disposed: boolean; + + constructor() + { + super(); + + this._mannequinScale = -1; + this._figure = null; + this._gender = null; + this._dynamicAssetName = null; + this._needsUpdate = false; + + this._placeHolderFigure = 'hd-99999-99998'; + + this._disposed = false; + } + + public initialize(data: IObjectVisualizationData): boolean + { + if(!(data instanceof FurnitureMannequinVisualizationData)) return false; + + return super.initialize(data); + } + + public dispose(): void + { + if(this._disposed) return; + + this._disposed = true; + + if(this._dynamicAssetName && this.asset) + { + this.asset.disposeAsset(this._dynamicAssetName); + + this._dynamicAssetName = null; + } + + super.dispose(); + } + + protected updateObject(scale: number, direction: number): boolean + { + const updateObject = super.updateObject(scale, direction); + + if(updateObject) + { + if(this._mannequinScale !== scale) + { + this._mannequinScale = scale; + + this.updateAvatar(); + } + } + + return updateObject; + } + + protected updateModel(scale: number): boolean + { + let updateModel = super.updateModel(scale); + + if(updateModel) + { + const figure = (this.object.model.getValue(RoomObjectVariable.FURNITURE_MANNEQUIN_FIGURE) || null); + + if(figure) + { + this._figure = (figure + '.' + this._placeHolderFigure); + this._gender = (this.object.model.getValue(RoomObjectVariable.FURNITURE_MANNEQUIN_GENDER) || null); + + this.updateAvatar(); + } + } + + updateModel = (updateModel || this._needsUpdate); + + this._needsUpdate = false; + + return updateModel; + } + + private updateAvatar(forceUpdate: boolean = false): void + { + if(!this.avatarExists() || forceUpdate) + { + const avatarImage = this.data.createAvatarImage(this._figure, this._mannequinScale, this._gender, this); + + if(avatarImage) + { + avatarImage.setDirection(AvatarSetType.FULL, this.direction); + + if(this._dynamicAssetName) this.asset.disposeAsset(this._dynamicAssetName); + + this.asset.addAsset(this.getAvatarAssetName(), avatarImage.getImage(AvatarSetType.FULL, false, 1, false), true); + + this._dynamicAssetName = this.getAvatarAssetName(); + this._needsUpdate = true; + + avatarImage.dispose(); + } + } + } + + private avatarExists(): boolean + { + return (this._figure && (this.getAsset(this.getAvatarAssetName()) !== null)); + } + + private getAvatarAssetName(): string + { + return (((((('mannequin_' + this._figure) + '_') + this._mannequinScale) + '_') + this.direction) + '_') + this.object.id; + } + + public resetFigure(figure: string): void + { + if(figure === this._figure) this.updateAvatar(true); + } + + protected getSpriteAssetName(scale: number, layerId: number): string + { + const tag = this.getLayerTag(scale, this.direction, layerId); + + if(this._figure && (tag === FurnitureMannequinVisualization.AVATAR_IMAGE_SPRITE_TAG) && this.avatarExists()) + { + return this.getAvatarAssetName(); + } + + return super.getSpriteAssetName(scale, layerId); + } + + protected getLayerXOffset(scale: number, direction: number, layerId: number): number + { + const tag = this.getLayerTag(scale, direction, layerId); + + if((tag === FurnitureMannequinVisualization.AVATAR_IMAGE_SPRITE_TAG) && this.avatarExists()) return (-(this.getSprite(layerId).width) / 2); + + return super.getLayerXOffset(scale, direction, layerId); + } + + protected getLayerYOffset(scale: number, direction: number, layerId: number): number + { + const tag = this.getLayerTag(scale, direction, layerId); + + if((tag === FurnitureMannequinVisualization.AVATAR_IMAGE_SPRITE_TAG) && this.avatarExists()) return -(this.getSprite(layerId).height); + + return super.getLayerYOffset(scale, direction, layerId); + } + + public get disposed(): boolean + { + return this._disposed; + } + + protected get data(): FurnitureMannequinVisualizationData + { + return this._data as FurnitureMannequinVisualizationData; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualizationData.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualizationData.ts new file mode 100644 index 0000000..52185aa --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureMannequinVisualizationData.ts @@ -0,0 +1,37 @@ +import { IAvatarEffectListener, IAvatarImage, IAvatarImageListener, IAvatarRenderManager } from '../../../../../api'; +import { AvatarVisualizationData } from '../avatar'; +import { FurnitureVisualizationData } from './FurnitureVisualizationData'; + +export class FurnitureMannequinVisualizationData extends FurnitureVisualizationData +{ + private _avatarData: AvatarVisualizationData; + + constructor() + { + super(); + + this._avatarData = new AvatarVisualizationData(); + } + + public dispose(): void + { + super.dispose(); + + if(this._avatarData) + { + this._avatarData.dispose(); + + this._avatarData = null; + } + } + + public createAvatarImage(figure: string, size: number, gender: string = null, avatarListener: IAvatarImageListener = null, effectListener: IAvatarEffectListener = null): IAvatarImage + { + return this._avatarData.createAvatarImage(figure, size, gender, avatarListener, effectListener); + } + + public set avatarManager(renderer: IAvatarRenderManager) + { + this._avatarData.avatarManager = renderer; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts new file mode 100644 index 0000000..1c8ec0f --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts @@ -0,0 +1,333 @@ +import { RenderTexture, Texture } from '@pixi/core'; +import { AlphaFilter } from '@pixi/filter-alpha'; +import { Graphics } from '@pixi/graphics'; +import { Matrix } from '@pixi/math'; +import { AdvancedMap, IAdvancedMap, IGraphicAsset, IParticleSystem, IRoomObjectSprite } from '../../../../../api'; +import { NitroPoint, NitroSprite, PixiApplicationProxy } from '../../../../../pixi-proxy'; +import { Vector3D } from '../../../../avatar'; +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; +import { FurnitureParticleSystemEmitter } from './FurnitureParticleSystemEmitter'; + +export class FurnitureParticleSystem +{ + private _emitters: IAdvancedMap; + private _visualization: FurnitureAnimatedVisualization; + private _size: number; + private _canvasId: number = -1; + private _offsetY: number; + private _currentEmitter: FurnitureParticleSystemEmitter; + private _canvasTexture: RenderTexture; + private _roomSprite: IRoomObjectSprite; + private _hasIgnited: boolean = false; + private _centerX: number = 0; + private _centerY: number = 0; + private _scaleMultiplier: number = 1; + private _blackOverlay: Graphics; + private _blackOverlayAlphaTransform: AlphaFilter; + private _particleColorTransform: AlphaFilter; + private _identityMatrix: Matrix; + private _translationMatrix: Matrix; + private _blend: number = 1; + private _bgColor: number = 0xFF000000; + private _emptySprite: NitroSprite; + private _isDone: boolean = false; + + constructor(visualization: FurnitureAnimatedVisualization) + { + this._emitters = new AdvancedMap(); + this._visualization = visualization; + this._blackOverlayAlphaTransform = new AlphaFilter(); + this._blackOverlayAlphaTransform.alpha = 1; + this._particleColorTransform = new AlphaFilter(); + this._identityMatrix = new Matrix(); + this._translationMatrix = new Matrix(); + } + + public dispose(): void + { + for(const emitter of this._emitters.getValues()) emitter.dispose(); + + this._emitters = null; + + if(this._canvasTexture) + { + this._canvasTexture.destroy(); + this._canvasTexture = null; + } + + if(this._blackOverlay) + { + this._blackOverlay.destroy(); + this._blackOverlay = null; + } + + if(this._emptySprite) + { + this._emptySprite.destroy(); + this._emptySprite = null; + } + + this._blackOverlayAlphaTransform = null; + this._particleColorTransform = null; + this._identityMatrix = null; + this._translationMatrix = null; + } + + public reset(): void + { + if(this._currentEmitter) this._currentEmitter.reset(); + + this._currentEmitter = null; + this._hasIgnited = false; + this._isDone = false; + + this.updateCanvas(); + } + + public setAnimation(id: number): void + { + if(this._currentEmitter) this._currentEmitter.reset(); + + this._currentEmitter = this._emitters.getValue(id); + this._hasIgnited = false; + this._isDone = false; + + this.updateCanvas(); + } + + private updateCanvas(): void + { + if(!this._currentEmitter || (this._canvasId === -1)) return; + + this._roomSprite = this._visualization.getSprite(this._canvasId); + + if(this._roomSprite && this._roomSprite.texture) + { + if((this._roomSprite.width <= 1) || (this._roomSprite.height <= 1)) return; + + if(this._canvasTexture && ((this._canvasTexture.width !== this._roomSprite.width) || (this._canvasTexture.height !== this._roomSprite.height))) this._canvasTexture = null; + + this.clearCanvas(); + + this._centerX = -(this._roomSprite.offsetX); + this._centerY = -(this._roomSprite.offsetY); + this._roomSprite.texture = this._canvasTexture; + } + } + + public getLayerYOffset(scale: number, direction: number, layerId: number): number + { + if(this._currentEmitter && (this._currentEmitter.roomObjectSpriteId === layerId)) + { + return this._currentEmitter.y * this._scaleMultiplier; + } + + return 0; + } + + public controlsSprite(k: number): boolean + { + if(this._currentEmitter) return this._currentEmitter.roomObjectSpriteId == k; + + return false; + } + + public updateSprites(): void + { + if(!this._currentEmitter || !this._roomSprite) return; + + if(this._canvasTexture && (this._roomSprite.texture !== this._canvasTexture)) + { + this._roomSprite.texture = this._canvasTexture; + } + + if(this._hasIgnited) + { + if(this._currentEmitter.roomObjectSpriteId >= 0) this._visualization.getSprite(this._currentEmitter.roomObjectSpriteId).visible = false; + } + } + + public updateAnimation(): void + { + if(!this._currentEmitter || !this._roomSprite || this._isDone) return; + + const k = 10; + + if(!this._hasIgnited && this._currentEmitter.hasIgnited) this._hasIgnited = true; + + const offsetY = (this._offsetY * this._scaleMultiplier); + + this._currentEmitter.update(); + + if(this._hasIgnited) + { + if(this._currentEmitter.roomObjectSpriteId >= 0) + { + this._visualization.getSprite(this._currentEmitter.roomObjectSpriteId).visible = false; + } + + if(!this._canvasTexture) this.updateCanvas(); + + this.clearCanvas(); + + for(const particle of this._currentEmitter.particles) + { + const tx = (this._centerX + ((((particle.x - particle.z) * k) / 10) * this._scaleMultiplier)); + const ty = ((this._centerY - offsetY) + ((((particle.y + ((particle.x + particle.z) / 2)) * k) / 10) * this._scaleMultiplier)); + const asset = particle.getAsset(); + + if(asset && asset.texture) + { + if(particle.fade && (particle.alphaMultiplier < 1)) + { + this._translationMatrix.identity(); + this._translationMatrix.translate((tx + asset.offsetX), (ty + asset.offsetY)); + + const sprite = new NitroSprite(asset.texture); + + this._particleColorTransform.alpha = particle.alphaMultiplier; + + sprite.filters = [this._particleColorTransform]; + + PixiApplicationProxy.instance.renderer.render(sprite, { + renderTexture: this._canvasTexture, + transform: this._translationMatrix, + clear: false + }); + } + else + { + const point = new NitroPoint((tx + asset.offsetX), (ty + asset.offsetY)); + const sprite = new NitroSprite(asset.texture); + + sprite.x = point.x; + sprite.y = point.y; + + PixiApplicationProxy.instance.renderer.render(sprite, { + renderTexture: this._canvasTexture, + clear: false + }); + } + } + else + { + const sprite = new NitroSprite(Texture.WHITE); + + sprite.tint = 0xFFFFFF; + sprite.x = (tx - 1); + sprite.y = (ty - 1); + sprite.width = 2; + sprite.height = 2; + + PixiApplicationProxy.instance.renderer.render(sprite, { + renderTexture: this._canvasTexture, + clear: false + }); + } + } + + if(!this._currentEmitter.particles.length) + { + this._isDone = true; + + return; + } + } + } + + public parseData(particleSystem: IParticleSystem): void + { + this._size = particleSystem.size; + this._canvasId = ((particleSystem.canvasId !== undefined) ? particleSystem.canvasId : -1); + this._offsetY = ((particleSystem.offsetY !== undefined) ? particleSystem.offsetY : 10); + this._scaleMultiplier = (this._size / 64); + this._blend = ((particleSystem.blend !== undefined) ? particleSystem.blend : 1); + this._blend = Math.min(this._blend, 1); + + this._blackOverlayAlphaTransform.alpha = this._blend; + + const bgColor = ((particleSystem.bgColor !== undefined) ? particleSystem.bgColor : '0'); + + this._bgColor = (parseInt(bgColor, 16) || 0x000000); + + if(!particleSystem.emitters || !particleSystem.emitters.length) return; + + for(const emitter of particleSystem.emitters) + { + const emitterId = emitter.id; + const emitterName = emitter.name; + const emitterSpriteId = emitter.spriteId; + + const particleEmitter = new FurnitureParticleSystemEmitter(emitterName, emitterSpriteId); + + this._emitters.add(emitterId, particleEmitter); + + const maxNumParticles = emitter.maxNumParticles; + const particlesPerFrame = emitter.particlesPerFrame; + const burstPulse = ((emitter.burstPulse !== undefined) ? emitter.burstPulse : 1); + const fuseTime = emitter.fuseTime; + const simulationForce = emitter.simulation.force; + const simulationDirection = emitter.simulation.direction; + const simulationGravity = emitter.simulation.gravity; + const simulationAirFriction = emitter.simulation.airFriction; + const simulationShape = emitter.simulation.shape; + const simulationEnergy = emitter.simulation.energy; + + for(const particle of emitter.particles) + { + const lifeTime = particle.lifeTime; + const isEmitter = (particle.isEmitter || false); + const fade = (particle.fade || false); + + const frames: IGraphicAsset[] = []; + + for(const name of particle.frames) frames.push(this._visualization.asset.getAsset(name)); + + particleEmitter.configureParticle(lifeTime, isEmitter, frames, fade); + } + + particleEmitter.setup(maxNumParticles, particlesPerFrame, simulationForce, new Vector3D(0, simulationDirection, 0), simulationGravity, simulationAirFriction, simulationShape, simulationEnergy, fuseTime, burstPulse); + } + } + + public copyStateFrom(particleSystem: FurnitureParticleSystem): void + { + let emitterId = 0; + + if(particleSystem._emitters && particleSystem._currentEmitter) + { + emitterId = particleSystem._emitters.getKey(particleSystem._emitters.getValues().indexOf(particleSystem._currentEmitter)); + } + + this.setAnimation(emitterId); + + if(this._currentEmitter) this._currentEmitter.copyStateFrom(particleSystem._currentEmitter, (particleSystem._size / this._size)); + + this._canvasTexture = null; + } + + private clearCanvas(): void + { + if(!this._emptySprite) + { + this._emptySprite = new NitroSprite(Texture.EMPTY); + + this._emptySprite.alpha = 0; + } + + if(!this._canvasTexture) + { + this._canvasTexture = RenderTexture.create({ + width: this._roomSprite.width, + height: this._roomSprite.height + }); + } + else + { + PixiApplicationProxy.instance.renderer.render(this._emptySprite, { + renderTexture: this._canvasTexture, + clear: true + }); + } + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureParticleSystemEmitter.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureParticleSystemEmitter.ts new file mode 100644 index 0000000..5fce0ac --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureParticleSystemEmitter.ts @@ -0,0 +1,277 @@ +import { IGraphicAsset } from '../../../../../api'; +import { Vector3D } from '../../../../avatar'; +import { ParticleSystemParticle } from '../data'; +import { FurnitureParticleSystemParticle } from './FurnitureParticleSystemParticle'; + +export class FurnitureParticleSystemEmitter extends FurnitureParticleSystemParticle +{ + public static CONE: string = 'cone'; + public static PLANE: string = 'plane'; + public static SPHERE: string = 'sphere'; + + private _name: string; + private _roomObjectSpriteId: number = -1; + private _force: number; + private _timeStep: number = 0.1; + private _gravity: number; + private _airFriction: number; + private _explosionShape: string; + private _particleConfigurations: ParticleSystemParticle[]; + private _particles: FurnitureParticleSystemParticle[]; + private _maxNumberOfParticles: number; + private _particlesPerFrame: number; + private _emittedParticles: number; + private _fuseTime: number = 10; + private _energy: number = 1; + private _hasIgnited: boolean = false; + private _burstPulse: number = 1; + private _emitterDirection: Vector3D; + + constructor(name: string = '', spriteId: number = -1) + { + super(); + + this._particles = []; + this._name = name; + this._roomObjectSpriteId = spriteId; + this._particleConfigurations = []; + } + + public dispose(): void + { + for(const k of this._particles) k.dispose(); + + this._particles = null; + this._particleConfigurations = null; + + super.dispose(); + } + + public setup(maxNumOfParticles: number, particlesPerFrame: number, force: number, direction: Vector3D, gravity: number, airFriction: number, explosionShape: string, energy: number, fuseTime: number, burstPulse: number): void + { + this._maxNumberOfParticles = maxNumOfParticles; + this._particlesPerFrame = particlesPerFrame; + this._force = force; + this._emitterDirection = direction; + this._emitterDirection.normalize(); + this._gravity = gravity; + this._airFriction = airFriction; + this._explosionShape = explosionShape; + this._fuseTime = fuseTime; + this._energy = energy; + this._burstPulse = burstPulse; + this.reset(); + } + + public reset(): void + { + for(const particle of this._particles) particle.dispose(); + + this._particles = []; + this._emittedParticles = 0; + this._hasIgnited = false; + + this.init(0, 0, 0, this._emitterDirection, this._force, this._timeStep, this._fuseTime, true); + } + + public copyStateFrom(emitter: FurnitureParticleSystemEmitter, scale: number): void + { + super.copy(emitter, scale); + + this._force = emitter._force; + this._emitterDirection = emitter._emitterDirection; + this._gravity = emitter._gravity; + this._airFriction = emitter._airFriction; + this._explosionShape = emitter._explosionShape; + this._fuseTime = emitter._fuseTime; + this._energy = emitter._energy; + this._burstPulse = emitter._burstPulse; + this._timeStep = emitter._timeStep; + this._hasIgnited = emitter._hasIgnited; + } + + public configureParticle(lifeTIme: number, isEmitter: boolean, frames: IGraphicAsset[], fade: boolean): void + { + const particle: ParticleSystemParticle = {}; + + particle.lifeTime = lifeTIme; + particle.isEmitter = isEmitter; + particle.frames = frames; + particle.fade = fade; + + this._particleConfigurations.push(particle); + } + + protected ignite(): void + { + this._hasIgnited = true; + + if(this._emittedParticles < this._maxNumberOfParticles) + { + if(this.age > 1) this.releaseParticles(this, this.direction); + } + } + + private releaseParticles(particle: FurnitureParticleSystemParticle, direction: Vector3D = null): void + { + if(!direction) direction = new Vector3D(); + + const newDirection = new Vector3D(); + const randomParticle = this.getRandomParticleConfiguration(); + + let i = 0; + + while(i < this._particlesPerFrame) + { + switch(this._explosionShape) + { + case FurnitureParticleSystemEmitter.CONE: + newDirection.x = ((this.randomBoolean(0.5)) ? Math.random() : -(Math.random())); + newDirection.y = -(Math.random() + 1); + newDirection.z = ((this.randomBoolean(0.5)) ? Math.random() : -(Math.random())); + break; + case FurnitureParticleSystemEmitter.PLANE: + newDirection.x = ((this.randomBoolean(0.5)) ? Math.random() : -(Math.random())); + newDirection.y = 0; + newDirection.z = ((this.randomBoolean(0.5)) ? Math.random() : -(Math.random())); + break; + case FurnitureParticleSystemEmitter.SPHERE: + newDirection.x = ((this.randomBoolean(0.5)) ? Math.random() : -(Math.random())); + newDirection.y = ((this.randomBoolean(0.5)) ? Math.random() : -(Math.random())); + newDirection.z = ((this.randomBoolean(0.5)) ? Math.random() : -(Math.random())); + break; + } + + newDirection.normalize(); + + const newParticle = new FurnitureParticleSystemParticle(); + + let lifeTime = 0; + let isEmitter = false; + let fade = false; + let frames: IGraphicAsset[] = []; + + if(randomParticle) + { + lifeTime = Math.floor(((Math.random() * randomParticle.lifeTime) + 10)); + isEmitter = randomParticle.isEmitter; + frames = randomParticle.frames; + fade = randomParticle.fade; + } + else + { + lifeTime = Math.trunc(Math.floor(((Math.random() * 20) + 10))); + isEmitter = false; + frames = []; + } + + newParticle.init(particle.x, particle.y, particle.z, newDirection, this._energy, this._timeStep, lifeTime, isEmitter, frames, fade); + + this._particles.push(newParticle); + this._emittedParticles++; + + i++; + } + } + + private getRandomParticleConfiguration(): ParticleSystemParticle + { + const index: number = Math.trunc(Math.floor((Math.random() * this._particleConfigurations.length))); + + return this._particleConfigurations[index]; + } + + public update(): void + { + super.update(); + + this.accumulateForces(); + this.verlet(); + this.satisfyConstraints(); + + if(!this.isAlive && (this._emittedParticles < this._maxNumberOfParticles)) + { + if((this.age % this._burstPulse) === 0) this.releaseParticles(this, this.direction); + } + } + + public verlet(): void + { + if(this.isAlive || (this._emittedParticles < this._maxNumberOfParticles)) + { + const x = this.x; + const y = this.y; + const z = this.z; + + this.x = (((2 - this._airFriction) * this.x) - ((1 - this._airFriction) * this.lastX)); + this.y = ((((2 - this._airFriction) * this.y) - ((1 - this._airFriction) * this.lastY)) + ((this._gravity * this._timeStep) * this._timeStep)); + this.z = (((2 - this._airFriction) * this.z) - ((1 - this._airFriction) * this.lastZ)); + this.lastX = x; + this.lastY = y; + this.lastZ = z; + } + + const particles: FurnitureParticleSystemParticle[] = []; + + for(const particle of this._particles) + { + particle.update(); + + const x = particle.x; + const y = particle.y; + const z = particle.z; + particle.x = (((2 - this._airFriction) * particle.x) - ((1 - this._airFriction) * particle.lastX)); + particle.y = ((((2 - this._airFriction) * particle.y) - ((1 - this._airFriction) * particle.lastY)) + ((this._gravity * this._timeStep) * this._timeStep)); + particle.z = (((2 - this._airFriction) * particle.z) - ((1 - this._airFriction) * particle.lastZ)); + particle.lastX = x; + particle.lastY = y; + particle.lastZ = z; + + if((particle.y > 10) || !particle.isAlive) particles.push(particle); + } + + for(const particle of particles) + { + if(particle.isEmitter) + { + // + } + + this._particles.splice(this._particles.indexOf(particle), 1); + + particle.dispose(); + } + } + + private satisfyConstraints(): void + { + } + + private accumulateForces(): void + { + for(const k of this._particles) + { + // + } + } + + public get particles(): FurnitureParticleSystemParticle[] + { + return this._particles; + } + + public get hasIgnited(): boolean + { + return this._hasIgnited; + } + + private randomBoolean(k: number): boolean + { + return Math.random() < k; + } + + public get roomObjectSpriteId(): number + { + return this._roomObjectSpriteId; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureParticleSystemParticle.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureParticleSystemParticle.ts new file mode 100644 index 0000000..fc7b48b --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureParticleSystemParticle.ts @@ -0,0 +1,196 @@ +import { IGraphicAsset } from '../../../../../api'; +import { Vector3D } from '../../../../avatar'; + +export class FurnitureParticleSystemParticle +{ + private _x: number; + private _y: number; + private _z: number; + private _lastX: number; + private _lastY: number; + private _lastZ: number; + private _hasMoved: boolean = false; + private _particleDirection: Vector3D; + private _age: number = 0; + private _lifeTime: number; + private _isEmitter: boolean = false; + private _fade: boolean = false; + private _fadeTime: number; + private _alphaMultiplier: number = 1; + private _frames: IGraphicAsset[]; + + public init(x: number, y: number, z: number, direction: Vector3D, energy: number, timeStep: number, lifeTime: number, isEmitter: boolean = false, frames: IGraphicAsset[] = null, fade: boolean = false): void + { + this._x = x; + this._y = y; + this._z = z; + this._particleDirection = new Vector3D(direction.x, direction.y, direction.z); + this._particleDirection.scaleBy(energy); + + this._lastX = (this._x - (this._particleDirection.x * timeStep)); + this._lastY = (this._y - (this._particleDirection.y * timeStep)); + this._lastZ = (this._z - (this._particleDirection.z * timeStep)); + this._age = 0; + this._hasMoved = false; + this._lifeTime = lifeTime; + this._isEmitter = isEmitter; + this._frames = frames; + this._fade = fade; + this._alphaMultiplier = 1; + this._fadeTime = (0.5 + (Math.random() * 0.5)); + } + + public dispose(): void + { + this._particleDirection = null; + } + + public update(): void + { + this._age++; + + if(this._age === this._lifeTime) this.ignite(); + + if(this._fade) + { + if((this._age / this._lifeTime) > this._fadeTime) + { + this._alphaMultiplier = ((this._lifeTime - this._age) / (this._lifeTime * (1 - this._fadeTime))); + } + } + } + + public getAsset(): IGraphicAsset + { + if(((this._frames) && (this._frames.length > 0))) + { + return this._frames[(this._age % this._frames.length)]; + } + return null; + } + + protected ignite(): void + { + } + + public get fade(): boolean + { + return this._fade; + } + + public get alphaMultiplier(): number + { + return this._alphaMultiplier; + } + + public get direction(): Vector3D + { + return this._particleDirection; + } + + public get age(): number + { + return this._age; + } + + public get isEmitter(): boolean + { + return this._isEmitter; + } + + public get isAlive(): boolean + { + return this._age <= this._lifeTime; + } + + public get x(): number + { + return this._x; + } + + public set x(x: number) + { + this._x = x; + } + + public get y(): number + { + return this._y; + } + + public set y(y: number) + { + this._y = y; + } + + public get z(): number + { + return this._z; + } + + public set z(z: number) + { + this._z = z; + } + + public get lastX(): number + { + return this._lastX; + } + + public set lastX(y: number) + { + this._hasMoved = true; + this._lastX = y; + } + + public get lastY(): number + { + return this._lastY; + } + + public set lastY(k: number) + { + this._hasMoved = true; + this._lastY = k; + } + + public get lastZ(): number + { + return this._lastZ; + } + + public set lastZ(z: number) + { + this._hasMoved = true; + this._lastZ = z; + } + + public get hasMoved(): boolean + { + return this._hasMoved; + } + + public toString(): string + { + return [this._x, this._y, this._z].toString(); + } + + public copy(particle: FurnitureParticleSystemParticle, scale: number): void + { + this._x = (particle._x * scale); + this._y = (particle._y * scale); + this._z = (particle._z * scale); + this._lastX = (particle._lastX * scale); + this._lastY = (particle._lastY * scale); + this._lastZ = (particle._lastZ * scale); + this._hasMoved = particle.hasMoved; + this._particleDirection = particle._particleDirection; + this._age = particle._age; + this._lifeTime = particle._lifeTime; + this._isEmitter = particle._isEmitter; + this._fade = particle._fade; + this._fadeTime = particle._fadeTime; + this._alphaMultiplier = particle._alphaMultiplier; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurniturePartyBeamerVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurniturePartyBeamerVisualization.ts new file mode 100644 index 0000000..78b32c7 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurniturePartyBeamerVisualization.ts @@ -0,0 +1,160 @@ +import { NitroPoint } from '../../../../../pixi-proxy'; +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualization +{ + private static UPDATE_INTERVAL: number = 2; + private static AREA_DIAMETER_SMALL: number = 15; + private static AREA_DIAMETER_LARGE: number = 31; + private static ANIM_SPEED_FAST: number = 2; + private static ANIM_SPEED_SLOW: number = 1; + + private _animPhaseIndex: number[]; + private _animDirectionIndex: number[]; + private _animSpeedIndex: number[]; + private _animFactorIndex: number[]; + private _animOffsetIndex: NitroPoint[]; + + constructor() + { + super(); + + this._animOffsetIndex = []; + } + + protected updateAnimation(scale: number): number + { + if(!this._animSpeedIndex) this.initItems(scale); + + let sprite = this.getSprite(2); + + if(sprite) this._animOffsetIndex[0] = this.getNewPoint(scale, 0); + + sprite = this.getSprite(3); + + if(sprite) this._animOffsetIndex[1] = this.getNewPoint(scale, 1); + + return super.updateAnimation(scale); + } + + private getNewPoint(scale: number, layerId: number): NitroPoint + { + let diameter = 0; + + let animationPhase: number = this._animPhaseIndex[layerId]; + let animationDirection: number = this._animDirectionIndex[layerId]; + + const animationSpeed: number = this._animSpeedIndex[layerId]; + const animationFactor: number = this._animFactorIndex[layerId]; + + let _local_7 = 1; + + if(scale == 32) + { + diameter = FurniturePartyBeamerVisualization.AREA_DIAMETER_SMALL; + _local_7 = 0.5; + } + else + { + diameter = FurniturePartyBeamerVisualization.AREA_DIAMETER_LARGE; + } + + const _local_9: number = (animationPhase + (animationDirection * animationSpeed)); + + if(Math.abs(_local_9) >= diameter) + { + if(animationDirection > 0) + { + animationPhase = (animationPhase - (_local_9 - diameter)); + } + else + { + animationPhase = (animationPhase + (-(diameter) - _local_9)); + } + + animationDirection = -(animationDirection); + + this._animDirectionIndex[layerId] = animationDirection; + } + + const _local_10: number = ((diameter - Math.abs(animationPhase)) * animationFactor); + + let _local_11: number = ((animationDirection * Math.sin(Math.abs((animationPhase / 4)))) * _local_10); + + if(animationDirection > 0) + { + _local_11 = (_local_11 - _local_10); + } + else + { + _local_11 = (_local_11 + _local_10); + } + + animationPhase = (animationPhase + ((animationDirection * animationSpeed) * _local_7)); + + this._animPhaseIndex[layerId] = animationPhase; + + if(Math.trunc(_local_11) == 0) this._animFactorIndex[layerId] = this.getRandomAmplitudeFactor(); + + return new NitroPoint(animationPhase, _local_11); + } + + private initItems(scale: number): void + { + let diameter: number; + + if(scale === 32) + { + diameter = FurniturePartyBeamerVisualization.AREA_DIAMETER_SMALL; + } + else + { + diameter = FurniturePartyBeamerVisualization.AREA_DIAMETER_LARGE; + } + + this._animPhaseIndex = []; + this._animPhaseIndex.push(((Math.random() * diameter) * 1.5)); + this._animPhaseIndex.push(((Math.random() * diameter) * 1.5)); + + this._animDirectionIndex = []; + this._animDirectionIndex.push(1); + this._animDirectionIndex.push(-1); + + this._animSpeedIndex = []; + this._animSpeedIndex.push(FurniturePartyBeamerVisualization.ANIM_SPEED_FAST); + this._animSpeedIndex.push(FurniturePartyBeamerVisualization.ANIM_SPEED_SLOW); + + this._animFactorIndex = []; + this._animFactorIndex.push(this.getRandomAmplitudeFactor()); + this._animFactorIndex.push(this.getRandomAmplitudeFactor()); + } + + protected getLayerXOffset(scale: number, direction: number, layerId: number): number + { + if((layerId === 2) || (layerId === 3)) + { + if(this._animOffsetIndex.length == 2) + { + return this._animOffsetIndex[(layerId - 2)].x; + } + } + return super.getLayerXOffset(scale, direction, layerId); + } + + protected getLayerYOffset(scale: number, direction: number, layerId: number): number + { + if((layerId === 2) || (layerId === 3)) + { + if(this._animOffsetIndex.length == 2) + { + return this._animOffsetIndex[(layerId - 2)].y; + } + } + return super.getLayerYOffset(scale, direction, layerId); + } + + private getRandomAmplitudeFactor(): number + { + return ((Math.random() * 30) / 100) + 0.15; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualization.ts new file mode 100644 index 0000000..cae21b4 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualization.ts @@ -0,0 +1,133 @@ +import { IAssetLogicPlanetSystem, RoomObjectVariable, Vector3d } from '../../../../../api'; +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; +import { FurniturePlanetSystemVisualizationPlanetObject } from './FurniturePlanetSystemVisualizationPlanetObject'; + +export class FurniturePlanetSystemVisualization extends FurnitureAnimatedVisualization +{ + private _planetIndex: FurniturePlanetSystemVisualizationPlanetObject[]; + private _planetNameIndex: string[]; + private _offsetArray: Vector3d[]; + private _rootPosition: Vector3d; + + constructor() + { + super(); + + this._offsetArray = []; + this._rootPosition = new Vector3d(); + } + + public dispose(): void + { + if(this._planetIndex) + { + while(this._planetIndex.length > 0) + { + const planet = this._planetIndex.shift(); + + planet.dispose(); + } + } + + this._planetIndex = null; + this._planetNameIndex = null; + } + + protected updateAnimation(scale: number): number + { + if(!this._planetIndex && (this.spriteCount > 0)) + { + if(!this.processPlanets()) return 0; + } + + if(this._planetIndex) + { + for(const planet of this._planetIndex) planet.update(this._offsetArray, this._rootPosition, scale); + + return super.updateAnimation(scale); + } + + return 0; + } + + protected getLayerXOffset(scale: number, direction: number, layerId: number): number + { + if(this._offsetArray[layerId]) + { + return this._offsetArray[layerId].x; + } + + return super.getLayerXOffset(scale, direction, layerId); + } + + protected getLayerYOffset(scale: number, direction: number, layerId: number): number + { + if(this._offsetArray[layerId]) + { + return this._offsetArray[layerId].y; + } + + return super.getLayerYOffset(scale, direction, layerId); + } + + protected getLayerZOffset(scale: number, direction: number, layerId: number): number + { + if(this._offsetArray[layerId]) + { + return this._offsetArray[layerId].z; + } + + return super.getLayerZOffset(scale, direction, layerId); + } + + private processPlanets(): boolean + { + if(!this.object || !this.object.model) return; + + const planetSystems = this.object.model.getValue(RoomObjectVariable.FURNITURE_PLANETSYSTEM_DATA); + + if(!planetSystems) return false; + + this._planetIndex = []; + this._planetNameIndex = []; + + for(const planet of planetSystems) + { + const sprite = this.getSprite(planet.id); + + if(sprite) + { + this.addPlanet(planet.name, planet.id, planet.parent, (planet.radius || 0), (planet.arcSpeed || 0), (planet.arcOffset || 0), (planet.height || 0)); + } + } + + return true; + } + + private addPlanet(name: string, index: number, parentName: string, radius: number, arcSpeed: number, arcOffset: number, height: number): void + { + if(!this._planetIndex) return; + + const planet = new FurniturePlanetSystemVisualizationPlanetObject(name, index, radius, arcSpeed, arcOffset, height); + const existingPlanet = this.getPlanet(parentName); + + if(existingPlanet) existingPlanet.addChild(planet); + else + { + this._planetIndex.push(planet); + this._planetNameIndex.push(name); + } + } + + private getPlanet(name: string): FurniturePlanetSystemVisualizationPlanetObject + { + for(const planet of this._planetIndex) + { + if(planet.name === name) return planet; + + if(planet.hasChild(name)) return planet.getChild(name); + } + + return null; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualizationPlanetObject.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualizationPlanetObject.ts new file mode 100644 index 0000000..770daae --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurniturePlanetSystemVisualizationPlanetObject.ts @@ -0,0 +1,91 @@ +import { Vector3d } from '../../../../../api'; + +export class FurniturePlanetSystemVisualizationPlanetObject +{ + private static SYSTEM_TEMPO: number = 30; + + private _name: string; + private _index: number; + private _radius: number; + private _arcSpeed: number; + private _arcOffset: number; + private _height: number; + private _position: number; + private _positionVector: Vector3d; + private _children: FurniturePlanetSystemVisualizationPlanetObject[]; + + constructor(name: string, index: number, radius: number, arcSpeed: number, arcOffset: number, height: number) + { + this._name = name; + this._index = index; + this._radius = radius; + this._arcSpeed = (((arcSpeed * Math.PI) * 2) / 360); + this._arcOffset = (((arcOffset * Math.PI) * 2) / 360); + this._height = height; + this._position = 0; + this._positionVector = new Vector3d(0, 0, 0); + this._children = []; + } + + public dispose(): void + { + while(this._children.length > 0) + { + const child = this._children.shift(); + + child.dispose(); + } + } + + public update(offsets: Vector3d[], rootPosition: Vector3d, scale: number): void + { + this._position = (this._position + (this._arcSpeed / FurniturePlanetSystemVisualizationPlanetObject.SYSTEM_TEMPO)); + + offsets[this._index] = this.getPositionVector(rootPosition, scale); + + for(const child of this._children) child.update(offsets, this._positionVector, scale); + } + + public getPositionVector(position: Vector3d, scale: number): Vector3d + { + const cos = (this._radius * Math.cos((this._position + this._arcOffset))); + const sine = (this._radius * Math.sin((this._position + this._arcOffset))); + + this._positionVector.x = ((cos - sine) * (scale / 2)); + this._positionVector.y = ((((sine + cos) * (scale / 2)) * 0.5) - (this._height * (scale / 2))); + this._positionVector.z = -(Math.trunc(((4 * (cos + sine)) - 0.7))); + + if(position) this._positionVector.add(position); + + return this._positionVector; + } + + public addChild(planetObject: FurniturePlanetSystemVisualizationPlanetObject): void + { + if(this._children.indexOf(planetObject) >= 0) return; + + this._children.push(planetObject); + } + + public hasChild(name: string): boolean + { + return !!this.getChild(name); + } + + public getChild(name: string): FurniturePlanetSystemVisualizationPlanetObject + { + for(const child of this._children) + { + if(child.name === name) return child; + + if(child.hasChild(name)) return child.getChild(name); + } + + return null; + } + + public get name(): string + { + return this._name; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurniturePosterVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurniturePosterVisualization.ts new file mode 100644 index 0000000..6bfadc4 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurniturePosterVisualization.ts @@ -0,0 +1,6 @@ +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class FurniturePosterVisualization extends FurnitureAnimatedVisualization +{ + +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureQueueTileVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureQueueTileVisualization.ts new file mode 100644 index 0000000..9a1e5de --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureQueueTileVisualization.ts @@ -0,0 +1,50 @@ +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class FurnitureQueueTileVisualization extends FurnitureAnimatedVisualization +{ + private static ANIMATION_ID_ROLL: number = 3; + private static ANIMATION_ID_ROLL_ONCE: number = 2; + private static ANIMATION_ID_NORMAL: number = 1; + private static ANIMATION_DURATION: number = 15; + + private _stateQueue: number[]; + private _animationCounter: number; + + constructor() + { + super(); + + this._stateQueue = []; + this._animationCounter = -1; + } + + protected setAnimation(animationId: number): void + { + if(animationId === FurnitureQueueTileVisualization.ANIMATION_ID_ROLL_ONCE) + { + this._stateQueue = []; + this._stateQueue.push(FurnitureQueueTileVisualization.ANIMATION_ID_NORMAL); + + this._animationCounter = FurnitureQueueTileVisualization.ANIMATION_DURATION; + } + + return super.setAnimation(animationId); + } + + protected updateAnimation(scale: number): number + { + if(this._animationCounter > 0) this._animationCounter--; + + if(!this._animationCounter) + { + if(this._stateQueue.length) super.setAnimation(this._stateQueue.shift()); + } + + return super.updateAnimation(scale); + } + + protected usesAnimationResetting(): boolean + { + return true; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureResettingAnimatedVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureResettingAnimatedVisualization.ts new file mode 100644 index 0000000..dd191e9 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureResettingAnimatedVisualization.ts @@ -0,0 +1,9 @@ +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class FurnitureResettingAnimatedVisualization extends FurnitureAnimatedVisualization +{ + protected usesAnimationResetting(): boolean + { + return true; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureRoomBackgroundVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureRoomBackgroundVisualization.ts new file mode 100644 index 0000000..fc35376 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureRoomBackgroundVisualization.ts @@ -0,0 +1,64 @@ +import { Resource, Texture } from '@pixi/core'; +import { DirectionalOffsetData } from '../data'; +import { FurnitureBrandedImageVisualization } from './FurnitureBrandedImageVisualization'; + +export class FurnitureRoomBackgroundVisualization extends FurnitureBrandedImageVisualization +{ + private _imageOffset: DirectionalOffsetData; + + protected imageReady(texture: Texture, imageUrl: string): void + { + super.imageReady(texture, imageUrl); + + if(!texture) return; + + this.setImageOffset(texture.width, texture.height); + } + + private setImageOffset(width: number, height: number): void + { + const offsetData = new DirectionalOffsetData(); + + offsetData.setDirection(1, 0, -height); + offsetData.setDirection(3, 0, 0); + offsetData.setDirection(5, -width, 0); + offsetData.setDirection(7, -width, -height); + offsetData.setDirection(4, (-width / 2), (-height / 2)); + + this._imageOffset = offsetData; + } + + protected getLayerXOffset(scale: number, direction: number, layerId: number): number + { + if(this._imageOffset) + { + const offset = this._imageOffset.getXOffset(direction, 0); + + if(offset !== undefined) return offset + this._offsetX; + } + + return super.getLayerXOffset(scale, direction, layerId) + this._offsetX; + } + + protected getLayerYOffset(scale: number, direction: number, layerId: number): number + { + if(this._imageOffset) + { + const offset = this._imageOffset.getYOffset(direction, 0); + + if(offset !== undefined) return offset + this._offsetY; + } + + return super.getLayerYOffset(scale, direction, layerId) + this._offsetY; + } + + protected getLayerZOffset(scale: number, direction: number, layerId: number): number + { + return super.getLayerZOffset(scale, direction, layerId) + (-(this._offsetZ)); + } + + protected getLayerIgnoreMouse(scale: number, direction: number, layerId: number): boolean + { + return true; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureScoreBoardVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureScoreBoardVisualization.ts new file mode 100644 index 0000000..0ec747e --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureScoreBoardVisualization.ts @@ -0,0 +1,24 @@ +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class FurnitureScoreBoardVisualization extends FurnitureAnimatedVisualization +{ + private static ONES_SPRITE: string = 'ones_sprite'; + private static TENS_SPRITE: string = 'tens_sprite'; + private static HUNDREDS_SPRITE: string = 'hundreds_sprite'; + private static THOUSANDS_SPRITE: string = 'thousands_sprite'; + + protected getFrameNumber(scale: number, layerId: number): number + { + const tag = this.getLayerTag(scale, this.direction, layerId); + const animation = this.object.getState(0); + + switch(tag) + { + case FurnitureScoreBoardVisualization.ONES_SPRITE: return Math.floor(animation % 10); + case FurnitureScoreBoardVisualization.TENS_SPRITE: return Math.floor((animation / 10) % 10); + case FurnitureScoreBoardVisualization.HUNDREDS_SPRITE: return Math.floor((animation / 100) % 10); + case FurnitureScoreBoardVisualization.THOUSANDS_SPRITE: return Math.floor((animation / 1000) % 10); + default: return super.getFrameNumber(scale, layerId); + } + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureSoundBlockVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureSoundBlockVisualization.ts new file mode 100644 index 0000000..02c814e --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureSoundBlockVisualization.ts @@ -0,0 +1,16 @@ +import { RoomObjectVariable } from '../../../../../api'; +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class FurnitureSoundBlockVisualization extends FurnitureAnimatedVisualization +{ + private _internalFrameIncreaseCounter: number = 0; + + protected updateAnimations(scale: number): number + { + this._internalFrameIncreaseCounter = (this._internalFrameIncreaseCounter + this.object.model.getValue(RoomObjectVariable.FURNITURE_SOUNDBLOCK_RELATIVE_ANIMATION_SPEED)); + this._frameIncrease = this._internalFrameIncreaseCounter; + this._internalFrameIncreaseCounter = (this._internalFrameIncreaseCounter - this._frameIncrease); + + return super.updateAnimations(scale); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureStickieVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureStickieVisualization.ts new file mode 100644 index 0000000..76fb3b6 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureStickieVisualization.ts @@ -0,0 +1,12 @@ +import { ColorData } from '../data/ColorData'; +import { FurnitureVisualization } from './FurnitureVisualization'; + +export class FurnitureStickieVisualization extends FurnitureVisualization +{ + protected getLayerColor(scale: number, layerId: number, colorId: number): number + { + if(!this._data) return ColorData.DEFAULT_COLOR; + + return this._data.getLayerColor(scale, layerId, colorId); + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureValRandomizerVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureValRandomizerVisualization.ts new file mode 100644 index 0000000..b95769c --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureValRandomizerVisualization.ts @@ -0,0 +1,76 @@ +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class FurnitureValRandomizerVisualization extends FurnitureAnimatedVisualization +{ + private static ANIMATION_ID_OFFSET_SLOW1: number = 20; + private static ANIMATION_ID_OFFSET_SLOW2: number = 10; + private static ANIMATION_ID_START_ROLL: number = 31; + private static ANIMATION_ID_ROLL: number = 32; + private static ANIMATION_ID_OFF: number = 30; + + private _stateQueue: number[]; + private _running: boolean; + + constructor() + { + super(); + + this._stateQueue = []; + this._running = false; + + super.setAnimation(FurnitureValRandomizerVisualization.ANIMATION_ID_OFF); + } + + protected setAnimation(animationId: number): void + { + if(animationId === 0) + { + if(!this._running) + { + this._running = true; + this._stateQueue = []; + + this._stateQueue.push(FurnitureValRandomizerVisualization.ANIMATION_ID_START_ROLL); + this._stateQueue.push(FurnitureValRandomizerVisualization.ANIMATION_ID_ROLL); + + return; + } + } + + if((animationId > 0) && (animationId <= FurnitureValRandomizerVisualization.ANIMATION_ID_OFFSET_SLOW2)) + { + if(this._running) + { + this._running = false; + this._stateQueue = []; + + if(this.direction === 2) + { + this._stateQueue.push(FurnitureValRandomizerVisualization.ANIMATION_ID_OFFSET_SLOW1 + 5); + this._stateQueue.push(FurnitureValRandomizerVisualization.ANIMATION_ID_OFFSET_SLOW2 + 5); + } + else + { + this._stateQueue.push(FurnitureValRandomizerVisualization.ANIMATION_ID_OFFSET_SLOW1 + animationId); + this._stateQueue.push(FurnitureValRandomizerVisualization.ANIMATION_ID_OFFSET_SLOW2 + animationId); + } + + this._stateQueue.push(FurnitureValRandomizerVisualization.ANIMATION_ID_OFF); + + return; + } + + super.setAnimation(FurnitureValRandomizerVisualization.ANIMATION_ID_OFF); + } + } + + protected updateAnimation(scale: number): number + { + if(this.getLastFramePlayed(11)) + { + if(this._stateQueue.length) super.setAnimation(this._stateQueue.shift()); + } + + return super.updateAnimation(scale); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureVisualization.ts new file mode 100644 index 0000000..5b95684 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureVisualization.ts @@ -0,0 +1,588 @@ +import { AlphaTolerance, IGraphicAsset, IObjectVisualizationData, IRoomGeometry, IRoomObjectSprite, RoomObjectVariable, RoomObjectVisualizationType } from '../../../../../api'; +import { RoomObjectSpriteVisualization } from '../../../../../room'; +import { ColorData, LayerData } from '../data'; +import { FurnitureVisualizationData } from './FurnitureVisualizationData'; + +export class FurnitureVisualization extends RoomObjectSpriteVisualization +{ + protected static DEPTH_MULTIPLIER: number = Math.sqrt(0.5); + + public static TYPE: string = RoomObjectVisualizationType.FURNITURE_STATIC; + + protected _data: FurnitureVisualizationData; + + protected _type: string; + protected _direction: number; + protected _lastCameraAngle: number; + protected _selectedColor: number; + protected _furnitureLift: number; + protected _alphaMultiplier: number; + protected _alphaChanged: boolean; + protected _clickUrl: string; + protected _clickHandling: boolean; + + protected _cacheDirection: number; + protected _cacheScale: number; + protected _cacheSize: number; + + protected _layerCount: number; + protected _shadowLayerIndex: number; + protected _updatedLayers: boolean[]; + protected _assetNames: string[]; + protected _spriteTags: string[]; + protected _spriteInks: number[]; + protected _spriteAlphas: number[]; + protected _spriteColors: number[]; + protected _spriteMouseCaptures: boolean[]; + protected _spriteXOffsets: number[]; + protected _spriteYOffsets: number[]; + protected _spriteZOffsets: number[]; + + private _animationNumber: number; + + constructor() + { + super(); + + this._data = null; + + this._type = null; + this._direction = 0; + this._lastCameraAngle = NaN; + this._selectedColor = 0; + this._furnitureLift = 0; + this._alphaMultiplier = 1; + this._alphaChanged = false; + this._clickUrl = null; + this._clickHandling = false; + + this._cacheDirection = -1; + this._cacheScale = 0; + this._cacheSize = -1; + + this._layerCount = 0; + this._shadowLayerIndex = -1; + this._updatedLayers = []; + this._assetNames = []; + this._spriteTags = []; + this._spriteInks = []; + this._spriteAlphas = []; + this._spriteColors = []; + this._spriteMouseCaptures = []; + this._spriteXOffsets = []; + this._spriteYOffsets = []; + this._spriteZOffsets = []; + + this._animationNumber = 0; + } + + public initialize(data: IObjectVisualizationData): boolean + { + this.reset(); + + if(!(data instanceof FurnitureVisualizationData)) return false; + + this._type = data.type; + this._data = data; + + return true; + } + + public dispose(): void + { + super.dispose(); + + this._data = null; + this._updatedLayers = null; + this._assetNames = null; + this._spriteTags = null; + this._spriteInks = null; + this._spriteAlphas = null; + this._spriteColors = null; + this._spriteMouseCaptures = null; + this._spriteXOffsets = null; + this._spriteYOffsets = null; + this._spriteZOffsets = null; + } + + protected reset(): void + { + super.reset(); + + this.setDirection(-1); + + this._data = null; + this._updatedLayers = []; + this._assetNames = []; + this._spriteTags = []; + this._spriteInks = []; + this._spriteAlphas = []; + this._spriteColors = []; + this._spriteMouseCaptures = []; + this._spriteXOffsets = []; + this._spriteYOffsets = []; + this._spriteZOffsets = []; + + this.createSprites(0); + } + + protected resetLayers(scale: number, direction: number): void + { + if((this._cacheDirection === direction) && (this._cacheScale === scale)) return; + + this._updatedLayers = []; + this._assetNames = []; + this._spriteTags = []; + this._spriteInks = []; + this._spriteAlphas = []; + this._spriteColors = []; + this._spriteMouseCaptures = []; + this._spriteXOffsets = []; + this._spriteYOffsets = []; + this._spriteZOffsets = []; + + this._cacheDirection = direction; + this._cacheScale = scale; + this._cacheSize = this.getValidSize(scale); + + this.setLayerCount(((this._data && this._data.getLayerCount(scale)) || 0) + this.getAdditionalLayerCount()); + } + + public update(geometry: IRoomGeometry, time: number, update: boolean, skipUpdate: boolean): void + { + if(!geometry) return; + + const scale = geometry.scale; + let updateSprites = false; + + if(this.updateObject(scale, geometry.direction.x)) updateSprites = true; + + if(this.updateModel(scale)) updateSprites = true; + + let number = 0; + + if(skipUpdate) + { + this._animationNumber = (this._animationNumber | this.updateAnimation(scale)); + } + else + { + number = this.updateAnimation(scale) | this._animationNumber; + + this._animationNumber = 0; + } + + if(updateSprites || (number !== 0)) + { + this.updateSprites(scale, updateSprites, number); + + this._scale = scale; + + this.updateSpriteCounter++; + } + } + + protected updateObject(scale: number, direction: number): boolean + { + if(!this.object) return false; + + if((this.updateObjectCounter === this.object.updateCounter) && (scale === this._scale) && (this._lastCameraAngle === direction)) return false; + + let offsetDirection = (this.object.getDirection().x - (direction + 135)); + + offsetDirection = ((((offsetDirection) % 360) + 360) % 360); + + if(this._data) + { + const validDirection = this._data.getValidDirection(scale, offsetDirection); + + this.setDirection(validDirection); + } + + this._lastCameraAngle = direction; + this._scale = scale; + + this.updateObjectCounter = this.object.updateCounter; + + this.resetLayers(scale, this._direction); + + return true; + } + + protected updateModel(scale: number): boolean + { + const model = this.object && this.object.model; + + if(!model) return false; + + if(this.updateModelCounter === model.updateCounter) return false; + + this._selectedColor = model.getValue(RoomObjectVariable.FURNITURE_COLOR); + this._clickUrl = model.getValue(RoomObjectVariable.FURNITURE_AD_URL); + this._clickHandling = ((this._clickUrl && (this._clickUrl !== '') && (this._clickUrl.indexOf('http') === 0)) || false); + this._furnitureLift = (model.getValue(RoomObjectVariable.FURNITURE_LIFT_AMOUNT) || 0); + + let alphaMultiplier = model.getValue(RoomObjectVariable.FURNITURE_ALPHA_MULTIPLIER); + + if(isNaN(alphaMultiplier)) alphaMultiplier = 1; + + if(this._alphaMultiplier !== alphaMultiplier) + { + this._alphaMultiplier = alphaMultiplier; + + this._alphaChanged = true; + } + + this.updateModelCounter = model.updateCounter; + + return true; + } + + protected updateSprites(scale: number, update: boolean, animation: number): void + { + if(this._layerCount !== this.totalSprites) this.createSprites(this._layerCount); + + if(update) + { + let layerId = (this.totalSprites - 1); + + while(layerId >= 0) + { + this.updateSprite(scale, layerId); + + layerId--; + } + } + else + { + let layerId = 0; + + while(animation > 0) + { + if(animation) this.updateSprite(scale, layerId); + + layerId++; + animation = (animation >> 1); + } + } + + this._alphaChanged = false; + } + + protected updateSprite(scale: number, layerId: number): void + { + const assetName = this.getSpriteAssetName(scale, layerId); + const sprite = this.getSprite(layerId); + + if(assetName && sprite) + { + const assetData = this.getAsset(assetName, layerId); + + if(assetData && assetData.texture) + { + sprite.visible = true; + sprite.type = this._type; + sprite.texture = assetData.texture; + sprite.flipH = assetData.flipH; + sprite.flipV = assetData.flipV; + sprite.direction = this._direction; + + let relativeDepth = 0; + + if(layerId !== this._shadowLayerIndex) + { + sprite.tag = this.getLayerTag(scale, this._direction, layerId); + sprite.alpha = this.getLayerAlpha(scale, this._direction, layerId); + sprite.color = this.getLayerColor(scale, layerId, this._selectedColor); + sprite.offsetX = (assetData.offsetX + this.getLayerXOffset(scale, this._direction, layerId)); + sprite.offsetY = (assetData.offsetY + this.getLayerYOffset(scale, this._direction, layerId)); + sprite.blendMode = this.getLayerInk(scale, this._direction, layerId); + sprite.alphaTolerance = (this.getLayerIgnoreMouse(scale, this._direction, layerId) ? AlphaTolerance.MATCH_NOTHING : AlphaTolerance.MATCH_OPAQUE_PIXELS); + + relativeDepth = this.getLayerZOffset(scale, this._direction, layerId); + relativeDepth = (relativeDepth - (layerId * 0.001)); + } + else + { + sprite.offsetX = assetData.offsetX; + sprite.offsetY = (assetData.offsetY + this.getLayerYOffset(scale, this._direction, layerId)); + sprite.alpha = (48 * this._alphaMultiplier); + sprite.alphaTolerance = AlphaTolerance.MATCH_NOTHING; + + relativeDepth = 1; + } + + sprite.relativeDepth = (relativeDepth * FurnitureVisualization.DEPTH_MULTIPLIER); + sprite.name = assetName; + sprite.libraryAssetName = this.getLibraryAssetNameForSprite(assetData, sprite); + sprite.posture = this.getPostureForAsset(scale, assetData.source); + sprite.clickHandling = this._clickHandling; + } + else + { + this.resetSprite(sprite); + } + } + else + { + if(sprite) this.resetSprite(sprite); + } + } + + protected getLibraryAssetNameForSprite(asset: IGraphicAsset, sprite: IRoomObjectSprite): string + { + return asset.source; + } + + protected getPostureForAssetFile(scale: number, _arg_2: string): string + { + return null; + } + + private resetSprite(sprite: IRoomObjectSprite): void + { + if(!sprite) return; + + sprite.texture = null; + sprite.libraryAssetName = ''; + sprite.posture = ''; + sprite.tag = ''; + sprite.offsetX = 0; + sprite.offsetY = 0; + sprite.flipH = false; + sprite.flipV = false; + sprite.relativeDepth = 0; + sprite.clickHandling = false; + } + + protected getSpriteAssetName(scale: number, layerId: number): string + { + if(!this._data || (layerId >= FurnitureVisualizationData.LAYER_LETTERS.length)) return ''; + + let assetName = this._assetNames[layerId]; + let updated = this._updatedLayers[layerId]; + + if(!assetName || !assetName.length) + { + assetName = this.cacheSpriteAssetName(scale, layerId, true); + updated = (this._cacheSize !== 1); + } + + if(updated) assetName += this.getFrameNumber(scale, layerId); + + return assetName; + } + + protected cacheSpriteAssetName(scale: number, layerId: number, cache: boolean): string + { + const type = this._type; + const size = (cache) ? this._cacheSize : this.getValidSize(scale); + let layerCode = ''; + const isntIcon = (size !== 1); + + if(layerId !== this._shadowLayerIndex) + { + layerCode = FurnitureVisualizationData.LAYER_LETTERS[layerId] || ''; + } + else + { + layerCode = 'sd'; + } + + if(layerCode === '') return null; + + const assetName = (this._type + ((isntIcon) ? ('_' + size + '_' + layerCode + '_' + this._direction + '_') : ('_icon_' + layerCode))); + + if(cache) + { + this._assetNames[layerId] = assetName; + this._updatedLayers[layerId] = isntIcon; + } + + return assetName; + } + + protected getLayerTag(scale: number, direction: number, layerId: number): string + { + const existing = this._spriteTags[layerId]; + + if(existing !== undefined) return existing; + + if(!this._data) return LayerData.DEFAULT_TAG; + + const tag = this._data.getLayerTag(scale, direction, layerId); + + this._spriteTags[layerId] = tag; + + return tag; + } + + protected getLayerInk(scale: number, direction: number, layerId: number): number + { + const existing = this._spriteInks[layerId]; + + if(existing !== undefined) return existing; + + if(!this._data) return LayerData.DEFAULT_INK; + + const ink = this._data.getLayerInk(scale, direction, layerId); + + this._spriteInks[layerId] = ink; + + return ink; + } + + protected getLayerAlpha(scale: number, direction: number, layerId: number): number + { + if(!this._alphaChanged) + { + const existing = this._spriteAlphas[layerId]; + + if(existing !== undefined) return existing; + } + + if(!this._data) return LayerData.DEFAULT_ALPHA; + + let alpha = this._data.getLayerAlpha(scale, direction, layerId); + + if(this._alphaMultiplier !== null) alpha = (alpha * this._alphaMultiplier); + + this._spriteAlphas[layerId] = alpha; + + return alpha; + } + + protected getLayerColor(scale: number, layerId: number, colorId: number): number + { + const existing = this._spriteColors[layerId]; + + if(existing !== undefined) return existing; + + if(!this._data) return ColorData.DEFAULT_COLOR; + + const color = this._data.getLayerColor(scale, layerId, colorId); + + this._spriteColors[layerId] = color; + + return color; + } + + protected getLayerIgnoreMouse(scale: number, direction: number, layerId: number): boolean + { + const existing = this._spriteMouseCaptures[layerId]; + + if(existing !== undefined) return existing; + + if(!this._data) return LayerData.DEFAULT_IGNORE_MOUSE; + + const ignoreMouse = this._data.getLayerIgnoreMouse(scale, direction, layerId); + + this._spriteMouseCaptures[layerId] = ignoreMouse; + + return ignoreMouse; + } + + protected getLayerXOffset(scale: number, direction: number, layerId: number): number + { + const existing = this._spriteXOffsets[layerId]; + + if(existing !== undefined) return existing; + + if(!this._data) return LayerData.DEFAULT_XOFFSET; + + const xOffset = this._data.getLayerXOffset(scale, direction, layerId); + + this._spriteXOffsets[layerId] = xOffset; + + return xOffset; + } + + protected getLayerYOffset(scale: number, direction: number, layerId: number): number + { + if(layerId === this._shadowLayerIndex) return Math.ceil((this._furnitureLift * (scale / 2))); + + const existing = this._spriteYOffsets[layerId]; + + if(existing !== undefined) return existing; + + if(!this._data) return LayerData.DEFAULT_YOFFSET; + + const yOffset = this._data.getLayerYOffset(scale, direction, layerId); + + this._spriteYOffsets[layerId] = yOffset; + + return yOffset; + } + + protected getLayerZOffset(scale: number, direction: number, layerId: number): number + { + const existing = this._spriteZOffsets[layerId]; + + if(existing !== undefined) return existing; + + if(!this._data) return LayerData.DEFAULT_ZOFFSET; + + const zOffset = this._data.getLayerZOffset(scale, direction, layerId); + + this._spriteZOffsets[layerId] = zOffset; + + return zOffset; + } + + protected getValidSize(scale: number): number + { + if(!this._data) return scale; + + return this._data.getValidSize(scale); + } + + protected setLayerCount(count: number): void + { + this._layerCount = count; + this._shadowLayerIndex = count - this.getAdditionalLayerCount(); + } + + protected setDirection(direction: number): void + { + if(this._direction === direction) return; + + this._direction = direction; + } + + protected getAdditionalLayerCount(): number + { + return 1; + } + + protected updateAnimation(scale: number): number + { + return 0; + } + + protected getFrameNumber(scale: number, layerId: number): number + { + return 0; + } + + protected getPostureForAsset(scale: number, name: string): string + { + return null; + } + + public getAsset(name: string, layerId: number = -1): IGraphicAsset + { + if(!this.asset) return null; + + return this.asset.getAsset(name); + } + + protected get direction(): number + { + return this._direction; + } + + protected get data(): FurnitureVisualizationData + { + return this._data; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureVisualizationData.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureVisualizationData.ts new file mode 100644 index 0000000..7c6b948 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureVisualizationData.ts @@ -0,0 +1,291 @@ +import { IAssetData, IAssetVisualizationData, IObjectVisualizationData } from '../../../../../api'; +import { ColorData, LayerData, SizeData } from '../data'; + +export class FurnitureVisualizationData implements IObjectVisualizationData +{ + public static LAYER_LETTERS: string[] = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; + + private _type: string; + private _sizes: number[]; + private _sizeDatas: Map; + private _lastSize: number; + private _lastSizeScale: number; + private _lastSizeData: SizeData; + private _lastSizeDataScale: number; + + constructor() + { + this._type = ''; + this._sizes = []; + this._sizeDatas = new Map(); + this._lastSize = -1; + this._lastSizeScale = -1; + this._lastSizeData = null; + this._lastSizeDataScale = -1; + } + + public initialize(asset: IAssetData): boolean + { + this.reset(); + + if(!asset) return false; + + this._type = asset.name; + + if(!this.defineVisualizations(asset.visualizations)) + { + this.reset(); + + return false; + } + + return true; + } + + public dispose(): void + { + if(this._sizeDatas && this._sizeDatas.size) + { + for(const size of this._sizeDatas.values()) size && size.dispose(); + + this._sizeDatas = null; + } + + this._lastSizeData = null; + this._sizes = null; + } + + private reset(): void + { + this._type = ''; + + if(this._sizeDatas && this._sizeDatas.size) + { + for(const size of this._sizeDatas.values()) size && size.dispose(); + } + + this._sizeDatas.clear(); + + this._sizes = []; + this._lastSizeData = null; + this._lastSizeDataScale = -1; + } + + protected createSizeData(scale: number, layerCount: number, angle: number): SizeData + { + return new SizeData(layerCount, angle); + } + + protected defineVisualizations(visualizations: IAssetVisualizationData[]): boolean + { + if(!visualizations) return false; + + for(const visualizationId in visualizations) + { + const visualization = visualizations[visualizationId]; + + const layerCount = visualization.layerCount; + const angle = visualization.angle; + + let size = visualization.size; + + if(size < 1) size = 1; + + if(this._sizeDatas.get(size)) return false; + + const sizeData = this.createSizeData(size, layerCount, angle); + + if(!sizeData) return false; + + for(const key in visualization) + { + //@ts-ignore + const data = visualization[key]; + + if(!this.processVisualElement(sizeData, key, data)) + { + sizeData.dispose(); + + return false; + } + } + + this._sizeDatas.set(size, sizeData); + + this._sizes.push(size); + } + + this._sizes.sort(); + + return true; + } + + protected processVisualElement(sizeData: SizeData, key: string, data: any): boolean + { + if(!sizeData || !key || !data) return false; + + switch(key) + { + case 'layers': + if(!sizeData.processLayers(data)) return false; + break; + case 'directions': + if(!sizeData.processDirections(data)) return false; + break; + case 'colors': + if(!sizeData.processColors(data)) return false; + break; + } + + return true; + } + + public getValidSize(scale: number): number + { + if(scale === this._lastSizeScale) return this._lastSize; + + const sizeIndex = this.getSizeIndex(scale); + + let newScale = -1; + + if(sizeIndex < this._sizes.length) newScale = this._sizes[sizeIndex]; + + this._lastSizeScale = scale; + this._lastSize = newScale; + + return newScale; + } + + private getSizeIndex(size: number): number + { + if(size <= 0) return 0; + + let index = 0; + let iterator = 1; + + while(iterator < this._sizes.length) + { + if(this._sizes[iterator] > size) + { + if((this._sizes[iterator] / size) < (size / this._sizes[(iterator - 1)])) index = iterator; + + break; + } + + index = iterator; + + iterator++; + } + + return index; + } + + protected getSizeData(size: number): SizeData + { + if(size === this._lastSizeDataScale) return this._lastSizeData; + + const sizeIndex = this.getSizeIndex(size); + + if(sizeIndex < this._sizes.length) this._lastSizeData = this._sizeDatas.get(this._sizes[sizeIndex]); + else this._lastSizeData = null; + + this._lastSizeDataScale = size; + + return this._lastSizeData; + } + + public getLayerCount(scale: number): number + { + const size = this.getSizeData(scale); + + if(!size) return LayerData.DEFAULT_COUNT; + + return size.layerCount; + } + + public getValidDirection(scale: number, direction: number): number + { + const size = this.getSizeData(scale); + + if(!size) return LayerData.DEFAULT_DIRECTION; + + return size.getValidDirection(direction); + } + + public getLayerTag(scale: number, direction: number, layerId: number): string + { + const size = this.getSizeData(scale); + + if(!size) return LayerData.DEFAULT_TAG; + + return size.getLayerTag(direction, layerId); + } + + public getLayerInk(scale: number, direction: number, layerId: number): number + { + const size = this.getSizeData(scale); + + if(!size) return LayerData.DEFAULT_INK; + + return size.getLayerInk(direction, layerId); + } + + public getLayerAlpha(scale: number, direction: number, layerId: number): number + { + const size = this.getSizeData(scale); + + if(!size) return LayerData.DEFAULT_ALPHA; + + return size.getLayerAlpha(direction, layerId); + } + + public getLayerColor(scale: number, layerId: number, colorId: number): number + { + const size = this.getSizeData(scale); + + if(!size) return ColorData.DEFAULT_COLOR; + + return size.getLayerColor(layerId, colorId); + } + + public getLayerIgnoreMouse(scale: number, direction: number, layerId: number): boolean + { + const size = this.getSizeData(scale); + + if(!size) return LayerData.DEFAULT_IGNORE_MOUSE; + + return size.getLayerIgnoreMouse(direction, layerId); + } + + public getLayerXOffset(scale: number, direction: number, layerId: number): number + { + const size = this.getSizeData(scale); + + if(!size) return LayerData.DEFAULT_XOFFSET; + + return size.getLayerXOffset(direction, layerId); + } + + public getLayerYOffset(scale: number, direction: number, layerId: number): number + { + const size = this.getSizeData(scale); + + if(!size) return LayerData.DEFAULT_YOFFSET; + + return size.getLayerYOffset(direction, layerId); + } + + public getLayerZOffset(scale: number, direction: number, layerId: number): number + { + const size = this.getSizeData(scale); + + if(!size) return LayerData.DEFAULT_ZOFFSET; + + return size.getLayerZOffset(direction, layerId); + } + + public get type(): string + { + return this._type; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureVoteCounterVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureVoteCounterVisualization.ts new file mode 100644 index 0000000..b313402 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureVoteCounterVisualization.ts @@ -0,0 +1,51 @@ +import { RoomObjectVariable } from '../../../../../api'; +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class FurnitureVoteCounterVisualization extends FurnitureAnimatedVisualization +{ + private static ONES_SPRITE: string = 'ones_sprite'; + private static TENS_SPRITE: string = 'tens_sprite'; + private static HUNDREDS_SPRITE: string = 'hundreds_sprite'; + private static HIDE_COUNTER_SCORE: number = -1; + + protected updateObject(scale: number, direction: number): boolean + { + super.updateObject(scale, direction); + + return true; + } + + protected getFrameNumber(scale: number, layerId: number): number + { + const result = this.object.model.getValue(RoomObjectVariable.FURNITURE_VOTE_COUNTER_COUNT); + const tag = this.getLayerTag(scale, this.direction, layerId); + + switch(tag) + { + case FurnitureVoteCounterVisualization.ONES_SPRITE: return (result % 10); + case FurnitureVoteCounterVisualization.TENS_SPRITE: return ((result / 10) % 10); + case FurnitureVoteCounterVisualization.HUNDREDS_SPRITE: return ((result / 100) % 10); + default: return super.getFrameNumber(scale, layerId); + } + } + + protected getLayerAlpha(scale: number, direction: number, layerId: number): number + { + const result = this.object.model.getValue(RoomObjectVariable.FURNITURE_VOTE_COUNTER_COUNT); + + if(result === FurnitureVoteCounterVisualization.HIDE_COUNTER_SCORE) + { + const tag = this.getLayerTag(scale, direction, layerId); + + switch(tag) + { + case FurnitureVoteCounterVisualization.ONES_SPRITE: + case FurnitureVoteCounterVisualization.TENS_SPRITE: + case FurnitureVoteCounterVisualization.HUNDREDS_SPRITE: + return 0; + } + } + + return super.getLayerAlpha(scale, direction, layerId); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureVoteMajorityVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureVoteMajorityVisualization.ts new file mode 100644 index 0000000..8e4b46d --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureVoteMajorityVisualization.ts @@ -0,0 +1,45 @@ +import { RoomObjectVariable } from '../../../../../api'; +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class FurnitureVoteMajorityVisualization extends FurnitureAnimatedVisualization +{ + private static ONES_SPRITE: string = 'ones_sprite'; + private static TENS_SPRITE: string = 'tens_sprite'; + private static HUNDREDS_SPRITE: string = 'hundreds_sprite'; + private static HIDE_RESULTS_STATES: number[] = [-1, 1]; + private static HIDE_RESULTS_VALUE: number = -1; + + protected getFrameNumber(scale: number, layerId: number): number + { + const result = this.object.model.getValue(RoomObjectVariable.FURNITURE_VOTE_MAJORITY_RESULT); + const tag = this.getLayerTag(scale, this.direction, layerId); + + switch(tag) + { + case FurnitureVoteMajorityVisualization.ONES_SPRITE: return (result % 10); + case FurnitureVoteMajorityVisualization.TENS_SPRITE: return ((result / 10) % 10); + case FurnitureVoteMajorityVisualization.HUNDREDS_SPRITE: return ((result / 100) % 10); + default: return super.getFrameNumber(scale, layerId); + } + } + + protected getLayerAlpha(scale: number, direction: number, layerId: number): number + { + const result = this.object.model.getValue(RoomObjectVariable.FURNITURE_VOTE_MAJORITY_RESULT); + + if(((!(FurnitureVoteMajorityVisualization.HIDE_RESULTS_STATES.indexOf(this.object.getState(0)) === -1)) || (result === FurnitureVoteMajorityVisualization.HIDE_RESULTS_VALUE))) + { + const tag = this.getLayerTag(scale, direction, layerId); + + switch(tag) + { + case FurnitureVoteMajorityVisualization.ONES_SPRITE: + case FurnitureVoteMajorityVisualization.TENS_SPRITE: + case FurnitureVoteMajorityVisualization.HUNDREDS_SPRITE: + return 0; + } + } + + return super.getLayerAlpha(scale, direction, layerId); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureWaterAreaVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureWaterAreaVisualization.ts new file mode 100644 index 0000000..c40f65c --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureWaterAreaVisualization.ts @@ -0,0 +1,6 @@ +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class FurnitureWaterAreaVisualization extends FurnitureAnimatedVisualization +{ + +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureYoutubeVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureYoutubeVisualization.ts new file mode 100644 index 0000000..2283aec --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/FurnitureYoutubeVisualization.ts @@ -0,0 +1,18 @@ +import { RoomObjectVariable } from '../../../../../api'; +import { FurnitureDynamicThumbnailVisualization } from './FurnitureDynamicThumbnailVisualization'; + +export class FurnitureYoutubeVisualization extends FurnitureDynamicThumbnailVisualization +{ + protected static THUMBNAIL_URL: string = 'THUMBNAIL_URL'; + + protected getThumbnailURL(): string + { + if(!this.object) return null; + + const furnitureData = this.object.model.getValue<{ [index: string]: string }>(RoomObjectVariable.FURNITURE_DATA); + + if(furnitureData) return (furnitureData[FurnitureYoutubeVisualization.THUMBNAIL_URL] || null); + + return null; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/IsometricImageFurniVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/IsometricImageFurniVisualization.ts new file mode 100644 index 0000000..1c0a0ce --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/IsometricImageFurniVisualization.ts @@ -0,0 +1,173 @@ +import { Resource, Texture } from '@pixi/core'; +import { Matrix } from '@pixi/math'; +import { IGraphicAsset } from '../../../../../api'; +import { NitroSprite, NitroTexture, TextureUtils } from '../../../../../pixi-proxy'; +import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; + +export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualization +{ + protected static THUMBNAIL: string = 'THUMBNAIL'; + + private _thumbnailAssetNameNormal: string; + private _thumbnailImageNormal: Texture; + private _thumbnailDirection: number; + private _thumbnailChanged: boolean; + protected _hasOutline: boolean; + + constructor() + { + super(); + + this._thumbnailAssetNameNormal = null; + this._thumbnailImageNormal = null; + this._thumbnailDirection = -1; + this._thumbnailChanged = false; + this._hasOutline = false; + } + + public get hasThumbnailImage(): boolean + { + return !(this._thumbnailImageNormal == null); + } + + public setThumbnailImages(k: Texture): void + { + this._thumbnailImageNormal = k; + this._thumbnailChanged = true; + } + + protected updateModel(scale: number): boolean + { + const flag = super.updateModel(scale); + + if(!this._thumbnailChanged && (this._thumbnailDirection === this.direction)) return flag; + + this.refreshThumbnail(); + + return true; + } + + private refreshThumbnail(): void + { + if(this.asset == null) return; + + if(this._thumbnailImageNormal) + { + this.addThumbnailAsset(this._thumbnailImageNormal, 64); + } + else + { + this.asset.disposeAsset(this.getThumbnailAssetName(64)); + } + + this._thumbnailChanged = false; + this._thumbnailDirection = this.direction; + } + + private addThumbnailAsset(k: Texture, scale: number): void + { + let layerId = 0; + + while(layerId < this.totalSprites) + { + if(this.getLayerTag(scale, this.direction, layerId) === IsometricImageFurniVisualization.THUMBNAIL) + { + const assetName = (this.cacheSpriteAssetName(scale, layerId, false) + this.getFrameNumber(scale, layerId)); + const asset = this.getAsset(assetName, layerId); + + if(asset) + { + const _local_6 = this.generateTransformedThumbnail(k, asset); + const _local_7 = this.getThumbnailAssetName(scale); + + this.asset.disposeAsset(_local_7); + this.asset.addAsset(_local_7, _local_6, true, asset.offsetX, asset.offsetY, false, false); + } + + return; + } + + layerId++; + } + } + + protected generateTransformedThumbnail(texture: Texture, asset: IGraphicAsset): Texture + { + if(this._hasOutline) + { + const container = new NitroSprite(); + const background = new NitroSprite(NitroTexture.WHITE); + + background.tint = 0x000000; + background.width = (texture.width + 40); + background.height = (texture.height + 40); + + const sprite = new NitroSprite(texture); + const offsetX = ((background.width - sprite.width) / 2); + const offsetY = ((background.height - sprite.height) / 2); + + sprite.position.set(offsetX, offsetY); + + container.addChild(background, sprite); + + texture = TextureUtils.generateTexture(container); + } + + const scale = 1.1; + const matrix = new Matrix(); + const difference = (asset.width / texture.width); + + switch(this.direction) + { + case 2: + matrix.a = difference; + matrix.b = (-0.5 * difference); + matrix.c = 0; + matrix.d = (difference * scale); + matrix.tx = 0; + matrix.ty = ((0.5 * difference) * texture.width); + break; + case 0: + case 4: + matrix.a = difference; + matrix.b = (0.5 * difference); + matrix.c = 0; + matrix.d = (difference * scale); + matrix.tx = 0; + matrix.ty = 0; + break; + default: + matrix.a = difference; + matrix.b = 0; + matrix.c = 0; + matrix.d = difference; + matrix.tx = 0; + matrix.ty = 0; + } + + const sprite = new NitroSprite(texture); + + sprite.transform.setFromMatrix(matrix); + + return TextureUtils.generateTexture(sprite); + } + + protected getSpriteAssetName(scale: number, layerId: number): string + { + if(this._thumbnailImageNormal && (this.getLayerTag(scale, this.direction, layerId) === IsometricImageFurniVisualization.THUMBNAIL)) return this.getThumbnailAssetName(scale); + + return super.getSpriteAssetName(scale, layerId); + } + + protected getThumbnailAssetName(scale: number): string + { + this._thumbnailAssetNameNormal = this.getFullThumbnailAssetName(this.object.id, 64); + + return this._thumbnailAssetNameNormal; + } + + protected getFullThumbnailAssetName(k: number, _arg_2: number): string + { + return [this._type, k, 'thumb', _arg_2].join('_'); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/furniture/index.ts b/submodules/renderer/src/nitro/room/object/visualization/furniture/index.ts new file mode 100644 index 0000000..01ef20b --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/furniture/index.ts @@ -0,0 +1,41 @@ +export * from './FurnitureAnimatedVisualization'; +export * from './FurnitureAnimatedVisualizationData'; +export * from './FurnitureBadgeDisplayVisualization'; +export * from './FurnitureBBVisualization'; +export * from './FurnitureBottleVisualization'; +export * from './FurnitureBrandedImageVisualization'; +export * from './FurnitureBuilderPlaceholderVisualization'; +export * from './FurnitureCounterClockVisualization'; +export * from './FurnitureCuboidVisualization'; +export * from './FurnitureDynamicThumbnailVisualization'; +export * from './FurnitureExternalImageVisualization'; +export * from './FurnitureFireworksVisualization'; +export * from './FurnitureGiftWrappedFireworksVisualization'; +export * from './FurnitureGiftWrappedVisualization'; +export * from './FurnitureGuildCustomizedVisualization'; +export * from './FurnitureGuildIsometricBadgeVisualization'; +export * from './FurnitureHabboWheelVisualization'; +export * from './FurnitureIsometricBBVisualization'; +export * from './FurnitureMannequinVisualization'; +export * from './FurnitureMannequinVisualizationData'; +export * from './FurnitureParticleSystem'; +export * from './FurnitureParticleSystemEmitter'; +export * from './FurnitureParticleSystemParticle'; +export * from './FurniturePartyBeamerVisualization'; +export * from './FurniturePlanetSystemVisualization'; +export * from './FurniturePlanetSystemVisualizationPlanetObject'; +export * from './FurniturePosterVisualization'; +export * from './FurnitureQueueTileVisualization'; +export * from './FurnitureResettingAnimatedVisualization'; +export * from './FurnitureRoomBackgroundVisualization'; +export * from './FurnitureScoreBoardVisualization'; +export * from './FurnitureSoundBlockVisualization'; +export * from './FurnitureStickieVisualization'; +export * from './FurnitureValRandomizerVisualization'; +export * from './FurnitureVisualization'; +export * from './FurnitureVisualizationData'; +export * from './FurnitureVoteCounterVisualization'; +export * from './FurnitureVoteMajorityVisualization'; +export * from './FurnitureWaterAreaVisualization'; +export * from './FurnitureYoutubeVisualization'; +export * from './IsometricImageFurniVisualization'; diff --git a/submodules/renderer/src/nitro/room/object/visualization/index.ts b/submodules/renderer/src/nitro/room/object/visualization/index.ts new file mode 100644 index 0000000..747873f --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/index.ts @@ -0,0 +1,5 @@ +export * from './avatar'; +export * from './data'; +export * from './furniture'; +export * from './pet'; +export * from './room'; diff --git a/submodules/renderer/src/nitro/room/object/visualization/pet/ExperienceData.ts b/submodules/renderer/src/nitro/room/object/visualization/pet/ExperienceData.ts new file mode 100644 index 0000000..535c7ff --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/pet/ExperienceData.ts @@ -0,0 +1,77 @@ +import { RenderTexture, Resource, Texture } from '@pixi/core'; +import { Sprite } from '@pixi/sprite'; +import { Text } from '@pixi/text'; +import { NitroContainer, NitroSprite, PixiApplicationProxy, TextureUtils } from '../../../../../pixi-proxy'; + +export class ExperienceData +{ + private _sprite: Sprite; + private _texture: RenderTexture; + private _amount: number; + private _alpha: number; + + constructor(texture: Texture) + { + this._sprite = new NitroSprite(texture); + this._texture = null; + this._amount = -1; + this._alpha = 0; + } + + public renderBubble(amount: number): RenderTexture + { + if(!this._sprite || (this._amount === amount)) return null; + + const container = new NitroContainer(); + + container.addChild(this._sprite); + + const text = new Text(('+' + amount), { + fontFamily: 'Arial', + fontSize: 9, + fill: 0xFFFFFF, + align: 'center' + }); + + text.anchor.x = 0.5; + + text.x = (this._sprite.width / 2); + text.y = 19; + + container.addChild(text); + + if(!this._texture) + { + this._texture = TextureUtils.generateTexture(container); + } + else + { + PixiApplicationProxy.instance.renderer.render(container, { + renderTexture: this._texture, + clear: true + }); + } + + return this._texture; + } + + public get amount(): number + { + return this._amount; + } + + public set amount(amount: number) + { + this._amount = amount; + } + + public get alpha(): number + { + return this._alpha; + } + + public set alpha(alpha: number) + { + this._alpha = alpha; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/pet/PetVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/pet/PetVisualization.ts new file mode 100644 index 0000000..e12279a --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/pet/PetVisualization.ts @@ -0,0 +1,599 @@ +import { Resource, Texture } from '@pixi/core'; +import { GetAssetManager, IGraphicAsset, IObjectVisualizationData, IRoomGeometry, RoomObjectVariable, RoomObjectVisualizationType } from '../../../../../api'; +import { AnimationData, AnimationStateData, DirectionData, LayerData } from '../data'; +import { FurnitureAnimatedVisualization, FurnitureVisualizationData } from '../furniture'; +import { ExperienceData } from './ExperienceData'; +import { PetVisualizationData } from './PetVisualizationData'; + +export class PetVisualization extends FurnitureAnimatedVisualization +{ + public static TYPE: string = RoomObjectVisualizationType.PET_ANIMATED; + + private static HEAD: string = 'head'; + private static SADDLE: string = 'saddle'; + private static HAIR: string = 'hair'; + private static ADDITIONAL_SPRITE_COUNT: number = 1; + private static EXPERIENCE_BUBBLE_VISIBLE_IN_MS: number = 1000; + private static PET_EXPERIENCE_BUBBLE: string = 'avatar_addition_pet_experience_bubble'; + private static POSTURE_ANIMATION_INDEX: number = 0; + private static GESTURE_ANIMATION_INDEX: number = 1; + private static ANIMATION_INDEX_COUNT: number = 2; + + private _posture: string; + private _gesture: string; + private _isSleeping: boolean; + private _headDirection: number; + private _headOnly: boolean; + private _nonHeadSprites: boolean[]; + private _headSprites: boolean[]; + private _saddleSprites: boolean[]; + private _animationOver: boolean; + private _paletteIndex: number; + private _paletteName: string; + private _customLayerIds: number[]; + private _customPartIds: number[]; + private _customPaletteIds: number[]; + private _isRiding: boolean; + private _color: number; + private _experience: number; + private _experienceTimestamp: number; + private _experienceData: ExperienceData; + + private _previousAnimationDirection: number; + private _animationStates: AnimationStateData[]; + + constructor() + { + super(); + + this._posture = ''; + this._gesture = ''; + this._isSleeping = false; + this._headDirection = -1; + this._headOnly = false; + this._nonHeadSprites = []; + this._headSprites = []; + this._saddleSprites = []; + this._animationOver = false; + this._paletteIndex = -1; + this._paletteName = ''; + this._customLayerIds = []; + this._customPartIds = []; + this._customPaletteIds = []; + this._isRiding = false; + this._color = 0xFFFFFF; + this._experience = 0; + this._experienceTimestamp = 0; + this._experienceData = null; + + this._previousAnimationDirection = -1; + this._animationStates = []; + + while(this._animationStates.length < PetVisualization.ANIMATION_INDEX_COUNT) this._animationStates.push(new AnimationStateData()); + } + + public initialize(data: IObjectVisualizationData): boolean + { + if(!(data instanceof PetVisualizationData)) return false; + + const texture = this.getPetAdditionAsset(PetVisualization.PET_EXPERIENCE_BUBBLE); + + if(texture) + { + this._experienceData = new ExperienceData(texture); + } + + return super.initialize(data); + } + + public dispose(): void + { + super.dispose(); + + if(this._animationStates) + { + while(this._animationStates.length) + { + const animationState = this._animationStates[0]; + + if(animationState) animationState.dispose(); + + this._animationStates.pop(); + } + + this._animationStates = null; + } + } + + protected getAnimationId(animationData: AnimationStateData): number + { + return animationData.animationId; + } + + public update(geometry: IRoomGeometry, time: number, update: boolean, skipUpdate: boolean): void + { + super.update(geometry, time, update, skipUpdate); + + this.updateExperienceBubble(time); + } + + protected updateExperienceBubble(time: number): void + { + if(!this._experienceData) return; + + this._experienceData.alpha = 0; + + if(this._experienceTimestamp) + { + const difference = (time - this._experienceTimestamp); + + if(difference < PetVisualization.EXPERIENCE_BUBBLE_VISIBLE_IN_MS) + { + this._experienceData.alpha = (Math.sin(((difference / PetVisualization.EXPERIENCE_BUBBLE_VISIBLE_IN_MS) * Math.PI)) * 0xFF); + } + else + { + this._experienceTimestamp = 0; + } + + const sprite = this.getSprite((this.totalSprites - 1)); + + if(sprite) + { + if(this._experienceData.alpha > 0) + { + const texture = this._experienceData.renderBubble(this._experience); + + if(texture) + { + sprite.texture = texture; + sprite.offsetX = -20; + sprite.offsetY = -80; + sprite.alpha = this._experienceData.alpha; + sprite.visible = true; + sprite.relativeDepth = -0.2; + + return; + } + } + + sprite.texture = null; + sprite.visible = false; + } + } + } + + protected updateModel(scale: number): boolean + { + const model = this.object && this.object.model; + + if(!model) return false; + + if(this.updateModelCounter === model.updateCounter) return false; + + const posture = model.getValue(RoomObjectVariable.FIGURE_POSTURE); + const gesture = model.getValue(RoomObjectVariable.FIGURE_GESTURE); + + this.setPostureAndGesture(posture, gesture); + + let alphaMultiplier = (model.getValue(RoomObjectVariable.FURNITURE_ALPHA_MULTIPLIER) || null); + + if(alphaMultiplier === null || isNaN(alphaMultiplier)) alphaMultiplier = 1; + + if(this._alphaMultiplier !== alphaMultiplier) + { + this._alphaMultiplier = alphaMultiplier; + + this._alphaChanged = true; + } + + this._isSleeping = (model.getValue(RoomObjectVariable.FIGURE_SLEEP) > 0); + + const headDirection = model.getValue(RoomObjectVariable.HEAD_DIRECTION); + + if(!isNaN(headDirection) && this.data.isAllowedToTurnHead) + { + this._headDirection = headDirection; + } + else + { + this._headDirection = this.object.getDirection().x; + } + + this._experience = (model.getValue(RoomObjectVariable.FIGURE_GAINED_EXPERIENCE)); + this._experienceTimestamp = (model.getValue(RoomObjectVariable.FIGURE_EXPERIENCE_TIMESTAMP)); + + const customPaletteIndex = model.getValue(RoomObjectVariable.PET_PALETTE_INDEX); + const customLayerIds = model.getValue(RoomObjectVariable.PET_CUSTOM_LAYER_IDS); + const customPartIds = model.getValue(RoomObjectVariable.PET_CUSTOM_PARTS_IDS); + const customPaletteIds = model.getValue(RoomObjectVariable.PET_CUSTOM_PALETTE_IDS); + const isRiding = model.getValue(RoomObjectVariable.PET_IS_RIDING); + const headOnly = model.getValue(RoomObjectVariable.PET_HEAD_ONLY); + const color = model.getValue(RoomObjectVariable.PET_COLOR); + + if(customPaletteIndex !== this._paletteIndex) + { + this._paletteIndex = customPaletteIndex; + this._paletteName = this._paletteIndex.toString(); + } + + this._customLayerIds = (customLayerIds) ? customLayerIds : []; + this._customPartIds = (customPartIds) ? customPartIds : []; + this._customPaletteIds = (customPaletteIds) ? customPaletteIds : []; + this._isRiding = (!isNaN(isRiding) && (isRiding > 0)); + this._headOnly = (!isNaN(headOnly) && (headOnly > 0)); + + if(!isNaN(color) && this._color !== color) this._color = color; + + this.updateModelCounter = model.updateCounter; + + return true; + } + + protected updateAnimation(scale: number): number + { + if(this.object) + { + const direction = this.object.getDirection().x; + + if(direction !== this._previousAnimationDirection) + { + this._previousAnimationDirection = direction; + + this.resetAllAnimationFrames(); + } + } + + return super.updateAnimation(scale); + } + + protected setPostureAndGesture(posture: string, gesture: string): void + { + if(!this.data) return; + + if(posture !== this._posture) + { + this._posture = posture; + + this.setAnimationForIndex(PetVisualization.POSTURE_ANIMATION_INDEX, this.data.postureToAnimation(this._scale, posture)); + } + + if(this.data.getGestureDisabled(this._scale, posture)) gesture = null; + + if(gesture !== this._gesture) + { + this._gesture = gesture; + + this.setAnimationForIndex(PetVisualization.GESTURE_ANIMATION_INDEX, this.data.gestureToAnimation(this._scale, gesture)); + } + } + + private getAnimationStateData(k: number): AnimationStateData + { + if((k >= 0) && (k < this._animationStates.length)) return this._animationStates[k]; + + return null; + } + + private setAnimationForIndex(k: number, _arg_2: number): void + { + const animationStateData = this.getAnimationStateData(k); + + if(animationStateData) + { + if(this.setSubAnimation(animationStateData, _arg_2)) this._animationOver = false; + } + } + + protected resetAllAnimationFrames(): void + { + this._animationOver = false; + + let index = (this._animationStates.length - 1); + + while(index >= 0) + { + const stateData = this._animationStates[index]; + + if(stateData) stateData.setLayerCount(this.animatedLayerCount); + + index--; + } + } + + protected updateAnimations(scale: number): number + { + if(this._animationOver) return 0; + + let animationOver = true; + let _local_3 = 0; + let index = 0; + + while(index < this._animationStates.length) + { + const stateData = this._animationStates[index]; + + if(stateData) + { + if(!stateData.animationOver) + { + const _local_6 = this.updateFramesForAnimation(stateData, scale); + + _local_3 = (_local_3 | _local_6); + + if(!stateData.animationOver) + { + animationOver = false; + } + else + { + if(AnimationData.isTransitionFromAnimation(stateData.animationId) || AnimationData.isTransitionToAnimation(stateData.animationId)) + { + this.setAnimationForIndex(index, stateData.animationAfterTransitionId); + + animationOver = false; + } + } + } + } + + index++; + } + + this._animationOver = animationOver; + + return _local_3; + } + + protected getSpriteAssetName(scale: number, layerId: number): string + { + if(this._headOnly && this.isNonHeadSprite(layerId)) return null; + + if(this._isRiding && this._parser3(layerId)) return null; + + const totalSprites = this.totalSprites; + + if(layerId < (totalSprites - PetVisualization.ADDITIONAL_SPRITE_COUNT)) + { + const validScale = this.getValidSize(scale); + + if(layerId < (totalSprites - (1 + PetVisualization.ADDITIONAL_SPRITE_COUNT))) + { + if(layerId >= FurnitureVisualizationData.LAYER_LETTERS.length) return null; + + const layerLetter = FurnitureVisualizationData.LAYER_LETTERS[layerId]; + + if(validScale === 1) return (this._type + '_icon_' + layerLetter); + + return (this._type + '_' + validScale + '_' + layerLetter + '_' + this.getDirection(scale, layerId) + '_' + this.getFrameNumber(validScale, layerId)); + } + + return (this._type + '_' + validScale + '_sd_' + this.getDirection(scale, layerId) + '_0'); + } + + return null; + } + + protected getLayerColor(scale: number, layerId: number, colorId: number): number + { + if(layerId < (this.totalSprites - PetVisualization.ADDITIONAL_SPRITE_COUNT)) return this._color; + + return 0xFFFFFF; + } + + protected getLayerXOffset(scale: number, direction: number, layerId: number): number + { + let offset = super.getLayerXOffset(scale, direction, layerId); + let index = (this._animationStates.length - 1); + + while(index >= 0) + { + const stateData = this._animationStates[index]; + + if(stateData) + { + const frame = stateData.getFrame(layerId); + + if(frame) offset += frame.x; + } + + index--; + } + + return offset; + } + + protected getLayerYOffset(scale: number, direction: number, layerId: number): number + { + let offset = super.getLayerYOffset(scale, direction, layerId); + let index = (this._animationStates.length - 1); + + while(index >= 0) + { + const stateData = this._animationStates[index]; + + if(stateData) + { + const frame = stateData.getFrame(layerId); + + if(frame) offset += frame.y; + } + + index--; + } + + return offset; + } + + protected getLayerZOffset(scale: number, direction: number, layerId: number): number + { + if(!this.data) return LayerData.DEFAULT_ZOFFSET; + + return this.data.getLayerZOffset(scale, this.getDirection(scale, layerId), layerId); + } + + private getDirection(scale: number, layerId: number): number + { + if(!this.isHeadSprite(layerId)) return this._direction; + + return this.data.getValidDirection(scale, this._headDirection); + } + + protected getFrameNumber(scale: number, layerId: number): number + { + let index = (this._animationStates.length - 1); + + while(index >= 0) + { + const stateData = this._animationStates[index]; + + if(stateData) + { + const frame = stateData.getFrame(layerId); + + if(frame) return frame.id; + } + + index--; + } + + return super.getFrameNumber(scale, layerId); + } + + private isHeadSprite(layerId: number): boolean + { + if(this._headSprites[layerId] === undefined) + { + const isHead = (this.data.getLayerTag(this._scale, DirectionData.USE_DEFAULT_DIRECTION, layerId) === PetVisualization.HEAD); + const isHair = (this.data.getLayerTag(this._scale, DirectionData.USE_DEFAULT_DIRECTION, layerId) === PetVisualization.HAIR); + + if(isHead || isHair) this._headSprites[layerId] = true; + else this._headSprites[layerId] = false; + } + + return this._headSprites[layerId]; + } + + private isNonHeadSprite(layerId: number): boolean + { + if(this._nonHeadSprites[layerId] === undefined) + { + if(layerId < (this.totalSprites - (1 + PetVisualization.ADDITIONAL_SPRITE_COUNT))) + { + const tag = this.data.getLayerTag(this._scale, DirectionData.USE_DEFAULT_DIRECTION, layerId); + + if(((tag && (tag.length > 0)) && (tag !== PetVisualization.HEAD)) && (tag !== PetVisualization.HAIR)) + { + this._nonHeadSprites[layerId] = true; + } + else + { + this._nonHeadSprites[layerId] = false; + } + } + else + { + this._nonHeadSprites[layerId] = true; + } + } + + return this._nonHeadSprites[layerId]; + } + + private _parser3(layerId: number): boolean + { + if(this._saddleSprites[layerId] === undefined) + { + if(this.data.getLayerTag(this._scale, DirectionData.USE_DEFAULT_DIRECTION, layerId) === PetVisualization.SADDLE) + { + this._saddleSprites[layerId] = true; + } + else + { + this._saddleSprites[layerId] = false; + } + } + + return this._saddleSprites[layerId]; + } + + public getAsset(name: string, layerId: number = -1): IGraphicAsset + { + if(!this.asset) return null; + + const layerIndex = this._customLayerIds.indexOf(layerId); + let paletteName = this._paletteName; + let partId = -1; + let paletteId = -1; + + if(layerIndex > -1) + { + partId = this._customPartIds[layerIndex]; + paletteId = this._customPaletteIds[layerIndex]; + paletteName = ((paletteId > -1) ? paletteId.toString() : this._paletteName); + } + + if(!(isNaN(partId)) && (partId > -1)) + { + name = (name + '_' + partId); + } + + return this.asset.getAssetWithPalette(name, paletteName); + } + + protected getAdditionalLayerCount(): number + { + return super.getAdditionalLayerCount() + PetVisualization.ADDITIONAL_SPRITE_COUNT; + } + + protected setLayerCount(count: number): void + { + super.setLayerCount(count); + + this._headSprites = []; + } + + protected getPostureForAsset(scale: number, name: string): string + { + const parts = name.split('_'); + let length = parts.length; + let i = 0; + + while(i < parts.length) + { + if((parts[i] === '64') || (parts[i] === '32')) + { + length = (i + 3); + + break; + } + + i++; + } + + let posture: string = null; + + if(length < parts.length) + { + let part = parts[length]; + + part = part.split('@')[0]; + + posture = this.data.animationToPosture(scale, (parseInt(part) / 100), false); + + if(!posture) posture = this.data.getGestureForAnimationId(scale, (parseInt(part) / 100)); + } + + return posture; + } + + public getPetAdditionAsset(name: string): Texture + { + return GetAssetManager().getTexture(name); + } + + protected get data(): PetVisualizationData + { + return this._data as PetVisualizationData; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/pet/PetVisualizationData.ts b/submodules/renderer/src/nitro/room/object/visualization/pet/PetVisualizationData.ts new file mode 100644 index 0000000..a1f92ec --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/pet/PetVisualizationData.ts @@ -0,0 +1,125 @@ +import { IAssetVisualizationData } from '../../../../../api'; +import { AnimationSizeData, PetSizeData, SizeData } from '../data'; +import { FurnitureAnimatedVisualizationData } from '../furniture'; + +export class PetVisualizationData extends FurnitureAnimatedVisualizationData +{ + private _isAllowedToTurnHead: boolean; + + constructor() + { + super(); + + this._isAllowedToTurnHead = true; + } + + protected createSizeData(scale: number, layerCount: number, angle: number): SizeData + { + if(scale > 1) return new PetSizeData(layerCount, angle); + else return new AnimationSizeData(layerCount, angle); + } + + protected defineVisualizations(visualizations: IAssetVisualizationData[]): boolean + { + this._isAllowedToTurnHead = true; //check visualization for '@disableheadturn' + + return super.defineVisualizations(visualizations); + } + + protected processVisualElement(sizeData: SizeData, key: string, data: any): boolean + { + if(!sizeData || !key || !data) return false; + + switch(key) + { + case 'postures': + if(!(sizeData instanceof PetSizeData) || !sizeData.processPostures(data)) return false; + break; + case 'gestures': + if(!(sizeData instanceof PetSizeData) || !sizeData.processGestures(data)) return false; + break; + default: + if(!super.processVisualElement(sizeData, key, data)) return false; + break; + } + + return true; + } + + public postureToAnimation(scale: number, posture: string): number + { + const size = this.getSizeData(scale) as PetSizeData; + + if(!size) return PetSizeData.DEFAULT; + + return size.postureToAnimation(posture); + } + + public getGestureDisabled(scale: number, posture: string): boolean + { + const size = this.getSizeData(scale) as PetSizeData; + + if(!size) return false; + + return size.getGestureDisabled(posture); + } + + public gestureToAnimation(scale: number, gesture: string): number + { + const size = this.getSizeData(scale) as PetSizeData; + + if(!size) return PetSizeData.DEFAULT; + + return size.gestureToAnimation(gesture); + } + + public animationToPosture(scale: number, index: number, useDefault: boolean): string + { + const size = this.getSizeData(scale) as PetSizeData; + + if(!size) return null; + + return size.animationToPosture(index, useDefault); + } + + public animationToGesture(scale: number, index: number): string + { + const size = this.getSizeData(scale) as PetSizeData; + + if(!size) return null; + + return size.animationToGesture(index); + } + + public getGestureForAnimationId(scale: number, _arg_2: number): string + { + const size = this.getSizeData(scale) as PetSizeData; + + if(!size) return null; + + return size.getGestureForAnimationId(_arg_2); + } + + public totalPostures(scale: number): number + { + const size = this.getSizeData(scale) as PetSizeData; + + if(!size) return 0; + + return size.totalPostures; + } + + public totalGestures(scale: number): number + { + const size = this.getSizeData(scale) as PetSizeData; + + if(!size) return 0; + + return size.totalGestures; + } + + public get isAllowedToTurnHead(): boolean + { + return this._isAllowedToTurnHead; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/pet/index.ts b/submodules/renderer/src/nitro/room/object/visualization/pet/index.ts new file mode 100644 index 0000000..02a6ab3 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/pet/index.ts @@ -0,0 +1,3 @@ +export * from './ExperienceData'; +export * from './PetVisualization'; +export * from './PetVisualizationData'; diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/PlaneDrawingData.ts b/submodules/renderer/src/nitro/room/object/visualization/room/PlaneDrawingData.ts new file mode 100644 index 0000000..009d918 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/PlaneDrawingData.ts @@ -0,0 +1,103 @@ +import { Point } from '@pixi/math'; +import { IPlaneDrawingData } from '../../../../../api'; + +export class PlaneDrawingData implements IPlaneDrawingData +{ + private _z: number; + private _points: Point[]; + private _color: number; + private _maskAssetNames: string[]; + private _maskAssetLocations: Point[]; + private _maskAssetFlipHs: boolean[]; + private _maskAssetFlipVs: boolean[]; + private _alignBottom: boolean; + private _assetNames: string[][]; + + constructor(k: PlaneDrawingData = null, _arg_2: number = 0, _arg_3: boolean = false) + { + this._assetNames = []; + this._maskAssetNames = []; + this._maskAssetLocations = []; + this._maskAssetFlipHs = []; + this._maskAssetFlipVs = []; + + if(k != null) + { + this._maskAssetNames = k._maskAssetNames; + this._maskAssetLocations = k._maskAssetLocations; + this._maskAssetFlipHs = k._maskAssetFlipHs; + this._maskAssetFlipVs = k._maskAssetFlipVs; + } + + this._color = _arg_2; + this._alignBottom = _arg_3; + } + + public addMask(k: string, _arg_2: Point, _arg_3: boolean, _arg_4: boolean): void + { + this._maskAssetNames.push(k); + this._maskAssetLocations.push(_arg_2); + this._maskAssetFlipHs.push(_arg_3); + this._maskAssetFlipVs.push(_arg_4); + } + + public addAssetColumn(k: string[]): void + { + this._assetNames.push(k); + } + + public set z(k: number) + { + this._z = k; + } + + public get z(): number + { + return this._z; + } + + public set cornerPoints(k: Point[]) + { + this._points = k; + } + + public get cornerPoints(): Point[] + { + return this._points; + } + + public get color(): number + { + return this._color; + } + + public get maskAssetNames(): string[] + { + return this._maskAssetNames; + } + + public get maskAssetLocations(): Point[] + { + return this._maskAssetLocations; + } + + public get maskAssetFlipHs(): boolean[] + { + return this._maskAssetFlipHs; + } + + public get maskAssetFlipVs(): boolean[] + { + return this._maskAssetFlipVs; + } + + public isBottomAligned(): boolean + { + return this._alignBottom; + } + + public get assetNameColumns(): string[][] + { + return this._assetNames; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/RoomPlane.ts b/submodules/renderer/src/nitro/room/object/visualization/room/RoomPlane.ts new file mode 100644 index 0000000..15c6404 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/RoomPlane.ts @@ -0,0 +1,890 @@ +import { Renderer, RenderTexture, Resource, Texture } from '@pixi/core'; +import { Matrix, Point } from '@pixi/math'; +import { Sprite } from '@pixi/sprite'; +import { IRoomGeometry, IRoomPlane, IVector3D, Vector3d } from '../../../../../api'; +import { PixiApplicationProxy, PlaneTextureCache } from '../../../../../pixi-proxy'; +import { ColorConverter } from '../../../../../room'; +import { PlaneMaskManager } from './mask'; +import { PlaneDrawingData } from './PlaneDrawingData'; +import { IPlaneRasterizer } from './rasterizer'; +import { RoomPlaneBitmapMask } from './RoomPlaneBitmapMask'; +import { RoomPlaneRectangleMask } from './RoomPlaneRectangleMask'; +import { PlaneBitmapData, Randomizer } from './utils'; + +export class RoomPlane implements IRoomPlane +{ + private static ZERO_POINT: Point = new Point(0, 0); + public static TYPE_UNDEFINED: number = 0; + public static TYPE_WALL: number = 1; + public static TYPE_FLOOR: number = 2; + public static TYPE_LANDSCAPE: number = 3; + private static _uniqueIdCounter: number = 1; + + private _textureCache: PlaneTextureCache; + private _disposed: boolean; + private _randomSeed: number; + private _origin: Vector3d; + private _location: Vector3d; + private _leftSide: Vector3d; + private _rightSide: Vector3d; + private _normal: Vector3d; + private _secondaryNormals: Vector3d[]; + private _geometryUpdateId: number; + private _type: number; + private _isVisible: boolean; + private _bitmapData: RenderTexture; + private _hasTexture: boolean; + private _offset: Point; + private _relativeDepth: number; + private _color: number; + private _rasterizer: IPlaneRasterizer; + private _maskManager: PlaneMaskManager = null; + private _id: string; + private _uniqueId: number; + private _textureOffsetX: number; + private _textureOffsetY: number; + private _textureMaxX: number; + private _textureMaxY: number; + private _activeTexture: PlaneBitmapData; + private _useMask: boolean; + private _bitmapMasks: RoomPlaneBitmapMask[]; + private _rectangleMasks: RoomPlaneRectangleMask[]; + private _maskChanged: boolean; + private _maskBitmapData: RenderTexture; + private _maskPixels: Uint8Array; + private _bitmapMasksOld: RoomPlaneBitmapMask[]; + private _rectangleMasksOld: RoomPlaneRectangleMask[]; + private _cornerA: Vector3d; + private _cornerB: Vector3d; + private _cornerC: Vector3d; + private _cornerD: Vector3d; + private _width: number = 0; + private _height: number = 0; + private _canBeVisible: boolean; + + constructor(textureCache: PlaneTextureCache, origin: IVector3D, location: IVector3D, leftSide: IVector3D, rightSide: IVector3D, type: number, usesMask: boolean, secondaryNormals: IVector3D[], randomSeed: number, textureOffsetX: number = 0, textureOffsetY: number = 0, textureMaxX: number = 0, textureMaxY: number = 0) + { + this._textureCache = textureCache; + this._secondaryNormals = []; + this._bitmapMasks = []; + this._rectangleMasks = []; + this._bitmapMasksOld = []; + this._rectangleMasksOld = []; + this._randomSeed = randomSeed; + this._bitmapData = null; + this._maskBitmapData = null; + this._maskChanged = false; + this._activeTexture = null; + this._origin = new Vector3d(); + this._origin.assign(origin); + this._location = new Vector3d(); + this._location.assign(location); + this._leftSide = new Vector3d(); + this._leftSide.assign(leftSide); + this._rightSide = new Vector3d(); + this._rightSide.assign(rightSide); + this._normal = Vector3d.crossProduct(this._leftSide, this._rightSide); + + if(this._normal.length > 0) + { + this._normal.multiply((1 / this._normal.length)); + } + + if(secondaryNormals != null) + { + for(const entry of secondaryNormals) + { + if(!entry) continue; + + const vector = new Vector3d(); + + vector.assign(entry); + + this._secondaryNormals.push(vector); + } + } + this._disposed = false; + this._isVisible = false; + this._id = null; + this._hasTexture = true; + this._geometryUpdateId = -1; + this._offset = new Point(); + this._relativeDepth = 0; + this._type = type; + this._color = 0; + this._rasterizer = null; + this._canBeVisible = true; + this._cornerA = new Vector3d(); + this._cornerB = new Vector3d(); + this._cornerC = new Vector3d(); + this._cornerD = new Vector3d(); + this._width = 0; + this._height = 0; + this._textureOffsetX = textureOffsetX; + this._textureOffsetY = textureOffsetY; + this._textureMaxX = textureMaxX; + this._textureMaxY = textureMaxY; + this._useMask = usesMask; + this._uniqueId = ++RoomPlane._uniqueIdCounter; + } + + private static blend(a: number, b: number): number + { + return ColorConverter.colorize(b, (a | 0xFF000000)) & 0xFFFFFF; + } + + public set canBeVisible(k: boolean) + { + if(k !== this._canBeVisible) + { + if(!this._canBeVisible) this.resetTextureCache(); + + this._canBeVisible = k; + } + } + + public get canBeVisible(): boolean + { + return this._canBeVisible; + } + + public get bitmapData(): Texture + { + if(!this.visible || !this._bitmapData) return null; + + return this._bitmapData; + } + + public get maskBitmapData(): RenderTexture + { + if(!this.visible || !this._maskBitmapData) return null; + + return this._maskBitmapData; + } + + public get visible(): boolean + { + return (this._isVisible && this._canBeVisible); + } + + public get offset(): Point + { + return this._offset; + } + + public get relativeDepth(): number + { + return this._relativeDepth; + } + + public get color(): number + { + return this._color; + } + + public set color(k: number) + { + this._color = k; + } + + public get type(): number + { + return this._type; + } + + public get leftSide(): IVector3D + { + return this._leftSide; + } + + public get rightSide(): IVector3D + { + return this._rightSide; + } + + public get location(): IVector3D + { + return this._location; + } + + public get normal(): IVector3D + { + return this._normal; + } + + public get hasTexture(): boolean + { + return this._hasTexture; + } + + public set hasTexture(k: boolean) + { + this._hasTexture = k; + } + + public set rasterizer(k: IPlaneRasterizer) + { + this._rasterizer = k; + } + + public set maskManager(k: PlaneMaskManager) + { + this._maskManager = k; + } + + public set id(k: string) + { + if(k === this._id) return; + + this.resetTextureCache(); + this._id = k; + } + + public get uniqueId(): number + { + return this._uniqueId; + } + + public dispose(): void + { + this._activeTexture = null; + this._location = null; + this._origin = null; + this._leftSide = null; + this._rightSide = null; + this._normal = null; + this._rasterizer = null; + this._cornerA = null; + this._cornerB = null; + this._cornerC = null; + this._cornerD = null; + this._bitmapMasks = null; + this._rectangleMasks = null; + this._maskPixels = null; + + if(this._maskBitmapData) + { + this._maskBitmapData.destroy(true); + + this._maskBitmapData = null; + } + + this._disposed = true; + } + + public copyBitmapData(k: Texture): Texture + { + if(!this.visible || !this._bitmapData || !k) return null; + + if((this._bitmapData.width !== k.width) || (this._bitmapData.height !== k.height)) return null; + + //k.copyPixels(this._bitmapData, this._bitmapData.rect, RoomPlane.ZERO_POINT); + return k; + } + + private resetTextureCache(k: RenderTexture = null): void + { + this._activeTexture = null; + } + + private getTextureIdentifier(k: number): string + { + if(this._rasterizer) return this._rasterizer.getTextureIdentifier(k, this.normal); + + return k.toString(); + } + + private needsNewTexture(k: IRoomGeometry, _arg_2: number): boolean + { + if(!k) return false; + + const planeBitmap = this._activeTexture; + + this.updateMaskChangeStatus(); + + if(this._canBeVisible && ((!planeBitmap || ((planeBitmap.timeStamp >= 0) && (_arg_2 > planeBitmap.timeStamp))) || this._maskChanged)) return true; + + return false; + } + + private getTexture(geometry: IRoomGeometry, timeSinceStartMs: number): RenderTexture + { + if(!geometry) return null; + + let bitmapData: PlaneBitmapData = null; + + if(this.needsNewTexture(geometry, timeSinceStartMs)) + { + const identifier = this.getTextureIdentifier(geometry.scale); + const width = this._leftSide.length * geometry.scale; + const height = this._rightSide.length * geometry.scale; + const normal = geometry.getCoordinatePosition(this._normal); + + bitmapData = this._rasterizer.render(this._uniqueId.toString(), this._textureCache, null, this._id, width, height, geometry.scale, normal, this._hasTexture, this._textureOffsetX, this._textureOffsetY, this._textureMaxX, this._textureMaxY, timeSinceStartMs); + + if(bitmapData) + { + this.updateMask(bitmapData.texture, geometry); + } + } + else + { + if(this._activeTexture) bitmapData = this._activeTexture; + } + + if(bitmapData) + { + this._activeTexture = bitmapData; + + return bitmapData.texture; + } + + return null; + } + + private resolveMasks(k: IRoomGeometry): PlaneDrawingData + { + if(!this._useMask) return null; + + const drawingData = new PlaneDrawingData(); + + const index = 0; + + while(index < this._bitmapMasks.length) + { + const mask = this._bitmapMasks[index]; + + if(mask) + { + const planeMask = this._maskManager.getMask(mask.type); + + if(planeMask) + { + const assetName = planeMask.getAssetName(k.scale); + + if(assetName) + { + const position = k.getCoordinatePosition(this._normal); + const asset = planeMask.getGraphicAsset(k.scale, position); + + if(asset) + { + const x = (this._maskBitmapData.width * (1 - (mask.leftSideLoc / this._leftSide.length))); + const y = (this._maskBitmapData.height * (1 - (mask.rightSideLoc / this._rightSide.length))); + + drawingData.addMask(assetName, new Point((x + asset.offsetX), (y + asset.offsetY)), asset.flipH, asset.flipV); + } + } + } + } + } + + return drawingData; + } + + private screenWidth(k: IRoomGeometry): number + { + const _local_2 = k.getScreenPoint(new Vector3d(0, 0, 0)); + const _local_3 = k.getScreenPoint(new Vector3d(0, 1, 0)); + + return Math.round((this._leftSide.length * Math.abs((_local_2.x - _local_3.x)))); + } + + public getDrawingDatas(geometry: IRoomGeometry): PlaneDrawingData[] + { + const drawingDatas: PlaneDrawingData[] = []; + + if(this._isVisible) + { + const maskData = this.resolveMasks(geometry); + const layers = this._rasterizer.getLayers(this._id); + + for(const layer of layers) + { + if(this._hasTexture && layer.getMaterial()) + { + const normal = geometry.getCoordinatePosition(this._normal); + const cellMatrix = layer.getMaterial().getMaterialCellMatrix(normal); + const data = new PlaneDrawingData(maskData, RoomPlane.blend(this._color, layer.getColor()), cellMatrix.isBottomAligned()); + + Randomizer.setSeed(this._randomSeed); + + for(const column of cellMatrix.getColumns(this.screenWidth(geometry))) + { + const assetNames: string[] = []; + + for(const cell of column.getCells()) + { + const name = cell.getAssetName(normal); + + if(name) assetNames.push(name); + } + + if(assetNames.length > 0) + { + if(!column.isRepeated()) assetNames.push(''); + + data.addAssetColumn(assetNames); + } + } + + if(data.assetNameColumns.length > 0) drawingDatas.push(data); + } + else + { + const data = new PlaneDrawingData(maskData, RoomPlane.blend(this._color, layer.getColor())); + + drawingDatas.push(data); + } + } + + if(!drawingDatas.length) drawingDatas.push(new PlaneDrawingData(maskData, this._color)); + } + + return drawingDatas; + } + + // private _Str_25956(k:PlaneBitmapData): void + // { + // } + + public update(geometry: IRoomGeometry, timeSinceStartMs: number): boolean + { + if(!geometry || this._disposed) return false; + + let geometryChanged = false; + + if(this._geometryUpdateId != geometry.updateId) geometryChanged = true; + + if(!geometryChanged || !this._canBeVisible) + { + if(!this.visible) return false; + } + + if(geometryChanged) + { + this._activeTexture = null; + + let cosAngle = 0; + + cosAngle = Vector3d.cosAngle(geometry.directionAxis, this.normal); + + if(cosAngle > -0.001) + { + if(this._isVisible) + { + this._isVisible = false; + return true; + } + + return false; + } + + let i = 0; + + while(i < this._secondaryNormals.length) + { + cosAngle = Vector3d.cosAngle(geometry.directionAxis, this._secondaryNormals[i]); + + if(cosAngle > -0.001) + { + if(this._isVisible) + { + this._isVisible = false; + return true; + } + + return false; + } + + i++; + } + + this.updateCorners(geometry); + + const originPos = geometry.getScreenPosition(this._origin); + const originZ = originPos.z; + + let relativeDepth = (Math.max(this._cornerA.z, this._cornerB.z, this._cornerC.z, this._cornerD.z) - originZ); + + if(this._type === RoomPlane.TYPE_FLOOR) + { + relativeDepth = (relativeDepth - ((this._location.z + Math.min(0, this._leftSide.z, this._rightSide.z)) * 8)); + } + + if(this._type === RoomPlane.TYPE_LANDSCAPE) + { + relativeDepth = (relativeDepth + 0.02); + } + + this._relativeDepth = relativeDepth; + this._isVisible = true; + this._geometryUpdateId = geometry.updateId; + } + + if(geometryChanged || this.needsNewTexture(geometry, timeSinceStartMs)) + { + if(!this._bitmapData || (this._width !== this._bitmapData.width) || (this._height !== this._bitmapData.height)) + { + if(this._bitmapData) + { + if((this._width !== this._bitmapData.width) || (this._height !== this._bitmapData.height)) + { + this._bitmapData.destroy(); + + this._bitmapData = null; + + if((this._width < 1) || (this._height < 1)) return true; + + this._bitmapData = this._textureCache.createAndFillRenderTexture(this._width, this._height); + } + else + { + if((this._width < 1) || (this._height < 1)) + { + this._bitmapData.destroy(); + + this._bitmapData = null; + + return true; + } + + this._textureCache.clearAndFillRenderTexture(this._bitmapData); + } + } + else + { + if((this._width < 1) || (this._height < 1)) return false; + + this._bitmapData = this._textureCache.createAndFillRenderTexture(this._width, this._height); + } + + if(!this._bitmapData) return false; + } + else + { + this._textureCache.clearAndFillRenderTexture(this._bitmapData); + } + + Randomizer.setSeed(this._randomSeed); + + const texture = this.getTexture(geometry, timeSinceStartMs); + + if(texture) + { + this.renderTexture(geometry, texture); + } + else + { + this.dispose(); + + return false; + } + + return ((texture !== null) || geometryChanged); + } + + return false; + } + + private updateCorners(geometry: IRoomGeometry): void + { + this._cornerA.assign(geometry.getScreenPosition(this._location)); + this._cornerB.assign(geometry.getScreenPosition(Vector3d.sum(this._location, this._rightSide))); + this._cornerC.assign(geometry.getScreenPosition(Vector3d.sum(Vector3d.sum(this._location, this._leftSide), this._rightSide))); + this._cornerD.assign(geometry.getScreenPosition(Vector3d.sum(this._location, this._leftSide))); + this._offset = geometry.getScreenPoint(this._origin); + this._cornerA.x = Math.round(this._cornerA.x); + this._cornerA.y = Math.round(this._cornerA.y); + this._cornerB.x = Math.round(this._cornerB.x); + this._cornerB.y = Math.round(this._cornerB.y); + this._cornerC.x = Math.round(this._cornerC.x); + this._cornerC.y = Math.round(this._cornerC.y); + this._cornerD.x = Math.round(this._cornerD.x); + this._cornerD.y = Math.round(this._cornerD.y); + this._offset.x = Math.round(this._offset.x); + this._offset.y = Math.round(this._offset.y); + + const minX = Math.min(this._cornerA.x, this._cornerB.x, this._cornerC.x, this._cornerD.x); + const maxX = Math.max(this._cornerA.x, this._cornerB.x, this._cornerC.x, this._cornerD.x) - minX; + const minY = Math.min(this._cornerA.y, this._cornerB.y, this._cornerC.y, this._cornerD.y); + const maxY = Math.max(this._cornerA.y, this._cornerB.y, this._cornerC.y, this._cornerD.y) - minY; + + this._offset.x = (this._offset.x - minX); + this._cornerA.x = (this._cornerA.x - minX); + this._cornerB.x = (this._cornerB.x - minX); + this._cornerC.x = (this._cornerC.x - minX); + this._cornerD.x = (this._cornerD.x - minX); + + this._offset.y = (this._offset.y - minY); + this._cornerA.y = (this._cornerA.y - minY); + this._cornerB.y = (this._cornerB.y - minY); + this._cornerC.y = (this._cornerC.y - minY); + this._cornerD.y = (this._cornerD.y - minY); + + this._width = maxX; + this._height = maxY; + } + + private getMatrixForDimensions(width: number, height: number): Matrix + { + let _local_3: number = (this._cornerD.x - this._cornerC.x); + let _local_4: number = (this._cornerD.y - this._cornerC.y); + let _local_5: number = (this._cornerB.x - this._cornerC.x); + let _local_6: number = (this._cornerB.y - this._cornerC.y); + + if((this._type === RoomPlane.TYPE_WALL) || (this._type === RoomPlane.TYPE_LANDSCAPE)) + { + if(Math.abs((_local_5 - width)) <= 1) _local_5 = width; + + if(Math.abs((_local_6 - width)) <= 1) _local_6 = width; + + if(Math.abs((_local_3 - height)) <= 1) _local_3 = height; + + if(Math.abs((_local_4 - height)) <= 1) _local_4 = height; + } + + const xScale: number = (_local_5 / width); + const ySkew: number = (_local_6 / width); + const xSkew: number = (_local_3 / height); + const yScale: number = (_local_4 / height); + + const matrix = new Matrix(xScale, ySkew, xSkew, yScale); + + matrix.translate(this._cornerC.x, this._cornerC.y); + + return matrix; + } + + private renderTexture(geometry: IRoomGeometry, _arg_2: RenderTexture): void + { + if(((((((this._cornerA == null) || (this._cornerB == null)) || (this._cornerC == null)) || (this._cornerD == null)) || (_arg_2 == null)) || (this._bitmapData == null))) + { + return; + } + + this.draw(_arg_2, this.getMatrixForDimensions(_arg_2.width, _arg_2.height)); + } + + private draw(k: RenderTexture, matrix: Matrix): void + { + //k.baseTexture.mipmap = MIPMAP_MODES.OFF; + //k.baseTexture.scaleMode = SCALE_MODES.LINEAR; + + this._textureCache.writeToRenderTexture(new Sprite(k), this._bitmapData, true, matrix); + } + + public resetBitmapMasks(): void + { + if(this._disposed || !this._useMask || !this._bitmapMasks.length) return; + + this._maskChanged = true; + this._bitmapMasks = []; + } + + public addBitmapMask(maskType: string, leftSideLoc: number, rightSideLoc: number): boolean + { + if(!this._useMask) return false; + + for(const mask of this._bitmapMasks) + { + if(!mask) continue; + + if((((mask.type === maskType) && (mask.leftSideLoc === leftSideLoc)) && (mask.rightSideLoc === rightSideLoc))) return false; + } + + const mask = new RoomPlaneBitmapMask(maskType, leftSideLoc, rightSideLoc); + + this._bitmapMasks.push(mask); + this._maskChanged = true; + + return true; + } + + public resetRectangleMasks(): void + { + if(!this._useMask || !this._rectangleMasks.length) return; + + this._maskChanged = true; + this._rectangleMasks = []; + } + + public addRectangleMask(k: number, _arg_2: number, _arg_3: number, _arg_4: number): boolean + { + if(this._useMask) + { + for(const mask of this._rectangleMasks) + { + if(!mask) continue; + + if((((mask.leftSideLoc === k) && (mask.rightSideLoc === _arg_2)) && (mask.leftSideLength === _arg_3)) && (mask.rightSideLength === _arg_4)) return false; + } + + const _local_5 = new RoomPlaneRectangleMask(k, _arg_2, _arg_3, _arg_4); + + this._rectangleMasks.push(_local_5); + this._maskChanged = true; + + return true; + } + + return false; + } + + private updateMaskChangeStatus(): void + { + if(!this._maskChanged) return; + + let maskChanged = true; + + if(this._bitmapMasks.length === this._bitmapMasksOld.length) + { + for(const mask of this._bitmapMasks) + { + if(!mask) continue; + + let _local_6 = false; + + for(const plane of this._bitmapMasksOld) + { + if(!plane) continue; + + if(((plane.type === mask.type) && (plane.leftSideLoc === mask.leftSideLoc)) && (plane.rightSideLoc === mask.rightSideLoc)) + { + _local_6 = true; + + break; + } + } + + if(!_local_6) + { + maskChanged = false; + + break; + } + } + } + else + { + maskChanged = false; + } + + if(this._rectangleMasks.length > this._rectangleMasksOld.length) maskChanged = false; + + if(maskChanged) this._maskChanged = false; + } + + private updateMask(canvas: RenderTexture, geometry: IRoomGeometry): void + { + if(!canvas || !geometry) return; + + if(!this._useMask || ((!this._bitmapMasks.length && !this._rectangleMasks.length) && !this._maskChanged) || !this._maskManager) return; + + const width = canvas.width; + const height = canvas.height; + + this.updateMaskChangeStatus(); + + if(!this._maskBitmapData || (this._maskBitmapData.width !== width) || (this._maskBitmapData.height !== height)) + { + this._maskBitmapData = this._textureCache.createAndFillRenderTexture(width, height, 'mask'); + this._maskChanged = true; + } + + if(this._maskChanged) + { + this._bitmapMasksOld = []; + this._rectangleMasksOld = []; + + if(this._maskBitmapData) this._textureCache.clearAndFillRenderTexture(this._maskBitmapData); + + this.resetTextureCache(canvas); + + const normal = geometry.getCoordinatePosition(this._normal); + + let type: string = null; + let posX = 0; + let posY = 0; + let i = 0; + + while(i < this._bitmapMasks.length) + { + const mask = this._bitmapMasks[i]; + + if(mask) + { + type = mask.type; + posX = (this._maskBitmapData.width - ((this._maskBitmapData.width * mask.leftSideLoc) / this._leftSide.length)); + posY = (this._maskBitmapData.height - ((this._maskBitmapData.height * mask.rightSideLoc) / this._rightSide.length)); + + this._maskManager.updateMask(this._maskBitmapData, type, geometry.scale, normal, posX, posY); + this._bitmapMasksOld.push(new RoomPlaneBitmapMask(type, mask.leftSideLoc, mask.rightSideLoc)); + } + + i++; + } + + i = 0; + + while(i < this._rectangleMasks.length) + { + const rectMask = this._rectangleMasks[i]; + + if(rectMask) + { + posX = (this._maskBitmapData.width - ((this._maskBitmapData.width * rectMask.leftSideLoc) / this._leftSide.length)); + posY = (this._maskBitmapData.height - ((this._maskBitmapData.height * rectMask.rightSideLoc) / this._rightSide.length)); + + const wd = ((this._maskBitmapData.width * rectMask.leftSideLength) / this._leftSide.length); + const ht = ((this._maskBitmapData.height * rectMask.rightSideLength) / this._rightSide.length); + + const sprite = new Sprite(Texture.WHITE); + + sprite.tint = 0x000000; + sprite.width = wd; + sprite.height = ht; + sprite.position.set((posX - wd), (posY - ht)); + + this._textureCache.writeToRenderTexture(sprite, this._maskBitmapData, false); + + this._rectangleMasksOld.push(new RoomPlaneRectangleMask(rectMask.leftSideLength, rectMask.rightSideLoc, rectMask.leftSideLength, rectMask.rightSideLength)); + } + + i++; + } + + this._maskPixels = this._textureCache.getPixels(this._maskBitmapData); + + this._maskChanged = false; + } + + this.combineTextureMask(canvas, this._maskPixels); + } + + private combineTextureMask(canvas: RenderTexture, maskPixels: Uint8Array): void + { + if(!canvas || !maskPixels) return; + + const canvasPixels = this._textureCache.getPixels(canvas); + + for(let i = 0; i < canvasPixels.length; i += 4) + { + const maskRed = maskPixels[i]; + const maskGreen = maskPixels[i + 1]; + const maskBlue = maskPixels[i + 2]; + const maskAlpha = maskPixels[i + 3]; + + if(!maskRed && !maskGreen && !maskBlue) canvasPixels[i + 3] = 0; + } + + const canvaGLTexture = canvas.baseTexture._glTextures['1']?.texture; + const gl = (PixiApplicationProxy.instance.renderer as Renderer)?.gl; + + if(!canvaGLTexture || !gl) return; + + gl.bindTexture(gl.TEXTURE_2D, canvaGLTexture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, canvas.width, canvas.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, canvasPixels); + gl.bindTexture(gl.TEXTURE_2D, null); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/RoomPlaneBitmapMask.ts b/submodules/renderer/src/nitro/room/object/visualization/room/RoomPlaneBitmapMask.ts new file mode 100644 index 0000000..44f583c --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/RoomPlaneBitmapMask.ts @@ -0,0 +1,28 @@ +export class RoomPlaneBitmapMask +{ + private _type: string; + private _leftSideLoc: number; + private _rightSideLoc: number; + + constructor(maskType: string, leftSideLoc: number, rightSideLoc: number) + { + this._type = maskType; + this._leftSideLoc = leftSideLoc; + this._rightSideLoc = rightSideLoc; + } + + public get type(): string + { + return this._type; + } + + public get leftSideLoc(): number + { + return this._leftSideLoc; + } + + public get rightSideLoc(): number + { + return this._rightSideLoc; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/RoomPlaneRectangleMask.ts b/submodules/renderer/src/nitro/room/object/visualization/room/RoomPlaneRectangleMask.ts new file mode 100644 index 0000000..807dc20 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/RoomPlaneRectangleMask.ts @@ -0,0 +1,35 @@ +export class RoomPlaneRectangleMask +{ + private _leftSideLoc: number; + private _rightSideLoc: number; + private _leftSideLength: number; + private _rightSideLength: number; + + constructor(k: number, _arg_2: number, _arg_3: number, _arg_4: number) + { + this._leftSideLoc = k; + this._rightSideLoc = _arg_2; + this._leftSideLength = _arg_3; + this._rightSideLength = _arg_4; + } + + public get leftSideLoc(): number + { + return this._leftSideLoc; + } + + public get rightSideLoc(): number + { + return this._rightSideLoc; + } + + public get leftSideLength(): number + { + return this._leftSideLength; + } + + public get rightSideLength(): number + { + return this._rightSideLength; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/RoomVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/room/RoomVisualization.ts new file mode 100644 index 0000000..2fea538 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/RoomVisualization.ts @@ -0,0 +1,939 @@ +import { Rectangle } from '@pixi/math'; +import { AlphaTolerance, IObjectVisualizationData, IPlaneVisualization, IRoomGeometry, IRoomObjectModel, IRoomObjectSprite, IRoomPlane, RoomObjectSpriteType, RoomObjectVariable, Vector3d } from '../../../../../api'; +import { PlaneTextureCache } from '../../../../../pixi-proxy'; +import { RoomObjectSpriteVisualization } from '../../../../../room'; +import { ToInt32 } from '../../../../utils'; +import { RoomMapData } from '../../RoomMapData'; +import { RoomMapMaskData } from '../../RoomMapMaskData'; +import { RoomPlaneBitmapMaskData } from '../../RoomPlaneBitmapMaskData'; +import { RoomPlaneBitmapMaskParser } from '../../RoomPlaneBitmapMaskParser'; +import { RoomPlaneData } from '../../RoomPlaneData'; +import { RoomPlaneParser } from '../../RoomPlaneParser'; +import { RoomPlane } from './RoomPlane'; +import { RoomVisualizationData } from './RoomVisualizationData'; + +export class RoomVisualization extends RoomObjectSpriteVisualization implements IPlaneVisualization +{ + public static FLOOR_COLOR: number = 0xFFFFFF; + public static FLOOR_COLOR_LEFT: number = 0xDDDDDD; + public static FLOOR_COLOR_RIGHT: number = 0xBBBBBB; + private static WALL_COLOR_TOP: number = 0xFFFFFF; + private static WALL_COLOR_SIDE: number = 0xCCCCCC; + private static WALL_COLOR_BOTTOM: number = 0x999999; + private static WALL_COLOR_BORDER: number = 0x999999; + public static LANDSCAPE_COLOR_TOP: number = 0xFFFFFF; + public static LANDSCAPE_COLOR_SIDE: number = 0xCCCCCC; + public static LANDSCAPE_COLOR_BOTTOM: number = 0x999999; + private static ROOM_DEPTH_OFFSET: number = 1000; + + protected _data: RoomVisualizationData; + + private _roomPlaneParser: RoomPlaneParser; + private _roomPlaneBitmapMaskParser: RoomPlaneBitmapMaskParser; + + private _geometryUpdateId: number; + private _boundingRectangle: Rectangle; + private _directionX: number; + private _directionY: number; + private _directionZ: number; + private _floorThickness: number; + private _wallThickness: number; + private _holeUpdateTime: number; + private _planes: RoomPlane[]; + private _visiblePlanes: RoomPlane[]; + private _visiblePlaneSpriteNumbers: number[]; + private _roomScale: number; + private _lastUpdateTime: number; + private _updateIntervalTime: number; + private _wallType: string; + private _floorType: string; + private _landscapeType: string; + private _colorBackgroundOnly: boolean; + private _color: number; + private _redColor: number; + private _greenColor: number; + private _blueColor: number; + private _typeVisibility: boolean[]; + private _assetUpdateCounter: number; + private _maskData: RoomMapMaskData; + private _isPlaneSet: boolean; + private _textureCache: PlaneTextureCache; + + constructor() + { + super(); + + this._data = null; + + this._roomPlaneParser = new RoomPlaneParser(); + this._roomPlaneBitmapMaskParser = new RoomPlaneBitmapMaskParser(); + + this._geometryUpdateId = -1; + this._directionX = 0; + this._directionY = 0; + this._directionZ = 0; + this._floorThickness = 1; + this._wallThickness = 1; + this._holeUpdateTime = NaN; + this._planes = []; + this._visiblePlanes = []; + this._visiblePlaneSpriteNumbers = []; + this._roomScale = 0; + this._lastUpdateTime = -1000; + this._updateIntervalTime = 250; + this._wallType = null; + this._floorType = null; + this._landscapeType = null; + this._colorBackgroundOnly = true; + this._color = 0xFFFFFF; + this._redColor = 0xFF; + this._greenColor = 0xFF; + this._blueColor = 0xFF; + this._typeVisibility = []; + this._assetUpdateCounter = 0; + this._maskData = null; + this._isPlaneSet = false; + this._textureCache = new PlaneTextureCache(); + + this._typeVisibility[RoomPlane.TYPE_UNDEFINED] = false; + this._typeVisibility[RoomPlane.TYPE_FLOOR] = true; + this._typeVisibility[RoomPlane.TYPE_WALL] = true; + this._typeVisibility[RoomPlane.TYPE_LANDSCAPE] = true; + } + + public initialize(data: IObjectVisualizationData): boolean + { + if(!(data instanceof RoomVisualizationData)) return false; + + this._data = data; + + super.initialize(data); + + this._data.setGraphicAssetCollection(this.asset); + + return true; + } + + public dispose(): void + { + super.dispose(); + + this.clearPlanes(); + + this._planes = null; + this._visiblePlanes = null; + this._visiblePlaneSpriteNumbers = null; + + if(this._roomPlaneParser) + { + this._roomPlaneParser.dispose(); + + this._roomPlaneParser = null; + } + + if(this._roomPlaneBitmapMaskParser) + { + this._roomPlaneBitmapMaskParser.dispose(); + + this._roomPlaneBitmapMaskParser = null; + } + + if(this._data) + { + this._data.clearCache(); + + this._data = null; + } + + if(this._textureCache) + { + this._textureCache.clearCache(); + } + } + + protected reset(): void + { + super.reset(); + + this._floorType = null; + this._wallType = null; + this._landscapeType = null; + this._maskData = null; + this._geometryUpdateId = -1; + this._roomScale = 0; + } + + public update(geometry: IRoomGeometry, time: number, update: boolean, skipUpdate: boolean): void + { + if(!this.object || !geometry) return; + + const geometryUpdate = this.updateGeometry(geometry); + const objectModel = this.object.model; + + let needsUpdate = false; + + if(this.updateThickness(objectModel)) needsUpdate = true; + + if(this.updateHole(objectModel)) needsUpdate = true; + + this.initializeRoomPlanes(); + + needsUpdate = this.updateMasks(objectModel); + + if(((time < (this._lastUpdateTime + this._updateIntervalTime)) && (!geometryUpdate)) && (!needsUpdate)) return; + + if(this.updatePlaneTexturesAndVisibilities(objectModel)) + { + needsUpdate = true; + } + + if(this.updatePlanes(geometry, geometryUpdate, time)) needsUpdate = true; + + if(needsUpdate) + { + let index = 0; + + while(index < this._visiblePlanes.length) + { + const spriteIndex = this._visiblePlaneSpriteNumbers[index]; + const sprite = this.getSprite(spriteIndex); + const plane = this._visiblePlanes[index]; + + if(sprite && plane && (plane.type !== RoomPlane.TYPE_LANDSCAPE)) + { + if(this._colorBackgroundOnly) + { + let _local_14 = plane.color; + + const _local_15 = (((_local_14 & 0xFF) * this._redColor) / 0xFF); + const _local_16 = ((((_local_14 >> 8) & 0xFF) * this._greenColor) / 0xFF); + const _local_17 = ((((_local_14 >> 16) & 0xFF) * this._blueColor) / 0xFF); + const _local_18 = (_local_14 >> 24); + + _local_14 = ((((_local_18 << 24) + (_local_17 << 16)) + (_local_16 << 8)) + _local_15); + + sprite.color = _local_14; + } + else + { + sprite.color = plane.color; + } + } + + index++; + } + + this.updateSpriteCounter++; + } + + this.updateModelCounter = objectModel.updateCounter; + this._lastUpdateTime = time; + } + + private updateGeometry(k: IRoomGeometry): boolean + { + if(!k) return false; + + if(this._geometryUpdateId === k.updateId) return false; + + this._geometryUpdateId = k.updateId; + this._boundingRectangle = null; + + const direction = k.direction; + + if(direction && ((direction.x !== this._directionX) || (direction.y !== this._directionY) || (direction.z !== this._directionZ) || (k.scale !== this._roomScale))) + { + this._directionX = direction.x; + this._directionY = direction.y; + this._directionZ = direction.z; + this._roomScale = k.scale; + + return true; + } + + return false; + } + + private updateThickness(k: IRoomObjectModel): boolean + { + if(this.updateModelCounter === k.updateCounter) return false; + + const floorThickness = k.getValue(RoomObjectVariable.ROOM_FLOOR_THICKNESS); + const wallThickness = k.getValue(RoomObjectVariable.ROOM_WALL_THICKNESS); + + if((!isNaN(floorThickness) && !isNaN(wallThickness)) && ((floorThickness !== this._floorThickness) || (wallThickness !== this._wallThickness))) + { + this._floorThickness = floorThickness; + this._wallThickness = wallThickness; + + this.clearPlanes(); + + return true; + } + + return false; + } + + private updateHole(k: IRoomObjectModel): boolean + { + if(this.updateModelCounter === k.updateCounter) return false; + + const holeUpdate = k.getValue(RoomObjectVariable.ROOM_FLOOR_HOLE_UPDATE_TIME); + + if(!isNaN(holeUpdate) && (holeUpdate !== this._holeUpdateTime)) + { + this._holeUpdateTime = holeUpdate; + + this.clearPlanes(); + + return true; + } + + return false; + } + + private updateMasks(k: IRoomObjectModel): boolean + { + if(this.updateModelCounter === k.updateCounter) return false; + + let didUpdate = false; + + const planeMask = k.getValue(RoomObjectVariable.ROOM_PLANE_MASK_XML); + + if(planeMask !== this._maskData) + { + this.updatePlaneMasks(planeMask); + + this._maskData = planeMask; + + didUpdate = true; + } + + const backgroundColor = k.getValue(RoomObjectVariable.ROOM_BACKGROUND_COLOR); + + if(backgroundColor !== this._color) + { + this._color = backgroundColor; + this._redColor = (this._color & 0xFF); + this._greenColor = ((this._color >> 8) & 0xFF); + this._blueColor = ((this._color >> 16) & 0xFF); + + didUpdate = true; + } + + const backgroundOnly = (k.getValue(RoomObjectVariable.ROOM_COLORIZE_BG_ONLY) || false); + + if(backgroundOnly !== this._colorBackgroundOnly) + { + this._colorBackgroundOnly = backgroundOnly; + + didUpdate = true; + } + + return didUpdate; + } + + private updatePlaneTexturesAndVisibilities(model: IRoomObjectModel): boolean + { + if(this.updateModelCounter === model.updateCounter) return false; + + const floorType = model.getValue(RoomObjectVariable.ROOM_FLOOR_TYPE); + const wallType = model.getValue(RoomObjectVariable.ROOM_WALL_TYPE); + const landscapeType = model.getValue(RoomObjectVariable.ROOM_LANDSCAPE_TYPE); + + const floorVisibility = (model.getValue(RoomObjectVariable.ROOM_FLOOR_VISIBILITY) === 1); + const wallVisibility = (model.getValue(RoomObjectVariable.ROOM_WALL_VISIBILITY) === 1); + const landscapeVisibility = (model.getValue(RoomObjectVariable.ROOM_LANDSCAPE_VISIBILITY) === 1); + + return (this.updatePlaneTypes(floorType, wallType, landscapeType) || this.updatePlaneVisibility(floorVisibility, wallVisibility, landscapeVisibility)); + } + + private clearPlanes(): void + { + if(this._planes) + { + while(this._planes.length) + { + const plane = this._planes[0]; + + if(plane) plane.dispose(); + + this._planes.pop(); + } + + this._planes = []; + this._planes = []; + } + + this._isPlaneSet = false; + this._assetUpdateCounter = (this._assetUpdateCounter + 1); + + this.reset(); + } + + protected initializeRoomPlanes(): void + { + if(!this.object || this._isPlaneSet) return; + + if(!isNaN(this._floorThickness)) this._roomPlaneParser.floorThicknessMultiplier = this._floorThickness; + if(!isNaN(this._wallThickness)) this._roomPlaneParser.wallThicknessMultiplier = this._wallThickness; + + const mapData = this.object.model.getValue(RoomObjectVariable.ROOM_MAP_DATA); + + if(!this._roomPlaneParser.initializeFromMapData(mapData)) return; + + const maxX = this.getLandscapeWidth(); + const maxY = this.getLandscapeHeight(); + + let _local_5 = 0; + let randomSeed = this.object.model.getValue(RoomObjectVariable.ROOM_RANDOM_SEED); + let index = 0; + + while(index < this._roomPlaneParser.planeCount) + { + const location = this._roomPlaneParser.getPlaneLocation(index); + const leftSide = this._roomPlaneParser.getPlaneLeftSide(index); + const rightSide = this._roomPlaneParser.getPlaneRightSide(index); + const secondaryNormals = this._roomPlaneParser.getPlaneSecondaryNormals(index); + const planeType = this._roomPlaneParser.getPlaneType(index); + + let plane: RoomPlane = null; + + if(location && leftSide && rightSide) + { + const _local_14 = Vector3d.crossProduct(leftSide, rightSide); + + randomSeed = ToInt32(Math.trunc((randomSeed * 7613) + 517) >>> 0); + plane = null; + + if(planeType === RoomPlaneData.PLANE_FLOOR) + { + const _local_15 = ((location.x + leftSide.x) + 0.5); + const _local_16 = ((location.y + rightSide.y) + 0.5); + const textureOffsetX = (Math.trunc(_local_15) - _local_15); + const textureOffsetY = (Math.trunc(_local_16) - _local_16); + + plane = new RoomPlane(this._textureCache, this.object.getLocation(), location, leftSide, rightSide, RoomPlane.TYPE_FLOOR, true, secondaryNormals, randomSeed, -(textureOffsetX), -(textureOffsetY)); + + if(_local_14.z !== 0) + { + plane.color = RoomVisualization.FLOOR_COLOR; + } + else + { + plane.color = ((_local_14.x !== 0) ? RoomVisualization.FLOOR_COLOR_RIGHT : RoomVisualization.FLOOR_COLOR_LEFT); + } + + if(this._data) plane.rasterizer = this._data.floorRasterizer; + } + + else if(planeType === RoomPlaneData.PLANE_WALL) + { + plane = new RoomPlane(this._textureCache, this.object.getLocation(), location, leftSide, rightSide, RoomPlane.TYPE_WALL, true, secondaryNormals, randomSeed); + + if((leftSide.length < 1) || (rightSide.length < 1)) + { + plane.hasTexture = false; + } + + if((_local_14.x === 0) && (_local_14.y === 0)) + { + plane.color = RoomVisualization.WALL_COLOR_BORDER; + } + else + { + if(_local_14.y > 0) + { + plane.color = RoomVisualization.WALL_COLOR_TOP; + } + else + { + if(_local_14.y === 0) + { + plane.color = RoomVisualization.WALL_COLOR_SIDE; + } + else + { + plane.color = RoomVisualization.WALL_COLOR_BOTTOM; + } + } + } + + if(this._data) plane.rasterizer = this._data.wallRasterizer; + } + + else if(planeType === RoomPlaneData.PLANE_LANDSCAPE) + { + plane = new RoomPlane(this._textureCache, this.object.getLocation(), location, leftSide, rightSide, RoomPlane.TYPE_LANDSCAPE, true, secondaryNormals, randomSeed, _local_5, 0, maxX, maxY); + + if(_local_14.y > 0) + { + plane.color = RoomVisualization.LANDSCAPE_COLOR_TOP; + } + else + { + if(_local_14.y == 0) + { + plane.color = RoomVisualization.LANDSCAPE_COLOR_SIDE; + } + else + { + plane.color = RoomVisualization.LANDSCAPE_COLOR_BOTTOM; + } + } + + if(this._data) plane.rasterizer = this._data.landscapeRasterizer; + + _local_5 = (_local_5 + leftSide.length); + } + + else if(planeType == RoomPlaneData.PLANE_BILLBOARD) + { + plane = new RoomPlane(this._textureCache, this.object.getLocation(), location, leftSide, rightSide, RoomPlane.TYPE_WALL, true, secondaryNormals, randomSeed); + if(((leftSide.length < 1) || (rightSide.length < 1))) + { + plane.hasTexture = false; + } + if(((_local_14.x == 0) && (_local_14.y == 0))) + { + plane.color = RoomVisualization.WALL_COLOR_BORDER; + } + else + { + if(_local_14.y > 0) + { + plane.color = RoomVisualization.WALL_COLOR_TOP; + } + else + { + if(_local_14.y == 0) + { + plane.color = RoomVisualization.WALL_COLOR_SIDE; + } + else + { + plane.color = RoomVisualization.WALL_COLOR_BOTTOM; + } + } + } + // if (this._Str_594 != null) + // { + // _local_13.rasterizer = this._Str_594._Str_23913; + // } + } + + + if(plane) + { + plane.maskManager = this._data.maskManager; + + let _local_19 = 0; + + while(_local_19 < this._roomPlaneParser.getPlaneMaskCount(index)) + { + const _local_20 = this._roomPlaneParser.getPlaneMaskLeftSideLoc(index, _local_19); + const _local_21 = this._roomPlaneParser.getPlaneMaskRightSideLoc(index, _local_19); + const _local_22 = this._roomPlaneParser.getPlaneMaskLeftSideLength(index, _local_19); + const _local_23 = this._roomPlaneParser.getPlaneMaskRightSideLength(index, _local_19); + + plane.addRectangleMask(_local_20, _local_21, _local_22, _local_23); + + _local_19++; + } + + this._planes.push(plane); + } + } + else + { + return; + } + + index++; + } + + this._isPlaneSet = true; + this.defineSprites(); + } + + protected defineSprites(): void + { + this.createSprites(this._planes.length); + + let planeIndex = 0; + + while(planeIndex < this._planes.length) + { + const plane = this._planes[planeIndex]; + const sprite = this.getSprite(planeIndex); + + if(plane && sprite && plane.leftSide && plane.rightSide) + { + if((plane.type === RoomPlane.TYPE_WALL) && ((plane.leftSide.length < 1) || (plane.rightSide.length < 1))) + { + sprite.alphaTolerance = AlphaTolerance.MATCH_NOTHING; + } + else + { + sprite.alphaTolerance = AlphaTolerance.MATCH_OPAQUE_PIXELS; + } + + if(plane.type === RoomPlane.TYPE_WALL) + { + sprite.tag = 'plane.wall@' + (planeIndex + 1); + } + + else if(plane.type === RoomPlane.TYPE_FLOOR) + { + sprite.tag = 'plane.floor@' + (planeIndex + 1); + } + + else + { + sprite.tag = 'plane@' + (planeIndex + 1); + } + + sprite.spriteType = RoomObjectSpriteType.ROOM_PLANE; + } + + planeIndex++; + } + } + + private getLandscapeWidth(): number + { + let length = 0; + let index = 0; + + while(index < this._roomPlaneParser.planeCount) + { + const type = this._roomPlaneParser.getPlaneType(index); + + if(type === RoomPlaneData.PLANE_LANDSCAPE) + { + const vector = this._roomPlaneParser.getPlaneLeftSide(index); + + length += vector.length; + } + + index++; + } + + return length; + } + + private getLandscapeHeight(): number + { + let length = 0; + let index = 0; + + while(index < this._roomPlaneParser.planeCount) + { + const type = this._roomPlaneParser.getPlaneType(index); + + if(type === RoomPlaneData.PLANE_LANDSCAPE) + { + const vector = this._roomPlaneParser.getPlaneRightSide(index); + + if(vector.length > length) length = vector.length; + } + + index++; + } + + if(length > 5) length = 5; + + return length; + } + + protected updatePlaneTypes(floorType: string, wallType: string, landscapeType: string): boolean + { + if(floorType !== this._floorType) this._floorType = floorType; + else floorType = null; + + if(wallType !== this._wallType) this._wallType = wallType; + else wallType = null; + + if(landscapeType !== this._landscapeType) this._landscapeType = landscapeType; + else landscapeType = null; + + if(!floorType && !wallType && !landscapeType) return false; + + let index = 0; + + while(index < this._planes.length) + { + const plane = this._planes[index]; + + if(plane) + { + if((plane.type === RoomPlane.TYPE_FLOOR) && floorType) + { + plane.id = floorType; + } + + else if((plane.type === RoomPlane.TYPE_WALL) && wallType) + { + plane.id = wallType; + } + + else if((plane.type === RoomPlane.TYPE_LANDSCAPE) && landscapeType) + { + plane.id = landscapeType; + } + } + + index++; + } + + return true; + } + + private updatePlaneVisibility(k: boolean, _arg_2: boolean, _arg_3: boolean): boolean + { + if((k === this._typeVisibility[RoomPlane.TYPE_FLOOR]) && (_arg_2 === this._typeVisibility[RoomPlane.TYPE_WALL]) && (_arg_3 === this._typeVisibility[RoomPlane.TYPE_LANDSCAPE])) return false; + + this._typeVisibility[RoomPlane.TYPE_FLOOR] = k; + this._typeVisibility[RoomPlane.TYPE_WALL] = _arg_2; + this._typeVisibility[RoomPlane.TYPE_LANDSCAPE] = _arg_3; + + this._visiblePlanes = []; + this._visiblePlaneSpriteNumbers = []; + + return true; + } + + protected updatePlanes(geometry: IRoomGeometry, geometryUpdate: boolean, timeSinceStartMs: number): boolean + { + if(!geometry || !this.object) return false; + + this._assetUpdateCounter++; + + if(geometryUpdate) + { + this._visiblePlanes = []; + this._visiblePlaneSpriteNumbers = []; + } + + const hasVisiblePlanes = (this._visiblePlanes.length > 0); + + let visiblePlanes = this._visiblePlanes; + + if(!this._visiblePlanes.length) visiblePlanes = this._planes; + + let depth = 0; + let updated = false; + let index = 0; + + while(index < visiblePlanes.length) + { + let id = index; + + if(hasVisiblePlanes) id = this._visiblePlaneSpriteNumbers[index]; + + const sprite = this.getSprite(id); + + if(sprite) + { + const plane = visiblePlanes[index]; + + if(plane) + { + sprite.id = plane.uniqueId; + + if(plane.update(geometry, timeSinceStartMs)) + { + if(plane.visible) + { + depth = ((plane.relativeDepth + this.floorRelativeDepth) + (id / 1000)); + + if(plane.type !== RoomPlane.TYPE_FLOOR) + { + depth = ((plane.relativeDepth + this.wallRelativeDepth) + (id / 1000)); + + if((plane.leftSide.length < 1) || (plane.rightSide.length < 1)) + { + depth = (depth + (RoomVisualization.ROOM_DEPTH_OFFSET * 0.5)); + } + } + + this.updateSprite(sprite, geometry, plane, `plane ${ id } ${ geometry.scale }`, depth); + } + + updated = true; + } + + if(sprite.visible != ((plane.visible) && (this._typeVisibility[plane.type]))) + { + sprite.visible = (!(sprite.visible)); + updated = true; + } + + if(sprite.visible) + { + if(!hasVisiblePlanes) + { + this._visiblePlanes.push(plane); + this._visiblePlaneSpriteNumbers.push(index); + } + } + } + else + { + sprite.id = 0; + + if(sprite.visible) + { + sprite.visible = false; + updated = true; + } + } + } + + index++; + } + + return updated; + } + + protected updatePlaneMasks(k: RoomMapMaskData): void + { + if(!k) return; + + this._roomPlaneBitmapMaskParser.initialize(k); + + const _local_4: number[] = []; + const _local_5: number[] = []; + + let _local_6 = false; + let index = 0; + + while(index < this._planes.length) + { + const plane = this._planes[index]; + + if(plane) + { + plane.resetBitmapMasks(); + + if(plane.type === RoomPlane.TYPE_LANDSCAPE) _local_4.push(index); + } + + index++; + } + + for(const mask of this._roomPlaneBitmapMaskParser.masks.values()) + { + const maskType = this._roomPlaneBitmapMaskParser.getMaskType(mask); + const maskLocation = this._roomPlaneBitmapMaskParser.getMaskLocation(mask); + const maskCategory = this._roomPlaneBitmapMaskParser.getMaskCategory(mask); + + if(maskLocation) + { + let i = 0; + + while(i < this._planes.length) + { + const plane = this._planes[i]; + + if((plane.type === RoomPlane.TYPE_WALL) || (plane.type === RoomPlane.TYPE_LANDSCAPE)) + { + if(plane && plane.location && plane.normal) + { + const _local_14 = Vector3d.dif(maskLocation, plane.location); + const _local_15 = Math.abs(Vector3d.scalarProjection(_local_14, plane.normal)); + + if(_local_15 < 0.01) + { + if(plane.leftSide && plane.rightSide) + { + const leftSideLoc = Vector3d.scalarProjection(_local_14, plane.leftSide); + const rightSideLoc = Vector3d.scalarProjection(_local_14, plane.rightSide); + + if((plane.type === RoomPlane.TYPE_WALL) || ((plane.type === RoomPlane.TYPE_LANDSCAPE) && (maskCategory === RoomPlaneBitmapMaskData.HOLE))) + { + plane.addBitmapMask(maskType, leftSideLoc, rightSideLoc); + } + else + { + if(plane.type === RoomPlane.TYPE_LANDSCAPE) + { + if(!plane.canBeVisible) _local_6 = true; + + plane.canBeVisible = true; + + _local_5.push(i); + } + } + } + } + } + } + + i++; + } + } + } + + index = 0; + + while(index < _local_4.length) + { + const planeIndex = _local_4[index]; + + if(_local_5.indexOf(planeIndex) < 0) + { + const plane = this._planes[planeIndex]; + + plane.canBeVisible = false; + _local_6 = true; + } + + index++; + } + + if(_local_6) + { + this._visiblePlanes = []; + this._visiblePlaneSpriteNumbers = []; + } + } + + private updateSprite(sprite: IRoomObjectSprite, geometry: IRoomGeometry, plane: RoomPlane, _arg_3: string, relativeDepth: number): void + { + const offset = plane.offset; + + sprite.offsetX = -(offset.x); + sprite.offsetY = -(offset.y); + sprite.relativeDepth = relativeDepth; + sprite.color = plane.color; + sprite.texture = plane.bitmapData; + sprite.name = ((_arg_3 + '_') + this._assetUpdateCounter); + } + + public getBoundingRectangle(): Rectangle + { + if(!this._boundingRectangle) this._boundingRectangle = super.getBoundingRectangle(); + + return new Rectangle(this._boundingRectangle.x, this._boundingRectangle.y, this._boundingRectangle.width, this._boundingRectangle.height); + } + + public get planes(): IRoomPlane[] + { + const planes: IRoomPlane[] = []; + + for(const plane of this._visiblePlanes) planes.push(plane); + + return planes; + } + + public get floorRelativeDepth(): number + { + return RoomVisualization.ROOM_DEPTH_OFFSET + 0.1; + } + + public get wallRelativeDepth(): number + { + return RoomVisualization.ROOM_DEPTH_OFFSET + 0.5; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/RoomVisualizationData.ts b/submodules/renderer/src/nitro/room/object/visualization/room/RoomVisualizationData.ts new file mode 100644 index 0000000..98534fe --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/RoomVisualizationData.ts @@ -0,0 +1,121 @@ +import { IAssetData, IGraphicAssetCollection, IObjectVisualizationData } from '../../../../../api'; +import { Disposable } from '../../../../../core'; +import { PlaneMaskManager } from './mask'; +import { FloorRasterizer, LandscapeRasterizer, WallRasterizer } from './rasterizer'; + +export class RoomVisualizationData extends Disposable implements IObjectVisualizationData +{ + private _wallRasterizer: WallRasterizer; + private _floorRasterizer: FloorRasterizer; + private _landscapeRasterizer: LandscapeRasterizer; + private _maskManager: PlaneMaskManager; + private _initialized: boolean; + + constructor() + { + super(); + + this._wallRasterizer = new WallRasterizer(); + this._floorRasterizer = new FloorRasterizer(); + this._landscapeRasterizer = new LandscapeRasterizer(); + this._maskManager = new PlaneMaskManager(); + this._initialized = false; + } + + public initialize(asset: IAssetData): boolean + { + if(!asset.roomVisualization) return false; + + const wallData = asset.roomVisualization.wallData; + + if(wallData) this._wallRasterizer.initialize(wallData); + + const floorData = asset.roomVisualization.floorData; + + if(floorData) this._floorRasterizer.initialize(floorData); + + const landscapeData = asset.roomVisualization.landscapeData; + + if(landscapeData) this._landscapeRasterizer.initialize(landscapeData); + + const maskData = asset.roomVisualization.maskData; + + if(maskData) this._maskManager.initialize(maskData); + + return true; + } + + protected onDispose(): void + { + if(this._wallRasterizer) + { + this._wallRasterizer.dispose(); + + this._wallRasterizer = null; + } + + if(this._floorRasterizer) + { + this._floorRasterizer.dispose(); + + this._floorRasterizer = null; + } + + if(this._landscapeRasterizer) + { + this._landscapeRasterizer.dispose(); + + this._landscapeRasterizer = null; + } + + if(this._maskManager) + { + this._maskManager.dispose(); + + this._maskManager = null; + } + + super.onDispose(); + } + + public setGraphicAssetCollection(collection: IGraphicAssetCollection): void + { + if(this._initialized) return; + + this._wallRasterizer.initializeAssetCollection(collection); + this._floorRasterizer.initializeAssetCollection(collection); + this._landscapeRasterizer.initializeAssetCollection(collection); + this._maskManager.initializeAssetCollection(collection); + + this._initialized = true; + } + + public clearCache(): void + { + if(this._wallRasterizer) this._wallRasterizer.clearCache(); + + if(this._floorRasterizer) this._floorRasterizer.clearCache(); + + if(this._landscapeRasterizer) this._landscapeRasterizer.clearCache(); + } + + public get wallRasterizer(): WallRasterizer + { + return this._wallRasterizer; + } + + public get floorRasterizer(): FloorRasterizer + { + return this._floorRasterizer; + } + + public get landscapeRasterizer(): LandscapeRasterizer + { + return this._landscapeRasterizer; + } + + public get maskManager(): PlaneMaskManager + { + return this._maskManager; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/TileCursorVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/room/TileCursorVisualization.ts new file mode 100644 index 0000000..899d545 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/TileCursorVisualization.ts @@ -0,0 +1,26 @@ +import { RoomObjectVariable } from '../../../../../api'; +import { FurnitureAnimatedVisualization } from '../furniture'; + +export class TileCursorVisualization extends FurnitureAnimatedVisualization +{ + private _tileHeight: number; + + constructor() + { + super(); + + this._tileHeight = 0; + } + + protected getLayerYOffset(scale: number, direction: number, layerId: number): number + { + if(layerId === 1) + { + this._tileHeight = this.object.model.getValue(RoomObjectVariable.TILE_CURSOR_HEIGHT); + + return -(this._tileHeight) * 32; // 32 = scale / 2 + } + + return super.getLayerYOffset(scale, direction, layerId); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/index.ts b/submodules/renderer/src/nitro/room/object/visualization/room/index.ts new file mode 100644 index 0000000..7947171 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/index.ts @@ -0,0 +1,12 @@ +export * from './mask'; +export * from './PlaneDrawingData'; +export * from './rasterizer'; +export * from './rasterizer/animated'; +export * from './rasterizer/basic'; +export * from './RoomPlane'; +export * from './RoomPlaneBitmapMask'; +export * from './RoomPlaneRectangleMask'; +export * from './RoomVisualization'; +export * from './RoomVisualizationData'; +export * from './TileCursorVisualization'; +export * from './utils'; diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/mask/PlaneMask.ts b/submodules/renderer/src/nitro/room/object/visualization/room/mask/PlaneMask.ts new file mode 100644 index 0000000..aa141b0 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/mask/PlaneMask.ts @@ -0,0 +1,119 @@ +import { IGraphicAsset, IVector3D } from '../../../../../../api'; +import { PlaneMaskVisualization } from './PlaneMaskVisualization'; + +export class PlaneMask +{ + private _maskVisualizations: Map; + private _sizes: number[]; + private _assetNames: Map; + private _lastMaskVisualization: PlaneMaskVisualization; + private _lastSize: number; + + constructor() + { + this._sizes = []; + this._maskVisualizations = new Map(); + this._assetNames = new Map(); + this._lastMaskVisualization = null; + this._lastSize = -1; + } + + public dispose(): void + { + if(this._maskVisualizations) + { + for(const mask of this._maskVisualizations.values()) + { + if(!mask) continue; + + mask.dispose(); + } + + this._maskVisualizations = null; + } + + this._lastMaskVisualization = null; + this._sizes = null; + } + + public createMaskVisualization(size: number): PlaneMaskVisualization + { + const existing = this._maskVisualizations.get(size); + + if(existing) return null; + + const visualization = new PlaneMaskVisualization(); + + this._maskVisualizations.set(size, visualization); + + this._sizes.push(size); + this._sizes.sort(); + + return visualization; + } + + private getSizeIndex(k: number): number + { + let sizeIndex = 0; + let index = 1; + + while(index < this._sizes.length) + { + if(this._sizes[index] > k) + { + if((this._sizes[index] - k) < (k - this._sizes[(index - 1)])) sizeIndex = index; + + break; + } + + sizeIndex = index; + + index++; + } + + return sizeIndex; + } + + protected getMaskVisualization(k: number): PlaneMaskVisualization + { + if(k === this._lastSize) return this._lastMaskVisualization; + + const sizeIndex = this.getSizeIndex(k); + + if(sizeIndex < this._sizes.length) + { + this._lastMaskVisualization = (this._maskVisualizations.get(this._sizes[sizeIndex])); + } + else + { + this._lastMaskVisualization = null; + } + + this._lastSize = k; + + return this._lastMaskVisualization; + } + + public getGraphicAsset(k: number, _arg_2: IVector3D): IGraphicAsset + { + const visualization = this.getMaskVisualization(k); + + if(!visualization) return null; + + return visualization.getAsset(_arg_2); + } + + public getAssetName(k: number): string + { + if(!this._assetNames) return null; + + return this._assetNames.get(k) || null; + } + + public setAssetName(k: number, _arg_2: string): void + { + if(!this._assetNames) return; + + this._assetNames.set(k, _arg_2); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/mask/PlaneMaskBitmap.ts b/submodules/renderer/src/nitro/room/object/visualization/room/mask/PlaneMaskBitmap.ts new file mode 100644 index 0000000..1920247 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/mask/PlaneMaskBitmap.ts @@ -0,0 +1,52 @@ +import { IGraphicAsset } from '../../../../../../api'; + +export class PlaneMaskBitmap +{ + public static MIN_NORMAL_COORDINATE_VALUE: number = -1; + public static MAX_NORMAL_COORDINATE_VALUE: number = 1; + + private _asset: IGraphicAsset; + private _normalMinX: number; + private _normalMaxX: number; + private _normalMinY: number; + private _normalMaxY: number; + + constructor(k: IGraphicAsset, _arg_2: number = -1, _arg_3: number = 1, _arg_4: number = -1, _arg_5: number = 1) + { + this._normalMinX = _arg_2; + this._normalMaxX = _arg_3; + this._normalMinY = _arg_4; + this._normalMaxY = _arg_5; + this._asset = k; + } + + public get asset(): IGraphicAsset + { + return this._asset; + } + + public get normalMinX(): number + { + return this._normalMinX; + } + + public get normalMaxX(): number + { + return this._normalMaxX; + } + + public get normalMinY(): number + { + return this._normalMinY; + } + + public get normalMaxY(): number + { + return this._normalMaxY; + } + + public dispose(): void + { + this._asset = null; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/mask/PlaneMaskManager.ts b/submodules/renderer/src/nitro/room/object/visualization/room/mask/PlaneMaskManager.ts new file mode 100644 index 0000000..ab14f00 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/mask/PlaneMaskManager.ts @@ -0,0 +1,205 @@ +import { RenderTexture } from '@pixi/core'; +import { Matrix, Point } from '@pixi/math'; +import { Sprite } from '@pixi/sprite'; +import { IAssetPlaneMaskData, IAssetPlaneTextureBitmap, IGraphicAssetCollection, IVector3D } from '../../../../../../api'; +import { PixiApplicationProxy } from '../../../../../../pixi-proxy'; +import { PlaneMask } from './PlaneMask'; +import { PlaneMaskVisualization } from './PlaneMaskVisualization'; + +export class PlaneMaskManager +{ + private _assetCollection: IGraphicAssetCollection; + private _masks: Map; + private _data: IAssetPlaneMaskData; + + constructor() + { + this._assetCollection = null; + this._masks = new Map(); + this._data = null; + } + + public get data(): IAssetPlaneMaskData + { + return this._data; + } + + public dispose(): void + { + this._assetCollection = null; + this._data = null; + + if(this._masks && this._masks.size) + { + for(const mask of this._masks.values()) + { + if(!mask) continue; + + mask.dispose(); + } + + this._masks.clear(); + } + } + + public initialize(k: IAssetPlaneMaskData): void + { + this._data = k; + } + + public initializeAssetCollection(k: IGraphicAssetCollection): void + { + if(!this.data) return; + + this._assetCollection = k; + + this.parseMasks(this.data, k); + } + + private parseMasks(maskData: IAssetPlaneMaskData, _arg_2: IGraphicAssetCollection): void + { + if(!maskData || !_arg_2) return; + + if(maskData.masks && maskData.masks.length) + { + let index = 0; + + while(index < maskData.masks.length) + { + const mask = maskData.masks[index]; + + if(mask) + { + const id = mask.id; + const existing = this._masks.get(id); + + if(existing) continue; + + const newMask = new PlaneMask(); + + if(mask.visualizations && mask.visualizations.length) + { + let visualIndex = 0; + + while(visualIndex < mask.visualizations.length) + { + const visualization = mask.visualizations[visualIndex]; + + if(visualization) + { + const size = visualization.size; + const maskVisualization = newMask.createMaskVisualization(size); + + if(maskVisualization) + { + const assetName = this.parseMaskBitmaps(visualization.bitmaps, maskVisualization, _arg_2); + + newMask.setAssetName(size, assetName); + } + } + + visualIndex++; + } + } + + this._masks.set(id, newMask); + } + + index++; + } + } + } + + private parseMaskBitmaps(bitmaps: IAssetPlaneTextureBitmap[], maskVisualization: PlaneMaskVisualization, assetCollection: IGraphicAssetCollection): string + { + if(!bitmaps || !bitmaps.length) return null; + + let graphicName: string = null; + + for(const bitmap of bitmaps) + { + if(!bitmap) continue; + + const assetName = bitmap.assetName; + const asset = assetCollection.getAsset(assetName); + + if(!asset) continue; + + let normalMinX = PlaneMaskVisualization.MIN_NORMAL_COORDINATE_VALUE; + let normalMaxX = PlaneMaskVisualization.MAX_NORMAL_COORDINATE_VALUE; + let normalMinY = PlaneMaskVisualization.MIN_NORMAL_COORDINATE_VALUE; + let normalMaxY = PlaneMaskVisualization.MAX_NORMAL_COORDINATE_VALUE; + + if(bitmap.normalMinX !== undefined) normalMinX = bitmap.normalMinX; + if(bitmap.normalMaxX !== undefined) normalMaxX = bitmap.normalMaxX; + if(bitmap.normalMinY !== undefined) normalMinY = bitmap.normalMinY; + if(bitmap.normalMaxY !== undefined) normalMaxY = bitmap.normalMaxY; + + if(!asset.flipH) graphicName = assetName; + + maskVisualization.addBitmap(asset, normalMinX, normalMaxX, normalMinY, normalMaxY); + } + + return graphicName; + } + + public updateMask(canvas: RenderTexture, type: string, scale: number, normal: IVector3D, posX: number, posY: number): boolean + { + const mask = this._masks.get(type); + + if(!mask) return true; + + const asset = mask.getGraphicAsset(scale, normal); + + if(!asset) return true; + + const texture = asset.texture; + + if(!texture) return true; + + const point = new Point((posX + asset.offsetX), (posY + asset.offsetY)); + + const matrix = new Matrix(); + + let xScale = 1; + let ySkew = 1; + let xSkew = 0; + let yScale = 0; + let tx = (point.x + xSkew); + let ty = (point.y + yScale); + + if(asset.flipH) + { + xScale = -1; + xSkew = texture.width; + + tx = ((point.x + xSkew) - texture.width); + } + + if(asset.flipV) + { + ySkew = -1; + yScale = texture.height; + + ty = ((point.y + yScale) - texture.height); + } + + matrix.scale(xScale, ySkew); + matrix.translate(tx, ty); + + PixiApplicationProxy.instance.renderer.render(new Sprite(texture), { + renderTexture: canvas, + clear: false, + transform: matrix + }); + + return true; + } + + public getMask(k: string): PlaneMask + { + if(!this._masks || !this._masks.size) return null; + + return this._masks.get(k) || null; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/mask/PlaneMaskVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/room/mask/PlaneMaskVisualization.ts new file mode 100644 index 0000000..19a6d22 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/mask/PlaneMaskVisualization.ts @@ -0,0 +1,49 @@ +import { IGraphicAsset, IVector3D } from '../../../../../../api'; +import { PlaneMaskBitmap } from './PlaneMaskBitmap'; + +export class PlaneMaskVisualization +{ + public static MIN_NORMAL_COORDINATE_VALUE: number = -1; + public static MAX_NORMAL_COORDINATE_VALUE: number = 1; + + private _bitmaps: PlaneMaskBitmap[]; + + constructor() + { + this._bitmaps = []; + } + + public dispose(): void + { + for(const mask of this._bitmaps) + { + if(!mask) continue; + + mask.dispose(); + } + + this._bitmaps = null; + } + + public addBitmap(k: IGraphicAsset, _arg_2: number = -1, _arg_3: number = 1, _arg_4: number = -1, _arg_5: number = 1): void + { + this._bitmaps.push(new PlaneMaskBitmap(k, _arg_2, _arg_3, _arg_4, _arg_5)); + } + + public getAsset(k: IVector3D): IGraphicAsset + { + if(!k) return null; + + for(const mask of this._bitmaps) + { + if(!mask) continue; + + if((((k.x >= mask.normalMinX) && (k.x <= mask.normalMaxX)) && (k.y >= mask.normalMinY)) && (k.y <= mask.normalMaxY)) + { + return mask.asset; + } + } + + return null; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/mask/index.ts b/submodules/renderer/src/nitro/room/object/visualization/room/mask/index.ts new file mode 100644 index 0000000..51da625 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/mask/index.ts @@ -0,0 +1,4 @@ +export * from './PlaneMask'; +export * from './PlaneMaskBitmap'; +export * from './PlaneMaskManager'; +export * from './PlaneMaskVisualization'; diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/IPlaneRasterizer.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/IPlaneRasterizer.ts new file mode 100644 index 0000000..53f4fb2 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/IPlaneRasterizer.ts @@ -0,0 +1,14 @@ +import { RenderTexture } from '@pixi/core'; +import { IVector3D } from '../../../../../../api'; +import { PlaneTextureCache } from '../../../../../../pixi-proxy'; +import { PlaneBitmapData } from '../utils'; +import { PlaneVisualizationLayer } from './basic'; + +export interface IPlaneRasterizer +{ + initializeDimensions(_arg_1: number, _arg_2: number): boolean; + render(planeId: string, textureCache: PlaneTextureCache, canvas: RenderTexture, id: string, width: number, height: number, scale: number, normal: IVector3D, useTexture: boolean, offsetX?: number, offsetY?: number, maxX?: number, maxY?: number, timeSinceStartMs?: number): PlaneBitmapData; + getTextureIdentifier(_arg_1: number, _arg_2: IVector3D): string; + getLayers(_arg_1: string): PlaneVisualizationLayer[]; + reinitialize(): void; +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/animated/AnimationItem.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/animated/AnimationItem.ts new file mode 100644 index 0000000..3fcbab6 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/animated/AnimationItem.ts @@ -0,0 +1,53 @@ +import { Point } from '@pixi/math'; +import { IGraphicAsset } from '../../../../../../../api'; + +export class AnimationItem +{ + private _x: number; + private _y: number; + private _speedX: number; + private _speedY: number; + private _asset: IGraphicAsset; + + constructor(x: number, y: number, speedX: number, speedY: number, asset: IGraphicAsset) + { + this._x = x; + this._y = y; + this._speedX = speedX; + this._speedY = speedY; + this._asset = asset; + + if(isNaN(this._x)) this._x = 0; + + if(isNaN(this._y)) this._y = 0; + + if(isNaN(this._speedX)) this._speedX = 0; + + if(isNaN(this._speedY)) this._speedY = 0; + } + + public get bitmapData(): IGraphicAsset + { + return this._asset; + } + + public dispose(): void + { + this._asset = null; + } + + public getPosition(maxX: number, maxY: number, dimensionX: number, dimensionY: number, timeSinceStartMs: number): Point + { + let x = this._x; + let y = this._y; + + if(dimensionX > 0) x = (x + (((this._speedX / dimensionX) * timeSinceStartMs) / 1000)); + + if(dimensionY > 0) y = (y + (((this._speedY / dimensionY) * timeSinceStartMs) / 1000)); + + const _local_8 = Math.trunc((x % 1) * maxX); + const _local_9 = Math.trunc((y % 1) * maxY); + + return new Point(_local_8, _local_9); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapePlane.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapePlane.ts new file mode 100644 index 0000000..f680dbc --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapePlane.ts @@ -0,0 +1,62 @@ +import { RenderTexture } from '@pixi/core'; +import { IVector3D, Vector3d } from '../../../../../../../api'; +import { PlaneTextureCache } from '../../../../../../../pixi-proxy'; +import { Plane } from '../basic'; + +export class LandscapePlane extends Plane +{ + public static DEFAULT_COLOR: number = 0xFFFFFF; + public static HORIZONTAL_ANGLE_DEFAULT: number = 45; + public static VERTICAL_ANGLE_DEFAULT: number = 30; + + private _width: number = 0; + private _height: number = 0; + + public isStatic(scale: number): boolean + { + const visualization = this.getPlaneVisualization(scale); + + if(visualization) return !visualization.hasAnimationLayers; + + return super.isStatic(scale); + } + + public initializeDimensions(width: number, height: number): void + { + if(width < 0) width = 0; + + if(height < 0) height = 0; + + if((width !== this._width) || (height !== this._height)) + { + this._width = width; + this._height = height; + } + } + + public render(planeId: string, textureCache: PlaneTextureCache, canvas: RenderTexture, width: number, height: number, scale: number, normal: IVector3D, useTexture: boolean, offsetX: number, offsetY: number, maxX: number, maxY: number, timeSinceStartMs: number): RenderTexture + { + const visualization = this.getPlaneVisualization(scale); + + if(!visualization || !visualization.geometry) return null; + + const _local_13 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, 0)); + const _local_14 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, 1)); + const _local_15 = visualization.geometry.getScreenPoint(new Vector3d(0, 1, 0)); + + if(_local_13 && _local_14 && _local_15) + { + width = Math.round(Math.abs((((_local_13.x - _local_15.x) * width) / visualization.geometry.scale))); + height = Math.round(Math.abs((((_local_13.y - _local_14.y) * height) / visualization.geometry.scale))); + + const renderOffsetX = Math.trunc(offsetX * Math.abs((_local_13.x - _local_15.x))); + const renderOffsetY = Math.trunc(offsetY * Math.abs((_local_13.y - _local_14.y))); + const renderMaxX = Math.trunc(maxX * Math.abs((_local_13.x - _local_15.x))); + const renderMaxY = Math.trunc(maxY * Math.abs((_local_13.y - _local_14.y))); + + return visualization.render(planeId, textureCache, canvas, width, height, normal, useTexture, renderOffsetX, renderOffsetY, renderMaxX, renderMaxY, maxX, maxY, timeSinceStartMs); + } + + return null; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapeRasterizer.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapeRasterizer.ts new file mode 100644 index 0000000..22174d1 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/animated/LandscapeRasterizer.ts @@ -0,0 +1,231 @@ +import { RenderTexture } from '@pixi/core'; +import { IAssetPlane, IAssetPlaneVisualizationAnimatedLayer, IAssetPlaneVisualizationLayer, IVector3D } from '../../../../../../../api'; +import { PlaneTextureCache } from '../../../../../../../pixi-proxy'; +import { PlaneBitmapData, Randomizer } from '../../utils'; +import { PlaneMaterial, PlaneRasterizer, PlaneVisualizationLayer } from '../basic'; +import { LandscapePlane } from './LandscapePlane'; + +export class LandscapeRasterizer extends PlaneRasterizer +{ + public static LANDSCAPES_ENABLED: boolean = true; + public static LANDSCAPE_DEFAULT_COLOR: number = 8828617; + + private static UPDATE_INTERVAL: number = 500; + + private _landscapeWidth: number = 0; + private _landscapeHeight: number = 0; + private _cachedBitmap: RenderTexture = null; + + public initializeDimensions(k: number, _arg_2: number): boolean + { + if(k < 0) k = 0; + + if(_arg_2 < 0) _arg_2 = 0; + + this._landscapeWidth = k; + this._landscapeHeight = _arg_2; + + return true; + } + + protected initializePlanes(): void + { + if(!this.data) return; + + const landscapes = this.data.planes; + + if(landscapes && landscapes.length) this.parseLandscapes(landscapes); + } + + private parseLandscapes(k: IAssetPlane[]): void + { + if(!k) return; + + const randomNumber = Math.trunc((Math.random() * 654321)); + + for(const landscapeIndex in k) + { + const landscape = k[landscapeIndex]; + + if(!landscape) continue; + + const id = landscape.id; + const visualizations = landscape.animatedVisualization; + + const plane = new LandscapePlane(); + + for(const visualization of visualizations) + { + if(!visualization) continue; + + const size = visualization.size; + + let horizontalAngle = LandscapePlane.HORIZONTAL_ANGLE_DEFAULT; + let verticalAngle = LandscapePlane.VERTICAL_ANGLE_DEFAULT; + + if(visualization.horizontalAngle !== undefined) horizontalAngle = visualization.horizontalAngle; + if(visualization.verticalAngle !== undefined) verticalAngle = visualization.verticalAngle; + + const totalLayers = (visualization.allLayers.length ?? 0); + + const planeVisualization = plane.createPlaneVisualization(size, (totalLayers || 0), this.getGeometry(size, horizontalAngle, verticalAngle)); + + if(planeVisualization) + { + Randomizer.setSeed(randomNumber); + + let layerId = 0; + + while(layerId < totalLayers) + { + const layer = visualization.allLayers[layerId]; + + if(layer) + { + if((layer as IAssetPlaneVisualizationAnimatedLayer).items === undefined) + { + const basicLayer = (layer as IAssetPlaneVisualizationLayer); + + let material: PlaneMaterial = null; + let align: number = PlaneVisualizationLayer.ALIGN_DEFAULT; + let color: number = LandscapePlane.DEFAULT_COLOR; + let offset: number = PlaneVisualizationLayer.DEFAULT_OFFSET; + + if(basicLayer.materialId) material = this.getMaterial(basicLayer.materialId); + + if(basicLayer.color) color = basicLayer.color; + + if(basicLayer.offset) offset = basicLayer.offset; + + if(basicLayer.align) + { + if(basicLayer.align === 'bottom') + { + align = PlaneVisualizationLayer.ALIGN_BOTTOM; + } + + else if(basicLayer.align === 'top') align = PlaneVisualizationLayer.ALIGN_TOP; + } + + planeVisualization.setLayer(layerId, material, color, align, offset); + } + else + { + const animatedLayer = (layer as IAssetPlaneVisualizationAnimatedLayer); + + const items = animatedLayer.items; + const animationItems: {}[] = []; + + if(items && items.length) + { + for(const item of items) + { + if(item) + { + const id = item.id; + const assetId = item.assetId; + const x = this.getCoordinateValue(item.x || '', item.randomX || ''); + const y = this.getCoordinateValue(item.y || '', item.randomY || ''); + const speedX = item.speedX; + const speedY = item.speedY; + + animationItems.push({ + asset: assetId, + x, + y, + speedX, + speedY + }); + } + } + } + + planeVisualization.setAnimationLayer(layerId, animationItems, this.assetCollection); + } + + layerId++; + } + } + } + } + + if(!this.addPlane(id, plane)) plane.dispose(); + } + } + + private getCoordinateValue(x: string, randomX: string): number + { + let _local_3 = 0; + + if((x.length > 0)) + { + if(x.charAt((x.length - 1)) === '%') + { + x = x.substr(0, (x.length - 1)); + + _local_3 = (parseFloat(x) / 100); + } + } + + if((randomX.length > 0)) + { + const _local_4 = 10000; + const _local_5 = Randomizer.getValues(1, 0, _local_4); + const _local_6 = (_local_5[0] / _local_4); + + if(randomX.charAt((randomX.length - 1)) === '%') + { + randomX = randomX.substr(0, (randomX.length - 1)); + + _local_3 = (_local_3 + ((_local_6 * parseFloat(randomX)) / 100)); + } + } + + return _local_3; + } + + public render(planeId: string, textureCache: PlaneTextureCache, canvas: RenderTexture, id: string, width: number, height: number, scale: number, normal: IVector3D, useTexture: boolean, offsetX: number = 0, offsetY: number = 0, maxX: number = 0, maxY: number = 0, timeSinceStartMs: number = 0): PlaneBitmapData + { + let plane = this.getPlane(id) as LandscapePlane; + + if(!plane) plane = this.getPlane(LandscapeRasterizer.DEFAULT) as LandscapePlane; + + if(!plane) return null; + + if(canvas) textureCache.clearRenderTexture(canvas); + + let graphic = plane.render(planeId,textureCache, canvas, width, height, scale, normal, useTexture, offsetX, offsetY, maxX, maxY, timeSinceStartMs); + + if(graphic && (graphic !== canvas)) + { + graphic = new RenderTexture(graphic.baseTexture); + + if(!graphic) return null; + } + + let planeBitmapData: PlaneBitmapData = null; + + if(!plane.isStatic(scale) && (LandscapeRasterizer.UPDATE_INTERVAL > 0)) + { + planeBitmapData = new PlaneBitmapData(graphic, ((Math.round((timeSinceStartMs / LandscapeRasterizer.UPDATE_INTERVAL)) * LandscapeRasterizer.UPDATE_INTERVAL) + LandscapeRasterizer.UPDATE_INTERVAL)); + } + else + { + planeBitmapData = new PlaneBitmapData(graphic, -1); + } + + return planeBitmapData; + } + + public getTextureIdentifier(k: number, _arg_2: IVector3D): string + { + if(_arg_2) + { + if(_arg_2.x < 0) return (k + '_0'); + + return (k + '_1'); + } + + return super.getTextureIdentifier(k, _arg_2); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/animated/PlaneVisualizationAnimationLayer.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/animated/PlaneVisualizationAnimationLayer.ts new file mode 100644 index 0000000..a0f66e1 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/animated/PlaneVisualizationAnimationLayer.ts @@ -0,0 +1,121 @@ +import { RenderTexture } from '@pixi/core'; +import { Sprite } from '@pixi/sprite'; +import { IDisposable, IGraphicAssetCollection, IVector3D } from '../../../../../../../api'; +import { PlaneTextureCache } from '../../../../../../../pixi-proxy'; +import { AnimationItem } from './AnimationItem'; + +export class PlaneVisualizationAnimationLayer implements IDisposable +{ + private _color: number = 0; + private _isDisposed: boolean = false; + private _items: AnimationItem[]; + + constructor(k: any, assets: IGraphicAssetCollection) + { + this._color = 0; + this._isDisposed = false; + this._items = []; + + if(k && assets) + { + for(const item of k) + { + if(!item) continue; + + const assetName = item.asset; + + if(assetName) + { + const asset = assets.getAsset(assetName); + + if(asset) this._items.push(new AnimationItem(item.x, item.y, item.speedX, item.speedY, asset)); + } + } + } + } + + public get disposed(): boolean + { + return this._isDisposed; + } + + public dispose(): void + { + this._isDisposed = true; + + if(this._items) + { + for(const item of this._items) item && item.dispose(); + + this._items = []; + } + } + + public clearCache(): void + { + } + + public render(textureCache: PlaneTextureCache, canvas: RenderTexture, width: number, height: number, normal: IVector3D, offsetX: number, offsetY: number, maxX: number, maxY: number, dimensionX: number, dimensionY: number, timeSinceStartMs: number): RenderTexture + { + if(((maxX > 0) && (maxY > 0))) + { + let index = 0; + + while(index < this._items.length) + { + const item = (this._items[index] as AnimationItem); + + if(item) + { + const point = item.getPosition(maxX, maxY, dimensionX, dimensionY, timeSinceStartMs); + + point.x = Math.trunc(point.x - offsetX); + point.y = Math.trunc(point.y - offsetY); + + if(item.bitmapData) + { + if((point.x > -(item.bitmapData.width)) && (point.x < canvas.width) && (point.y > -(item.bitmapData.height)) && (point.y < canvas.height)) + { + const sprite = new Sprite(item.bitmapData.texture); + + sprite.position.set(point.x, point.y); + + textureCache.writeToRenderTexture(sprite, canvas, false); + } + + if(((point.x - maxX) > -(item.bitmapData.width)) && ((point.x - maxX) < canvas.width) && (point.y > -(item.bitmapData.height)) && (point.y < canvas.height)) + { + const sprite = new Sprite(item.bitmapData.texture); + + sprite.position.set((point.x - maxX), point.y); + + textureCache.writeToRenderTexture(sprite, canvas, false); + } + + if((point.x > -(item.bitmapData.width)) && (point.x < canvas.width) && ((point.y - maxY) > -(item.bitmapData.height)) && ((point.y - maxY) < canvas.height)) + { + const sprite = new Sprite(item.bitmapData.texture); + + sprite.position.set(point.x, (point.y - maxY)); + + textureCache.writeToRenderTexture(sprite, canvas, false); + } + + if(((point.x - maxX) > -(item.bitmapData.width)) && ((point.x - maxX) < canvas.width) && ((point.y - maxY) > -(item.bitmapData.height)) && ((point.y - maxY) < canvas.height)) + { + const sprite = new Sprite(item.bitmapData.texture); + + sprite.position.set((point.x - maxX), (point.y - maxY)); + + textureCache.writeToRenderTexture(sprite, canvas, false); + } + } + } + + index++; + } + } + + return canvas; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/animated/index.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/animated/index.ts new file mode 100644 index 0000000..185d1a6 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/animated/index.ts @@ -0,0 +1,4 @@ +export * from './AnimationItem'; +export * from './LandscapePlane'; +export * from './LandscapeRasterizer'; +export * from './PlaneVisualizationAnimationLayer'; diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/FloorPlane.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/FloorPlane.ts new file mode 100644 index 0000000..fb3c44a --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/FloorPlane.ts @@ -0,0 +1,38 @@ +import { RenderTexture } from '@pixi/core'; +import { IVector3D, Vector3d } from '../../../../../../../api'; +import { PlaneTextureCache } from '../../../../../../../pixi-proxy'; +import { Plane } from './Plane'; + +export class FloorPlane extends Plane +{ + public static DEFAULT_COLOR: number = 0xFFFFFF; + public static HORIZONTAL_ANGLE_DEFAULT: number = 45; + public static VERTICAL_ANGLE_DEFAULT: number = 30; + + public render(planeId: string, textureCache: PlaneTextureCache, canvas: RenderTexture, width: number, height: number, scale: number, normal: IVector3D, useTexture: boolean, offsetX: number, offsetY: number): RenderTexture + { + const visualization = this.getPlaneVisualization(scale); + + if(!visualization || !visualization.geometry) return null; + + const _local_10 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, 0)); + const _local_11 = visualization.geometry.getScreenPoint(new Vector3d(0, (height / visualization.geometry.scale), 0)); + const _local_12 = visualization.geometry.getScreenPoint(new Vector3d((width / visualization.geometry.scale), 0, 0)); + + let x = 0; + let y = 0; + + if(_local_10 && _local_11 && _local_12) + { + width = Math.round(Math.abs((_local_10.x - _local_12.x))); + height = Math.round(Math.abs((_local_10.x - _local_11.x))); + + const _local_15 = (_local_10.x - visualization.geometry.getScreenPoint(new Vector3d(1, 0, 0)).x); + + x = (offsetX * Math.trunc(Math.abs(_local_15))); + y = (offsetY * Math.trunc(Math.abs(_local_15))); + } + + return visualization.render(planeId, textureCache, canvas, width, height, normal, useTexture, x, y); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/FloorRasterizer.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/FloorRasterizer.ts new file mode 100644 index 0000000..cee0282 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/FloorRasterizer.ts @@ -0,0 +1,60 @@ +import { RenderTexture } from '@pixi/core'; +import { IAssetPlane, IVector3D } from '../../../../../../../api'; +import { PlaneTextureCache } from '../../../../../../../pixi-proxy'; +import { PlaneBitmapData } from '../../utils'; +import { FloorPlane } from './FloorPlane'; +import { PlaneRasterizer } from './PlaneRasterizer'; + +export class FloorRasterizer extends PlaneRasterizer +{ + protected initializePlanes(): void + { + if(!this.data) return; + + const floors = this.data.planes; + + if(floors && floors.length) this.parseFloors(floors); + } + + private parseFloors(k: IAssetPlane[]): void + { + if(!k) return; + + for(const floorIndex in k) + { + const floor = k[floorIndex]; + + if(!floor) continue; + + const id = floor.id; + const visualization = floor.visualizations; + const plane = new FloorPlane(); + + this.parseVisualizations(plane, visualization); + + if(!this.addPlane(id, plane)) plane.dispose(); + } + } + + public render(planeId: string, textureCache: PlaneTextureCache, canvas: RenderTexture, id: string, width: number, height: number, scale: number, normal: IVector3D, useTexture: boolean, offsetX: number = 0, offsetY: number = 0, maxX: number = 0, maxY: number = 0, timeSinceStartMs: number = 0): PlaneBitmapData + { + let plane = this.getPlane(id) as FloorPlane; + + if(!plane) plane = this.getPlane(PlaneRasterizer.DEFAULT) as FloorPlane; + + if(!plane) return null; + + if(canvas) textureCache.clearAndFillRenderTexture(canvas); + + let graphic = plane.render(planeId, textureCache, canvas, width, height, scale, normal, useTexture, offsetX, offsetY); + + if(graphic && (graphic !== canvas)) + { + graphic = new RenderTexture(graphic.baseTexture); + + if(!graphic) return null; + } + + return new PlaneBitmapData(graphic, -1); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/Plane.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/Plane.ts new file mode 100644 index 0000000..9524f06 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/Plane.ts @@ -0,0 +1,112 @@ +import { IRoomGeometry } from '../../../../../../../api'; +import { PlaneVisualization } from './PlaneVisualization'; +import { PlaneVisualizationLayer } from './PlaneVisualizationLayer'; + +export class Plane +{ + private _planeVisualizations: Map; + private _sizes: number[]; + private _lastPlaneVisualization: PlaneVisualization; + private _lastSize: number; + + constructor() + { + this._planeVisualizations = new Map(); + this._sizes = []; + this._lastPlaneVisualization = null; + this._lastSize = -1; + } + + public isStatic(size: number): boolean + { + return true; + } + + public dispose(): void + { + for(const visualization of this._planeVisualizations.values()) + { + if(!visualization) continue; + + visualization.dispose(); + } + + this._planeVisualizations = null; + this._lastPlaneVisualization = null; + this._sizes = null; + this._lastSize = -1; + } + + public clearCache(): void + { + for(const visualization of this._planeVisualizations.values()) + { + if(!visualization) continue; + + visualization.clearCache(); + } + } + + public createPlaneVisualization(size: number, totalLayers: number, geometry: IRoomGeometry): PlaneVisualization + { + const existing = this._planeVisualizations.get(size.toString()); + + if(existing) return null; + + const plane = new PlaneVisualization(size, totalLayers, geometry); + + this._planeVisualizations.set(size.toString(), plane); + + this._sizes.push(size); + this._sizes.sort(); + + return plane; + } + + private getSizeIndex(size: number): number + { + let sizeIndex = 0; + let i = 1; + + while(i < this._sizes.length) + { + if(this._sizes[i] > size) + { + if((this._sizes[i] - size) < (size - this._sizes[(i - 1)])) sizeIndex = i; + + break; + } + + sizeIndex = i; + + i++; + } + + return sizeIndex; + } + + public getPlaneVisualization(size: number): PlaneVisualization + { + if(size === this._lastSize) return this._lastPlaneVisualization; + + const sizeIndex = this.getSizeIndex(size); + + if(sizeIndex < this._sizes.length) + { + this._lastPlaneVisualization = this._planeVisualizations.get(this._sizes[sizeIndex].toString()); + } + else + { + this._lastPlaneVisualization = null; + } + + this._lastSize = size; + + return this._lastPlaneVisualization; + } + + public getLayers(): PlaneVisualizationLayer[] + { + return this.getPlaneVisualization(this._lastSize).getLayers(); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterial.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterial.ts new file mode 100644 index 0000000..7e20da1 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterial.ts @@ -0,0 +1,94 @@ +import { RenderTexture } from '@pixi/core'; +import { IVector3D } from '../../../../../../../api'; +import { PlaneTextureCache } from '../../../../../../../pixi-proxy'; +import { PlaneMaterialCellMatrix } from './PlaneMaterialCellMatrix'; + +export class PlaneMaterial +{ + public static MIN_NORMAL_COORDINATE_VALUE: number = -1; + public static MAX_NORMAL_COORDINATE_VALUE: number = 1; + + private _planeMaterialItems: PlaneMaterialCellMatrix[]; + private _isCached: boolean; + + constructor() + { + this._planeMaterialItems = []; + this._isCached = false; + } + + public dispose(): void + { + if(this._planeMaterialItems && this._planeMaterialItems.length) + { + for(const item of this._planeMaterialItems) + { + if(!item) continue; + + item.dispose(); + } + + this._planeMaterialItems = null; + } + + this._isCached = false; + } + + public clearCache(): void + { + if(!this._isCached) return; + + if(this._planeMaterialItems && this._planeMaterialItems.length) + { + for(const item of this._planeMaterialItems) + { + if(!item) continue; + + item.clearCache(); + } + } + + this._isCached = false; + } + + public addMaterialCellMatrix(totalColumns: number, repeatMode: number, align: number, normalMinX: number = -1, normalMaxX: number = 1, normalMinY: number = -1, normalMaxY: number = 1): PlaneMaterialCellMatrix + { + const cellMatrix = new PlaneMaterialCellMatrix(totalColumns, repeatMode, align, normalMinX, normalMaxX, normalMinY, normalMaxY); + + this._planeMaterialItems.push(cellMatrix); + + return cellMatrix; + } + + public getMaterialCellMatrix(normal: IVector3D): PlaneMaterialCellMatrix + { + if(!normal) return null; + + if(this._planeMaterialItems && this._planeMaterialItems.length) + { + for(const item of this._planeMaterialItems) + { + if(!item) continue; + + if((((normal.x >= item.normalMinX) && (normal.x <= item.normalMaxX)) && (normal.y >= item.normalMinY)) && (normal.y <= item.normalMaxY)) return item; + } + } + + return null; + } + + public render(planeId: string, textureCache: PlaneTextureCache, canvas: RenderTexture, width: number, height: number, normal: IVector3D, useTexture: boolean, offsetX: number, offsetY: number, topAlign: boolean): RenderTexture + { + if(width < 1) width = 1; + + if(height < 1) height = 1; + + const cellMatrix = this.getMaterialCellMatrix(normal); + + if(!cellMatrix) return null; + + this._isCached = true; + + return cellMatrix.render(planeId, textureCache, canvas, width, height, normal, useTexture, offsetX, offsetY, topAlign); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCell.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCell.ts new file mode 100644 index 0000000..b38be7b --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCell.ts @@ -0,0 +1,193 @@ +import { Matrix, Point } from '@pixi/math'; +import { Sprite } from '@pixi/sprite'; +import { TilingSprite } from '@pixi/sprite-tiling'; +import { IGraphicAsset, IVector3D } from '../../../../../../../api'; +import { Randomizer } from '../../utils'; +import { PlaneTexture } from './PlaneTexture'; + +export class PlaneMaterialCell +{ + private _texture: PlaneTexture; + private _extraItemOffsets: Point[]; + private _extraItemAssets: IGraphicAsset[]; + private _extraItemCount: number = 0; + + constructor(texture: PlaneTexture, assets: IGraphicAsset[] = null, offsetPoints: Point[] = null, limit: number = 0) + { + this._texture = texture; + this._extraItemOffsets = []; + this._extraItemAssets = []; + this._extraItemCount = 0; + + if(assets && assets.length && (limit > 0)) + { + let assetIndex = 0; + + while(assetIndex < assets.length) + { + const graphic = assets[assetIndex]; + + if(graphic) this._extraItemAssets.push(graphic); + + assetIndex++; + } + + if(this._extraItemAssets.length) + { + if(offsetPoints) + { + let pointIndex = 0; + + while(pointIndex < offsetPoints.length) + { + const point = offsetPoints[pointIndex]; + + if(point) this._extraItemOffsets.push(new Point(point.x, point.y)); + + pointIndex++; + } + } + + this._extraItemCount = limit; + } + } + } + + public get isStatic(): boolean + { + return this._extraItemCount === 0; + } + + public dispose(): void + { + if(this._texture) + { + this._texture.dispose(); + + this._texture = null; + } + + this._extraItemAssets = null; + this._extraItemOffsets = null; + this._extraItemCount = 0; + } + + public clearCache(): void + { + } + + public getHeight(normal: IVector3D): number + { + if(this._texture) + { + const texture = this._texture.getBitmap(normal); + + if(texture) return texture.height; + } + + return 0; + } + + public render(normal: IVector3D, textureOffsetX: number, textureOffsetY: number): Sprite + { + if(!this._texture) return null; + + const texture = this._texture.getBitmap(normal); + + if(!texture) return null; + + const bitmap = new TilingSprite(texture, texture.width, texture.height); + + if((textureOffsetX !== 0) || (textureOffsetY !== 0)) + { + while(textureOffsetX < 0) textureOffsetX += texture.width; + + while(textureOffsetY < 0) textureOffsetY += texture.height; + + bitmap.tilePosition.set((textureOffsetX % texture.width), (textureOffsetY % texture.height)); + + bitmap.uvRespectAnchor = true; + + if(textureOffsetX) + { + bitmap.anchor.x = 1; + bitmap.scale.x = -1; + } + + if(textureOffsetY) + { + bitmap.anchor.y = 1; + bitmap.scale.y = -1; + } + } + + if(!this.isStatic) + { + const limitMin = Math.min(this._extraItemCount, this._extraItemOffsets.length); + const limitMax = Math.max(this._extraItemCount, this._extraItemOffsets.length); + const offsetIndexes = Randomizer.getArray(this._extraItemCount, limitMax); + + let i = 0; + + while(i < limitMin) + { + const offset = this._extraItemOffsets[offsetIndexes[i]]; + const item = this._extraItemAssets[(i % this._extraItemAssets.length)]; + + if(offset && item) + { + const assetTexture = item.texture; + + if(assetTexture) + { + let itemOffsetX = item.offsetX; + let itemOffsetY = item.offsetY; + + let x = 1; + let y = 1; + let translateX = 0; + let translateY = 0; + + if(item.flipH) + { + x = -1; + translateX = assetTexture.width; + itemOffsetX = -(item.width + item.x); + } + + if(item.flipV) + { + y = -1; + translateY = assetTexture.height; + itemOffsetY = -(item.height + item.y); + } + + const offsetFinal = new Point((offset.x + itemOffsetX), (offset.y + itemOffsetY)); + const flipMatrix = new Matrix(); + + let offsetX = (offsetFinal.x + translateX); + offsetX = ((offsetX >> 1) << 1); + + flipMatrix.scale(x, y); + flipMatrix.translate(offsetX, (offsetFinal.y + translateY)); + + const sprite = new Sprite(assetTexture); + + sprite.transform.setFromMatrix(flipMatrix); + + bitmap.addChild(sprite); + } + } + + i++; + } + } + + return bitmap; + } + + public getAssetName(normal: IVector3D): string + { + return (this._texture == null) ? null : this._texture.getAssetName(normal); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellColumn.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellColumn.ts new file mode 100644 index 0000000..4c79e53 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellColumn.ts @@ -0,0 +1,457 @@ +import { RenderTexture } from '@pixi/core'; +import { IVector3D, Vector3d } from '../../../../../../../api'; +import { PlaneTextureCache, TextureUtils } from '../../../../../../../pixi-proxy'; +import { PlaneMaterialCell } from './PlaneMaterialCell'; + +export class PlaneMaterialCellColumn +{ + public static REPEAT_MODE_NONE: number = 0; + public static REPEAT_MODE_ALL: number = 1; + public static REPEAT_MODE_BORDERS: number = 2; + public static REPEAT_MODE_CENTER: number = 3; + public static REPEAT_MODE_FIRST: number = 4; + public static REPEAT_MODE_LAST: number = 5; + + private _cells: PlaneMaterialCell[]; + private _repeatMode: number; + private _width: number; + private _cachedBitmapData: RenderTexture; + private _cachedBitmapNormal: Vector3d; + private _cachedBitmapDataOffsetX: number; + private _cachedBitmapDataOffsetY: number; + private _isCached: boolean; + private _isStatic: boolean; + + constructor(width: number, cells: PlaneMaterialCell[], repeatMode: number = 1) + { + this._cells = []; + this._repeatMode = repeatMode; + this._width = (width < 1) ? 1 : width; + this._cachedBitmapData = null; + this._cachedBitmapNormal = null; + this._cachedBitmapDataOffsetX = 0; + this._cachedBitmapDataOffsetY = 0; + this._isCached = false; + this._isStatic = true; + + if(cells && cells.length) + { + let cellIndex = 0; + + while(cellIndex < cells.length) + { + const cell = cells[cellIndex]; + + if(cell) + { + this._cells.push(cell); + + if(!cell.isStatic) this._isStatic = false; + } + + cellIndex++; + } + } + } + + public get isStatic(): boolean + { + return this._isStatic; + } + + public isRepeated(): boolean + { + return !(this._repeatMode === PlaneMaterialCellColumn.REPEAT_MODE_NONE); + } + + public get width(): number + { + return this._width; + } + + public dispose(): void + { + if(this._cells && this._cells.length) + { + for(const cell of this._cells) + { + if(!cell) continue; + + cell.dispose(); + } + + this._cells = null; + } + + this._cachedBitmapData = null; + + if(this._cachedBitmapNormal) this._cachedBitmapNormal = null; + } + + public clearCache(): void + { + if(!this._isCached) return; + + if(this._cachedBitmapData) this._cachedBitmapData = null; + + if(this._cachedBitmapNormal) + { + this._cachedBitmapNormal.x = 0; + this._cachedBitmapNormal.y = 0; + this._cachedBitmapNormal.z = 0; + } + + if(this._cells && this._cells.length) + { + for(const cell of this._cells) + { + if(!cell) continue; + + cell.clearCache(); + } + } + + this._isCached = false; + } + + public render(planeId: string, textureCache: PlaneTextureCache, height: number, normal: IVector3D, offsetX: number, offsetY: number): RenderTexture + { + if(this._repeatMode === PlaneMaterialCellColumn.REPEAT_MODE_NONE) height = this.getCellsHeight(this._cells, normal); + + if(!this._cachedBitmapNormal) this._cachedBitmapNormal = new Vector3d(); + + if(this.isStatic) + { + if(this._cachedBitmapData) + { + if((this._cachedBitmapData.height === height) && Vector3d.isEqual(this._cachedBitmapNormal, normal) && (this._cachedBitmapDataOffsetX === offsetX) && (this._cachedBitmapDataOffsetY === offsetY)) + { + return this._cachedBitmapData; + } + else + { + this._cachedBitmapData = null; + } + } + } + else + { + this._cachedBitmapData = null; + } + + this._isCached = true; + + if(!this._cachedBitmapData) + { + this._cachedBitmapData = textureCache.createRenderTexture(this._width, height, `${ planeId }:column`); + } + + this._cachedBitmapNormal.assign(normal); + this._cachedBitmapDataOffsetX = offsetX; + this._cachedBitmapDataOffsetY = offsetY; + + if(!this._cells.length) return this._cachedBitmapData; + + switch(this._repeatMode) + { + case PlaneMaterialCellColumn.REPEAT_MODE_NONE: + this.renderRepeatNone(normal); + break; + case PlaneMaterialCellColumn.REPEAT_MODE_BORDERS: + this.renderRepeatBorders(normal); + break; + case PlaneMaterialCellColumn.REPEAT_MODE_CENTER: + this.renderRepeatCenter(normal); + break; + case PlaneMaterialCellColumn.REPEAT_MODE_FIRST: + this.renderRepeatFirst(normal); + break; + case PlaneMaterialCellColumn.REPEAT_MODE_LAST: + this.renderRepeatLast(normal); + break; + default: + this.renderRepeatAll(normal, offsetX, offsetY); + break; + } + + return this._cachedBitmapData; + } + + private getCellsHeight(cells: PlaneMaterialCell[], normal: IVector3D): number + { + if(!cells || !cells.length) return 0; + + let height = 0; + let cellIterator = 0; + + while(cellIterator < cells.length) + { + const cell = cells[cellIterator]; + + if(cell) height += cell.getHeight(normal); + + cellIterator++; + } + + return height; + } + + private renderCells(cells: PlaneMaterialCell[], index: number, flag: boolean, normal: IVector3D, offsetX: number = 0, offsetY: number = 0): number + { + if(((!cells || !cells.length) || !this._cachedBitmapData)) return index; + + let cellIndex = 0; + + while(cellIndex < cells.length) + { + let cell: PlaneMaterialCell = null; + + if(flag) + { + cell = cells[cellIndex]; + } + else + { + cell = cells[((cells.length - 1) - cellIndex)]; + } + + if(cell) + { + const graphic = cell.render(normal, offsetX, offsetY); + + if(graphic) + { + if(!flag) index -= graphic.height; + + graphic.y = index; + + TextureUtils.writeToRenderTexture(graphic, this._cachedBitmapData, false); + + if(flag) index = (index + graphic.height); + + if(((flag) && (index >= this._cachedBitmapData.height)) || ((!(flag)) && (index <= 0))) return index; + } + } + + cellIndex++; + } + + return index; + } + + private renderRepeatNone(normal: IVector3D): void + { + if(!this._cells.length || !this._cachedBitmapData) return; + + this.renderCells(this._cells, 0, true, normal); + } + + private renderRepeatAll(normal: IVector3D, offsetX: number, offsetY: number): void + { + if(!this._cells.length || !this._cachedBitmapData) return; + + let index = 0; + + while(index < this._cachedBitmapData.height) + { + index = this.renderCells(this._cells, index, true, normal, offsetX, offsetY); + + if(!index) return; + } + } + + private renderRepeatBorders(k:IVector3D): void + { + if(!this._cells.length || !this._cachedBitmapData) return; + + const _local_4: PlaneMaterialCell[] = []; + + let _local_5 = 0; + let _local_7 = 1; + + while(_local_7 < (this._cells.length - 1)) + { + const cell = (this._cells[_local_7] as PlaneMaterialCell); + + if(cell) + { + const height = cell.getHeight(k); + + if(height > 0) + { + _local_5 = (_local_5 + height); + + _local_4.push(cell); + } + } + + _local_7++; + } + + if(this._cells.length == 1) + { + const cell = this._cells[0]; + + if(cell) + { + const height = cell.getHeight(k); + + if(height > 0) + { + _local_5 = (_local_5 + height); + + _local_4.push(cell); + } + } + } + + let _local_8 = ((this._cachedBitmapData.height - _local_5) >> 1); + let index: number = this.renderCells(_local_4, _local_8, true, k); + + let cell = this._cells[0]; + + if(cell) + { + const cells = [cell]; + + while(_local_8 >= 0) _local_8 = this.renderCells(cells, _local_8, false, k); + } + + cell = this._cells[(this._cells.length - 1)]; + + if(cell) + { + const cells = [cell]; + + while(index < this._cachedBitmapData.height) index = this.renderCells(cells, index, true, k); + } + } + + private renderRepeatCenter(k:IVector3D): void + { + if(!this._cells.length || !this._cachedBitmapData) return; + + const _local_4: PlaneMaterialCell[] = []; + const _local_5: PlaneMaterialCell[] = []; + + let _local_6 = 0; + let _local_7 = 0; + + let _local_9 = 0; + + while(_local_9 < (this._cells.length >> 1)) + { + const cell = this._cells[_local_9]; + + if(cell) + { + const height = cell.getHeight(k); + + if(height > 0) + { + _local_6 = (_local_6 + height); + + _local_4.push(cell); + } + } + + _local_9++; + } + + _local_9 = ((this._cells.length >> 1) + 1); + + while(_local_9 < this._cells.length) + { + const cell = this._cells[_local_9]; + + if(cell) + { + const height = cell.getHeight(k); + + if(height > 0) + { + _local_7 = (_local_7 + height); + + _local_5.push(cell); + } + } + + _local_9++; + } + + let _local_10 = 0; + let _local_11: number; + let _local_12 = this._cachedBitmapData.height; + + if((_local_6 + _local_7) > this._cachedBitmapData.height) + { + _local_10 = ((_local_6 + _local_7) - this._cachedBitmapData.height); + _local_11 = (_local_11 - (_local_10 >> 1)); + _local_12 = (_local_12 + (_local_10 - (_local_10 >> 1))); + } + + if(_local_10 == 0) + { + const cell = this._cells[(this._cells.length >> 1)]; + + if(cell) + { + const height = cell.getHeight(k); + + if(height > 0) + { + const _local_13 = (this._cachedBitmapData.height - (_local_6 + _local_7)); + const _local_14 = (Math.ceil((_local_13 / height)) * height); + + let _local_11 = (_local_6 - ((_local_14 - _local_13) >> 1)); + + const _local_15 = (_local_11 + _local_14); + const _local_16 = [cell]; + + while(_local_11 < _local_15) _local_11 = this.renderCells(_local_16, _local_11, true, k); + } + } + } + + this.renderCells(_local_4, 0, true, k); + this.renderCells(_local_5, _local_12, false, k); + } + + private renderRepeatFirst(k:IVector3D): void + { + if(!this._cells.length || !this._cachedBitmapData) return; + + let index = this.renderCells(this._cells, this._cachedBitmapData.height, false, k); + + const cell = (this._cells[0] as PlaneMaterialCell); + + if(!cell) return; + + const cells = [ cell ]; + + while(index >= 0) index = this.renderCells(cells, index, false, k); + } + + private renderRepeatLast(normal: IVector3D): void + { + if(!this._cells.length || !this._cachedBitmapData) return; + + let index = this.renderCells(this._cells, 0, true, normal); + + const cell = (this._cells[(this._cells.length - 1)] as PlaneMaterialCell); + + if(!cell) return; + + const cells = [cell]; + + while(index < this._cachedBitmapData.height) + { + index = this.renderCells(cells, index, true, normal); + } + } + + public getCells(): PlaneMaterialCell[] + { + return this._cells; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellMatrix.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellMatrix.ts new file mode 100644 index 0000000..4d73032 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneMaterialCellMatrix.ts @@ -0,0 +1,654 @@ +import { RenderTexture } from '@pixi/core'; +import { Point, Rectangle } from '@pixi/math'; +import { Sprite } from '@pixi/sprite'; +import { IVector3D, NitroLogger, Vector3d } from '../../../../../../../api'; +import { PlaneTextureCache, TextureUtils } from '../../../../../../../pixi-proxy'; +import { Randomizer } from '../../utils'; +import { PlaneMaterialCell } from './PlaneMaterialCell'; +import { PlaneMaterialCellColumn } from './PlaneMaterialCellColumn'; + +export class PlaneMaterialCellMatrix +{ + public static REPEAT_MODE_ALL: number = 1; + public static REPEAT_MODE_BORDERS: number = 2; + public static REPEAT_MODE_CENTER: number = 3; + public static REPEAT_MODE_FIRST: number = 4; + public static REPEAT_MODE_LAST: number = 5; + public static REPEAT_MODE_RANDOM: number = 6; + public static REPEAT_MODE_DEFAULT: number = PlaneMaterialCellMatrix.REPEAT_MODE_ALL;//1 + public static MIN_NORMAL_COORDINATE_VALUE: number = -1; + public static MAX_NORMAL_COORDINATE_VALUE: number = 1; + public static ALIGN_TOP: number = 1; + public static ALIGN_BOTTOM: number = 2; + public static ALIGN_DEFAULT: number = PlaneMaterialCellMatrix.ALIGN_TOP;//1 + + private _columns: PlaneMaterialCellColumn[]; + private _repeatMode: number = 1; + private _align: number = 1; + private _cachedBitmapData: RenderTexture; + private _cachedBitmapNormal: Vector3d = null; + private _cachedBitmapHeight: number = 0; + private _isCached: boolean = false; + private _isStatic: boolean = true; + private _normalMinX: number = -1; + private _normalMaxX: number = 1; + private _normalMinY: number = -1; + private _normalMaxY: number = 1; + + constructor(totalColumns: number, repeatMode: number = 1, align: number = 1, normalMinX: number = -1, normalMaxX: number = 1, normalMinY: number = -1, normalMaxY: number = 1) + { + this._columns = []; + + if(totalColumns < 1) totalColumns = 1; + + let _local_8 = 0; + + while(_local_8 < totalColumns) + { + this._columns.push(null); + + _local_8++; + } + + this._repeatMode = repeatMode; + this._align = align; + this._normalMinX = normalMinX; + this._normalMaxX = normalMaxX; + this._normalMinY = normalMinY; + this._normalMaxY = normalMaxY; + + if(this._repeatMode === PlaneMaterialCellMatrix.REPEAT_MODE_RANDOM) this._isStatic = false; + } + + private static nextRandomColumnIndex(totalColumns: number): number + { + const _local_2 = Randomizer.getValues(1, 0, (totalColumns * 17631)); + + return _local_2[0] % totalColumns; + } + + public get normalMinX(): number + { + return this._normalMinX; + } + + public get normalMaxX(): number + { + return this._normalMaxX; + } + + public get normalMinY(): number + { + return this._normalMinY; + } + + public get normalMaxY(): number + { + return this._normalMaxY; + } + + public isBottomAligned(): boolean + { + return this._align === PlaneMaterialCellMatrix.ALIGN_BOTTOM; + } + + public get isStatic(): boolean + { + return this._isStatic; + } + + public dispose(): void + { + if(this._cachedBitmapNormal) this._cachedBitmapNormal = null; + } + + public clearCache(): void + { + if(!this._isCached) return; + + if(this._cachedBitmapNormal) + { + this._cachedBitmapNormal.x = 0; + this._cachedBitmapNormal.y = 0; + this._cachedBitmapNormal.z = 0; + } + + if(this._columns && this._columns.length) + { + for(const column of this._columns) + { + if(!column) continue; + + column.clearCache(); + } + } + + this._isCached = false; + } + + public createColumn(index: number, width: number, cells: PlaneMaterialCell[], repeatMode: number = 1): boolean + { + if((index < 0) || (index >= this._columns.length)) return false; + + const newColumn = new PlaneMaterialCellColumn(width, cells, repeatMode); + const oldColumn = this._columns[index]; + + if(oldColumn) oldColumn.dispose(); + + this._columns[index] = newColumn; + + if(newColumn && !newColumn.isStatic) this._isStatic = false; + + return true; + } + + public render(planeId: string, textureCache: PlaneTextureCache, canvas: RenderTexture, width: number, height: number, normal: IVector3D, useTexture: boolean, offsetX: number, offsetY: number, topAlign: boolean): RenderTexture + { + if(width < 1) width = 1; + + if(height < 1) height = 1; + + if(!this._cachedBitmapNormal) this._cachedBitmapNormal = new Vector3d(); + + if(this.isStatic) + { + if(this._cachedBitmapData) + { + if(this._cachedBitmapData.baseTexture && (this._cachedBitmapData.width === width) && (this._cachedBitmapData.height === height) && Vector3d.isEqual(this._cachedBitmapNormal, normal)) + { + if(canvas) + { + this.copyCachedBitmapOnCanvas(canvas, this._cachedBitmapHeight, offsetY, topAlign); + + return canvas; + } + + return this._cachedBitmapData; + } + + this._cachedBitmapData = null; + } + } + else + { + this._cachedBitmapData = null; + } + + this._isCached = true; + this._cachedBitmapNormal.assign(normal); + + if(!useTexture) + { + this._cachedBitmapHeight = height; + + if(!this._cachedBitmapData) + { + this._cachedBitmapData = textureCache.createAndFillRenderTexture(width, height, `${ planeId }:matrix`); + } + else + { + textureCache.clearAndFillRenderTexture(this._cachedBitmapData); + } + + + return this._cachedBitmapData; + } + + if(!this._cachedBitmapData) + { + this._cachedBitmapHeight = height; + + this._cachedBitmapData = textureCache.createRenderTexture(width, height, `${ planeId }:matrix`); + + textureCache.clearRenderTexture(this._cachedBitmapData); + } + + const columns: RenderTexture[] = []; + + let columnIndex = 0; + + while(columnIndex < this._columns.length) + { + const column = this._columns[columnIndex]; + + if(column) + { + const columnBitmapData = column.render(planeId, textureCache, height, normal, offsetX, offsetY); + + if(columnBitmapData) columns.push(columnBitmapData); + } + + columnIndex++; + } + + if(!columns.length) + { + if(canvas) return canvas; + + return this._cachedBitmapData; + } + + let maxColumnHeight = 0; + + switch(this._repeatMode) + { + case PlaneMaterialCellMatrix.REPEAT_MODE_BORDERS: + NitroLogger.log('REPEAT_MODE_BORDERS'); + // maxColumnHeight = this.renderRepeatBorders(this._cachedBitmapData, columns); + break; + case PlaneMaterialCellMatrix.REPEAT_MODE_CENTER: + NitroLogger.log('REPEAT_MODE_CENTER'); + // maxColumnHeight = this.renderRepeatCenter(this._cachedBitmapData, columns); + break; + case PlaneMaterialCellMatrix.REPEAT_MODE_FIRST: + NitroLogger.log('REPEAT_MODE_FIRST'); + // maxColumnHeight = this.renderRepeatFirst(this._cachedBitmapData, columns); + break; + case PlaneMaterialCellMatrix.REPEAT_MODE_LAST: + NitroLogger.log('REPEAT_MODE_LAST'); + // maxColumnHeight = this.renderRepeatLast(this._cachedBitmapData, columns); + break; + case PlaneMaterialCellMatrix.REPEAT_MODE_RANDOM: + maxColumnHeight = this.renderRepeatRandom(this._cachedBitmapData, columns); + break; + default: + maxColumnHeight = this.renderRepeatAll(this._cachedBitmapData, columns); + break; + } + + this._cachedBitmapHeight = maxColumnHeight; + + if(canvas) + { + this.copyCachedBitmapOnCanvas(canvas, maxColumnHeight, offsetY, topAlign); + + return canvas; + } + + return this._cachedBitmapData; + } + + private copyCachedBitmapOnCanvas(canvas: RenderTexture, height: number, offsetY: number, topAlign: boolean): void + { + if(!canvas || !this._cachedBitmapData || (canvas === this._cachedBitmapData)) return; + + if(!topAlign) offsetY = ((canvas.height - height) - offsetY); + + let bounds: Rectangle = null; + + if(this._align === PlaneMaterialCellMatrix.ALIGN_TOP) + { + bounds = new Rectangle(0, 0, this._cachedBitmapData.width, this._cachedBitmapHeight); + } + else + { + bounds = new Rectangle(0, (this._cachedBitmapData.height - this._cachedBitmapHeight), this._cachedBitmapData.width, this._cachedBitmapHeight); + } + + const texture = new RenderTexture(this._cachedBitmapData.baseTexture, bounds); + const sprite = new Sprite(texture); + + sprite.position.set(0, offsetY); + + TextureUtils.writeToRenderTexture(sprite, canvas, false); + } + + private getColumnsWidth(columns: RenderTexture[]): number + { + if(!columns || !columns.length) return 0; + + let width = 0; + + for(const texture of columns) + { + if(!texture) continue; + + width += texture.width; + } + + return width; + } + + private renderColumns(canvas: RenderTexture, columns: RenderTexture[], x: number, flag: boolean): Point + { + if(!canvas || !columns || !columns.length) return new Point(x, 0); + + let height = 0; + let i = 0; + + while(i < columns.length) + { + const column = flag ? columns[i] : columns[((columns.length - 1) - i)]; + + if(column) + { + if(!flag) x = (x - column.width); + + let y = 0; + + if(this._align == PlaneMaterialCellMatrix.ALIGN_BOTTOM) y = (canvas.height - column.height); + + const sprite = new Sprite(column); + + sprite.position.set(x, y); + + TextureUtils.writeToRenderTexture(sprite, canvas, false); + + if(column.height > height) height = column.height; + + if(flag) x = (x + column.width); + + if((flag && (x >= canvas.width)) || (!flag && (x <= 0))) return new Point(x, height); + } + + i++; + } + + return new Point(x, height); + } + + private renderRepeatAll(canvas: RenderTexture, columns: RenderTexture[]): number + { + if(!canvas || !columns || !columns.length) return 0; + + const totalWidth: number = this.getColumnsWidth(columns); + + let x = 0; + let y = 0; + + while(x < canvas.width) + { + const point = this.renderColumns(canvas, columns, x, true); + + x = point.x; + + if(point.y > y) y = point.y; + + if(!point.x) return y; + } + + return y; + } + + // private renderRepeatBorders(k:BitmapData, _arg_2:Array): number + // { + // if ((((_arg_2 == null) || (_arg_2.length == 0)) || (k == null))) + // { + // return 0; + // } + // var _local_3: number; + // var _local_4:BitmapData; + // var _local_5:Array = []; + // var _local_6: number; + // var _local_7: number; + // _local_7 = 1; + // while (_local_7 < (_arg_2.length - 1)) + // { + // _local_4 = (_arg_2[_local_7] as BitmapData); + // if (_local_4 != null) + // { + // _local_6 = (_local_6 + _local_4.width); + // _local_5.push(_local_4); + // } + // _local_7++; + // } + // if (this._columns.length == 1) + // { + // _local_4 = (this._columns[0] as BitmapData); + // if (_local_4 != null) + // { + // _local_6 = _local_4.width; + // _local_5.push(_local_4); + // } + // } + // var _local_8:* = ((k.width - _local_6) >> 1); + // var _local_9:Point; + // _local_9 = this.renderColumns(k, _local_5, _local_8, true); + // var _local_10: number = _local_9.x; + // if (_local_9.y > _local_3) + // { + // _local_3 = _local_9.y; + // } + // _local_4 = (_arg_2[0] as BitmapData); + // if (_local_4 != null) + // { + // _local_5 = [_local_4]; + // while (_local_8 >= 0) + // { + // _local_9 = this.renderColumns(k, _local_5, _local_8, false); + // _local_8 = _local_9.x; + // if (_local_9.y > _local_3) + // { + // _local_3 = _local_9.y; + // } + // } + // } + // _local_4 = (_arg_2[(_arg_2.length - 1)] as BitmapData); + // if (_local_4 != null) + // { + // _local_5 = [_local_4]; + // while (_local_10 < k.height) + // { + // _local_9 = this.renderColumns(k, _local_5, _local_10, true); + // _local_10 = _local_9.x; + // if (_local_9.y > _local_3) + // { + // _local_3 = _local_9.y; + // } + // } + // } + // return _local_3; + // } + + // private renderRepeatCenter(k:BitmapData, _arg_2:Array): number + // { + // var _local_14: number; + // var _local_15: number; + // var _local_16: number; + // var _local_17: number; + // var _local_18:Array; + // if ((((_arg_2 == null) || (_arg_2.length == 0)) || (k == null))) + // { + // return 0; + // } + // var _local_3: number; + // var _local_4:BitmapData; + // var _local_5:Array = []; + // var _local_6:Array = []; + // var _local_7: number; + // var _local_8: number; + // var _local_9: number; + // _local_9 = 0; + // while (_local_9 < (_arg_2.length >> 1)) + // { + // _local_4 = (_arg_2[_local_9] as BitmapData); + // if (_local_4 != null) + // { + // _local_7 = (_local_7 + _local_4.width); + // _local_5.push(_local_4); + // } + // _local_9++; + // } + // _local_9 = ((_arg_2.length >> 1) + 1); + // while (_local_9 < _arg_2.length) + // { + // _local_4 = (_arg_2[_local_9] as BitmapData); + // if (_local_4 != null) + // { + // _local_8 = (_local_8 + _local_4.width); + // _local_6.push(_local_4); + // } + // _local_9++; + // } + // var _local_10:Point; + // var _local_11: number; + // var _local_12: number; + // var _local_13: number = k.width; + // if ((_local_7 + _local_8) > k.width) + // { + // _local_11 = ((_local_7 + _local_8) - k.width); + // _local_12 = (_local_12 - (_local_11 >> 1)); + // _local_13 = (_local_13 + (_local_11 - (_local_11 >> 1))); + // } + // if (_local_11 == 0) + // { + // _local_4 = (_arg_2[(_arg_2.length >> 1)] as BitmapData); + // if (_local_4 != null) + // { + // _local_14 = _local_4.width; + // _local_15 = (k.width - (_local_7 + _local_8)); + // _local_16 = (Math.ceil((_local_15 / _local_14)) * _local_14); + // _local_12 = (_local_7 - ((_local_16 - _local_15) >> 1)); + // _local_17 = (_local_12 + _local_16); + // _local_18 = [_local_4]; + // while (_local_12 < _local_17) + // { + // _local_10 = this.renderColumns(k, _local_18, _local_12, true); + // _local_12 = _local_10.x; + // if (_local_10.y > _local_3) + // { + // _local_3 = _local_10.y; + // } + // } + // } + // } + // _local_12 = 0; + // _local_10 = this.renderColumns(k, _local_5, _local_12, true); + // if (_local_10.y > _local_3) + // { + // _local_3 = _local_10.y; + // } + // _local_10 = this.renderColumns(k, _local_6, _local_13, false); + // if (_local_10.y > _local_3) + // { + // _local_3 = _local_10.y; + // } + // return _local_3; + // } + + // private renderRepeatFirst(k:BitmapData, _arg_2:Array): number + // { + // var _local_7:Array; + // if ((((_arg_2 == null) || (_arg_2.length == 0)) || (k == null))) + // { + // return 0; + // } + // var _local_3: number; + // var _local_4:BitmapData; + // var _local_5: number = k.width; + // var _local_6:Point = this.renderColumns(k, _arg_2, _local_5, false); + // _local_5 = _local_6.x; + // if (_local_6.y > _local_3) + // { + // _local_3 = _local_6.y; + // } + // _local_4 = (_arg_2[0] as BitmapData); + // if (_local_4 != null) + // { + // _local_7 = [_local_4]; + // while (_local_5 >= 0) + // { + // _local_6 = this.renderColumns(k, _local_7, _local_5, false); + // _local_5 = _local_6.x; + // if (_local_6.y > _local_3) + // { + // _local_3 = _local_6.y; + // } + // } + // } + // return _local_3; + // } + + // private renderRepeatLast(k:BitmapData, _arg_2:Array): number + // { + // var _local_7:Array; + // if ((((_arg_2 == null) || (_arg_2.length == 0)) || (k == null))) + // { + // return 0; + // } + // var _local_3: number; + // var _local_4:BitmapData; + // var _local_5: number; + // var _local_6:Point = this.renderColumns(k, _arg_2, _local_5, true); + // _local_5 = _local_6.x; + // if (_local_6.y > _local_3) + // { + // _local_3 = _local_6.y; + // } + // _local_4 = (_arg_2[(_arg_2.length - 1)] as BitmapData); + // if (_local_4 != null) + // { + // _local_7 = [_local_4]; + // while (_local_5 < k.width) + // { + // _local_6 = this.renderColumns(k, _local_7, _local_5, true); + // _local_5 = _local_6.x; + // if (_local_6.y > _local_3) + // { + // _local_3 = _local_6.y; + // } + // } + // } + // return _local_3; + // } + + private renderRepeatRandom(canvas: RenderTexture, columns: RenderTexture[]): number + { + if(!canvas || !columns || !columns.length) return 0; + + let height = 0; + let width = 0; + + while(width < canvas.width) + { + const column = columns[PlaneMaterialCellMatrix.nextRandomColumnIndex(columns.length)]; + + if(column != null) + { + const point = this.renderColumns(canvas, [ column ], width, true); + + width = point.x; + + if(point.y > height) + { + height = point.y; + } + } + else + { + return height; + + } + } + + return height; + } + + public getColumns(width: number): PlaneMaterialCellColumn[] + { + if(this._repeatMode === PlaneMaterialCellMatrix.REPEAT_MODE_RANDOM) + { + const columns: PlaneMaterialCellColumn[] = []; + + let columnIndex = 0; + + while(columnIndex < width) + { + const column = this._columns[PlaneMaterialCellMatrix.nextRandomColumnIndex(this._columns.length)]; + + if(column) + { + columns.push(column); + + if(column.width > 1) columnIndex += column.width; + else break; + } + else break; + } + + return columns; + } + + return this._columns; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneRasterizer.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneRasterizer.ts new file mode 100644 index 0000000..ea213c5 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneRasterizer.ts @@ -0,0 +1,606 @@ +import { RenderTexture, Resource, Texture } from '@pixi/core'; +import { Point } from '@pixi/math'; +import { IAssetPlaneMaterial, IAssetPlaneMaterialCellColumn, IAssetPlaneTexture, IAssetPlaneVisualization, IAssetPlaneVisualizationData, IAssetPlaneVisualizationLayer, IGraphicAsset, IGraphicAssetCollection, IRoomGeometry, IVector3D, Vector3d } from '../../../../../../../api'; +import { PlaneTextureCache } from '../../../../../../../pixi-proxy'; +import { Rasterizer, RoomGeometry } from '../../../../../../../room'; +import { PlaneBitmapData } from '../../utils'; +import { IPlaneRasterizer } from '../IPlaneRasterizer'; +import { FloorPlane } from './FloorPlane'; +import { Plane } from './Plane'; +import { PlaneMaterial } from './PlaneMaterial'; +import { PlaneMaterialCell } from './PlaneMaterialCell'; +import { PlaneMaterialCellColumn } from './PlaneMaterialCellColumn'; +import { PlaneMaterialCellMatrix } from './PlaneMaterialCellMatrix'; +import { PlaneTexture } from './PlaneTexture'; +import { PlaneVisualizationLayer } from './PlaneVisualizationLayer'; + +export class PlaneRasterizer implements IPlaneRasterizer +{ + protected static DEFAULT: string = 'default'; + + private _assetCollection: IGraphicAssetCollection; + private _materials: Map; + private _textures: Map; + private _planes: Map; + private _geometries: Map; + private _data: IAssetPlaneVisualizationData; + + constructor() + { + this._assetCollection = null; + this._textures = new Map(); + this._materials = new Map(); + this._planes = new Map(); + this._geometries = new Map(); + this._data = null; + } + + protected get data(): IAssetPlaneVisualizationData + { + return this._data; + } + + protected get assetCollection(): IGraphicAssetCollection + { + return this._assetCollection; + } + + public initializeDimensions(k: number, _arg_2: number): boolean + { + return true; + } + + public dispose(): void + { + if(this._planes) + { + for(const plane of this._planes.values()) + { + if(!plane) continue; + + plane.dispose(); + } + + this._planes = null; + } + + if(this._materials) + { + this.resetMaterials(); + + this._materials = null; + } + + if(this._textures) + { + this.resetTextures(); + + this._textures = null; + } + + if(this._geometries) + { + for(const geometry of this._geometries.values()) + { + if(!geometry) continue; + + geometry.dispose(); + } + + this._geometries = null; + } + + this._data = null; + this._assetCollection = null; + } + + public clearCache(): void + { + for(const plane of this._planes.values()) + { + if(!plane) continue; + + plane.clearCache(); + } + + for(const material of this._materials.values()) + { + if(!material) continue; + + material.clearCache(); + } + } + + public initialize(data: IAssetPlaneVisualizationData): void + { + this._data = data; + } + + public reinitialize(): void + { + this.resetTextures(); + this.resetMaterials(); + this.initializeAll(); + } + + private resetMaterials(): void + { + for(const material of this._materials.values()) + { + if(!material) continue; + + material.dispose(); + } + + this._materials.clear(); + } + + private resetTextures(): void + { + for(const texture of this._textures.values()) + { + if(!texture) continue; + + texture.dispose(); + } + + this._textures.clear(); + } + + protected getTexture(textureId: string): PlaneTexture + { + return this._textures.get(textureId); + } + + protected getMaterial(materialId: string): PlaneMaterial + { + return this._materials.get(materialId); + } + + protected getPlane(planeId: string): Plane + { + return this._planes.get(planeId); + } + + protected addPlane(id: string, plane: Plane): boolean + { + if(!plane) return false; + + const existing = this._planes.get(id); + + if(!existing) + { + this._planes.set(id, plane); + + return true; + } + + return false; + } + + public initializeAssetCollection(collection: IGraphicAssetCollection): void + { + if(!this._data) return; + + this._assetCollection = collection; + + this.initializeAll(); + } + + private initializeAll(): void + { + if(!this._data) return; + + this.initializeTexturesAndMaterials(); + + this.initializePlanes(); + } + + private initializeTexturesAndMaterials(): void + { + if(this._data.textures && this._data.textures.length) this.parseTextures(this._data.textures, this.assetCollection); + if(this._data.materials && this._data.materials.length) this.parsePlaneMaterials(this._data.materials); + } + + protected initializePlanes(): void + { + } + + private parseTextures(textures: IAssetPlaneTexture[], collection: IGraphicAssetCollection): void + { + if(!textures || !collection) return; + + if(textures.length) + { + for(const texture of textures) + { + if(!texture) continue; + + const id = texture.id; + + if(!this._textures.get(id)) + { + const plane = new PlaneTexture(); + + if(texture.bitmaps && texture.bitmaps.length) + { + for(const bitmap of texture.bitmaps) + { + if(!bitmap) continue; + + const assetName = bitmap.assetName; + + let normalMinX = PlaneTexture.MIN_NORMAL_COORDINATE_VALUE; + let normalMaxX = PlaneTexture.MAX_NORMAL_COORDINATE_VALUE; + let normalMinY = PlaneTexture.MIN_NORMAL_COORDINATE_VALUE; + let normalMaxY = PlaneTexture.MAX_NORMAL_COORDINATE_VALUE; + + if(bitmap.normalMinX !== undefined) normalMinX = bitmap.normalMinX; + if(bitmap.normalMaxX !== undefined) normalMaxX = bitmap.normalMaxX; + if(bitmap.normalMinY !== undefined) normalMinY = bitmap.normalMinY; + if(bitmap.normalMaxY !== undefined) normalMaxY = bitmap.normalMaxY; + + const asset = collection.getAsset(assetName); + + if(asset) + { + const texture = asset.texture; + + if(texture) + { + let newTexture: Texture = texture; + + if(asset.flipH) + { + newTexture = Rasterizer.getFlipHBitmapData(texture); + } + else + { + newTexture = newTexture.clone(); + } + + plane.addBitmap(newTexture, normalMinX, normalMaxX, normalMinY, normalMaxY, assetName); + } + } + } + } + + this._textures.set(id, plane); + } + } + } + } + + private parsePlaneMaterials(materials: IAssetPlaneMaterial[]): void + { + if(!materials || !materials.length) return; + + for(const material of materials) + { + if(!material) continue; + + const id = material.id; + const newMaterial = new PlaneMaterial(); + + if(material.matrices && material.matrices.length) + { + for(const matrix of material.matrices) + { + if(!matrix) continue; + + let repeatMode = PlaneMaterialCellMatrix.REPEAT_MODE_DEFAULT; + let align = PlaneMaterialCellMatrix.ALIGN_DEFAULT; + + let normalMinX = PlaneMaterialCellMatrix.MIN_NORMAL_COORDINATE_VALUE; + let normalMaxX = PlaneMaterialCellMatrix.MAX_NORMAL_COORDINATE_VALUE; + let normalMinY = PlaneMaterialCellMatrix.MIN_NORMAL_COORDINATE_VALUE; + let normalMaxY = PlaneMaterialCellMatrix.MAX_NORMAL_COORDINATE_VALUE; + + if(matrix.normalMinX !== undefined) normalMinX = matrix.normalMinX; + if(matrix.normalMaxX !== undefined) normalMaxX = matrix.normalMaxX; + if(matrix.normalMinY !== undefined) normalMinY = matrix.normalMinY; + if(matrix.normalMaxY !== undefined) normalMaxY = matrix.normalMaxY; + + switch(matrix.repeatMode) + { + case 'borders': + repeatMode = PlaneMaterialCellMatrix.REPEAT_MODE_BORDERS; + break; + case 'center': + repeatMode = PlaneMaterialCellMatrix.REPEAT_MODE_CENTER; + break; + case 'first': + repeatMode = PlaneMaterialCellMatrix.REPEAT_MODE_FIRST; + break; + case 'last': + repeatMode = PlaneMaterialCellMatrix.REPEAT_MODE_LAST; + break; + case 'random': + repeatMode = PlaneMaterialCellMatrix.REPEAT_MODE_RANDOM; + break; + default: + repeatMode = PlaneMaterialCellMatrix.REPEAT_MODE_DEFAULT; + break; + } + + switch(matrix.align) + { + case 'top': + align = PlaneMaterialCellMatrix.ALIGN_TOP; + break; + case 'bottom': + align = PlaneMaterialCellMatrix.ALIGN_BOTTOM; + break; + default: + align = PlaneMaterialCellMatrix.ALIGN_DEFAULT; + break; + } + + if(matrix.columns && matrix.columns.length) + { + const cellMatrix = newMaterial.addMaterialCellMatrix(matrix.columns.length, repeatMode, align, normalMinX, normalMaxX, normalMinY, normalMaxY); + + let index = 0; + + while(index < matrix.columns.length) + { + const column = matrix.columns[index]; + + if(column) this.parsePlaneMaterialCellColumn(column, cellMatrix, index); + + index++; + } + } + } + } + + this._materials.set(id, newMaterial); + } + } + + private parsePlaneMaterialCellColumn(column: IAssetPlaneMaterialCellColumn, cellMatrix: PlaneMaterialCellMatrix, index: number): void + { + if(!column || !cellMatrix) return; + + let repeatMode = PlaneMaterialCellColumn.REPEAT_MODE_ALL; + + const width = column.width; + + const cells = this.parsePlaneMaterialCells(column); + + switch(column.repeatMode) + { + case 'borders': + repeatMode = PlaneMaterialCellColumn.REPEAT_MODE_BORDERS; + break; + case 'center': + repeatMode = PlaneMaterialCellColumn.REPEAT_MODE_CENTER; + break; + case 'first': + repeatMode = PlaneMaterialCellColumn.REPEAT_MODE_FIRST; + break; + case 'last': + repeatMode = PlaneMaterialCellColumn.REPEAT_MODE_LAST; + break; + case 'none': + repeatMode = PlaneMaterialCellColumn.REPEAT_MODE_NONE; + break; + default: + repeatMode = PlaneMaterialCellColumn.REPEAT_MODE_ALL; + break; + } + + cellMatrix.createColumn(index, width, cells, repeatMode); + } + + private parsePlaneMaterialCells(column: IAssetPlaneMaterialCellColumn): PlaneMaterialCell[] + { + if(!column || !column.cells || !column.cells.length) return null; + + const cells: PlaneMaterialCell[] = []; + + let index = 0; + + while(index < column.cells.length) + { + const cell = column.cells[index]; + + if(cell) + { + const textureId = cell.textureId; + + let assetNames: string[] = null; + let offsetPoints: Point[] = null; + let graphics: IGraphicAsset[] = null; + let limit = 0; + + if(cell.extraData) + { + const types = cell.extraData.extraItemTypes; + const offsets = cell.extraData.offsets; + + if(types && offsets) + { + if(types.length && offsets.length) + { + assetNames = this.parseExtraItemTypes(types); + offsetPoints = this.parseExtraItemOffsets(offsets); + limit = offsetPoints.length; + + if(cell.extraData.limitMax !== undefined) limit = cell.extraData.limitMax; + } + } + } + + if(assetNames && assetNames.length) + { + graphics = []; + + for(const assetName of assetNames) + { + if(!assetName) continue; + + const asset = this._assetCollection.getAsset(assetName); + + if(!asset) continue; + + graphics.push(asset); + } + } + + const texture = this.getTexture(textureId); + const newCell = new PlaneMaterialCell(texture, graphics, offsetPoints, limit); + + cells.push(newCell); + } + + index++; + } + + if(!cells || !cells.length) return null; + + return cells; + } + + private parseExtraItemTypes(k: string[]): string[] + { + const assetNames: string[] = []; + + if(k && k.length) + { + let index = 0; + + while(index < k.length) + { + const type = k[index]; + + if(type) assetNames.push(type); + + index++; + } + } + + return assetNames; + } + + private parseExtraItemOffsets(k: [ number, number][]): Point[] + { + const offsets: Point[] = []; + + if(k && k.length) + { + let index = 0; + + while(index < k.length) + { + const [ x, y ] = k[index]; + + offsets.push(new Point(x, y)); + + index++; + } + } + + return offsets; + } + + protected getGeometry(size: number, horizontalAngle: number, verticalAngle: number): IRoomGeometry + { + horizontalAngle = Math.abs(horizontalAngle); + if(horizontalAngle > 90) horizontalAngle = 90; + + verticalAngle = Math.abs(verticalAngle); + if(verticalAngle > 90) verticalAngle = 90; + + const identifier = `${size}_${Math.round(horizontalAngle)}_${Math.round(verticalAngle)}`; + + let geometry = this._geometries.get(identifier); + + if(geometry) return geometry; + + geometry = new RoomGeometry(size, new Vector3d(horizontalAngle, verticalAngle), new Vector3d(-10, 0, 0)); + + this._geometries.set(identifier, geometry); + + return geometry; + } + + protected parseVisualizations(plane: Plane, visualizations: IAssetPlaneVisualization[]): void + { + if(!plane || !visualizations) return; + + if(visualizations && visualizations.length) + { + for(const visualization of visualizations) + { + if(!visualization) continue; + + const size = visualization.size; + + let horizontalAngle = FloorPlane.HORIZONTAL_ANGLE_DEFAULT; + let verticalAngle = FloorPlane.VERTICAL_ANGLE_DEFAULT; + + if(visualization.horizontalAngle !== undefined) horizontalAngle = visualization.horizontalAngle; + if(visualization.verticalAngle !== undefined) verticalAngle = visualization.verticalAngle; + + const layers = visualization.allLayers as IAssetPlaneVisualizationLayer[]; + + const planeVisualization = plane.createPlaneVisualization(size, ((layers && layers.length) || 0), this.getGeometry(size, horizontalAngle, verticalAngle)); + + if(planeVisualization && (layers && layers.length)) + { + let layerId = 0; + + while(layerId < layers.length) + { + const layer = layers[layerId]; + + if(layer) + { + let material: PlaneMaterial = null; + let align: number = PlaneVisualizationLayer.ALIGN_DEFAULT; + let color: number = FloorPlane.DEFAULT_COLOR; + let offset: number = PlaneVisualizationLayer.DEFAULT_OFFSET; + + if(layer.materialId) material = this.getMaterial(layer.materialId); + + if(layer.color) color = layer.color; + + if(layer.offset) offset = layer.offset; + + if(layer.align) + { + if(layer.align === 'bottom') align = PlaneVisualizationLayer.ALIGN_BOTTOM; + + else if(layer.align == 'top') align = PlaneVisualizationLayer.ALIGN_TOP; + } + + planeVisualization.setLayer(layerId, material, color, align, offset); + } + + layerId++; + } + } + } + } + } + + public render(planeId: string, textureCache: PlaneTextureCache, canvas: RenderTexture, id: string, width: number, height: number, size: number, normal: IVector3D, useTexture: boolean, offsetX: number = 0, offsetY: number = 0, maxX: number = 0, maxY: number = 0, timeSinceStartMs: number = 0): PlaneBitmapData + { + return null; + } + + public getTextureIdentifier(k: number, normal: IVector3D): string + { + return k.toString(); + } + + public getLayers(id: string): PlaneVisualizationLayer[] + { + let planes = this.getPlane(id); + + if(!planes) planes = this.getPlane(PlaneRasterizer.DEFAULT); + + return planes.getLayers(); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneTexture.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneTexture.ts new file mode 100644 index 0000000..d89fe1e --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneTexture.ts @@ -0,0 +1,66 @@ +import { Resource, Texture } from '@pixi/core'; +import { IVector3D } from '../../../../../../../api'; +import { PlaneTextureBitmap } from './PlaneTextureBitmap'; + +export class PlaneTexture +{ + public static MIN_NORMAL_COORDINATE_VALUE: number = -1; + public static MAX_NORMAL_COORDINATE_VALUE: number = 1; + + private _bitmaps: PlaneTextureBitmap[]; + + constructor() + { + this._bitmaps = []; + } + + public dispose(): void + { + if(this._bitmaps) + { + for(const bitmap of this._bitmaps) + { + if(!bitmap) continue; + + bitmap.dispose(); + } + + this._bitmaps = null; + } + } + + public addBitmap(bitmap: Texture, normalMinX: number = -1, normalMaxX: number = 1, normalMinY: number = -1, normalMaxY: number = 1, assetName: string = null): void + { + this._bitmaps.push(new PlaneTextureBitmap(bitmap, normalMinX, normalMaxX, normalMinY, normalMaxY, assetName)); + } + + public getBitmap(k: IVector3D): Texture + { + const _local_2 = this.getPlaneTextureBitmap(k); + + if(!_local_2) return null; + + return _local_2.bitmap; + } + + public getPlaneTextureBitmap(k: IVector3D): PlaneTextureBitmap + { + if(!k) return null; + + for(const bitmap of this._bitmaps) + { + if(!bitmap) continue; + + if((((k.x >= bitmap.normalMinX) && (k.x <= bitmap.normalMaxX)) && (k.y >= bitmap.normalMinY)) && (k.y <= bitmap.normalMaxY)) return bitmap; + } + + return null; + } + + public getAssetName(k: IVector3D): string + { + const _local_2 = this.getPlaneTextureBitmap(k); + + return (!_local_2) ? null : _local_2.assetName; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneTextureBitmap.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneTextureBitmap.ts new file mode 100644 index 0000000..d49d1f2 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneTextureBitmap.ts @@ -0,0 +1,59 @@ +import { Resource, Texture } from '@pixi/core'; + +export class PlaneTextureBitmap +{ + public static MIN_NORMAL_COORDINATE_VALUE: number = -1; + public static MAX_NORMAL_COORDINATE_VALUE: number = 1; + + private _bitmap: Texture; + private _normalMinX: number; + private _normalMaxX: number; + private _normalMinY: number; + private _normalMaxY: number; + private _assetName: string; + + constructor(bitmap: Texture, normalMinX: number = -1, normalMaxX: number = 1, normalMinY: number = -1, normalMaxY: number = 1, assetName: string = null) + { + this._bitmap = bitmap; + this._normalMinX = normalMinX; + this._normalMaxX = normalMaxX; + this._normalMinY = normalMinY; + this._normalMaxY = normalMaxY; + this._assetName = assetName; + } + + public get bitmap(): Texture + { + return this._bitmap; + } + + public get normalMinX(): number + { + return this._normalMinX; + } + + public get normalMaxX(): number + { + return this._normalMaxX; + } + + public get normalMinY(): number + { + return this._normalMinY; + } + + public get normalMaxY(): number + { + return this._normalMaxY; + } + + public get assetName(): string + { + return this._assetName; + } + + public dispose(): void + { + this._bitmap = null; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualization.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualization.ts new file mode 100644 index 0000000..7a5ef68 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualization.ts @@ -0,0 +1,159 @@ +import { RenderTexture } from '@pixi/core'; +import { IDisposable, IGraphicAssetCollection, IRoomGeometry, IVector3D, Vector3d } from '../../../../../../../api'; +import { PlaneTextureCache } from '../../../../../../../pixi-proxy'; +import { PlaneVisualizationAnimationLayer } from '../animated'; +import { PlaneMaterial } from './PlaneMaterial'; +import { PlaneVisualizationLayer } from './PlaneVisualizationLayer'; + +export class PlaneVisualization +{ + private _layers: IDisposable[]; + private _geometry: IRoomGeometry; + private _cachedBitmapNormal: Vector3d; + private _isCached: boolean; + private _hasAnimationLayers: boolean; + + constructor(size: number, totalLayers: number, geometry: IRoomGeometry) + { + this._layers = []; + this._geometry = geometry; + this._cachedBitmapNormal = new Vector3d(); + this._isCached = false; + this._hasAnimationLayers = false; + + if(totalLayers < 0) totalLayers = 0; + + let index = 0; + + while(index < totalLayers) + { + this._layers.push(null); + + index++; + } + } + + public get geometry(): IRoomGeometry + { + return this._geometry; + } + + public get hasAnimationLayers(): boolean + { + return this._hasAnimationLayers; + } + + public dispose(): void + { + if(this._layers && this._layers.length) + { + for(const layer of this._layers) + { + if(!layer) continue; + + layer.dispose(); + } + + this._layers = null; + } + + this._geometry = null; + + if(this._cachedBitmapNormal) this._cachedBitmapNormal = null; + } + + public clearCache(): void + { + if(!this._isCached) return; + + if(this._cachedBitmapNormal) + { + this._cachedBitmapNormal.assign(new Vector3d()); + } + + if(this._layers && this._layers.length) + { + for(const layer of this._layers) + { + if(!layer) continue; + + const planeLayer = layer as PlaneVisualizationLayer; + + planeLayer.clearCache(); + } + } + + this._isCached = false; + } + + public setLayer(layerId: number, material: PlaneMaterial, color: number, align: number, offset: number = 0): boolean + { + if((layerId < 0) || (layerId > this._layers.length)) return false; + + let layer = this._layers[layerId]; + + if(layer) layer.dispose(); + + layer = new PlaneVisualizationLayer(material, color, align, offset); + + this._layers[layerId] = layer; + + return true; + } + + public setAnimationLayer(layerId: number, animationItems: any, collection: IGraphicAssetCollection): boolean + { + if((layerId < 0) || (layerId > this._layers.length)) return false; + + let layer = this._layers[layerId] as IDisposable; + + if(layer) layer.dispose(); + + layer = new PlaneVisualizationAnimationLayer(animationItems, collection); + + this._layers[layerId] = layer; + this._hasAnimationLayers = true; + + return true; + } + + public getLayers(): PlaneVisualizationLayer[] + { + return this._layers as PlaneVisualizationLayer[]; + } + + public render(planeId: string, textureCache: PlaneTextureCache, canvas: RenderTexture, width: number, height: number, normal: IVector3D, useTexture: boolean, offsetX: number = 0, offsetY: number = 0, maxX: number = 0, maxY: number = 0, dimensionX: number = 0, dimensionY: number = 0, timeSinceStartMs: number = 0): RenderTexture + { + if(width < 1) width = 1; + + if(height < 1) height = 1; + + if((!canvas || (canvas.width !== width)) || (canvas.height !== height)) canvas = null; + + this._isCached = true; + + const bitmap = textureCache.createAndFillRenderTexture(width, height, planeId); + + this._cachedBitmapNormal.assign(normal); + + if(this._layers && this._layers.length) + { + for(const layer of this._layers) + { + if(!layer) continue; + + if(layer instanceof PlaneVisualizationLayer) + { + layer.render(`${ planeId }:${ this._layers.indexOf(layer) }`, textureCache, bitmap, width, height, normal, useTexture, offsetX, offsetY); + } + + else if(layer instanceof PlaneVisualizationAnimationLayer) + { + layer.render(textureCache, bitmap, width, height, normal, offsetX, offsetY, maxX, maxY, dimensionX, dimensionY, timeSinceStartMs); + } + } + } + + return bitmap; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualizationLayer.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualizationLayer.ts new file mode 100644 index 0000000..45e8588 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/PlaneVisualizationLayer.ts @@ -0,0 +1,95 @@ +import { RenderTexture } from '@pixi/core'; +import { Sprite } from '@pixi/sprite'; +import { IVector3D } from '../../../../../../../api'; +import { PlaneTextureCache } from '../../../../../../../pixi-proxy'; +import { PlaneMaterial } from './PlaneMaterial'; + +export class PlaneVisualizationLayer +{ + public static DEFAULT_OFFSET: number = 0; + public static ALIGN_TOP: number = 1; + public static ALIGN_BOTTOM: number = 2; + public static ALIGN_DEFAULT: number = PlaneVisualizationLayer.ALIGN_TOP; + + private _material: PlaneMaterial; + private _color: number; + private _offset: number; + private _align: number; + private _isDisposed: boolean; + + constructor(material: PlaneMaterial, color: number, align: number, offset: number = 0) + { + this._material = material; + this._offset = offset; + this._align = align; + this._color = color; + this._isDisposed = false; + } + + public get offset(): number + { + return this._offset; + } + + public get align(): number + { + return this._align; + } + + public get disposed(): boolean + { + return this._isDisposed; + } + + public dispose(): void + { + this._isDisposed = true; + this._material = null; + + this.clearCache(); + } + + public clearCache(): void + { + } + + public render(planeId: string, textureCache: PlaneTextureCache, canvas: RenderTexture, width: number, height: number, normal: IVector3D, useTexture: boolean, offsetX: number, offsetY: number): RenderTexture + { + const r = (this._color >> 16); + const g = ((this._color >> 8) & 0xFF); + const b = (this._color & 0xFF); + const hasColor = ((r < 0xFF) || (g < 0xFF) || (b < 0xFF)); + + if(this._material) + { + const bitmapData = this._material.render(planeId, textureCache, hasColor ? null : canvas, width, height, normal, useTexture, offsetX, (offsetY + this.offset), (this.align === PlaneVisualizationLayer.ALIGN_TOP)); + + if(bitmapData && hasColor) + { + const sprite = new Sprite(bitmapData); + + if(hasColor) sprite.tint = this._color; + + textureCache.writeToRenderTexture(sprite, canvas, false); + } + } + else + { + const bitmapData = textureCache.createAndFillRenderTexture(width, height, planeId, this._color); + + textureCache.writeToRenderTexture(new Sprite(bitmapData), canvas, false); + } + + return canvas; + } + + public getMaterial(): PlaneMaterial + { + return this._material; + } + + public getColor(): number + { + return this._color; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/WallPlane.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/WallPlane.ts new file mode 100644 index 0000000..2f7d5dd --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/WallPlane.ts @@ -0,0 +1,30 @@ +import { RenderTexture } from '@pixi/core'; +import { IVector3D, Vector3d } from '../../../../../../../api'; +import { PlaneTextureCache } from '../../../../../../../pixi-proxy'; +import { Plane } from './Plane'; + +export class WallPlane extends Plane +{ + public static DEFAULT_COLOR: number = 0xFFFFFF; + public static HORIZONTAL_ANGLE_DEFAULT: number = 45; + public static VERTICAL_ANGLE_DEFAULT: number = 30; + + public render(planeId: string, textureCache: PlaneTextureCache, canvas: RenderTexture, width: number, height: number, size: number, normal: IVector3D, useTexture: boolean): RenderTexture + { + const visualization = this.getPlaneVisualization(size); + + if(!visualization || !visualization.geometry) return null; + + const _local_8 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, 0)); + const _local_9 = visualization.geometry.getScreenPoint(new Vector3d(0, 0, (height / visualization.geometry.scale))); + const _local_10 = visualization.geometry.getScreenPoint(new Vector3d(0, (width / visualization.geometry.scale), 0)); + + if(_local_8 && _local_9 && _local_10) + { + width = Math.round(Math.abs((_local_8.x - _local_10.x))); + height = Math.round(Math.abs((_local_8.y - _local_9.y))); + } + + return visualization.render(planeId, textureCache, canvas, width, height, normal, useTexture); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/WallRasterizer.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/WallRasterizer.ts new file mode 100644 index 0000000..d7538ae --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/WallRasterizer.ts @@ -0,0 +1,70 @@ +import { RenderTexture } from '@pixi/core'; +import { IAssetPlane, IVector3D } from '../../../../../../../api'; +import { PlaneTextureCache } from '../../../../../../../pixi-proxy'; +import { PlaneBitmapData } from '../../utils'; +import { PlaneRasterizer } from './PlaneRasterizer'; +import { WallPlane } from './WallPlane'; + +export class WallRasterizer extends PlaneRasterizer +{ + protected initializePlanes(): void + { + if(!this.data) return; + + const walls = this.data.planes; + + if(walls && walls.length) this.parseWalls(walls); + } + + private parseWalls(k: IAssetPlane[]): void + { + if(!k) return; + + for(const wallIndex in k) + { + const wall = k[wallIndex]; + + if(!wall) continue; + + const id = wall.id; + const visualization = wall.visualizations; + const plane = new WallPlane(); + + this.parseVisualizations(plane, visualization); + + if(!this.addPlane(id, plane)) plane.dispose(); + } + } + + public render(planeId: string, textureCache: PlaneTextureCache, canvas: RenderTexture, id: string, width: number, height: number, scale: number, normal: IVector3D, useTexture: boolean, offsetX: number = 0, offsetY: number = 0, maxX: number = 0, maxY: number = 0, timeSinceStartMs: number = 0): PlaneBitmapData + { + let plane = this.getPlane(id) as WallPlane; + + if(!plane) plane = this.getPlane(PlaneRasterizer.DEFAULT) as WallPlane; + + if(!plane) return null; + + if(canvas) textureCache.clearAndFillRenderTexture(canvas); + + let graphic = plane.render(planeId, textureCache, canvas, width, height, scale, normal, useTexture); + + if(graphic && (graphic !== canvas)) + { + graphic = new RenderTexture(graphic.baseTexture); + + if(!graphic) return null; + } + + return new PlaneBitmapData(graphic, -1); + } + + public getTextureIdentifier(k: number, normal: IVector3D): string + { + if(normal) + { + return `${k}_${normal.x}_${normal.y}_${normal.z}`; + } + + return super.getTextureIdentifier(k, normal); + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/index.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/index.ts new file mode 100644 index 0000000..6f91839 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/basic/index.ts @@ -0,0 +1,14 @@ +export * from './FloorPlane'; +export * from './FloorRasterizer'; +export * from './Plane'; +export * from './PlaneMaterial'; +export * from './PlaneMaterialCell'; +export * from './PlaneMaterialCellColumn'; +export * from './PlaneMaterialCellMatrix'; +export * from './PlaneRasterizer'; +export * from './PlaneTexture'; +export * from './PlaneTextureBitmap'; +export * from './PlaneVisualization'; +export * from './PlaneVisualizationLayer'; +export * from './WallPlane'; +export * from './WallRasterizer'; diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/index.ts b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/index.ts new file mode 100644 index 0000000..872d239 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/rasterizer/index.ts @@ -0,0 +1,3 @@ +export * from './animated'; +export * from './basic'; +export * from './IPlaneRasterizer'; diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/utils/PlaneBitmapData.ts b/submodules/renderer/src/nitro/room/object/visualization/room/utils/PlaneBitmapData.ts new file mode 100644 index 0000000..c72e07f --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/utils/PlaneBitmapData.ts @@ -0,0 +1,28 @@ +import { RenderTexture } from '@pixi/core'; + +export class PlaneBitmapData +{ + private _texture: RenderTexture; + private _timeStamp: number; + + constructor(texture: RenderTexture, timestamp: number) + { + this._texture = texture; + this._timeStamp = timestamp; + } + + public dispose(): void + { + this._texture = null; + } + + public get texture(): RenderTexture + { + return this._texture; + } + + public get timeStamp(): number + { + return this._timeStamp; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/utils/Randomizer.ts b/submodules/renderer/src/nitro/room/object/visualization/room/utils/Randomizer.ts new file mode 100644 index 0000000..e7c6c3d --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/utils/Randomizer.ts @@ -0,0 +1,128 @@ +import { ToInt32 } from '../../../../../utils'; + +export class Randomizer +{ + public static DEFAULT_SEED: number = 1; + public static DEFAULT_MODULUS: number = 16777216; + + private static _randomizer:Randomizer = null; + + private _seed: number = 1; + private _modulus: number = 16777216; + private _multiplier: number = 69069; + private _increment: number = 5; + + public static setSeed(k: number = 1): void + { + if(!Randomizer._randomizer) Randomizer._randomizer = new Randomizer(); + + Randomizer._randomizer.seed = k; + } + + public static setModulus(k: number = 16777216): void + { + if(!Randomizer._randomizer) Randomizer._randomizer = new Randomizer(); + + Randomizer._randomizer.modulus = k; + } + + public static getValues(k: number, _arg_2: number, _arg_3: number): number[] + { + if(!Randomizer._randomizer) Randomizer._randomizer = new Randomizer(); + + return Randomizer._randomizer.getRandomValues(k, _arg_2, _arg_3); + } + + public static getArray(k: number, _arg_2: number): number[] + { + if(!Randomizer._randomizer) Randomizer._randomizer = new Randomizer(); + + return Randomizer._randomizer.getRandomArray(k, _arg_2); + } + + public set seed(k: number) + { + this._seed = k; + } + + public set modulus(k: number) + { + if(k < 1) k = 1; + + this._modulus = k; + } + + public dispose(): void + { + } + + public getRandomValues(k: number, _arg_2: number, _arg_3: number): number[] + { + const _local_4: number[] = []; + + let _local_5 = 0; + + while(_local_5 < k) + { + _local_4.push(this.iterateScaled(_arg_2, (_arg_3 - _arg_2))); + _local_5++; + } + + return _local_4; + } + + public getRandomArray(k: number, _arg_2: number): number[] + { + if(((k > _arg_2) || (_arg_2 > 1000))) return null; + + const _local_3: number[] = []; + + let _local_4 = 0; + + while(_local_4 <= _arg_2) + { + _local_3.push(_local_4); + _local_4++; + } + + const _local_5: number[] = []; + + let _local_6 = 0; + + while(_local_6 < k) + { + const _local_7 = this.iterateScaled(0, (_local_3.length - 1)); + + _local_5.push(_local_3[_local_7]); + _local_3.splice(_local_7, 1); + + _local_6++; + } + + return _local_5; + } + + private iterate(): number + { + let k: number = ToInt32(Math.trunc(this._multiplier * this._seed) + this._increment); + + if(k < 0) k = -(k); + + k = (k % this._modulus); + + this._seed = k; + + return k; + } + + private iterateScaled(k: number, _arg_2: number): number + { + let _local_3: number = this.iterate(); + + if(_arg_2 < 1) return k; + + _local_3 = Math.trunc(k + ((_local_3 / this._modulus) * _arg_2)); + + return _local_3; + } +} diff --git a/submodules/renderer/src/nitro/room/object/visualization/room/utils/index.ts b/submodules/renderer/src/nitro/room/object/visualization/room/utils/index.ts new file mode 100644 index 0000000..beb9718 --- /dev/null +++ b/submodules/renderer/src/nitro/room/object/visualization/room/utils/index.ts @@ -0,0 +1,2 @@ +export * from './PlaneBitmapData'; +export * from './Randomizer'; diff --git a/submodules/renderer/src/nitro/room/preview/RoomPreviewer.ts b/submodules/renderer/src/nitro/room/preview/RoomPreviewer.ts new file mode 100644 index 0000000..a02c077 --- /dev/null +++ b/submodules/renderer/src/nitro/room/preview/RoomPreviewer.ts @@ -0,0 +1,875 @@ +import { RenderTexture, Texture } from '@pixi/core'; +import { Container, DisplayObject } from '@pixi/display'; +import { Point, Rectangle } from '@pixi/math'; +import { Sprite } from '@pixi/sprite'; +import { IGetImageListener, IImageResult, IObjectData, IRoomEngine, IRoomObjectController, IRoomRenderingCanvas, IVector3D, LegacyDataType, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, Vector3d } from '../../../api'; +import { RoomEngineEvent, RoomEngineObjectEvent } from '../../../events'; +import { GetTickerTime, NitroSprite } from '../../../pixi-proxy'; +import { RoomId } from '../../../room'; +import { FloorHeightMapMessageParser, RoomEntryTileMessageParser } from '../../communication'; +import { ObjectRoomMapUpdateMessage } from '../messages'; +import { RoomPlaneParser } from '../object/RoomPlaneParser'; +import { RoomEngine } from '../RoomEngine'; +import { LegacyWallGeometry } from '../utils/LegacyWallGeometry'; + +export class RoomPreviewer +{ + public static SCALE_NORMAL: number = 64; + public static SCALE_SMALL: number = 32; + public static PREVIEW_COUNTER: number = 0; + public static PREVIEW_CANVAS_ID: number = 1; + public static PREVIEW_OBJECT_ID: number = 1; + public static PREVIEW_OBJECT_LOCATION_X: number = 2; + public static PREVIEW_OBJECT_LOCATION_Y: number = 2; + + private static ALLOWED_IMAGE_CUT: number = 0.25; + private static AUTOMATIC_STATE_CHANGE_INTERVAL: number = 2500; + private static ZOOM_ENABLED: boolean = true; + + private _roomEngine: IRoomEngine; + private _planeParser: RoomPlaneParser; + private _previewRoomId: number = 1; + private _currentPreviewObjectType: number = 0; + private _currentPreviewObjectCategory: number = 0; + private _currentPreviewObjectData: string = ''; + private _currentPreviewRectangle: Rectangle = null; + private _currentPreviewCanvasWidth: number = 0; + private _currentPreviewCanvasHeight: number = 0; + private _currentPreviewScale: number = 64; + private _currentPreviewNeedsZoomOut: boolean; + private _automaticStateChange: boolean; + private _previousAutomaticStateChangeTime: number; + private _addViewOffset: Point; + private _backgroundColor: number = 305148561; + private _backgroundSprite: Sprite = null; + private _disableUpdate: boolean = false; + + constructor(roomEngine: IRoomEngine, roomId: number = 1) + { + this._roomEngine = roomEngine; + this._planeParser = new RoomPlaneParser(); + this._previewRoomId = RoomId.makeRoomPreviewerId(roomId); + this._addViewOffset = new Point(0, 0); + + this.onRoomObjectAdded = this.onRoomObjectAdded.bind(this); + this.onRoomInitializedonRoomInitialized = this.onRoomInitializedonRoomInitialized.bind(this); + + if(this.isRoomEngineReady && this._roomEngine.events) + { + this._roomEngine.events.addEventListener(RoomEngineObjectEvent.ADDED, this.onRoomObjectAdded); + this._roomEngine.events.addEventListener(RoomEngineObjectEvent.CONTENT_UPDATED, this.onRoomObjectAdded); + this._roomEngine.events.addEventListener(RoomEngineEvent.INITIALIZED, this.onRoomInitializedonRoomInitialized); + } + + this.createRoomForPreview(); + } + + public dispose(): void + { + this.reset(true); + + if(this.isRoomEngineReady && this._roomEngine.events) + { + this._roomEngine.events.removeEventListener(RoomEngineObjectEvent.ADDED, this.onRoomObjectAdded); + this._roomEngine.events.removeEventListener(RoomEngineObjectEvent.CONTENT_UPDATED, this.onRoomObjectAdded); + this._roomEngine.events.removeEventListener(RoomEngineEvent.INITIALIZED, this.onRoomInitializedonRoomInitialized); + } + + if(this._backgroundSprite) + { + this._backgroundSprite.destroy(); + + this._backgroundSprite = null; + } + + if(this._planeParser) + { + this._planeParser.dispose(); + + this._planeParser = null; + } + } + + private createRoomForPreview(): void + { + if(this.isRoomEngineReady) + { + const size = 7; + + const planeParser = new RoomPlaneParser(); + + planeParser.initializeTileMap((size + 2), (size + 2)); + + let y = 1; + + while(y < (1 + size)) + { + let x = 1; + + while(x < (1 + size)) + { + planeParser.setTileHeight(x, y, 0); + + x++; + } + + y++; + } + + planeParser.initializeFromTileData(); + + this._roomEngine.createRoomInstance(this._previewRoomId, planeParser.getMapData()); + + planeParser.dispose(); + } + } + + public reset(k: boolean): void + { + if(this.isRoomEngineReady) + { + this._roomEngine.removeRoomObjectFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID); + this._roomEngine.removeRoomObjectWall(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID); + this._roomEngine.removeRoomObjectUser(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID); + + if(!k) this.updatePreviewRoomView(); + } + + this._currentPreviewObjectCategory = RoomObjectCategory.MINIMUM; + } + + public updatePreviewModel(model: string, wallHeight: number, scale: boolean = true): void + { + const parser = new FloorHeightMapMessageParser(); + + parser.flush(); + parser.parseModel(model, wallHeight, scale); + + //@ts-ignore + const wallGeometry = (this._roomEngine as IRoomCreator).getLegacyWallGeometry(this._previewRoomId); + + if(!wallGeometry) return; + + this._planeParser.reset(); + + const width = parser.width; + const height = parser.height; + + this._planeParser.initializeTileMap(width, height); + + const entryTile: RoomEntryTileMessageParser = null; + + let doorX = -1; + let doorY = -1; + let doorZ = 0; + let doorDirection = 0; + + let y = 0; + + while(y < height) + { + let x = 0; + + while(x < width) + { + const tileHeight = parser.getHeight(x, y); + + if(((((y > 0) && (y < (height - 1))) || ((x > 0) && (x < (width - 1)))) && (!(tileHeight == RoomPlaneParser.TILE_BLOCKED))) && ((entryTile == null) || ((x == entryTile.x) && (y == entryTile.y)))) + { + if(((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight(x, (y + 1)) == RoomPlaneParser.TILE_BLOCKED)) + { + doorX = (x + 0.5); + doorY = y; + doorZ = tileHeight; + doorDirection = 90; + } + + if(((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight((x + 1), y) == RoomPlaneParser.TILE_BLOCKED)) + { + doorX = x; + doorY = (y + 0.5); + doorZ = tileHeight; + doorDirection = 180; + } + } + + this._planeParser.setTileHeight(x, y, tileHeight); + + x++; + } + + y++; + } + + this._planeParser.setTileHeight(Math.floor(doorX), Math.floor(doorY), doorZ); + this._planeParser.initializeFromTileData(parser.wallHeight); + this._planeParser.setTileHeight(Math.floor(doorX), Math.floor(doorY), (doorZ + this._planeParser.wallHeight)); + + wallGeometry.scale = LegacyWallGeometry.DEFAULT_SCALE; + wallGeometry.initialize(width, height, this._planeParser.floorHeight); + + let heightIterator = (parser.height - 1); + + while(heightIterator >= 0) + { + let widthIterator = (parser.width - 1); + + while(widthIterator >= 0) + { + wallGeometry.setHeight(widthIterator, heightIterator, this._planeParser.getTileHeight(widthIterator, heightIterator)); + widthIterator--; + } + + heightIterator--; + } + + const roomMap = this._planeParser.getMapData(); + + roomMap.doors.push({ + x: doorX, + y: doorY, + z: doorZ, + dir: doorDirection + }); + + const roomObject = this.getRoomPreviewOwnRoomObject(); + + if(roomObject) roomObject.processUpdateMessage(new ObjectRoomMapUpdateMessage(roomMap)); + } + + public addFurnitureIntoRoom(classId: number, direction: IVector3D, objectData: IObjectData = null, extra: string = null): number + { + if(!objectData) objectData = new LegacyDataType(); + + if(this.isRoomEngineReady) + { + this.reset(false); + + this._currentPreviewObjectType = classId; + this._currentPreviewObjectCategory = RoomObjectCategory.FLOOR; + this._currentPreviewObjectData = ''; + + if(this._roomEngine.addFurnitureFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, classId, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), direction, 0, objectData, NaN, -1, 0, -1, '', true, false)) + { + this._previousAutomaticStateChangeTime = GetTickerTime(); + this._automaticStateChange = true; + + const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory); + + if(roomObject && extra) roomObject.model.setValue(RoomObjectVariable.FURNITURE_EXTRAS, extra); + + this.updatePreviewRoomView(); + + return RoomPreviewer.PREVIEW_OBJECT_ID; + } + } + + return -1; + } + + public addWallItemIntoRoom(classId: number, direction: IVector3D, objectData: string): number + { + if(this.isRoomEngineReady) + { + if((this._currentPreviewObjectCategory === RoomObjectCategory.WALL) && (this._currentPreviewObjectType === classId) && (this._currentPreviewObjectData === objectData)) return RoomPreviewer.PREVIEW_OBJECT_ID; + + this.reset(false); + + this._currentPreviewObjectType = classId; + this._currentPreviewObjectCategory = RoomObjectCategory.WALL; + this._currentPreviewObjectData = objectData; + + if(this._roomEngine.addFurnitureWall(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, classId, new Vector3d(0.5, 2.3, 1.8), direction, 0, objectData, 0, 0, -1, '', false)) + { + this._previousAutomaticStateChangeTime = GetTickerTime(); + this._automaticStateChange = true; + + this.updatePreviewRoomView(); + + return RoomPreviewer.PREVIEW_OBJECT_ID; + } + } + + return -1; + } + + public addAvatarIntoRoom(figure: string, effect: number): number + { + if(this.isRoomEngineReady) + { + this.reset(false); + + this._currentPreviewObjectType = 1; + this._currentPreviewObjectCategory = RoomObjectCategory.UNIT; + this._currentPreviewObjectData = figure; + + if(this._roomEngine.addRoomObjectUser(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), new Vector3d(90, 0, 0), 135, RoomObjectUserType.getTypeNumber(RoomObjectUserType.USER), figure)) + { + this._previousAutomaticStateChangeTime = GetTickerTime(); + this._automaticStateChange = true; + + this.updateUserGesture(1); + this.updateUserEffect(effect); + this.updateUserPosture('std'); + } + + this.updatePreviewRoomView(); + + return RoomPreviewer.PREVIEW_OBJECT_ID; + } + + return -1; + } + + public addPetIntoRoom(figure: string): number + { + if(this.isRoomEngineReady) + { + this.reset(false); + + this._currentPreviewObjectType = 1; + this._currentPreviewObjectCategory = RoomObjectCategory.UNIT; + this._currentPreviewObjectData = figure; + + if(this._roomEngine.addRoomObjectUser(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), new Vector3d(90, 0, 0), 90, RoomObjectUserType.getTypeNumber(RoomObjectUserType.PET), figure)) + { + this._previousAutomaticStateChangeTime = GetTickerTime(); + this._automaticStateChange = false; + + this.updateUserGesture(1); + this.updateUserPosture('std'); + } + + this.updatePreviewRoomView(); + + return RoomPreviewer.PREVIEW_OBJECT_ID; + } + + return -1; + } + + public updateUserPosture(type: string, parameter: string = ''): void + { + if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserPosture(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, type, parameter); + } + + public updateUserGesture(gestureId: number): void + { + if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserGesture(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, gestureId); + } + + public updateUserEffect(effectId: number): void + { + if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserEffect(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, effectId); + } + + public updateObjectUserFigure(figure: string, gender: string = null, subType: string = null, isRiding: boolean = false): boolean + { + if(this.isRoomEngineReady) return this._roomEngine.updateRoomObjectUserFigure(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, figure, gender, subType, isRiding); + + return false; + } + + public updateObjectUserAction(action: string, value: number, parameter: string = null): void + { + if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserAction(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, action, value, parameter); + } + + public updateObjectStuffData(stuffData: IObjectData): void + { + if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, null, null, stuffData.state, stuffData); + } + + public changeRoomObjectState(): void + { + if(this.isRoomEngineReady) + { + this._automaticStateChange = false; + + if(this._currentPreviewObjectCategory !== RoomObjectCategory.UNIT) this._roomEngine.changeObjectState(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory); + } + } + + public changeRoomObjectDirection(): void + { + if(this.isRoomEngineReady) + { + const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory); + + if(!roomObject) return; + + const direction = this._roomEngine.objectEventHandler.getValidRoomObjectDirection(roomObject, true); + + switch(this._currentPreviewObjectCategory) + { + case RoomObjectCategory.FLOOR: { + const floorLocation = new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y); + const floorDirection = new Vector3d(direction, direction, direction); + + this._roomEngine.updateRoomObjectFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, floorLocation, floorDirection, null, null); + return; + } + case RoomObjectCategory.WALL: + //this._roomEngine.updateRoomObjectWall(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, null, direction, null, null); + return; + } + } + } + + private checkAutomaticRoomObjectStateChange(): void + { + if(this._automaticStateChange) + { + const time = GetTickerTime(); + + if(time > (this._previousAutomaticStateChangeTime + RoomPreviewer.AUTOMATIC_STATE_CHANGE_INTERVAL)) + { + this._previousAutomaticStateChangeTime = time; + + if(this.isRoomEngineReady) this._roomEngine.changeObjectState(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory); + } + } + } + + public getRoomCanvas(width: number, height: number): DisplayObject + { + if(this.isRoomEngineReady) + { + const displayObject = (this._roomEngine.getRoomInstanceDisplay(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, width, height, this._currentPreviewScale) as Container); + + if(displayObject && (this._backgroundColor !== null)) + { + let backgroundSprite = this._backgroundSprite; + + if(!backgroundSprite) + { + backgroundSprite = new NitroSprite(Texture.WHITE); + + displayObject.addChildAt(backgroundSprite, 0); + } + + backgroundSprite.width = width; + backgroundSprite.height = height; + backgroundSprite.tint = this._backgroundColor; + } + + this._roomEngine.setRoomInstanceRenderingCanvasMask(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, true); + + const geometry = this._roomEngine.getRoomInstanceGeometry(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID); + + if(geometry) geometry.adjustLocation(new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), 30); + + this._currentPreviewCanvasWidth = width; + this._currentPreviewCanvasHeight = height; + + return displayObject; + } + + return null; + } + + public modifyRoomCanvas(width: number, height: number): void + { + if(this.isRoomEngineReady) + { + this._currentPreviewCanvasWidth = width; + this._currentPreviewCanvasHeight = height; + + if(this._backgroundSprite) + { + this._backgroundSprite.width = width; + this._backgroundSprite.height = height; + } + + this._roomEngine.initializeRoomInstanceRenderingCanvas(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, width, height); + } + } + + public set addViewOffset(point: Point) + { + this._addViewOffset = point; + } + + public get addViewOffset(): Point + { + return this._addViewOffset; + } + + public updatePreviewObjectBoundingRectangle(point: Point): void + { + const objectBounds = this._roomEngine.getRoomObjectBoundingRectangle(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory, RoomPreviewer.PREVIEW_CANVAS_ID); + + if(objectBounds && point) + { + objectBounds.x += -(this._currentPreviewCanvasWidth >> 1); + objectBounds.y += -(this._currentPreviewCanvasHeight >> 1); + + objectBounds.x += -(point.x); + objectBounds.y += -(point.y); + + if(!this._currentPreviewRectangle) + { + this._currentPreviewRectangle = objectBounds; + } + else + { + const bounds = this._currentPreviewRectangle.clone().enlarge(objectBounds); + + if(((((bounds.width - this._currentPreviewRectangle.width) > ((this._currentPreviewCanvasWidth - this._currentPreviewRectangle.width) >> 1)) || ((bounds.height - this._currentPreviewRectangle.height) > ((this._currentPreviewCanvasHeight - this._currentPreviewRectangle.height) >> 1))) || (this._currentPreviewRectangle.width < 1)) || (this._currentPreviewRectangle.height < 1)) this._currentPreviewRectangle = bounds; + } + } + } + + private validatePreviewSize(point: Point): Point + { + if(((this._currentPreviewRectangle.width < 1) || (this._currentPreviewRectangle.height < 1))) + { + return point; + } + + if(this.isRoomEngineReady) + { + const geometry = this._roomEngine.getRoomInstanceGeometry(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID); + + if((this._currentPreviewRectangle.width > (this._currentPreviewCanvasWidth * (1 + RoomPreviewer.ALLOWED_IMAGE_CUT))) || (this._currentPreviewRectangle.height > (this._currentPreviewCanvasHeight * (1 + RoomPreviewer.ALLOWED_IMAGE_CUT)))) + { + if(RoomPreviewer.ZOOM_ENABLED) + { + if(this._roomEngine.getRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID) !== 0.5) + { + this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 0.5, null, null); + + this._currentPreviewScale = RoomPreviewer.SCALE_SMALL; + this._currentPreviewNeedsZoomOut = true; + + point.x = (point.x >> 1); + point.y = (point.y >> 1); + + this._currentPreviewRectangle.x = (this._currentPreviewRectangle.x >> 2); + this._currentPreviewRectangle.y = (this._currentPreviewRectangle.y >> 2); + this._currentPreviewRectangle.width = (this._currentPreviewRectangle.width >> 2); + this._currentPreviewRectangle.height = (this._currentPreviewRectangle.height >> 2); + } + } + else + { + if(geometry.isZoomedIn()) + { + geometry.performZoomOut(); + + this._currentPreviewScale = RoomPreviewer.SCALE_SMALL; + this._currentPreviewNeedsZoomOut = true; + } + } + } + + else if(!this._currentPreviewNeedsZoomOut) + { + if(RoomPreviewer.ZOOM_ENABLED) + { + if(this._roomEngine.getRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID) !== 1) + { + this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 1, null, null); + + this._currentPreviewScale = RoomPreviewer.SCALE_NORMAL; + } + } + else + { + if(!geometry.isZoomedIn()) + { + geometry.performZoomIn(); + + this._currentPreviewScale = RoomPreviewer.SCALE_NORMAL; + } + } + } + } + + return point; + } + + public zoomIn(): void + { + if(this.isRoomEngineReady) + { + if(RoomPreviewer.ZOOM_ENABLED) + { + this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 1); + } + else + { + const geometry = this._roomEngine.getRoomInstanceGeometry(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID); + + geometry.performZoomIn(); + } + } + + this._currentPreviewScale = RoomPreviewer.SCALE_NORMAL; + } + + public zoomOut(): void + { + if(this.isRoomEngineReady) + { + if(RoomPreviewer.ZOOM_ENABLED) + { + this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 0.5); + } + else + { + const geometry = this._roomEngine.getRoomInstanceGeometry(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID); + + geometry.performZoomOut(); + } + } + + this._currentPreviewScale = RoomPreviewer.SCALE_SMALL; + } + + public updateAvatarDirection(direction: number, headDirection: number): void + { + if(this.isRoomEngineReady) + { + this._roomEngine.updateRoomObjectUserLocation(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), false, 0, new Vector3d((direction * 45), 0, 0), (headDirection * 45)); + } + } + + public updateObjectRoom(floorType: string = null, wallType: string = null, landscapeType: string = null, _arg_4: boolean = false): boolean + { + if(this.isRoomEngineReady) return this._roomEngine.updateRoomInstancePlaneType(this._previewRoomId, floorType, wallType, landscapeType, _arg_4); + + return false; + } + + public updateRoomWallsAndFloorVisibility(wallsVisible: boolean, floorsVisible: boolean = true): void + { + if(this.isRoomEngineReady) this._roomEngine.updateRoomInstancePlaneVisibility(this._previewRoomId, wallsVisible, floorsVisible); + } + + private getCanvasOffset(point: Point): Point + { + if(((this._currentPreviewRectangle.width < 1) || (this._currentPreviewRectangle.height < 1))) return point; + + let x = (-(this._currentPreviewRectangle.left + this._currentPreviewRectangle.right) >> 1); + let y = (-(this._currentPreviewRectangle.top + this._currentPreviewRectangle.bottom) >> 1); + const height = ((this._currentPreviewCanvasHeight - this._currentPreviewRectangle.height) >> 1); + + if(height > 10) + { + y = (y + Math.min(15, (height - 10))); + } + else + { + if(this._currentPreviewObjectCategory !== RoomObjectCategory.UNIT) + { + y = (y + (5 - Math.max(0, (height / 2)))); + } + else + { + y = (y - (5 - Math.min(0, (height / 2)))); + } + } + + y = (y + this._addViewOffset.y); + x = (x + this._addViewOffset.x); + + const offsetX = (x - point.x); + const offsetY = (y - point.y); + + if((offsetX !== 0) || (offsetY !== 0)) + { + const _local_7 = Math.sqrt(((offsetX * offsetX) + (offsetY * offsetY))); + + if(_local_7 > 10) + { + x = (point.x + ((offsetX * 10) / _local_7)); + y = (point.y + ((offsetY * 10) / _local_7)); + } + + return new Point(x, y); + } + + return null; + } + + public updatePreviewRoomView(k: boolean = false): void + { + if(this._disableUpdate && !k) return; + + this.checkAutomaticRoomObjectStateChange(); + + if(this.isRoomEngineReady) + { + let offset = this._roomEngine.getRoomInstanceRenderingCanvasOffset(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID); + + if(offset) + { + this.updatePreviewObjectBoundingRectangle(offset); + + if(this._currentPreviewRectangle) + { + const scale = this._currentPreviewScale; + + offset = this.validatePreviewSize(offset); + + const canvasOffset = this.getCanvasOffset(offset); + + if(canvasOffset) + { + this._roomEngine.setRoomInstanceRenderingCanvasOffset(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, canvasOffset); + } + + if(this._currentPreviewScale !== scale) this._currentPreviewRectangle = null; + } + } + } + } + + public set disableUpdate(flag: boolean) + { + this._disableUpdate = flag; + } + + public set disableRoomEngineUpdate(flag: boolean) + { + if(this.isRoomEngineReady) this._roomEngine.disableUpdate(flag); + } + + private onRoomInitializedonRoomInitialized(event: RoomEngineEvent): void + { + if(!event) return; + + switch(event.type) + { + case RoomEngineEvent.INITIALIZED: + if((event.roomId === this._previewRoomId) && this.isRoomEngineReady) + { + this._roomEngine.updateRoomInstancePlaneType(this._previewRoomId, '110', '99999'); + } + return; + } + } + + private onRoomObjectAdded(event: RoomEngineObjectEvent): void + { + if((event.roomId === this._previewRoomId) && (event.objectId === RoomPreviewer.PREVIEW_OBJECT_ID) && (event.category === this._currentPreviewObjectCategory)) + { + this._currentPreviewRectangle = null; + this._currentPreviewNeedsZoomOut = false; + + const roomObject = this._roomEngine.getRoomObject(event.roomId, event.objectId, event.category); + + if(roomObject && roomObject.model && (event.category === RoomObjectCategory.WALL)) + { + const sizeZ = roomObject.model.getValue(RoomObjectVariable.FURNITURE_SIZE_Z); + const centerZ = roomObject.model.getValue(RoomObjectVariable.FURNITURE_CENTER_Z); + + if((sizeZ !== null) || (centerZ !== null)) + { + this._roomEngine.updateRoomObjectWallLocation(event.roomId, event.objectId, new Vector3d(0.5, 2.3, (((3.6 - sizeZ) / 2) + centerZ))); + } + } + } + } + + public updateRoomEngine(): void + { + if(this.isRoomEngineReady) this._roomEngine.runUpdate(); + } + + public getRenderingCanvas(): IRoomRenderingCanvas + { + const renderingCanvas = this._roomEngine.getRoomInstanceRenderingCanvas(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID); + + if(!renderingCanvas) return null; + + return renderingCanvas; + } + + public getGenericRoomObjectImage(type: string, value: string, direction: IVector3D, scale: number, listener: IGetImageListener, bgColor: number = 0, extras: string = null, objectData: IObjectData = null, state: number = -1, frame: number = -1, posture: string = null): IImageResult + { + if(this.isRoomEngineReady) + { + return this._roomEngine.getGenericRoomObjectImage(type, value, direction, scale, listener, bgColor, extras, objectData, state, frame, posture); + } + + return null; + } + + public getRoomObjectImage(direction: IVector3D, scale: number, listener: IGetImageListener, bgColor: number = 0): IImageResult + { + if(this.isRoomEngineReady) + { + return this._roomEngine.getRoomObjectImage(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory, direction, scale, listener, bgColor); + } + + return null; + } + + public getRoomObjectCurrentImage(): RenderTexture + { + if(this.isRoomEngineReady) + { + const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory); + + if(roomObject && roomObject.visualization) return roomObject.visualization.getImage(0xFFFFFF, -1); + } + + return null; + } + + public getRoomPreviewObject(): IRoomObjectController + { + if(this.isRoomEngineReady) + { + const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory); + + if(roomObject) return roomObject; + } + + return null; + } + + public getRoomPreviewOwnRoomObject(): IRoomObjectController + { + if(this.isRoomEngineReady) + { + const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM); + + if(roomObject) return roomObject; + } + + return null; + } + + public get isRoomEngineReady(): boolean + { + return (this._roomEngine && this._roomEngine.ready); + } + + public get roomId(): number + { + return this._previewRoomId; + } + + public get backgroundColor(): number + { + return this._backgroundColor; + } + + public set backgroundColor(color: number) + { + this._backgroundColor = color; + } + + public get width(): number + { + return this._currentPreviewCanvasWidth; + } + + public get height(): number + { + return this._currentPreviewCanvasHeight; + } +} diff --git a/submodules/renderer/src/nitro/room/preview/index.ts b/submodules/renderer/src/nitro/room/preview/index.ts new file mode 100644 index 0000000..8cf62f7 --- /dev/null +++ b/submodules/renderer/src/nitro/room/preview/index.ts @@ -0,0 +1 @@ +export * from './RoomPreviewer'; diff --git a/submodules/renderer/src/nitro/room/utils/FurnitureStackingHeightMap.ts b/submodules/renderer/src/nitro/room/utils/FurnitureStackingHeightMap.ts new file mode 100644 index 0000000..f567eb8 --- /dev/null +++ b/submodules/renderer/src/nitro/room/utils/FurnitureStackingHeightMap.ts @@ -0,0 +1,121 @@ +import { IFurnitureStackingHeightMap } from '../../../api'; + +export class FurnitureStackingHeightMap implements IFurnitureStackingHeightMap +{ + private _width: number; + private _height: number; + private _heights: number[]; + private _isNotStackable: boolean[]; + private _isRoomTile: boolean[]; + + constructor(width: number, height: number) + { + this._width = width; + this._height = height; + this._heights = []; + this._isNotStackable = []; + this._isRoomTile = []; + + let total = (width * height); + + while(total > 0) + { + this._heights.push(0); + this._isNotStackable.push(false); + this._isRoomTile.push(false); + + total--; + } + } + + public dispose(): void + { + this._width = 0; + this._height = 0; + this._height = null; + this._isNotStackable = null; + this._isRoomTile = null; + } + + private validPosition(x: number, y: number): boolean + { + return (((x >= 0) && (x < this._width)) && (y >= 0)) && (y < this._height); + } + + public getTileHeight(x: number, y: number): number + { + return ((this.validPosition(x, y)) ? this._heights[((y * this._width) + x)] : 0); + } + + public setTileHeight(x: number, y: number, height: number): void + { + if(this.validPosition(x, y)) this._heights[((y * this._width) + x)] = height; + } + + public setStackingBlocked(x: number, y: number, isNotStackable: boolean): void + { + if(this.validPosition(x, y)) this._isNotStackable[((y * this._width) + x)] = isNotStackable; + } + + public setIsRoomTile(x: number, y: number, isRoomTile: boolean): void + { + if(this.validPosition(x, y)) this._isRoomTile[((y * this._width) + x)] = isRoomTile; + } + + public validateLocation(k: number, _arg_2: number, _arg_3: number, _arg_4: number, _arg_5: number, _arg_6: number, _arg_7: number, _arg_8: number, _arg_9: boolean, _arg_10: number = -1): boolean + { + let _local_12 = 0; + let _local_13 = 0; + + if(!this.validPosition(k, _arg_2) || !this.validPosition(((k + _arg_3) - 1), ((_arg_2 + _arg_4) - 1))) return false; + + if(((_arg_5 < 0) || (_arg_5 >= this._width))) _arg_5 = 0; + + if(((_arg_6 < 0) || (_arg_6 >= this._height))) _arg_6 = 0; + + _arg_7 = Math.min(_arg_7, (this._width - _arg_5)); + _arg_8 = Math.min(_arg_8, (this._height - _arg_6)); + + if(_arg_10 === -1) _arg_10 = this.getTileHeight(k, _arg_2); + + let _local_11 = _arg_2; + + while(_local_11 < (_arg_2 + _arg_4)) + { + _local_12 = k; + + while(_local_12 < (k + _arg_3)) + { + if(((((_local_12 < _arg_5) || (_local_12 >= (_arg_5 + _arg_7))) || (_local_11 < _arg_6)) || (_local_11 >= (_arg_6 + _arg_8)))) + { + _local_13 = ((_local_11 * this._width) + _local_12); + + if(_arg_9) + { + if(!this._isRoomTile[_local_13]) return false; + } + else + { + if(((this._isNotStackable[_local_13]) || (!(this._isRoomTile[_local_13]))) || (Math.abs((this._heights[_local_13] - _arg_10)) > 0.01)) return false; + } + } + + _local_12++; + } + + _local_11++; + } + + return true; + } + + public get width(): number + { + return this._width; + } + + public get height(): number + { + return this._height; + } +} diff --git a/submodules/renderer/src/nitro/room/utils/LegacyWallGeometry.ts b/submodules/renderer/src/nitro/room/utils/LegacyWallGeometry.ts new file mode 100644 index 0000000..021fa43 --- /dev/null +++ b/submodules/renderer/src/nitro/room/utils/LegacyWallGeometry.ts @@ -0,0 +1,321 @@ +import { ILegacyWallGeometry, IVector3D, Vector3d } from '../../../api'; + +export class LegacyWallGeometry implements ILegacyWallGeometry +{ + public static DEFAULT_SCALE: number = 32; + + private static L: string = 'l'; + private static R: string = 'r'; + + private _isDisposed: boolean; + private _scale: number; + private _heightMap: number[][]; + private _width: number; + private _height: number; + private _floorHeight: number; + + constructor() + { + this._isDisposed = false; + this._scale = 64; + this._heightMap = []; + this._width = 0; + this._height = 0; + this._floorHeight = 0; + } + + public get disposed(): boolean + { + return this._isDisposed; + } + + public get scale(): number + { + return this._scale; + } + + public set scale(k: number) + { + this._scale = k; + } + + public dispose(): void + { + this.reset(); + this._isDisposed = true; + } + + public initialize(width: number, height: number, floorHeight: number): void + { + if((width <= this._width) && (height <= this._height)) + { + this._width = width; + this._height = height; + this._floorHeight = floorHeight; + + return; + } + + this.reset(); + + let y = 0; + + while(y < height) + { + const heights: number[] = []; + + this._heightMap.push(heights); + + let x = 0; + + while(x < width) + { + heights.push(0); + + x++; + } + + y++; + } + + this._width = width; + this._height = height; + this._floorHeight = floorHeight; + } + + private reset(): void + { + this._heightMap = []; + } + + public setHeight(x: number, y: number, height: number): boolean + { + if((((x < 0) || (x >= this._width)) || (y < 0)) || (y >= this._height)) return false; + + const heightMap = this._heightMap[y]; + + if(!heightMap) return false; + + heightMap[x] = height; + + return true; + } + + public getHeight(x: number, y: number): number + { + if((((x < 0) || (x >= this._width)) || (y < 0)) || (y >= this._height)) return 0; + + const heightMap = this._heightMap[y]; + + if(!heightMap) return 0; + + return heightMap[x]; + } + + public getLocation(width: number, height: number, localX: number, localY: number, direction: string): IVector3D + { + let _local_7: number; + if(((width == 0) && (height == 0))) + { + width = this._width; + height = this._height; + const _local_12 = Math.round((this.scale / 10)); + if(direction == LegacyWallGeometry.R) + { + let _local_7 = (this._width - 1); + while(_local_7 >= 0) + { + let _local_6 = 1; + while(_local_6 < this._height) + { + if(this.getHeight(_local_7, _local_6) <= this._floorHeight) + { + if((_local_6 - 1) < height) + { + width = _local_7; + height = (_local_6 - 1); + } + break; + } + _local_6++; + } + _local_7--; + } + localY = (localY + ((this.scale / 4) - (_local_12 / 2))); + localX = (localX + (this.scale / 2)); + } + else + { + let _local_6 = (this._height - 1); + while(_local_6 >= 0) + { + let _local_7 = 1; + while(_local_7 < this._width) + { + if(this.getHeight(_local_7, _local_6) <= this._floorHeight) + { + if((_local_7 - 1) < width) + { + width = (_local_7 - 1); + height = _local_6; + } + break; + } + _local_7++; + } + _local_6--; + } + localY = (localY + ((this.scale / 4) - (_local_12 / 2))); + localX = (localX - _local_12); + } + } + let _local_8: number = width; + let _local_9: number = height; + let _local_10: number = this.getHeight(width, height); + if(direction == LegacyWallGeometry.R) + { + _local_8 = (_local_8 + ((localX / (this._scale / 2)) - 0.5)); + _local_9 = (_local_9 + 0.5); + _local_10 = (_local_10 - ((localY - (localX / 2)) / (this._scale / 2))); + } + else + { + _local_9 = (_local_9 + ((((this._scale / 2) - localX) / (this._scale / 2)) - 0.5)); + _local_8 = (_local_8 + 0.5); + _local_10 = (_local_10 - ((localY - (((this._scale / 2) - localX) / 2)) / (this._scale / 2))); + } + const _local_11: Vector3d = new Vector3d(_local_8, _local_9, _local_10); + return _local_11; + } + + public getLocationOldFormat(k: number, _arg_2: number, _arg_3: string): IVector3D + { + let _local_4: number; + let _local_5: number; + let _local_6 = 0; + let _local_7 = 0; + _local_5 = Math.ceil(k); + _local_6 = (_local_5 - k); + let _local_8: number; + let _local_9: number; + let _local_11: number; + let _local_12 = 0; + _local_4 = 0; + while(_local_4 < this._width) + { + if(((_local_5 >= 0) && (_local_5 < this._height))) + { + if(this.getHeight(_local_4, _local_5) <= this._floorHeight) + { + _local_8 = (_local_4 - 1); + _local_9 = _local_5; + _local_7 = _local_4; + _arg_3 = LegacyWallGeometry.L; + break; + } + if(this.getHeight(_local_4, (_local_5 + 1)) <= this._floorHeight) + { + _local_8 = _local_4; + _local_9 = _local_5; + _local_7 = (_local_9 - k); + _arg_3 = LegacyWallGeometry.R; + break; + } + } + _local_5++; + _local_4++; + } + const _local_10 = ((this.scale / 2) * _local_6); + let _local_13: number = ((-(_local_7) * this.scale) / 2); + _local_13 = (_local_13 + ((((-(_arg_2) * 18) / 32) * this.scale) / 2)); + _local_12 = this.getHeight(_local_8, _local_9); + _local_11 = (((_local_12 * this.scale) / 2) + _local_13); + if(_arg_3 == LegacyWallGeometry.R) + { + _local_11 = (_local_11 + ((_local_6 * this.scale) / 4)); + } + else + { + _local_11 = (_local_11 + (((1 - _local_6) * this.scale) / 4)); + } + return this.getLocation(_local_8, _local_9, _local_10, _local_11, _arg_3); + } + + public getOldLocation(k: IVector3D, _arg_2: number): [number, number, number, number, string] + { + if(k == null) + { + return null; + } + let _local_3 = 0; + let _local_4 = 0; + let _local_5 = 0; + let _local_6 = 0; + let _local_7 = ''; + let _local_8 = 0; + if(_arg_2 == 90) + { + _local_3 = Math.floor((k.x - 0.5)); + _local_4 = Math.floor((k.y + 0.5)); + _local_8 = this.getHeight(_local_3, _local_4); + _local_5 = ((this._scale / 2) - (((k.y - _local_4) + 0.5) * (this._scale / 2))); + _local_6 = (((_local_8 - k.z) * (this._scale / 2)) + (((this._scale / 2) - _local_5) / 2)); + _local_7 = LegacyWallGeometry.L; + } + else + { + if(_arg_2 == 180) + { + _local_3 = Math.floor((k.x + 0.5)); + _local_4 = Math.floor((k.y - 0.5)); + _local_8 = this.getHeight(_local_3, _local_4); + _local_5 = (((k.x + 0.5) - _local_3) * (this._scale / 2)); + _local_6 = (((_local_8 - k.z) * (this._scale / 2)) + (_local_5 / 2)); + _local_7 = LegacyWallGeometry.R; + } + else + { + return null; + } + } + return [_local_3, _local_4, _local_5, _local_6, _local_7]; + } + + public getOldLocationString(k: IVector3D, _arg_2: number): string + { + const _local_3 = this.getOldLocation(k, _arg_2); + if(_local_3 == null) + { + return null; + } + const _local_4: number = Math.trunc(_local_3[0]); + const _local_5: number = Math.trunc(_local_3[1]); + const _local_6: number = Math.trunc(_local_3[2]); + const _local_7: number = Math.trunc(_local_3[3]); + const _local_8: string = _local_3[4]; + const _local_9: string = (((((((((':w=' + _local_4) + ',') + _local_5) + ' l=') + _local_6) + ',') + _local_7) + ' ') + _local_8); + return _local_9; + } + + public getDirection(k: string): number + { + if(k == LegacyWallGeometry.R) + { + return 180; + } + return 90; + } + + public getFloorAltitude(k: number, _arg_2: number): number + { + const _local_3 = this.getHeight(k, _arg_2); + const _local_4 = (_local_3 + 1); + + return _local_3 + (((((((((Math.trunc(this.getHeight((k - 1), (_arg_2 - 1))) == _local_4) || (Math.trunc(this.getHeight(k, (_arg_2 - 1))) == _local_4)) || (Math.trunc(this.getHeight((k + 1), (_arg_2 - 1))) == _local_4)) || (Math.trunc(this.getHeight((k - 1), _arg_2)) == _local_4)) || (Math.trunc(this.getHeight((k + 1), _arg_2)) == _local_4)) || (Math.trunc(this.getHeight((k - 1), (_arg_2 + 1))) == _local_4)) || (Math.trunc(this.getHeight(k, (_arg_2 + 1))) == _local_4)) || (Math.trunc(this.getHeight((k + 1), (_arg_2 + 1))) == _local_4)) ? 0.5 : 0); + } + + public isRoomTile(k: number, _arg_2: number): boolean + { + return ((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height)) && (this._heightMap[_arg_2][k] >= 0); + } +} diff --git a/submodules/renderer/src/nitro/room/utils/RoomCamera.ts b/submodules/renderer/src/nitro/room/utils/RoomCamera.ts new file mode 100644 index 0000000..0ead827 --- /dev/null +++ b/submodules/renderer/src/nitro/room/utils/RoomCamera.ts @@ -0,0 +1,287 @@ +import { IVector3D, Vector3d } from '../../../api'; + +export class RoomCamera +{ + private static MOVE_SPEED_DENOMINATOR: number = 12; + + private _targetId: number = -1; + private _targetCategory: number = -2; + private _targetLoc: Vector3d = null; + private _moveDistance: number = 0; + private _previousMoveSpeed: number = 0; + private _maintainPreviousMoveSpeed: boolean = false; + private _currentLoc: Vector3d = null; + private _targetObjectLoc: Vector3d; + private _limitedLocX: boolean = false; + private _limitedLocY: boolean = false; + private _centeredLocX: boolean = false; + private _centeredLocY: boolean = false; + private _screenWd: number = 0; + private _screenHt: number = 0; + private _scale: number = 0; + private _roomWd: number = 0; + private _roomHt: number = 0; + private _geometryUpdateId: number = -1; + private _scaleChanged: boolean = false; + private _followDuration: number; + + constructor() + { + this._targetObjectLoc = new Vector3d(); + } + + public get location(): IVector3D + { + return this._currentLoc; + } + + public get targetId(): number + { + return this._targetId; + } + + public set targetId(k: number) + { + this._targetId = k; + } + + public get targetCategory(): number + { + return this._targetCategory; + } + + public set targetCategory(k: number) + { + this._targetCategory = k; + } + + public get targetObjectLoc(): IVector3D + { + return this._targetObjectLoc; + } + + public set targetObjectLoc(k: IVector3D) + { + this._targetObjectLoc.assign(k); + } + + public get limitedLocationX(): boolean + { + return this._limitedLocX; + } + + public set limitedLocationX(k: boolean) + { + this._limitedLocX = k; + } + + public get limitedLocationY(): boolean + { + return this._limitedLocY; + } + + public set limitedLocationY(k: boolean) + { + this._limitedLocY = k; + } + + public get centeredLocX(): boolean + { + return this._centeredLocX; + } + + public set centeredLocX(k: boolean) + { + this._centeredLocX = k; + } + + public get centeredLocY(): boolean + { + return this._centeredLocY; + } + + public set centeredLocY(k: boolean) + { + this._centeredLocY = k; + } + + public get screenWd(): number + { + return this._screenWd; + } + + public set screenWd(k: number) + { + this._screenWd = k; + } + + public get screenHt(): number + { + return this._screenHt; + } + + public set screenHt(k: number) + { + this._screenHt = k; + } + + public get scale(): number + { + return this._scale; + } + + public set scale(k: number) + { + if(this._scale != k) + { + this._scale = k; + this._scaleChanged = true; + } + } + + public get roomWd(): number + { + return this._roomWd; + } + + public set roomWd(k: number) + { + this._roomWd = k; + } + + public get roomHt(): number + { + return this._roomHt; + } + + public set roomHt(k: number) + { + this._roomHt = k; + } + + public get geometryUpdateId(): number + { + return this._geometryUpdateId; + } + + public set geometryUpdateId(k: number) + { + this._geometryUpdateId = k; + } + + public get isMoving(): boolean + { + if(((!(this._targetLoc == null)) && (!(this._currentLoc == null)))) + { + return true; + } + return false; + } + + public set target(k: IVector3D) + { + let _local_2: Vector3d; + if(this._targetLoc == null) + { + this._targetLoc = new Vector3d(); + } + if((((!(this._targetLoc.x == k.x)) || (!(this._targetLoc.y == k.y))) || (!(this._targetLoc.z == k.z)))) + { + this._targetLoc.assign(k); + _local_2 = Vector3d.dif(this._targetLoc, this._currentLoc); + this._moveDistance = _local_2.length; + this._maintainPreviousMoveSpeed = true; + } + } + + public dispose(): void + { + this._targetLoc = null; + this._currentLoc = null; + } + + public initializeLocation(k: IVector3D): void + { + if(this._currentLoc != null) + { + return; + } + this._currentLoc = new Vector3d(); + this._currentLoc.assign(k); + } + + public resetLocation(k: IVector3D): void + { + if(this._currentLoc == null) + { + this._currentLoc = new Vector3d(); + } + this._currentLoc.assign(k); + } + + public update(k: number, _arg_2: number): void + { + let _local_3: Vector3d; + let _local_4: number; + let _local_5: number; + let _local_6: number; + let _local_7: number; + if((((this._followDuration > 0) && (!(this._targetLoc == null))) && (!(this._currentLoc == null)))) + { + if(this._scaleChanged) + { + this._scaleChanged = false; + this._currentLoc = this._targetLoc; + this._targetLoc = null; + return; + } + _local_3 = Vector3d.dif(this._targetLoc, this._currentLoc); + if(_local_3.length > this._moveDistance) + { + this._moveDistance = _local_3.length; + } + if(_local_3.length <= _arg_2) + { + this._currentLoc = this._targetLoc; + this._targetLoc = null; + this._previousMoveSpeed = 0; + } + else + { + _local_4 = Math.sin(((Math.PI * _local_3.length) / this._moveDistance)); + _local_5 = (_arg_2 * 0.5); + _local_6 = (this._moveDistance / RoomCamera.MOVE_SPEED_DENOMINATOR); + _local_7 = (_local_5 + ((_local_6 - _local_5) * _local_4)); + if(this._maintainPreviousMoveSpeed) + { + if(_local_7 < this._previousMoveSpeed) + { + _local_7 = this._previousMoveSpeed; + if(_local_7 > _local_3.length) + { + _local_7 = _local_3.length; + } + } + else + { + this._maintainPreviousMoveSpeed = false; + } + } + this._previousMoveSpeed = _local_7; + _local_3.divide(_local_3.length); + _local_3.multiply(_local_7); + this._currentLoc = Vector3d.sum(this._currentLoc, _local_3); + } + } + } + + public reset(): void + { + this._geometryUpdateId = -1; + } + + public activateFollowing(k: number): void + { + this._followDuration = k; + } +} diff --git a/submodules/renderer/src/nitro/room/utils/RoomData.ts b/submodules/renderer/src/nitro/room/utils/RoomData.ts new file mode 100644 index 0000000..c3a2629 --- /dev/null +++ b/submodules/renderer/src/nitro/room/utils/RoomData.ts @@ -0,0 +1,59 @@ +import { RoomMapData } from '../object'; + +export class RoomData +{ + private _roomId: number; + private _data: RoomMapData; + private _floorType: string; + private _wallType: string; + private _landscapeType: string; + + constructor(roomId: number, data: RoomMapData) + { + this._roomId = roomId; + this._data = data; + this._floorType = null; + this._wallType = null; + this._landscapeType = null; + } + + public get roomId(): number + { + return this._roomId; + } + + public get data(): RoomMapData + { + return this._data; + } + + public get floorType(): string + { + return this._floorType; + } + + public set floorType(k: string) + { + this._floorType = k; + } + + public get wallType(): string + { + return this._wallType; + } + + public set wallType(k: string) + { + this._wallType = k; + } + + public get landscapeType(): string + { + return this._landscapeType; + } + + public set landscapeType(k: string) + { + this._landscapeType = k; + } +} diff --git a/submodules/renderer/src/nitro/room/utils/RoomFurnitureData.ts b/submodules/renderer/src/nitro/room/utils/RoomFurnitureData.ts new file mode 100644 index 0000000..9520b9f --- /dev/null +++ b/submodules/renderer/src/nitro/room/utils/RoomFurnitureData.ts @@ -0,0 +1,118 @@ +import { IObjectData, IVector3D, Vector3d } from '../../../api'; + +export class RoomFurnitureData +{ + private _id: number; + private _typeId: number; + private _type: string; + private _location: Vector3d; + private _direction: Vector3d; + private _state: number; + private _data: IObjectData; + private _extra: number; + private _expiryTime: number; + private _usagePolicy: number; + private _ownerId: number; + private _ownerName: string; + private _synchronized: boolean; + private _realRoomObject: boolean; + private _sizeZ: number; + + constructor(id: number, typeId: number, type: string, location: IVector3D, direction: IVector3D, state: number, objectData: IObjectData, extra: number = NaN, expires: number = -1, usagePolicy: number = 0, ownerId: number = 0, ownerName: string = '', synchronized: boolean = true, realRoomObject: boolean = true, sizeZ: number = -1) + { + this._id = id; + this._typeId = typeId; + this._type = type; + this._state = state; + this._data = objectData; + this._extra = extra; + this._expiryTime = expires; + this._usagePolicy = usagePolicy; + this._ownerId = ownerId; + this._ownerName = ownerName; + this._synchronized = synchronized; + this._realRoomObject = realRoomObject; + this._sizeZ = sizeZ; + + this._location = new Vector3d(); + this._direction = new Vector3d(); + + this._location.assign(location); + this._direction.assign(direction); + } + + public get id(): number + { + return this._id; + } + + public get typeId(): number + { + return this._typeId; + } + + public get type(): string + { + return this._type; + } + + public get location(): IVector3D + { + return this._location; + } + + public get direction(): IVector3D + { + return this._direction; + } + + public get state(): number + { + return this._state; + } + + public get data(): IObjectData + { + return this._data; + } + + public get extra(): number + { + return this._extra; + } + + public get expiryTime(): number + { + return this._expiryTime; + } + + public get usagePolicy(): number + { + return this._usagePolicy; + } + + public get ownerId(): number + { + return this._ownerId; + } + + public get ownerName(): string + { + return this._ownerName; + } + + public get synchronized(): boolean + { + return this._synchronized; + } + + public get realRoomObject(): boolean + { + return this._realRoomObject; + } + + public get sizeZ(): number + { + return this._sizeZ; + } +} diff --git a/submodules/renderer/src/nitro/room/utils/RoomInstanceData.ts b/submodules/renderer/src/nitro/room/utils/RoomInstanceData.ts new file mode 100644 index 0000000..5d7aa42 --- /dev/null +++ b/submodules/renderer/src/nitro/room/utils/RoomInstanceData.ts @@ -0,0 +1,234 @@ +import { IFurnitureStackingHeightMap, ILegacyWallGeometry, ISelectedRoomObjectData, ITileObjectMap } from '../../../api'; +import { LegacyWallGeometry } from './LegacyWallGeometry'; +import { RoomCamera } from './RoomCamera'; +import { RoomFurnitureData } from './RoomFurnitureData'; +import { TileObjectMap } from './TileObjectMap'; + +export class RoomInstanceData +{ + private _roomId: number; + + private _modelName: string; + private _legacyGeometry: ILegacyWallGeometry; + private _tileObjectMap: ITileObjectMap; + private _roomCamera: RoomCamera; + private _selectedObject: ISelectedRoomObjectData; + private _placedObject: ISelectedRoomObjectData; + private _furnitureStackingHeightMap: IFurnitureStackingHeightMap; + + private _floorStack: Map; + private _wallStack: Map; + private _mouseButtonCursorOwners: string[]; + + constructor(roomId: number) + { + this._roomId = roomId; + + this._modelName = null; + this._legacyGeometry = new LegacyWallGeometry(); + this._tileObjectMap = null; + this._roomCamera = new RoomCamera(); + this._selectedObject = null; + this._placedObject = null; + this._furnitureStackingHeightMap = null; + + this._floorStack = new Map(); + this._wallStack = new Map(); + this._mouseButtonCursorOwners = []; + } + + public dispose(): void + { + return; + } + + public setModelName(name: string): void + { + this._modelName = name; + } + + public setSelectedObject(data: ISelectedRoomObjectData): void + { + if(this._selectedObject) + { + this._selectedObject.dispose(); + } + + this._selectedObject = data; + } + + public setPlacedObject(data: ISelectedRoomObjectData): void + { + if(this._placedObject) + { + this._placedObject.dispose(); + } + + this._placedObject = data; + } + + public setFurnitureStackingHeightMap(heightMap: IFurnitureStackingHeightMap): void + { + if(this._furnitureStackingHeightMap) this._furnitureStackingHeightMap.dispose(); + + this._furnitureStackingHeightMap = heightMap; + + if(this._tileObjectMap) this._tileObjectMap.dispose(); + + if(this._furnitureStackingHeightMap) + { + this._tileObjectMap = new TileObjectMap(this._furnitureStackingHeightMap.width, this._furnitureStackingHeightMap.height); + } + } + + public addPendingFurnitureFloor(data: RoomFurnitureData): void + { + if(!data) return; + + this._floorStack.delete(data.id); + this._floorStack.set(data.id, data); + } + + public removePendingFunitureFloor(id: number): RoomFurnitureData + { + const existing = this._floorStack.get(id); + + if(!existing) return null; + + this._floorStack.delete(id); + + return existing; + } + + public getPendingFurnitureFloor(id: number): RoomFurnitureData + { + const existing = this._floorStack.get(id); + + if(!existing) return null; + + this._floorStack.delete(id); + + return existing; + } + + public getNextPendingFurnitureFloor(): RoomFurnitureData + { + if(!this._floorStack.size) return null; + + const keys = this._floorStack.keys(); + + return this.getPendingFurnitureFloor(keys.next().value as number); + } + + public addPendingFurnitureWall(data: RoomFurnitureData): void + { + if(!data) return; + + this._wallStack.delete(data.id); + this._wallStack.set(data.id, data); + } + + public removePendingFurnitureWall(id: number): RoomFurnitureData + { + const existing = this._wallStack.get(id); + + if(!existing) return null; + + this._wallStack.delete(id); + + return existing; + } + + public getPendingFurnitureWall(id: number): RoomFurnitureData + { + const existing = this._wallStack.get(id); + + if(!existing) return null; + + this._wallStack.delete(id); + + return existing; + } + + public getNextPendingFurnitureWall(): RoomFurnitureData + { + if(!this._wallStack.size) return null; + + const keys = this._wallStack.keys(); + + return this.getPendingFurnitureWall(keys.next().value as number); + } + + public addButtonMouseCursorOwner(k: string): boolean + { + const _local_2 = this._mouseButtonCursorOwners.indexOf(k); + + if(_local_2 === -1) + { + this._mouseButtonCursorOwners.push(k); + + return true; + } + + return false; + } + + public removeButtonMouseCursorOwner(k: string): boolean + { + const _local_2 = this._mouseButtonCursorOwners.indexOf(k); + + if(_local_2 > -1) + { + this._mouseButtonCursorOwners.splice(_local_2, 1); + + return true; + } + + return false; + } + + public hasButtonMouseCursorOwners(): boolean + { + return this._mouseButtonCursorOwners.length > 0; + } + + public get roomId(): number + { + return this._roomId; + } + + public get modelName(): string + { + return this._modelName; + } + + public get legacyGeometry(): ILegacyWallGeometry + { + return this._legacyGeometry; + } + + public get tileObjectMap(): ITileObjectMap + { + return this._tileObjectMap; + } + + public get roomCamera(): RoomCamera + { + return this._roomCamera; + } + + public get selectedObject(): ISelectedRoomObjectData + { + return this._selectedObject; + } + + public get placedObject(): ISelectedRoomObjectData + { + return this._placedObject; + } + + public get furnitureStackingHeightMap(): IFurnitureStackingHeightMap + { + return this._furnitureStackingHeightMap; + } +} diff --git a/submodules/renderer/src/nitro/room/utils/RoomObjectBadgeImageAssetListener.ts b/submodules/renderer/src/nitro/room/utils/RoomObjectBadgeImageAssetListener.ts new file mode 100644 index 0000000..06618d3 --- /dev/null +++ b/submodules/renderer/src/nitro/room/utils/RoomObjectBadgeImageAssetListener.ts @@ -0,0 +1,23 @@ +import { IRoomObjectController } from '../../../api'; + +export class RoomObjectBadgeImageAssetListener +{ + private _object: IRoomObjectController; + private _groupBadge: boolean; + + constructor(object: IRoomObjectController, groupBadge: boolean) + { + this._object = object; + this._groupBadge = groupBadge; + } + + public get object(): IRoomObjectController + { + return this._object; + } + + public get groupBadge(): boolean + { + return this._groupBadge; + } +} diff --git a/submodules/renderer/src/nitro/room/utils/SelectedRoomObjectData.ts b/submodules/renderer/src/nitro/room/utils/SelectedRoomObjectData.ts new file mode 100644 index 0000000..e03af7e --- /dev/null +++ b/submodules/renderer/src/nitro/room/utils/SelectedRoomObjectData.ts @@ -0,0 +1,94 @@ +import { IObjectData, ISelectedRoomObjectData, IVector3D, Vector3d } from '../../../api'; + +export class SelectedRoomObjectData implements ISelectedRoomObjectData +{ + private _id: number = 0; + private _category: number = 0; + private _operation: string = ''; + private _loc: Vector3d = null; + private _dir: Vector3d = null; + private _typeId: number = 0; + private _instanceData: string = null; + private _stuffData: IObjectData = null; + private _state: number = -1; + private _animFrame: number = -1; + private _posture: string = null; + + constructor(id: number, category: number, operation: string, location: IVector3D, direction: IVector3D, typeId: number = 0, instanceData: string = null, stuffData: IObjectData = null, state: number = -1, frameNumber: number = -1, posture: string = null) + { + this._id = id; + this._category = category; + this._operation = operation; + this._loc = new Vector3d(); + this._loc.assign(location); + this._dir = new Vector3d(); + this._dir.assign(direction); + this._typeId = typeId; + this._instanceData = instanceData; + this._stuffData = stuffData; + this._state = state; + this._animFrame = frameNumber; + this._posture = posture; + } + + public get id(): number + { + return this._id; + } + + public get category(): number + { + return this._category; + } + + public get operation(): string + { + return this._operation; + } + + public get loc(): Vector3d + { + return this._loc; + } + + public get dir(): Vector3d + { + return this._dir; + } + + public get typeId(): number + { + return this._typeId; + } + + public get instanceData(): string + { + return this._instanceData; + } + + public get stuffData(): IObjectData + { + return this._stuffData; + } + + public get state(): number + { + return this._state; + } + + public get animFrame(): number + { + return this._animFrame; + } + + public get posture(): string + { + return this._posture; + } + + public dispose(): void + { + this._loc = null; + this._dir = null; + } +} diff --git a/submodules/renderer/src/nitro/room/utils/SpriteDataCollector.ts b/submodules/renderer/src/nitro/room/utils/SpriteDataCollector.ts new file mode 100644 index 0000000..bb844b8 --- /dev/null +++ b/submodules/renderer/src/nitro/room/utils/SpriteDataCollector.ts @@ -0,0 +1,453 @@ +import { Point, Rectangle } from '@pixi/math'; +import { IPlaneDrawingData, IPlaneVisualization, IRoomObjectSpriteVisualization, IRoomPlane, IRoomRenderingCanvas, RoomObjectCategory, RoomObjectSpriteData, Vector3d } from '../../../api'; +import { PixiApplicationProxy } from '../../../pixi-proxy'; +import { PlaneDrawingData } from '../object'; +import { RoomEngine } from '../RoomEngine'; + +export class SpriteDataCollector +{ + private static MANNEQUIN_MAGIC_X_OFFSET: number = 1; + private static MANNEQUIN_MAGIC_Y_OFFSET: number = -16; + private static AVATAR_WATER_EFFECT_MAGIC_Y_OFFSET: number = -52; + private static MAX_EXTERNAL_IMAGE_COUNT: number = 30; + + private maxZ: number; + private spriteCount: number = 0; + private externalImageCount: number = 0; + + private static addMannequinSprites(k: RoomObjectSpriteData[], _arg_2: RoomEngine): RoomObjectSpriteData[] + { + const datas: RoomObjectSpriteData[] = []; + + for(const data of k) + { + if(!data) continue; + + if((data.type === 'boutique_mannequin1') && (data.name.indexOf('mannequin_') === 0)) + { + const roomObject = _arg_2.getRoomObject(_arg_2.activeRoomId, data.objectId, RoomObjectCategory.FLOOR); + + if(roomObject) + { + const spriteList = (roomObject.visualization as IRoomObjectSpriteVisualization).getSpriteList(); + + if(spriteList) + { + for(const sprite of spriteList) + { + sprite.x = (sprite.x + ((data.x + (data.width / 2)) + SpriteDataCollector.MANNEQUIN_MAGIC_X_OFFSET)); + sprite.y = (sprite.y + ((data.y + data.height) + SpriteDataCollector.MANNEQUIN_MAGIC_Y_OFFSET)); + sprite.z = (sprite.z + data.z); + datas.push(sprite); + } + } + } + } + else + { + datas.push(data); + } + } + + return datas; + } + + private static sortSpriteDataObjects(k: RoomObjectSpriteData, _arg_2: RoomObjectSpriteData): number + { + if(k.z < _arg_2.z) return 1; + + if(k.z > _arg_2.z) return -1; + + return -1; + } + + private static isSpriteInViewPort(k: RoomObjectSpriteData, _arg_2: Rectangle, _arg_3: IRoomRenderingCanvas): boolean + { + return true; + // var _local_4 = new Rectangle((k.x + _arg_3.screenOffsetX), (k.y + _arg_3.screenOffsetY), k.width, k.height); + // // intersects + // return _local_4.contains(_arg_2.x, _arg_2.y); + } + + private static sortQuadPoints(k: Point, _arg_2: Point, _arg_3: Point, _arg_4: Point): Point[] + { + const points: Point[] = []; + + if(k.x == _arg_2.x) + { + points.push(k, _arg_3, _arg_2, _arg_4); + } + else + { + if(k.x == _arg_3.x) + { + points.push(k, _arg_2, _arg_3, _arg_4); + } + else + { + if((((_arg_2.x < k.x) && (_arg_2.y > k.y)) || ((_arg_2.x > k.x) && (_arg_2.y < k.y)))) + { + points.push(k, _arg_3, _arg_2, _arg_4); + } + else + { + points.push(k, _arg_2, _arg_3, _arg_4); + } + } + } + + if(points[0].x < points[1].x) + { + let _local_6 = points[0]; + + points[0] = points[1]; + points[1] = _local_6; + + _local_6 = points[2]; + + points[2] = points[3]; + points[3] = _local_6; + } + + if(points[0].y < points[2].y) + { + let _local_6 = points[0]; + + points[0] = points[2]; + points[2] = _local_6; + + _local_6 = points[1]; + + points[1] = points[3]; + points[3] = _local_6; + } + + return points; + } + + + public getFurniData(k: Rectangle, _arg_2: IRoomRenderingCanvas, _arg_3: RoomEngine, _arg_4: number): string + { + const _local_5: Object[] = []; + let _local_6 = _arg_2.getSortableSpriteList(); + + const _local_7 = _arg_3.getRoomObjects(_arg_3.activeRoomId, RoomObjectCategory.UNIT); + + for(const _local_8 of _local_7) + { + if(_local_8.id !== _arg_4) + { + const _local_11 = (_local_8.visualization as IRoomObjectSpriteVisualization).getSpriteList(); + + if(_local_11) + { + let _local_12 = 0; + let _local_13 = 0; + + for(const _local_14 of _local_6) + { + if(_local_14.name === ('avatar_' + _local_8.id)) + { + _local_12 = _local_14.z; + _local_13 = ((_local_14.y + _local_14.height) - (_arg_2.geometry.scale / 4)); + + break; + } + } + + const _local_15 = _arg_3.getRoomObjectScreenLocation(_arg_3.activeRoomId, _local_8.id, RoomObjectCategory.UNIT, _arg_2.id); + + if(_local_15) + { + if(_local_13 === 0) _local_13 = _local_15.y; + + for(const _local_16 of _local_11) + { + _local_16.x = (_local_16.x + (_local_15.x - _arg_2.screenOffsetX)); + _local_16.y = (_local_16.y + _local_13); + _local_16.z = (_local_16.z + _local_12); + + if(((_local_16.name.indexOf('h_std_fx29_') === 0) || (_local_16.name.indexOf('h_std_fx185_') === 0))) + { + _local_16.y = (_local_16.y + SpriteDataCollector.AVATAR_WATER_EFFECT_MAGIC_Y_OFFSET); + } + + _local_6.push(_local_16); + } + } + } + } + } + + _local_6 = SpriteDataCollector.addMannequinSprites(_local_6, _arg_3); + _local_6.sort(SpriteDataCollector.sortSpriteDataObjects); + + for(const _local_9 of _local_6) + { + if((((((!(_local_9.name === null)) && (_local_9.name.length > 0)) && (!(_local_9.name.indexOf('tile_cursor_') === 0))) && (SpriteDataCollector.isSpriteInViewPort(_local_9, k, _arg_2))) && ((_arg_4 < 0) || (!(_local_9.objectId == _arg_4))))) + { + _local_5.push(this.getSpriteDataObject(_local_9, k, _arg_2, _arg_3)); + + if(!this.maxZ) this.maxZ = _local_9.z; + + this.spriteCount++; + } + } + + return JSON.stringify(_local_5); + } + + public getRoomRenderingModifiers(k: RoomEngine): string + { + return JSON.stringify(new Object()); + } + + private getSpriteDataObject(k: RoomObjectSpriteData, _arg_2: Rectangle, _arg_3: IRoomRenderingCanvas, _arg_4: RoomEngine): Object + { + let _local_7: string = null; + let _local_9: string[] = []; + + const _local_5: { + name?: string, + x?: number, + y?: number, + z?: number, + alpha?: number, + flipH?: boolean, + skew?: number, + frame?: boolean, + color?: number, + blendMode?: string, + width?: number, + height?: number, + posture?: string + } = {}; + + let _local_6 = k.name; + + if(k.name.indexOf('@') !== -1) + { + _local_9 = k.name.split('@'); + _local_6 = _local_9[0]; + _local_7 = _local_9[1]; + } + + // if(((_local_7) && (k.type))) + // { + // const _local_10 = _arg_4.roomContentLoader.getCollection(k.type); + + // if(_local_10) + // { + // const _local_11 = _local_10.getPalette(_local_7); + + // if (((!(_local_11 == null)) && (!(_local_11.@source == null)))) + // { + // _local_5.paletteSourceName = (_local_11.@source + ''); + // } + // } + // } + + // var _local_8: string = _arg_4.configuration.getProperty('image.library.url'); + // _local_6 = _local_6.replace('%image.library.url%', _local_8); + // if (_local_6.indexOf('%group.badge.url%') != -1) + // { + // _local_12 = _arg_4.configuration.getProperty('group.badge.url'); + // _local_6 = _local_6.replace('%group.badge.url%', ''); + // _local_13 = _local_12.replace('%imagerdata%', _local_6); + // _local_6 = _local_13; + // } + + _local_5.name = _local_6; + _local_5.x = (k.x - _arg_2.x); + _local_5.y = (k.y - _arg_2.y); + _local_5.x = (_local_5.x + _arg_3.screenOffsetX); + _local_5.y = (_local_5.y + _arg_3.screenOffsetY); + _local_5.z = k.z; + + if(k.alpha && (k.alpha.toString() !== '255')) _local_5.alpha = k.alpha; + + if(k.flipH) _local_5.flipH = k.flipH; + + if(k.skew) _local_5.skew = k.skew; + + if(k.frame) _local_5.frame = k.frame; + + if(k.color && (k.color.length > 0)) _local_5.color = parseInt(k.color); + + if(k.blendMode && (k.blendMode !== 'normal')) _local_5.blendMode = k.blendMode; + + if(_local_6.indexOf('http') === 0) + { + _local_5.width = k.width; + _local_5.height = k.height; + + this.externalImageCount++; + + if(this.externalImageCount > SpriteDataCollector.MAX_EXTERNAL_IMAGE_COUNT) _local_5.name = 'box'; + } + + if(k.posture) _local_5.posture = k.posture; + + return _local_5; + } + + private makeBackgroundPlane(k: Rectangle, _arg_2: number, _arg_3: IPlaneDrawingData[]): PlaneDrawingData + { + const _local_4 = new Point(0, 0); + const _local_5 = new Point(k.width, 0); + const _local_6 = new Point(0, k.height); + const _local_7 = new Point(k.width, k.height); + const _local_8 = SpriteDataCollector.sortQuadPoints(_local_4, _local_5, _local_6, _local_7); + + let _local_9 = 0; + + if(_arg_3.length > 0) + { + _local_9 = _arg_3[0].z; + + if(this.maxZ) _local_9 = Math.max(this.maxZ, _local_9); + } + else + { + _local_9 = ((this.maxZ) ? this.maxZ : 0); + } + + _local_9 = (_local_9 + ((this.spriteCount * 1.776104) + (_arg_3.length * 2.31743))); + + const _local_10 = new PlaneDrawingData(null, _arg_2); + + _local_10.cornerPoints = _local_8; + _local_10.z = _local_9; + + return _local_10; + } + + private sortRoomPlanes(k: IRoomPlane[], _arg_2: IRoomRenderingCanvas, _arg_3: RoomEngine): { plane: IRoomPlane, z: number }[] + { + const _local_4: Map = new Map(); + + let _local_5 = 1; + + if(this.maxZ) + { + _local_5 = (_local_5 + this.maxZ); + } + + for(const _local_6 of k) + { + const _local_10 = { + plane: _local_6, + z: _local_5 + }; + + _local_4.set(_local_6.uniqueId, _local_10); + } + + const sprites = _arg_2.getPlaneSortableSprites(); + + sprites.sort((a, b) => + { + return (b.z - a.z); + }); + + sprites.reverse(); + + let _local_8: { plane: IRoomPlane, z: number }[] = []; + + for(const sprite of sprites) + { + const objectSprite = sprite.sprite; + + if(objectSprite) + { + const _local_10 = _local_4.get(objectSprite.id); + + if(_local_10) + { + _local_4.delete(objectSprite.id); + + _local_10.z = sprite.z; + + _local_8.push(_local_10); + } + } + } + + _local_8 = _local_8.concat(Array.from(_local_4.values())); + + return _local_8; + } + + public getRoomPlanes(k: Rectangle, _arg_2: IRoomRenderingCanvas, _arg_3: RoomEngine, _arg_4: number): IPlaneDrawingData[] + { + const _local_5: IPlaneDrawingData[] = []; + + const roomObject = _arg_3.getRoomObject(_arg_3.activeRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM); + const visualization = (roomObject.visualization as unknown as IPlaneVisualization); + + if(visualization) + { + const _local_8 = _arg_2.geometry; + const _local_9 = this.sortRoomPlanes(visualization.planes, _arg_2, _arg_3); + const _local_10 = PixiApplicationProxy.instance.stage; + + for(const _local_11 of _local_9) + { + const _local_12 = _local_11.plane; + const _local_13: Point[] = []; + + const _local_14 = Vector3d.sum(_local_12.location, _local_12.leftSide); + const _local_15 = _local_8.getScreenPoint(_local_12.location); + const _local_16 = _local_8.getScreenPoint(_local_14); + const _local_17 = _local_8.getScreenPoint(Vector3d.sum(_local_12.location, _local_12.rightSide)); + const _local_18 = _local_8.getScreenPoint(Vector3d.sum(_local_14, _local_12.rightSide)); + + _local_13.push(_local_15, _local_16, _local_17, _local_18); + + let _local_19 = 0; + let _local_20 = 0; + + for(const _local_21 of _local_13) + { + _local_21.x += (_local_10.width / 2); + _local_21.y += (_local_10.height / 2); + + _local_21.x += _arg_2.screenOffsetX; + _local_21.y += _arg_2.screenOffsetY; + + _local_21.x += -(k.x); + _local_21.y += -(k.y); + + if(_local_21.x < 0) _local_19--; + + else if(_local_21.x >= k.width) _local_19++; + + if(_local_21.y < 0) _local_20--; + + else if(_local_21.y >= k.height) _local_20++; + } + + if(((Math.abs(_local_19) === 4) || (Math.abs(_local_20) === 4))) + { + // + } + else + { + const _local_22 = SpriteDataCollector.sortQuadPoints(_local_15, _local_16, _local_17, _local_18); + + for(const _local_23 of _local_12.getDrawingDatas(_local_8)) + { + _local_23.cornerPoints = _local_22; + _local_23.z = _local_11.z; + + _local_5.push(_local_23); + } + } + } + + _local_5.unshift(this.makeBackgroundPlane(k, _arg_4, _local_5)); + } + + return _local_5; + } +} diff --git a/submodules/renderer/src/nitro/room/utils/TileObjectMap.ts b/submodules/renderer/src/nitro/room/utils/TileObjectMap.ts new file mode 100644 index 0000000..ac09d86 --- /dev/null +++ b/submodules/renderer/src/nitro/room/utils/TileObjectMap.ts @@ -0,0 +1,121 @@ +import { IRoomObject, ITileObjectMap, NitroLogger, RoomObjectVariable } from '../../../api'; + +export class TileObjectMap implements ITileObjectMap +{ + private _tileObjectMap: Map>; + private _width: number; + private _height: number; + + constructor(k: number, _arg_2: number) + { + this._tileObjectMap = new Map(); + + let index = 0; + + while(index < _arg_2) + { + this._tileObjectMap.set(index, new Map()); + + index++; + } + + this._width = k; + this._height = _arg_2; + } + + public clear(): void + { + for(const k of this._tileObjectMap.values()) + { + if(!k) continue; + + k.clear(); + } + + this._tileObjectMap.clear(); + } + + public populate(k: IRoomObject[]): void + { + this.clear(); + + for(const _local_2 of k) this.addRoomObject(_local_2); + } + + public dispose(): void + { + this._tileObjectMap = null; + this._width = 0; + this._height = 0; + } + + public getObjectIntTile(k: number, _arg_2: number): IRoomObject + { + if((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height)) + { + const existing = this._tileObjectMap.get(_arg_2); + + if(existing) return existing.get(k); + } + + return null; + } + + public setObjectInTile(k: number, _arg_2: number, _arg_3: IRoomObject): void + { + if(!_arg_3.isReady) + { + NitroLogger.log('Assigning non initialized object to tile object map!'); + + return; + } + + if((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height)) + { + const existing = this._tileObjectMap.get(_arg_2); + + if(existing) existing.set(k, _arg_3); + } + } + + public addRoomObject(k: IRoomObject): void + { + if(!k || !k.model || !k.isReady) return; + + const location = k.getLocation(); + const direction = k.getDirection(); + + if(!location || !direction) return; + + let sizeX = k.model.getValue(RoomObjectVariable.FURNITURE_SIZE_X); + let sizeY = k.model.getValue(RoomObjectVariable.FURNITURE_SIZE_Y); + + if(sizeX < 1) sizeX = 1; + if(sizeY < 1) sizeY = 1; + + const directionNumber = ((Math.trunc((direction.x + 45)) % 360) / 90); + + if((directionNumber === 1) || (directionNumber === 3)) [sizeX, sizeY] = [sizeY, sizeX]; + + let y = location.y; + + while(y < (location.y + sizeY)) + { + let x = location.x; + + while(x < (location.x + sizeX)) + { + const roomObject = this.getObjectIntTile(x, y); + + if((!(roomObject)) || ((!(roomObject === k)) && (roomObject.getLocation().z <= location.z))) + { + this.setObjectInTile(x, y, k); + } + + x++; + } + + y++; + } + } +} diff --git a/submodules/renderer/src/nitro/room/utils/index.ts b/submodules/renderer/src/nitro/room/utils/index.ts new file mode 100644 index 0000000..82645dc --- /dev/null +++ b/submodules/renderer/src/nitro/room/utils/index.ts @@ -0,0 +1,10 @@ +export * from './FurnitureStackingHeightMap'; +export * from './LegacyWallGeometry'; +export * from './RoomCamera'; +export * from './RoomData'; +export * from './RoomFurnitureData'; +export * from './RoomInstanceData'; +export * from './RoomObjectBadgeImageAssetListener'; +export * from './SelectedRoomObjectData'; +export * from './SpriteDataCollector'; +export * from './TileObjectMap'; diff --git a/submodules/renderer/src/nitro/session/GroupInformationManager.ts b/submodules/renderer/src/nitro/session/GroupInformationManager.ts new file mode 100644 index 0000000..6dbb249 --- /dev/null +++ b/submodules/renderer/src/nitro/session/GroupInformationManager.ts @@ -0,0 +1,67 @@ +import { IDisposable, IGroupInformationManager, IMessageEvent } from '../../api'; +import { GetHabboGroupBadgesMessageComposer, HabboGroupBadgesMessageEvent, RoomReadyMessageEvent } from '../communication'; +import { SessionDataManager } from './SessionDataManager'; + +export class GroupInformationManager implements IDisposable, IGroupInformationManager +{ + private _sessionDataManager: SessionDataManager; + private _groupBadges: Map; + + private _messages: IMessageEvent[]; + + constructor(sessionDataManager: SessionDataManager) + { + this._sessionDataManager = sessionDataManager; + this._groupBadges = new Map(); + } + + public init(): void + { + if(this._sessionDataManager && this._sessionDataManager.communication) + { + this._messages = [ + new RoomReadyMessageEvent(this.onRoomReadyMessageEvent.bind(this)), + new HabboGroupBadgesMessageEvent(this.onGroupBadgesEvent.bind(this)) + ]; + + for(const message of this._messages) this._sessionDataManager.communication.registerMessageEvent(message); + } + } + + public dispose(): void + { + if(this.disposed) return; + + if(this._messages && this._messages.length) + { + for(const message of this._messages) this._sessionDataManager.communication.removeMessageEvent(message); + + this._messages = null; + } + + this._groupBadges = null; + this._sessionDataManager = null; + } + + private onRoomReadyMessageEvent(event: RoomReadyMessageEvent): void + { + this._sessionDataManager.send(new GetHabboGroupBadgesMessageComposer()); + } + + private onGroupBadgesEvent(event: HabboGroupBadgesMessageEvent): void + { + const parser = event.getParser(); + + for(const [groupId, badgeId] of parser.badges.entries()) this._groupBadges.set(groupId, badgeId); + } + + public getGroupBadge(groupId: number): string + { + return this._groupBadges.get(groupId); + } + + public get disposed(): boolean + { + return !!this._sessionDataManager; + } +} diff --git a/submodules/renderer/src/nitro/session/HabboClubLevelEnum.ts b/submodules/renderer/src/nitro/session/HabboClubLevelEnum.ts new file mode 100644 index 0000000..3986c8e --- /dev/null +++ b/submodules/renderer/src/nitro/session/HabboClubLevelEnum.ts @@ -0,0 +1,6 @@ +export class HabboClubLevelEnum +{ + public static NO_CLUB: number = 0; + public static CLUB: number = 1; + public static VIP: number = 2; +} diff --git a/submodules/renderer/src/nitro/session/IgnoredUsersManager.ts b/submodules/renderer/src/nitro/session/IgnoredUsersManager.ts new file mode 100644 index 0000000..2dfcffe --- /dev/null +++ b/submodules/renderer/src/nitro/session/IgnoredUsersManager.ts @@ -0,0 +1,124 @@ +import { IDisposable, IIgnoredUsersManager, IMessageEvent } from '../../api'; +import { GetIgnoredUsersComposer, IgnoredUsersEvent, IgnoreResultEvent, IgnoreUserComposer, IgnoreUserIdComposer, UnignoreUserComposer } from '../communication'; +import { SessionDataManager } from './SessionDataManager'; + +export class IgnoredUsersManager implements IDisposable, IIgnoredUsersManager +{ + private _sessionDataManager: SessionDataManager; + private _ignoredUsers: string[]; + + private _messages: IMessageEvent[]; + + constructor(sessionDataManager: SessionDataManager) + { + this._sessionDataManager = sessionDataManager; + this._ignoredUsers = []; + } + + public init(): void + { + if(this._sessionDataManager && this._sessionDataManager.communication) + { + this._messages = [ + new IgnoredUsersEvent(this.onIgnoredUsersEvent.bind(this)), + new IgnoreResultEvent(this.onIgnoreResultEvent.bind(this)) + ]; + + for(const message of this._messages) this._sessionDataManager.communication.registerMessageEvent(message); + } + } + + public dispose(): void + { + if(this.disposed) return; + + if(this._messages && this._messages.length) + { + for(const message of this._messages) this._sessionDataManager.communication.removeMessageEvent(message); + + this._messages = null; + } + + this._sessionDataManager = null; + } + + public requestIgnoredUsers(): void + { + this._sessionDataManager.send(new GetIgnoredUsersComposer(this._sessionDataManager.userName)); + } + + private onIgnoredUsersEvent(event: IgnoredUsersEvent): void + { + if(!event) return; + + const parser = event.getParser(); + + if(!parser) return; + + this._ignoredUsers = parser.ignoredUsers; + } + + private onIgnoreResultEvent(event: IgnoreResultEvent): void + { + if(!event) return; + + const parser = event.getParser(); + + if(!parser) return; + + const name = parser.name; + + switch(parser.result) + { + case 0: + return; + case 1: + this.addUserToIgnoreList(name); + return; + case 2: + this.addUserToIgnoreList(name); + this._ignoredUsers.shift(); + return; + case 3: + this.removeUserFromIgnoreList(name); + return; + } + } + + private addUserToIgnoreList(name: string): void + { + if(this._ignoredUsers.indexOf(name) < 0) this._ignoredUsers.push(name); + } + + private removeUserFromIgnoreList(name: string): void + { + const index = this._ignoredUsers.indexOf(name); + + if(index >= 0) this._ignoredUsers.splice(index, 1); + } + + public ignoreUserId(id: number): void + { + this._sessionDataManager.send(new IgnoreUserIdComposer(id)); + } + + public ignoreUser(name: string): void + { + this._sessionDataManager.send(new IgnoreUserComposer(name)); + } + + public unignoreUser(name: string): void + { + this._sessionDataManager.send(new UnignoreUserComposer(name)); + } + + public isIgnored(name: string): boolean + { + return (this._ignoredUsers.indexOf(name) >= 0); + } + + public get disposed(): boolean + { + return !!this._sessionDataManager; + } +} diff --git a/submodules/renderer/src/nitro/session/RoomPetData.ts b/submodules/renderer/src/nitro/session/RoomPetData.ts new file mode 100644 index 0000000..40c38f4 --- /dev/null +++ b/submodules/renderer/src/nitro/session/RoomPetData.ts @@ -0,0 +1,297 @@ +import { IRoomPetData } from '../../api'; + +export class RoomPetData implements IRoomPetData +{ + private _id: number; + private _level: number; + private _maximumLevel: number; + private _experience: number; + private _levelExperienceGoal: number; + private _energy: number; + private _maximumEnergy: number; + private _happyness: number; + private _maximumHappyness: number; + private _ownerId: number; + private _ownerName: string; + private _respect: number; + private _age: number; + private _unknownRarity: number; + private _saddle: boolean; + private _rider: boolean; + private _breedable: boolean; + private _skillThresholds: number[]; + private _publiclyRideable: number; + private _fullyGrown: boolean; + private _dead: boolean; + private _maximumTimeToLive: number; + private _remainingTimeToLive: number; + private _remainingGrowTime: number; + private _rarityLevel: number; + private _publiclyBreedable: boolean; + private _adultLevel: number = 7; + + public get id(): number + { + return this._id; + } + + public set id(k: number) + { + this._id = k; + } + + public get level(): number + { + return this._level; + } + + public set level(level: number) + { + this._level = level; + } + + public get maximumLevel(): number + { + return this._maximumLevel; + } + + public set maximumLevel(k: number) + { + this._maximumLevel = k; + } + + public get experience(): number + { + return this._experience; + } + + public set experience(experience: number) + { + this._experience = experience; + } + + public get levelExperienceGoal(): number + { + return this._levelExperienceGoal; + } + + public set levelExperienceGoal(k: number) + { + this._levelExperienceGoal = k; + } + + public get energy(): number + { + return this._energy; + } + + public set energy(energy: number) + { + this._energy = energy; + } + + public get maximumEnergy(): number + { + return this._maximumEnergy; + } + + public set maximumEnergy(k: number) + { + this._maximumEnergy = k; + } + + public get happyness(): number + { + return this._happyness; + } + + public set happyness(k: number) + { + this._happyness = k; + } + + public get maximumHappyness(): number + { + return this._maximumHappyness; + } + + public set maximumHappyness(k: number) + { + this._maximumHappyness = k; + } + + public get ownerId(): number + { + return this._ownerId; + } + + public set ownerId(k: number) + { + this._ownerId = k; + } + + public get ownerName(): string + { + return this._ownerName; + } + + public set ownerName(ownerName: string) + { + this._ownerName = ownerName; + } + + public get respect(): number + { + return this._respect; + } + + public set respect(k: number) + { + this._respect = k; + } + + public get age(): number + { + return this._age; + } + + public set age(age: number) + { + this._age = age; + } + + public get unknownRarity(): number + { + return this._unknownRarity; + } + + public set unknownRarity(k: number) + { + this._unknownRarity = k; + } + + public get saddle(): boolean + { + return this._saddle; + } + + public set saddle(k: boolean) + { + this._saddle = k; + } + + public get rider(): boolean + { + return this._rider; + } + + public set rider(k: boolean) + { + this._rider = k; + } + + public get skillTresholds(): number[] + { + return this._skillThresholds; + } + + public set skillTresholds(k: number[]) + { + this._skillThresholds = k; + } + + public get publiclyRideable(): number + { + return this._publiclyRideable; + } + + public set publiclyRideable(k: number) + { + this._publiclyRideable = k; + } + + public get breedable(): boolean + { + return this._breedable; + } + + public set breedable(k: boolean) + { + this._breedable = k; + } + + public get fullyGrown(): boolean + { + return this._fullyGrown; + } + + public set fullyGrown(k: boolean) + { + this._fullyGrown = k; + } + + public get dead(): boolean + { + return this._dead; + } + + public set dead(k: boolean) + { + this._dead = k; + } + + public get rarityLevel(): number + { + return this._rarityLevel; + } + + public set rarityLevel(rarityLevel: number) + { + this._rarityLevel = rarityLevel; + } + + public get maximumTimeToLive(): number + { + return this._maximumTimeToLive; + } + + public set maximumTimeToLive(k: number) + { + this._maximumTimeToLive = k; + } + + public get remainingTimeToLive(): number + { + return this._remainingTimeToLive; + } + + public set remainingTimeToLive(k: number) + { + this._remainingTimeToLive = k; + } + + public get remainingGrowTime(): number + { + return this._remainingGrowTime; + } + + public set remainingGrowTime(k: number) + { + this._remainingGrowTime = k; + } + + public get publiclyBreedable(): boolean + { + return this._publiclyBreedable; + } + + public set publiclyBreedable(k: boolean) + { + this._publiclyBreedable = k; + } + + public get adultLevel(): number + { + return this._adultLevel; + } +} diff --git a/submodules/renderer/src/nitro/session/RoomSession.ts b/submodules/renderer/src/nitro/session/RoomSession.ts new file mode 100644 index 0000000..681895b --- /dev/null +++ b/submodules/renderer/src/nitro/session/RoomSession.ts @@ -0,0 +1,463 @@ +import { IConnection, IRoomSession, RoomControllerLevel, RoomTradingLevelEnum } from '../../api'; +import { Disposable } from '../../core'; +import { RoomSessionEvent } from '../../events'; +import { BotRemoveComposer, ChangeQueueMessageComposer, CompostPlantMessageComposer, FurnitureMultiStateComposer, GetPetCommandsComposer, HarvestPetMessageComposer, MoodlightSettingsComposer, MoodlightSettingsSaveComposer, MoodlightTogggleStateComposer, NewUserExperienceScriptProceedComposer, OpenPetPackageMessageComposer, OpenPresentComposer, PeerUsersClassificationMessageComposer, PetMountComposer, PetRemoveComposer, PollAnswerComposer, PollRejectComposer, PollStartComposer, RemovePetSaddleComposer, RoomAmbassadorAlertComposer, RoomBanUserComposer, RoomDoorbellAccessComposer, RoomEnterComposer, RoomGiveRightsComposer, RoomKickUserComposer, RoomModerationSettings, RoomMuteUserComposer, RoomTakeRightsComposer, RoomUnitActionComposer, RoomUnitChatComposer, RoomUnitChatShoutComposer, RoomUnitChatWhisperComposer, RoomUnitDanceComposer, RoomUnitPostureComposer, RoomUnitSignComposer, RoomUnitTypingStartComposer, RoomUnitTypingStopComposer, RoomUsersClassificationMessageComposer, SetClothingChangeDataMessageComposer, TogglePetBreedingComposer, TogglePetRidingComposer, UsePetProductComposer, UserMottoComposer, VotePollCounterMessageComposer } from '../communication'; +import { UserDataManager } from './UserDataManager'; + +export class RoomSession extends Disposable implements IRoomSession +{ + private _connection: IConnection; + private _userData: UserDataManager; + + private _roomId: number; + private _password: string; + private _state: string; + private _tradeMode: number; + private _doorMode: number; + private _allowPets: boolean; + private _controllerLevel: number; + private _ownRoomIndex: number; + private _isGuildRoom: boolean; + private _isRoomOwner: boolean; + private _isDecorating: boolean; + private _isSpectator: boolean; + + private _moderationSettings: RoomModerationSettings; + + constructor() + { + super(); + + this._connection = null; + this._userData = new UserDataManager(); + + this._roomId = 0; + this._password = null; + this._state = RoomSessionEvent.CREATED; + this._tradeMode = RoomTradingLevelEnum.NO_TRADING; + this._doorMode = 0; + this._controllerLevel = RoomControllerLevel.NONE; + this._ownRoomIndex = -1; + this._isGuildRoom = false; + this._isRoomOwner = false; + this._isDecorating = false; + this._isSpectator = false; + + this._moderationSettings = null; + } + + protected onDispose(): void + { + if(this._userData) + { + this._userData.dispose(); + + this._userData = null; + } + + this._connection = null; + } + + public setConnection(connection: IConnection): void + { + if(this._connection || !connection) return; + + this._connection = connection; + + if(this._userData) this._userData.setConnection(connection); + } + + public setControllerLevel(level: number): void + { + if((level >= RoomControllerLevel.NONE) && (level <= RoomControllerLevel.MODERATOR)) + { + this._controllerLevel = level; + + return; + } + + this._controllerLevel = RoomControllerLevel.NONE; + } + + public setOwnRoomIndex(roomIndex: number): void + { + this._ownRoomIndex = roomIndex; + } + + public setRoomOwner(): void + { + this._isRoomOwner = true; + } + + public start(): boolean + { + if(this._state !== RoomSessionEvent.CREATED || !this._connection) return false; + + this._state = RoomSessionEvent.STARTED; + + return this.enterRoom(); + } + + private enterRoom(): boolean + { + if(!this._connection) return false; + + this._connection.send(new RoomEnterComposer(this._roomId, this._password)); + + return true; + } + + public reset(roomId: number): void + { + if(roomId === this._roomId) return; + + this._roomId = roomId; + } + + public sendChatMessage(text: string, styleId: number): void + { + this._connection.send(new RoomUnitChatComposer(text, styleId)); + } + + public sendShoutMessage(text: string, styleId: number): void + { + this._connection.send(new RoomUnitChatShoutComposer(text, styleId)); + } + + public sendWhisperMessage(recipientName: string, text: string, styleId: number): void + { + this._connection.send(new RoomUnitChatWhisperComposer(recipientName, text, styleId)); + } + + public sendChatTypingMessage(isTyping: boolean): void + { + if(isTyping) this._connection.send(new RoomUnitTypingStartComposer()); + else this._connection.send(new RoomUnitTypingStopComposer()); + } + + public sendMottoMessage(motto: string): void + { + this._connection.send(new UserMottoComposer(motto)); + } + + public sendDanceMessage(danceId: number): void + { + this._connection.send(new RoomUnitDanceComposer(danceId)); + } + + public sendExpressionMessage(expression: number): void + { + this._connection.send(new RoomUnitActionComposer(expression)); + } + + public sendSignMessage(sign: number): void + { + if((sign < 0) || (sign > 17)) return; + + this._connection.send(new RoomUnitSignComposer(sign)); + } + + public sendPostureMessage(posture: number): void + { + this._connection.send(new RoomUnitPostureComposer(posture)); + } + + public sendDoorbellApprovalMessage(userName: string, flag: boolean): void + { + this._connection.send(new RoomDoorbellAccessComposer(userName, flag)); + } + + public sendAmbassadorAlertMessage(userId: number): void + { + this._connection.send(new RoomAmbassadorAlertComposer(userId)); + } + + public sendKickMessage(userId: number): void + { + this._connection.send(new RoomKickUserComposer(userId)); + } + + public sendMuteMessage(userId: number, minutes: number): void + { + this._connection.send(new RoomMuteUserComposer(userId, minutes, this._roomId)); + } + + public sendBanMessage(userId: number, type: string): void + { + this._connection.send(new RoomBanUserComposer(userId, this._roomId, type)); + } + + public sendGiveRightsMessage(userId: number): void + { + this._connection.send(new RoomGiveRightsComposer(userId)); + } + + public sendTakeRightsMessage(userId: number): void + { + this._connection.send(new RoomTakeRightsComposer(userId)); + } + + public sendPollStartMessage(pollId: number): void + { + this._connection.send(new PollStartComposer(pollId)); + } + + public sendPollRejectMessage(pollId: number): void + { + this._connection.send(new PollRejectComposer(pollId)); + } + + public sendPollAnswerMessage(pollId: number, questionId: number, answers: string[]): void + { + this._connection.send(new PollAnswerComposer(pollId, questionId, answers)); + } + + public sendPeerUsersClassificationMessage(userClassType: string): void + { + this._connection.send(new PeerUsersClassificationMessageComposer(userClassType)); + } + + public sendOpenPetPackageMessage(objectId: number, petName: string): void + { + this._connection.send(new OpenPetPackageMessageComposer(objectId, petName)); + } + + public sendRoomUsersClassificationMessage(userClassType: string): void + { + this._connection.send(new RoomUsersClassificationMessageComposer(userClassType)); + } + + public updateMoodlightData(id: number, effectId: number, color: number, brightness: number, apply: boolean): void + { + let colorString = '000000' + color.toString(16).toUpperCase(); + colorString = '#' + colorString.substring((colorString.length - 6)); + + this.connection.send(new MoodlightSettingsSaveComposer(id, effectId, colorString, brightness, apply)); + } + + public toggleMoodlightState(): void + { + this.connection.send(new MoodlightTogggleStateComposer()); + } + + public pickupPet(id: number): void + { + if(!this._connection) return; + + this._connection.send(new PetRemoveComposer(id)); + } + + public pickupBot(id: number): void + { + if(!this._connection) return; + + this._connection.send(new BotRemoveComposer(id)); + } + + public requestMoodlightSettings(): void + { + if(!this._connection) return; + + this._connection.send(new MoodlightSettingsComposer()); + } + + public openGift(objectId: number): void + { + this._connection.send(new OpenPresentComposer(objectId)); + } + + public mountPet(id: number): void + { + this._connection.send(new PetMountComposer(id, true)); + } + + public dismountPet(id: number): void + { + this._connection.send(new PetMountComposer(id, false)); + } + + public usePetProduct(itemId: number, petId: number): void + { + this._connection.send(new UsePetProductComposer(itemId, petId)); + } + + public removePetSaddle(id: number): void + { + this._connection.send(new RemovePetSaddleComposer(id)); + } + + public togglePetBreeding(id: number): void + { + this._connection.send(new TogglePetBreedingComposer(id)); + } + + public togglePetRiding(id: number): void + { + this._connection.send(new TogglePetRidingComposer(id)); + } + + public useMultistateItem(id: number): void + { + this._connection.send(new FurnitureMultiStateComposer(id)); + } + + public harvestPet(id: number): void + { + this._connection.send(new HarvestPetMessageComposer(id)); + } + + public compostPlant(id: number): void + { + this._connection.send(new CompostPlantMessageComposer(id)); + } + + public requestPetCommands(id: number):void + { + this._connection.send(new GetPetCommandsComposer(id)); + } + + public sendScriptProceed(): void + { + this._connection.send(new NewUserExperienceScriptProceedComposer()); + } + + public sendUpdateClothingChangeFurniture(objectId: number, gender: string, look: string):void + { + this._connection.send(new SetClothingChangeDataMessageComposer(objectId, gender, look)); + } + + public changeQueue(targetQueue: number): void + { + this._connection.send(new ChangeQueueMessageComposer(targetQueue)); + } + + public votePoll(counter: number): void + { + this._connection.send(new VotePollCounterMessageComposer(counter)); + } + + public get connection(): IConnection + { + return this._connection; + } + + public get userDataManager(): UserDataManager + { + return this._userData; + } + + public get roomId(): number + { + return this._roomId; + } + + public set roomId(roomId: number) + { + this._roomId = roomId; + } + + public get password(): string + { + return this._password; + } + + public set password(password: string) + { + this._password = password; + } + + public get state(): string + { + return this._state; + } + + public get isPrivateRoom(): boolean + { + return true; + } + + public get tradeMode(): number + { + return this._tradeMode; + } + + public set tradeMode(mode: number) + { + this._tradeMode = mode; + } + + public get doorMode(): number + { + return this._doorMode; + } + + public set doorMode(mode: number) + { + this._doorMode = mode; + } + + public get allowPets(): boolean + { + return this._allowPets; + } + + public set allowPets(flag: boolean) + { + this._allowPets = flag; + } + + public get controllerLevel(): number + { + return this._controllerLevel; + } + + public get ownRoomIndex(): number + { + return this._ownRoomIndex; + } + + public get isGuildRoom(): boolean + { + return this._isGuildRoom; + } + + public set isGuildRoom(flag: boolean) + { + this._isGuildRoom = flag; + } + + public get isRoomOwner(): boolean + { + return this._isRoomOwner; + } + + public get isDecorating(): boolean + { + return this._isDecorating; + } + + public set isDecorating(flag: boolean) + { + this._isDecorating = flag; + } + + public get isSpectator(): boolean + { + return this._isSpectator; + } + + public set isSpectator(flag: boolean) + { + this._isSpectator = flag; + } + + public get moderationSettings(): RoomModerationSettings + { + return this._moderationSettings; + } + + public set moderationSettings(parser: RoomModerationSettings) + { + this._moderationSettings = parser; + } +} diff --git a/submodules/renderer/src/nitro/session/RoomSessionManager.ts b/submodules/renderer/src/nitro/session/RoomSessionManager.ts new file mode 100644 index 0000000..7711c38 --- /dev/null +++ b/submodules/renderer/src/nitro/session/RoomSessionManager.ts @@ -0,0 +1,232 @@ +import { INitroCommunicationManager, IRoomEngine, IRoomHandlerListener, IRoomSession, IRoomSessionManager } from '../../api'; +import { NitroManager } from '../../core'; +import { RoomEngineEvent, RoomSessionEvent } from '../../events'; +import { BaseHandler, GenericErrorHandler, PetPackageHandler, PollHandler, RoomChatHandler, RoomDataHandler, RoomDimmerPresetsHandler, RoomPermissionsHandler, RoomPresentHandler, RoomSessionHandler, RoomUsersHandler, WordQuizHandler } from './handler'; +import { RoomSession } from './RoomSession'; + +export class RoomSessionManager extends NitroManager implements IRoomSessionManager, IRoomHandlerListener +{ + private _communication: INitroCommunicationManager; + private _roomEngine: IRoomEngine; + + private _handlers: BaseHandler[]; + private _sessions: Map; + private _pendingSession: IRoomSession; + + private _sessionStarting: boolean; + private _viewerSession: IRoomSession; + + constructor(communication: INitroCommunicationManager, roomEngine: IRoomEngine) + { + super(); + + this._communication = communication; + this._roomEngine = roomEngine; + + this._handlers = []; + this._sessions = new Map(); + this._pendingSession = null; + + this._sessionStarting = false; + this._viewerSession = null; + + this.onRoomEngineEvent = this.onRoomEngineEvent.bind(this); + } + + protected onInit(): void + { + this.createHandlers(); + + this.processPendingSession(); + + this._roomEngine.events.addEventListener(RoomEngineEvent.ENGINE_INITIALIZED, this.onRoomEngineEvent); + } + + protected onDispose(): void + { + this._roomEngine.events.removeEventListener(RoomEngineEvent.ENGINE_INITIALIZED, this.onRoomEngineEvent); + + super.onDispose(); + } + + private createHandlers(): void + { + const connection = this._communication && this._communication.connection; + + if(!connection) return; + + this._handlers.push( + new RoomChatHandler(connection, this), + new RoomDataHandler(connection, this), + new RoomDimmerPresetsHandler(connection, this), + new RoomPermissionsHandler(connection, this), + new RoomSessionHandler(connection, this), + new RoomUsersHandler(connection, this), + new RoomPresentHandler(connection, this), + new GenericErrorHandler(connection, this), + new WordQuizHandler(connection, this), + new PollHandler(connection, this), + new PetPackageHandler(connection, this), + ); + } + + private setHandlers(session: IRoomSession): void + { + if(!this._handlers || !this._handlers.length) return; + + for(const handler of this._handlers) + { + if(!handler) continue; + + handler.setRoomId(session.roomId); + } + } + + public onRoomEngineEvent(event: RoomEngineEvent): void + { + this.processPendingSession(); + } + + private processPendingSession(): void + { + if(!this._pendingSession || !this._roomEngine.ready) return; + + this.addSession(this._pendingSession); + + this._pendingSession = null; + } + + public getSession(id: number): IRoomSession + { + const existing = this._sessions.get(this.getRoomId(id)); + + if(!existing) return null; + + return existing; + } + + public createSession(roomId: number, password: string = null): boolean + { + const session = new RoomSession(); + + session.roomId = roomId; + session.password = password; + + return this.addSession(session); + } + + private addSession(roomSession: IRoomSession): boolean + { + if(!this._roomEngine.ready) + { + this._pendingSession = roomSession; + + return false; + } + + this._sessionStarting = true; + + if(this._sessions.get(this.getRoomId(roomSession.roomId))) + { + this.removeSession(roomSession.roomId, false); + } + + roomSession.setConnection(this._communication.connection); + + this._sessions.set(this.getRoomId(roomSession.roomId), roomSession); + + this.events.dispatchEvent(new RoomSessionEvent(RoomSessionEvent.CREATED, roomSession)); + + this._viewerSession = roomSession; + + this.startSession(this._viewerSession); + + return true; + } + + public startSession(session: IRoomSession): boolean + { + if(session.state === RoomSessionEvent.STARTED) return false; + + this._sessionStarting = false; + + if(!session.start()) + { + this.removeSession(session.roomId); + + return false; + } + + this.events.dispatchEvent(new RoomSessionEvent(RoomSessionEvent.STARTED, session)); + + this.setHandlers(session); + + return true; + } + + public removeSession(id: number, openLandingView: boolean = true): void + { + const session = this.getSession(id); + + if(!session) return; + + this._sessions.delete(this.getRoomId(id)); + + this.events.dispatchEvent(new RoomSessionEvent(RoomSessionEvent.ENDED, session, openLandingView)); + + session.dispose(); + } + + public sessionUpdate(id: number, type: string): void + { + const session = this.getSession(id); + + if(!session) return; + + switch(type) + { + case RoomSessionHandler.RS_CONNECTED: + return; + case RoomSessionHandler.RS_READY: + return; + case RoomSessionHandler.RS_DISCONNECTED: + this.removeSession(id); + return; + } + } + + public sessionReinitialize(fromRoomId: number, toRoomId: number): void + { + const existing = this.getSession(fromRoomId); + + if(!existing) return; + + this._sessions.delete(this.getRoomId(fromRoomId)); + + existing.reset(toRoomId); + + this._sessions.set(this.getRoomId(toRoomId), existing); + + this.setHandlers(existing); + } + + private getRoomId(id: number): string + { + return 'hard_coded_room_id'; + } + + public get communication(): INitroCommunicationManager + { + return this._communication; + } + + public get roomEngine(): IRoomEngine + { + return this._roomEngine; + } + + public get viewerSession(): IRoomSession + { + return this._viewerSession; + } +} diff --git a/submodules/renderer/src/nitro/session/RoomUserData.ts b/submodules/renderer/src/nitro/session/RoomUserData.ts new file mode 100644 index 0000000..0f851cb --- /dev/null +++ b/submodules/renderer/src/nitro/session/RoomUserData.ts @@ -0,0 +1,258 @@ +import { IRoomUserData } from '../../api'; + +export class RoomUserData implements IRoomUserData +{ + private _roomIndex: number = -1; + private _name: string = ''; + private _type: number = 0; + private _sex: string = ''; + private _figure: string = ''; + private _custom: string = ''; + private _activityPoints: number; + private _webID: number = 0; + private _groupID: number = 0; + private _groupStatus: number = 0; + private _groupName: string = ''; + private _ownerId: number = 0; + private _ownerName: string = ''; + private _petLevel: number = 0; + private _rarityLevel: number = 0; + private _hasSaddle: boolean; + private _isRiding: boolean; + private _canBreed: boolean; + private _canHarvest: boolean; + private _canRevive: boolean; + private _hasBreedingPermission: boolean; + private _botSkills: number[]; + private _isModerator: boolean; + + constructor(k: number) + { + this._roomIndex = k; + } + + public get roomIndex(): number + { + return this._roomIndex; + } + + public get activityPoints(): number + { + return this._activityPoints; + } + + public set activityPoints(k: number) + { + this._activityPoints = k; + } + + public get name(): string + { + return this._name; + } + + public set name(k: string) + { + this._name = k; + } + + public get type(): number + { + return this._type; + } + + public set type(k: number) + { + this._type = k; + } + + public get sex(): string + { + return this._sex; + } + + public set sex(k: string) + { + this._sex = k; + } + + public get figure(): string + { + return this._figure; + } + + public set figure(k: string) + { + this._figure = k; + } + + public get custom(): string + { + return this._custom; + } + + public set custom(k: string) + { + this._custom = k; + } + + public get webID(): number + { + return this._webID; + } + + public set webID(k: number) + { + this._webID = k; + } + + public get groupId(): number + { + return this._groupID; + } + + public set groupId(groupId: number) + { + this._groupID = groupId; + } + + public get groupName(): string + { + return this._groupName; + } + + public set groupName(k: string) + { + this._groupName = k; + } + + public get groupStatus(): number + { + return this._groupStatus; + } + + public set groupStatus(k: number) + { + this._groupStatus = k; + } + + public get ownerId(): number + { + return this._ownerId; + } + + public set ownerId(k: number) + { + this._ownerId = k; + } + + public get ownerName(): string + { + return this._ownerName; + } + + public set ownerName(k: string) + { + this._ownerName = k; + } + + public get rarityLevel(): number + { + return this._rarityLevel; + } + + public set rarityLevel(k: number) + { + this._rarityLevel = k; + } + + public get hasSaddle(): boolean + { + return this._hasSaddle; + } + + public set hasSaddle(k: boolean) + { + this._hasSaddle = k; + } + + public get isRiding(): boolean + { + return this._isRiding; + } + + public set isRiding(k: boolean) + { + this._isRiding = k; + } + + public get canBreed(): boolean + { + return this._canBreed; + } + + public set canBreed(k: boolean) + { + this._canBreed = k; + } + + public get canHarvest(): boolean + { + return this._canHarvest; + } + + public set canHarvest(k: boolean) + { + this._canHarvest = k; + } + + public get canRevive(): boolean + { + return this._canRevive; + } + + public set canRevive(k: boolean) + { + this._canRevive = k; + } + + public get hasBreedingPermission(): boolean + { + return this._hasBreedingPermission; + } + + public set hasBreedingPermission(k: boolean) + { + this._hasBreedingPermission = k; + } + + public get petLevel(): number + { + return this._petLevel; + } + + public set petLevel(k: number) + { + this._petLevel = k; + } + + public get botSkills(): number[] + { + return this._botSkills; + } + + public set botSkills(k: number[]) + { + this._botSkills = k; + } + + public get isModerator(): boolean + { + return this._isModerator; + } + + public set isModerator(k: boolean) + { + this._isModerator = k; + } +} diff --git a/submodules/renderer/src/nitro/session/SessionDataManager.ts b/submodules/renderer/src/nitro/session/SessionDataManager.ts new file mode 100644 index 0000000..0e8f7d2 --- /dev/null +++ b/submodules/renderer/src/nitro/session/SessionDataManager.ts @@ -0,0 +1,729 @@ +import { Resource, Texture } from '@pixi/core'; +import { GetAssetManager, IFurnitureData, IFurnitureDataListener, IGroupInformationManager, IMessageComposer, INitroCommunicationManager, INitroEvent, IProductData, IProductDataListener, ISessionDataManager, NitroConfiguration, NoobnessLevelEnum, SecurityLevel } from '../../api'; +import { NitroManager } from '../../core'; +import { MysteryBoxKeysUpdateEvent, NitroSettingsEvent, SessionDataPreferencesEvent, UserNameUpdateEvent } from '../../events'; +import { AccountSafetyLockStatusChangeMessageEvent, AccountSafetyLockStatusChangeParser, AvailabilityStatusMessageEvent, ChangeUserNameResultMessageEvent, EmailStatusResultEvent, FigureUpdateEvent, GetUserTagsComposer, InClientLinkEvent, MysteryBoxKeysEvent, NoobnessLevelMessageEvent, PetRespectComposer, PetScratchFailedMessageEvent, RoomReadyMessageEvent, RoomUnitChatComposer, UserInfoEvent, UserNameChangeMessageEvent, UserPermissionsEvent, UserRespectComposer, UserTagsMessageEvent } from '../communication'; +import { Nitro } from '../Nitro'; +import { HabboWebTools } from '../utils/HabboWebTools'; +import { BadgeImageManager } from './badge/BadgeImageManager'; +import { FurnitureDataLoader } from './furniture/FurnitureDataLoader'; +import { GroupInformationManager } from './GroupInformationManager'; +import { IgnoredUsersManager } from './IgnoredUsersManager'; +import { ProductDataLoader } from './product/ProductDataLoader'; + +export class SessionDataManager extends NitroManager implements ISessionDataManager +{ + private _communication: INitroCommunicationManager; + + private _userId: number; + private _name: string; + private _figure: string; + private _gender: string; + private _realName: string; + private _respectsReceived: number; + private _respectsLeft: number; + private _respectsPetLeft: number; + private _canChangeName: boolean; + private _safetyLocked: boolean; + + private _ignoredUsersManager: IgnoredUsersManager; + private _groupInformationManager: IGroupInformationManager; + + private _clubLevel: number; + private _securityLevel: number; + private _isAmbassador: boolean; + private _noobnessLevel: number; + private _isEmailVerified: boolean; + + private _systemOpen: boolean; + private _systemShutdown: boolean; + private _isAuthenticHabbo: boolean; + private _isRoomCameraFollowDisabled: boolean; + private _uiFlags: number; + + private _floorItems: Map; + private _wallItems: Map; + private _products: Map; + private _furnitureData: FurnitureDataLoader; + private _productData: ProductDataLoader; + + private _furnitureReady: boolean; + private _productsReady: boolean; + private _furnitureListenersNotified: boolean; + private _pendingFurnitureListeners: IFurnitureDataListener[]; + private _pendingProductListeners: IProductDataListener[]; + private _tags: string[]; + + private _badgeImageManager: BadgeImageManager; + + constructor(communication: INitroCommunicationManager) + { + super(); + + this._communication = communication; + + this.resetUserInfo(); + + this._ignoredUsersManager = new IgnoredUsersManager(this); + this._groupInformationManager = new GroupInformationManager(this); + + this._clubLevel = 0; + this._securityLevel = 0; + this._isAmbassador = false; + this._noobnessLevel = -1; + this._isEmailVerified = false; + + this._systemOpen = false; + this._systemShutdown = false; + this._isAuthenticHabbo = false; + this._isRoomCameraFollowDisabled = false; + this._uiFlags = 0; + + this._floorItems = new Map(); + this._wallItems = new Map(); + this._products = new Map(); + this._furnitureData = null; + + this._furnitureReady = false; + this._productsReady = false; + this._furnitureListenersNotified = false; + this._pendingFurnitureListeners = []; + this._pendingProductListeners = []; + this._tags = []; + + this._badgeImageManager = null; + + this.onFurnitureDataReadyEvent = this.onFurnitureDataReadyEvent.bind(this); + this.onProductDataReadyEvent = this.onProductDataReadyEvent.bind(this); + this.onNitroSettingsEvent = this.onNitroSettingsEvent.bind(this); + } + + protected onInit(): void + { + this.loadFurnitureData(); + this.loadProductData(); + this.loadBadgeImageManager(); + + (this._ignoredUsersManager && this._ignoredUsersManager.init()); + (this._groupInformationManager && this._groupInformationManager.init()); + + this._communication.registerMessageEvent(new FigureUpdateEvent(this.onUserFigureEvent.bind(this))); + this._communication.registerMessageEvent(new UserInfoEvent(this.onUserInfoEvent.bind(this))); + this._communication.registerMessageEvent(new UserPermissionsEvent(this.onUserPermissionsEvent.bind(this))); + this._communication.registerMessageEvent(new AvailabilityStatusMessageEvent(this.onAvailabilityStatusMessageEvent.bind(this))); + this._communication.registerMessageEvent(new PetScratchFailedMessageEvent(this.onPetRespectFailed.bind(this))); + this._communication.registerMessageEvent(new ChangeUserNameResultMessageEvent(this.onChangeNameUpdateEvent.bind(this))); + this._communication.registerMessageEvent(new UserNameChangeMessageEvent(this.onUserNameChangeMessageEvent.bind(this))); + this._communication.registerMessageEvent(new UserTagsMessageEvent(this.onUserTags.bind(this))); + this._communication.registerMessageEvent(new RoomReadyMessageEvent(this.onRoomModelNameEvent.bind(this))); + this._communication.registerMessageEvent(new InClientLinkEvent(this.onInClientLinkEvent.bind(this))); + this._communication.registerMessageEvent(new MysteryBoxKeysEvent(this.onMysteryBoxKeysEvent.bind(this))); + this._communication.registerMessageEvent(new NoobnessLevelMessageEvent(this.onNoobnessLevelMessageEvent.bind(this))); + this._communication.registerMessageEvent(new AccountSafetyLockStatusChangeMessageEvent(this.onAccountSafetyLockStatusChangeMessageEvent.bind(this))); + this._communication.registerMessageEvent(new EmailStatusResultEvent(this.onEmailStatus.bind(this))); + + Nitro.instance.events.addEventListener(NitroSettingsEvent.SETTINGS_UPDATED, this.onNitroSettingsEvent); + } + + protected onDispose(): void + { + this.destroyFurnitureData(); + + if(this._ignoredUsersManager) + { + this._ignoredUsersManager.dispose(); + + this._ignoredUsersManager = null; + } + + if(this._groupInformationManager) + { + this._groupInformationManager.dispose(); + + this._groupInformationManager = null; + } + + Nitro.instance.events.removeEventListener(NitroSettingsEvent.SETTINGS_UPDATED, this.onNitroSettingsEvent); + + super.onDispose(); + } + + private resetUserInfo(): void + { + this._userId = 0; + this._name = null; + this._figure = null; + this._gender = null; + this._realName = null; + this._canChangeName = false; + this._safetyLocked = false; + } + + private loadFurnitureData(): void + { + this.destroyFurnitureData(); + + this._furnitureData = new FurnitureDataLoader(this._floorItems, this._wallItems, Nitro.instance.localization); + + this._furnitureData.addEventListener(FurnitureDataLoader.FURNITURE_DATA_READY, this.onFurnitureDataReadyEvent); + + this._furnitureData.loadFurnitureData(NitroConfiguration.getValue('furnidata.url')); + } + + private loadProductData(): void + { + this.destroyProductData(); + + this._productData = new ProductDataLoader(this._products); + + this._productData.addEventListener(ProductDataLoader.PDP_PRODUCT_DATA_READY, this.onProductDataReadyEvent); + + this._productData.loadProductData(NitroConfiguration.getValue('productdata.url')); + } + + private loadBadgeImageManager(): void + { + if(this._badgeImageManager) return; + + this._badgeImageManager = new BadgeImageManager(GetAssetManager(), this); + this._badgeImageManager.init(); + } + + public hasProductData(listener: IProductDataListener): boolean + { + if(this._productsReady) return true; + + if(listener && (this._pendingProductListeners.indexOf(listener) === -1)) this._pendingProductListeners.push(listener); + + return false; + } + + public getAllFurnitureData(listener: IFurnitureDataListener): IFurnitureData[] + { + if(!this._furnitureReady) + { + if(this._pendingFurnitureListeners.indexOf(listener) === -1) this._pendingFurnitureListeners.push(listener); + + return null; + } + + const furnitureData: IFurnitureData[] = []; + + for(const data of this._floorItems.values()) + { + if(!data) continue; + + furnitureData.push(data); + } + + for(const data of this._wallItems.values()) + { + if(!data) continue; + + furnitureData.push(data); + } + + return furnitureData; + } + + public removePendingFurniDataListener(listener: IFurnitureDataListener): void + { + if(!this._pendingFurnitureListeners) return; + + const index = this._pendingFurnitureListeners.indexOf(listener); + + if(index === -1) return; + + this._pendingFurnitureListeners.splice(index, 1); + } + + private onUserFigureEvent(event: FigureUpdateEvent): void + { + if(!event || !event.connection) return; + + this._figure = event.getParser().figure; + this._gender = event.getParser().gender; + + HabboWebTools.updateFigure(this._figure); + } + + private onUserInfoEvent(event: UserInfoEvent): void + { + if(!event || !event.connection) return; + + this.resetUserInfo(); + + const userInfo = event.getParser().userInfo; + + if(!userInfo) return; + + this._userId = userInfo.userId; + this._name = userInfo.username; + this._figure = userInfo.figure; + this._gender = userInfo.gender; + this._realName = userInfo.realName; + this._respectsReceived = userInfo.respectsReceived; + this._respectsLeft = userInfo.respectsRemaining; + this._respectsPetLeft = userInfo.respectsPetRemaining; + this._canChangeName = userInfo.canChangeName; + this._safetyLocked = userInfo.safetyLocked; + + (this._ignoredUsersManager && this._ignoredUsersManager.requestIgnoredUsers()); + } + + private onUserPermissionsEvent(event: UserPermissionsEvent): void + { + if(!event || !event.connection) return; + + this._clubLevel = event.getParser().clubLevel; + this._securityLevel = event.getParser().securityLevel; + this._isAmbassador = event.getParser().isAmbassador; + } + + private onAvailabilityStatusMessageEvent(event: AvailabilityStatusMessageEvent): void + { + if(!event || !event.connection) return; + + const parser = event.getParser(); + + if(!parser) return; + + this._systemOpen = parser.isOpen; + this._systemShutdown = parser.onShutdown; + this._isAuthenticHabbo = parser.isAuthenticUser; + } + + private onPetRespectFailed(event: PetScratchFailedMessageEvent): void + { + if(!event || !event.connection) return; + + this._respectsPetLeft++; + } + + private onChangeNameUpdateEvent(event: ChangeUserNameResultMessageEvent): void + { + if(!event || !event.connection) return; + + const parser = event.getParser(); + + if(!parser) return; + + if(parser.resultCode !== ChangeUserNameResultMessageEvent.NAME_OK) return; + + this._canChangeName = false; + + this.events.dispatchEvent(new UserNameUpdateEvent(parser.name)); + } + + private onUserNameChangeMessageEvent(event: UserNameChangeMessageEvent): void + { + if(!event || !event.connection) return; + + const parser = event.getParser(); + + if(!parser) return; + + if(parser.webId !== this.userId) return; + + this._name = parser.newName; + this._canChangeName = false; + + this.events.dispatchEvent(new UserNameUpdateEvent(this._name)); + } + + private onUserTags(event: UserTagsMessageEvent): void + { + if(!event || !event.connection) return; + + const parser = event.getParser(); + + if(!parser) return; + + this._tags = parser.tags; + } + + private onRoomModelNameEvent(event: RoomReadyMessageEvent): void + { + if(!event) return; + + const parser = event.getParser(); + + if(!parser) return; + + HabboWebTools.roomVisited(parser.roomId); + } + + private onFurnitureDataReadyEvent(event: INitroEvent): void + { + this._furnitureData.removeEventListener(FurnitureDataLoader.FURNITURE_DATA_READY, this.onFurnitureDataReadyEvent); + + this._furnitureReady = true; + + if(!this._furnitureListenersNotified) + { + this._furnitureListenersNotified = true; + + if(this._pendingFurnitureListeners && this._pendingFurnitureListeners.length) + { + for(const listener of this._pendingFurnitureListeners) listener && listener.loadFurnitureData(); + } + } + + this._pendingProductListeners = []; + } + + private onProductDataReadyEvent(event: INitroEvent): void + { + this._productData.removeEventListener(ProductDataLoader.PDP_PRODUCT_DATA_READY, this.onProductDataReadyEvent); + + this._productsReady = true; + + for(const listener of this._pendingProductListeners) listener && listener.loadProductData(); + + this._pendingProductListeners = []; + } + + private onInClientLinkEvent(event: InClientLinkEvent): void + { + if(!event) return; + + const parser = event.getParser(); + + if(!parser) return; + + Nitro.instance.createLinkEvent(parser.link); + } + + private onMysteryBoxKeysEvent(event: MysteryBoxKeysEvent): void + { + if(!event) return; + + const parser = event.getParser(); + + if(!parser) return; + + this.events.dispatchEvent(new MysteryBoxKeysUpdateEvent(parser.boxColor, parser.keyColor)); + } + + private onNoobnessLevelMessageEvent(event: NoobnessLevelMessageEvent): void + { + this._noobnessLevel = event.getParser().noobnessLevel; + + if(this._noobnessLevel !== NoobnessLevelEnum.OLD_IDENTITY) + { + NitroConfiguration.setValue('new.identity', 1); + } + } + + private onAccountSafetyLockStatusChangeMessageEvent(event: AccountSafetyLockStatusChangeMessageEvent): void + { + if(!event) return; + + const parser = event.getParser(); + + if(!parser) return; + + this._safetyLocked = (parser.status == AccountSafetyLockStatusChangeParser.SAFETY_LOCK_STATUS_LOCKED); + } + + private onEmailStatus(event: EmailStatusResultEvent): void + { + if(!event) return; + + const parser = event.getParser(); + + if(!parser) return; + + this._isEmailVerified = parser.isVerified; + } + + private onNitroSettingsEvent(event: NitroSettingsEvent): void + { + this._isRoomCameraFollowDisabled = event.cameraFollow; + this._uiFlags = event.flags; + + this.events.dispatchEvent(new SessionDataPreferencesEvent(this._uiFlags)); + } + + private destroyFurnitureData(): void + { + if(!this._furnitureData) return; + + this._furnitureData.dispose(); + + this._furnitureData = null; + } + + private destroyProductData(): void + { + if(!this._productData) return; + + this._productData.dispose(); + + this._productData = null; + } + + public getFloorItemData(id: number): IFurnitureData + { + const existing = this._floorItems.get(id); + + if(!existing) return null; + + return existing; + } + + public getFloorItemDataByName(name: string): IFurnitureData + { + if(!name || !this._floorItems || !this._floorItems.size) return null; + + for(const item of this._floorItems.values()) + { + if(!item || (item.className !== name)) continue; + + return item; + } + } + + public getWallItemData(id: number): IFurnitureData + { + const existing = this._wallItems.get(id); + + if(!existing) return null; + + return existing; + } + + public getWallItemDataByName(name: string): IFurnitureData + { + if(!name || !this._wallItems || !this._wallItems.size) return null; + + for(const item of this._wallItems.values()) + { + if(!item || (item.className !== name)) continue; + + return item; + } + } + + public getProductData(type: string): IProductData + { + if(!this._productsReady) this.loadProductData(); + + return this._products.get(type); + } + + public getBadgeUrl(name: string): string + { + return this._badgeImageManager.getBadgeUrl(name); + } + + public getGroupBadgeUrl(name: string): string + { + return this._badgeImageManager.getBadgeUrl(name, BadgeImageManager.GROUP_BADGE); + } + + public getBadgeImage(name: string): Texture + { + return this._badgeImageManager.getBadgeImage(name); + } + + public getGroupBadgeImage(name: string): Texture + { + return this._badgeImageManager.getBadgeImage(name, BadgeImageManager.GROUP_BADGE); + } + + public getUserTags(roomUnitId: number): string[] + { + if(roomUnitId < 0) return; + + this.send(new GetUserTagsComposer(roomUnitId)); + } + + public loadBadgeImage(name: string): string + { + return this._badgeImageManager.loadBadgeImage(name); + } + + public loadGroupBadgeImage(name: string): string + { + return this._badgeImageManager.loadBadgeImage(name, BadgeImageManager.GROUP_BADGE); + } + + public hasSecurity(level: number): boolean + { + return this._securityLevel >= level; + } + + public giveRespect(userId: number): void + { + if((userId < 0) || (this._respectsLeft <= 0)) return; + + this.send(new UserRespectComposer(userId)); + + this._respectsLeft--; + } + + public givePetRespect(petId: number): void + { + if((petId < 0) || (this._respectsPetLeft <= 0)) return; + + this.send(new PetRespectComposer(petId)); + + this._respectsPetLeft--; + } + + public sendSpecialCommandMessage(text: string, styleId: number = 0): void + { + this.send(new RoomUnitChatComposer(text)); + } + + public ignoreUser(name: string): void + { + (this._ignoredUsersManager && this._ignoredUsersManager.ignoreUser(name)); + } + + public unignoreUser(name: string): void + { + (this._ignoredUsersManager && this._ignoredUsersManager.unignoreUser(name)); + } + + public isUserIgnored(name: string): boolean + { + return (this._ignoredUsersManager && this._ignoredUsersManager.isIgnored(name)); + } + + public getGroupBadge(groupId: number): string + { + return (this._groupInformationManager && this._groupInformationManager.getGroupBadge(groupId)); + } + + public send(composer: IMessageComposer): void + { + this._communication.connection.send(composer); + } + + public get communication(): INitroCommunicationManager + { + return this._communication; + } + + public get userId(): number + { + return this._userId; + } + + public get userName(): string + { + return this._name; + } + + public get figure(): string + { + return this._figure; + } + + public get gender(): string + { + return this._gender; + } + + public get realName(): string + { + return this._realName; + } + + public get ignoredUsersManager(): IgnoredUsersManager + { + return this._ignoredUsersManager; + } + + public get groupInformationManager(): IGroupInformationManager + { + return this._groupInformationManager; + } + + public get respectsReceived(): number + { + return this._respectsReceived; + } + + public get respectsLeft(): number + { + return this._respectsLeft; + } + + public get respectsPetLeft(): number + { + return this._respectsPetLeft; + } + + public get canChangeName(): boolean + { + return this._canChangeName; + } + + public get clubLevel(): number + { + return this._clubLevel; + } + + public get securityLevel(): number + { + return this._securityLevel; + } + + public get isAmbassador(): boolean + { + return this._isAmbassador; + } + + public get isEmailVerified(): boolean + { + return this._isEmailVerified; + } + + public get isNoob(): boolean + { + return (this._noobnessLevel !== NoobnessLevelEnum.OLD_IDENTITY); + } + + public get isRealNoob(): boolean + { + return (this._noobnessLevel === NoobnessLevelEnum.REAL_NOOB); + } + + public get isSystemOpen(): boolean + { + return this._systemOpen; + } + + public get isSystemShutdown(): boolean + { + return this._systemShutdown; + } + + public get isAuthenticHabbo(): boolean + { + return this._isAuthenticHabbo; + } + + public get isModerator(): boolean + { + return (this._securityLevel >= SecurityLevel.MODERATOR); + } + + public get isCameraFollowDisabled(): boolean + { + return this._isRoomCameraFollowDisabled; + } + + public get uiFlags(): number + { + return this._uiFlags; + } + + public get tags(): string[] + { + return this._tags; + } +} diff --git a/submodules/renderer/src/nitro/session/UserDataManager.ts b/submodules/renderer/src/nitro/session/UserDataManager.ts new file mode 100644 index 0000000..1e5843b --- /dev/null +++ b/submodules/renderer/src/nitro/session/UserDataManager.ts @@ -0,0 +1,218 @@ +import { IConnection, IRoomUserData } from '../../api'; +import { Disposable } from '../../core'; +import { RequestPetInfoComposer, UserCurrentBadgesComposer } from '../communication'; + +export class UserDataManager extends Disposable +{ + private static TYPE_USER: number = 1; + private static TYPE_PET: number = 2; + private static TYPE_BOT: number = 3; + private static TYPE_RENTABLE_BOT: number = 4; + + private _connection: IConnection; + + private _userDataByType: Map>; + private _userDataByRoomIndex: Map; + private _userBadges: Map; + + constructor() + { + super(); + + this._connection = null; + + this._userDataByType = new Map(); + this._userDataByRoomIndex = new Map(); + this._userBadges = new Map(); + } + + protected onDispose(): void + { + this._connection = null; + } + + public setConnection(connection: IConnection): void + { + this._connection = connection; + } + + public getUserData(webID: number): IRoomUserData + { + return this.getDataByType(webID, UserDataManager.TYPE_USER); + } + + public getPetData(webID: number): IRoomUserData + { + return this.getDataByType(webID, UserDataManager.TYPE_PET); + } + + public getBotData(webID: number): IRoomUserData + { + return this.getDataByType(webID, UserDataManager.TYPE_BOT); + } + + public getRentableBotData(webID: number): IRoomUserData + { + return this.getDataByType(webID, UserDataManager.TYPE_RENTABLE_BOT); + } + + public getDataByType(webID: number, type: number): IRoomUserData + { + const existing = this._userDataByType.get(type); + + if(!existing) return null; + + const userData = existing.get(webID); + + if(!userData) return null; + + return userData; + } + + public getUserDataByIndex(roomIndex: number): IRoomUserData + { + const existing = this._userDataByRoomIndex.get(roomIndex); + + if(!existing) return null; + + return existing; + } + + public getUserDataByName(name: string): IRoomUserData + { + for(const userData of this._userDataByRoomIndex.values()) + { + if(!userData || (userData.name !== name)) continue; + + return userData; + } + + return null; + } + + public updateUserData(data: IRoomUserData): void + { + if(!data) return; + + this.removeUserData(data.roomIndex); + + let existingType = this._userDataByType.get(data.type); + + if(!existingType) + { + existingType = new Map(); + + this._userDataByType.set(data.type, existingType); + } + + existingType.set(data.webID, data); + + this._userDataByRoomIndex.set(data.roomIndex, data); + } + + public removeUserData(roomIndex: number): void + { + const existing = this.getUserDataByIndex(roomIndex); + + if(!existing) return; + + this._userDataByRoomIndex.delete(roomIndex); + + const existingType = this._userDataByType.get(existing.type); + + if(existingType) existingType.delete(existing.webID); + } + + public getUserBadges(userId: number): string[] + { + if(this._connection) + { + this._connection.send(new UserCurrentBadgesComposer(userId)); + } + + const badges = this._userBadges.get(userId); + + if(!badges) return []; + + return badges; + } + + public setUserBadges(userId: number, badges: string[]): void + { + this._userBadges.set(userId, badges); + } + + public updateFigure(roomIndex: number, figure: string, sex: string, hasSaddle: boolean, isRiding: boolean): void + { + const userData = this.getUserDataByIndex(roomIndex); + + if(!userData) return; + + userData.figure = figure; + userData.sex = sex; + userData.hasSaddle = hasSaddle; + userData.isRiding = isRiding; + } + + public updateName(roomIndex: number, name: string): void + { + const userData = this.getUserDataByIndex(roomIndex); + + if(!userData) return; + + userData.name = name; + } + + public updateMotto(roomIndex: number, custom: string): void + { + const userData = this.getUserDataByIndex(roomIndex); + + if(!userData) return; + + userData.custom = custom; + } + + public updateAchievementScore(roomIndex: number, score: number): void + { + const userData = this.getUserDataByIndex(roomIndex); + + if(!userData) return; + + userData.activityPoints = score; + } + + public updatePetLevel(roomIndex: number, level: number): void + { + const userData = this.getUserDataByIndex(roomIndex); + + if(userData) userData.petLevel = level; + } + + public updatePetBreedingStatus(roomIndex: number, canBreed: boolean, canHarvest: boolean, canRevive: boolean, hasBreedingPermission: boolean): void + { + const userData = this.getUserDataByIndex(roomIndex); + + if(!userData) return; + + userData.canBreed = canBreed; + userData.canHarvest = canHarvest; + userData.canRevive = canRevive; + userData.hasBreedingPermission = hasBreedingPermission; + } + + public requestPetInfo(id: number): void + { + if(!this._connection) return; + + const petData = this.getPetData(id); + + if(!petData) return; + + this._connection.send(new RequestPetInfoComposer(id)); + } + + public get connection(): IConnection + { + return this._connection; + } +} diff --git a/submodules/renderer/src/nitro/session/badge/BadgeImageManager.ts b/submodules/renderer/src/nitro/session/badge/BadgeImageManager.ts new file mode 100644 index 0000000..77aa974 --- /dev/null +++ b/submodules/renderer/src/nitro/session/badge/BadgeImageManager.ts @@ -0,0 +1,258 @@ +import { Resource, Texture } from '@pixi/core'; +import { IAssetManager, IDisposable, IMessageEvent, NitroConfiguration } from '../../../api'; +import { BadgeImageReadyEvent } from '../../../events'; +import { NitroContainer, NitroSprite, NitroTexture, TextureUtils } from '../../../pixi-proxy'; +import { GroupBadgePartsEvent } from '../../communication'; +import { SessionDataManager } from './../SessionDataManager'; +import { BadgeInfo } from './BadgeInfo'; +import { GroupBadge } from './GroupBadge'; +import { GroupBadgePart } from './GroupBadgePart'; + +export class BadgeImageManager implements IDisposable +{ + public static GROUP_BADGE: string = 'group_badge'; + public static NORMAL_BADGE: string = 'normal_badge'; + + private _assets: IAssetManager; + private _sessionDataManager: SessionDataManager; + private _messages: IMessageEvent[]; + + private _groupBases: Map; + private _groupSymbols: Map; + private _groupPartColors: Map; + + private _requestedBadges: Map; + private _groupBadgesQueue: Map; + + private _readyToGenerateGroupBadges: boolean; + + constructor(assetManager: IAssetManager, sessionDataManager: SessionDataManager) + { + this._assets = assetManager; + this._sessionDataManager = sessionDataManager; + + this._groupBases = new Map(); + this._groupSymbols = new Map(); + this._groupPartColors = new Map(); + + this._requestedBadges = new Map(); + this._groupBadgesQueue = new Map(); + + this._readyToGenerateGroupBadges = false; + } + + public init(): void + { + if(this._sessionDataManager && this._sessionDataManager.communication) + { + this._messages = [ + new GroupBadgePartsEvent(this.onGroupBadgePartsEvent.bind(this)) + ]; + + for(const message of this._messages) this._sessionDataManager.communication.registerMessageEvent(message); + } + } + + public dispose(): void + { + if(this._messages && this._messages.length) + { + for(const message of this._messages) this._sessionDataManager.communication.removeMessageEvent(message); + + this._messages = null; + } + + this._sessionDataManager = null; + } + + public getBadgeImage(badgeName: string, type: string = BadgeImageManager.NORMAL_BADGE, load: boolean = true): Texture + { + let badge = this.getBadgeTexture(badgeName, type); + + if(!badge && load) badge = this.getBadgePlaceholder(); + + return badge; + } + + public getBadgeInfo(k: string): BadgeInfo + { + const badge = this.getBadgeTexture(k); + + return (badge) ? new BadgeInfo(badge, false) : new BadgeInfo(this.getBadgePlaceholder(), true); + } + + public loadBadgeImage(badgeName: string, type: string = BadgeImageManager.NORMAL_BADGE): string + { + if(this._assets.getTexture(this.getBadgeUrl(badgeName, type))) return badgeName; + + this.getBadgeTexture(badgeName, type); + + return null; + } + + private getBadgeTexture(badgeName: string, type: string = BadgeImageManager.NORMAL_BADGE): Texture + { + const url = this.getBadgeUrl(badgeName, type); + + if(!url || !url.length) return null; + + const existing = this._assets.getTexture(url); + + if(existing) return existing.clone(); + + if(type === BadgeImageManager.NORMAL_BADGE) + { + if(this._requestedBadges.get(badgeName)) return null; + + this._requestedBadges.set(badgeName, true); + + this._assets + .downloadAsset(url) + .then(status => + { + if(!status) return; + + this._requestedBadges.delete(badgeName); + + const texture = this._assets.getTexture(url); + + if(texture && this._sessionDataManager) this._sessionDataManager.events.dispatchEvent(new BadgeImageReadyEvent(badgeName, texture.clone())); + }) + .catch(err => + { + + }); + } + + else if(type === BadgeImageManager.GROUP_BADGE) + { + if(this._groupBadgesQueue.get(badgeName)) return; + + this._groupBadgesQueue.set(badgeName, true); + + if(this._readyToGenerateGroupBadges) this.loadGroupBadge(badgeName); + } + + return null; + } + + private getBadgePlaceholder(): Texture + { + const url = (NitroConfiguration.getValue('images.url') + '/loading_icon.png'); + const existing = this._assets.getTexture(url); + + if(!existing) return null; + + return existing.clone(); + } + + public getBadgeUrl(badge: string, type: string = BadgeImageManager.NORMAL_BADGE): string + { + let url = null; + + switch(type) + { + case BadgeImageManager.NORMAL_BADGE: + url = (NitroConfiguration.getValue('badge.asset.url')).replace('%badgename%', badge); + break; + case BadgeImageManager.GROUP_BADGE: + url = badge; + break; + } + + return url; + } + + private loadGroupBadge(badgeCode: string): void + { + const groupBadge = new GroupBadge(badgeCode); + const partMatches = [...badgeCode.matchAll(/[b|s][0-9]{4,6}/g)]; + + for(const partMatch of partMatches) + { + const partCode = partMatch[0]; + const shortMethod = (partCode.length === 6); + const partType = partCode[0]; + const partId = parseInt(partCode.slice(1, shortMethod ? 3 : 4)); + const partColor = parseInt(partCode.slice(shortMethod ? 3 : 4, shortMethod ? 5 : 6)); + const partPosition = partCode.length < 6 ? 0 : parseInt(partCode.slice(shortMethod ? 5 : 6, shortMethod ? 6 : 7)); // sometimes position is ommitted + const part = new GroupBadgePart(partType, partId, partColor, partPosition); + + groupBadge.parts.push(part); + } + + this.renderGroupBadge(groupBadge); + } + + private renderGroupBadge(groupBadge: GroupBadge): void + { + const container = new NitroContainer(); + const tempSprite = new NitroSprite(NitroTexture.EMPTY); + + tempSprite.width = GroupBadgePart.IMAGE_WIDTH; + tempSprite.height = GroupBadgePart.IMAGE_HEIGHT; + + container.addChild(tempSprite); + + for(const part of groupBadge.parts) + { + let isFirst = true; + + const partNames = ((part.type === 'b') ? this._groupBases.get(part.key) : this._groupSymbols.get(part.key)); + + if(partNames) + { + for(const partName of partNames) + { + if(!partName || !partName.length) continue; + + const texture = this._assets.getTexture(`badgepart_${partName}`); + + if(!texture) continue; + + const { x, y } = part.calculatePosition(texture); + const sprite = new NitroSprite(texture); + + sprite.position.set(x, y); + + if(isFirst) sprite.tint = parseInt(this._groupPartColors.get(part.color), 16); + + isFirst = false; + + container.addChild(sprite); + } + } + } + + this._requestedBadges.delete(groupBadge.code); + this._groupBadgesQueue.delete(groupBadge.code); + + const texture = TextureUtils.generateTexture(container); + this._assets.setTexture(groupBadge.code, texture); + + if(this._sessionDataManager) this._sessionDataManager.events.dispatchEvent(new BadgeImageReadyEvent(groupBadge.code, texture)); + } + + private onGroupBadgePartsEvent(event: GroupBadgePartsEvent): void + { + if(!event) return; + + const data = event.getParser(); + + if(!data) return; + + data.bases.forEach((names, id) => this._groupBases.set(id, names.map(val => val.replace('.png', '').replace('.gif', '')))); + + data.symbols.forEach((names, id) => this._groupSymbols.set(id, names.map(val => val.replace('.png', '').replace('.gif', '')))); + + this._groupPartColors = data.partColors; + this._readyToGenerateGroupBadges = true; + + for(const badgeCode of this._groupBadgesQueue.keys()) this.loadGroupBadge(badgeCode); + } + + public get disposed(): boolean + { + return !!this._sessionDataManager; + } +} diff --git a/submodules/renderer/src/nitro/session/badge/BadgeInfo.ts b/submodules/renderer/src/nitro/session/badge/BadgeInfo.ts new file mode 100644 index 0000000..45d4a18 --- /dev/null +++ b/submodules/renderer/src/nitro/session/badge/BadgeInfo.ts @@ -0,0 +1,23 @@ +import { Resource, Texture } from '@pixi/core'; + +export class BadgeInfo +{ + private _image: Texture; + private _placeHolder: boolean; + + constructor(image: Texture, placeHolder: boolean) + { + this._image = image; + this._placeHolder = placeHolder; + } + + public get image(): Texture + { + return this._image; + } + + public get placeHolder(): boolean + { + return this._placeHolder; + } +} diff --git a/submodules/renderer/src/nitro/session/badge/GroupBadge.ts b/submodules/renderer/src/nitro/session/badge/GroupBadge.ts new file mode 100644 index 0000000..5ede983 --- /dev/null +++ b/submodules/renderer/src/nitro/session/badge/GroupBadge.ts @@ -0,0 +1,23 @@ +import { GroupBadgePart } from './GroupBadgePart'; + +export class GroupBadge +{ + private _code: string; + private _parts: GroupBadgePart[]; + + constructor(code: string) + { + this._code = code; + this._parts = []; + } + + public get code(): string + { + return this._code; + } + + public get parts(): GroupBadgePart[] + { + return this._parts; + } +} diff --git a/submodules/renderer/src/nitro/session/badge/GroupBadgePart.ts b/submodules/renderer/src/nitro/session/badge/GroupBadgePart.ts new file mode 100644 index 0000000..4e67651 --- /dev/null +++ b/submodules/renderer/src/nitro/session/badge/GroupBadgePart.ts @@ -0,0 +1,66 @@ +import { NitroPoint, NitroTexture } from '../../../pixi-proxy'; + +export class GroupBadgePart +{ + public static BASE: string = 'b'; + public static SYMBOL: string = 's'; + public static SYMBOL_ALT: string = 't'; + public static BASE_PART: number = 0; + public static LAYER_PART: number = 1; + public static IMAGE_WIDTH: number = 39; + public static IMAGE_HEIGHT: number = 39; + public static CELL_WIDTH: number = 13; + public static CELL_HEIGHT: number = 13; + + public type: string; + public key: number; + public color: number; + public position: number; + + constructor(type: string, key: number = 0, color: number = 0, position: number = 0) + { + this.type = type; + this.key = key; + this.color = color; + this.position = position; + } + + public get code(): string + { + if(this.key === 0) return null; + + return GroupBadgePart.getCode(this.type, this.key, this.color, this.position); + } + + public static getCode(type: string, key: number, color: number, position: number): string + { + return (type === GroupBadgePart.BASE ? type : key >= 100 ? GroupBadgePart.SYMBOL_ALT : GroupBadgePart.SYMBOL) + (key < 10 ? '0' : '') + (type === GroupBadgePart.BASE ? key : key >= 100 ? key - 100 : key) + (color < 10 ? '0' : '') + color + position; + } + + public calculatePosition(asset: NitroTexture): NitroPoint + { + const gridPos = this.calculateGridPos(this.position); + + let x: number = (((GroupBadgePart.CELL_WIDTH * gridPos.x) + (GroupBadgePart.CELL_WIDTH / 2)) - (asset.width / 2)); + let y: number = (((GroupBadgePart.CELL_HEIGHT * gridPos.y) + (GroupBadgePart.CELL_HEIGHT / 2)) - (asset.height / 2)); + + if(x < 0) x = 0; + + if((x + asset.width) > GroupBadgePart.IMAGE_WIDTH) x = (GroupBadgePart.IMAGE_WIDTH - asset.width); + + if(y < 0) y = 0; + + if((y + asset.height) > GroupBadgePart.IMAGE_HEIGHT) y = (GroupBadgePart.IMAGE_HEIGHT - asset.height); + + return new NitroPoint(Math.floor(x), Math.floor(y)); + } + + private calculateGridPos(gridVal: number): NitroPoint + { + const point = new NitroPoint(); + point.x = Math.floor((gridVal % 3)); + point.y = Math.floor((gridVal / 3)); + + return point; + } +} diff --git a/submodules/renderer/src/nitro/session/badge/index.ts b/submodules/renderer/src/nitro/session/badge/index.ts new file mode 100644 index 0000000..dd81f9c --- /dev/null +++ b/submodules/renderer/src/nitro/session/badge/index.ts @@ -0,0 +1,4 @@ +export * from './BadgeImageManager'; +export * from './BadgeInfo'; +export * from './GroupBadge'; +export * from './GroupBadgePart'; diff --git a/submodules/renderer/src/nitro/session/furniture/FurnitureData.ts b/submodules/renderer/src/nitro/session/furniture/FurnitureData.ts new file mode 100644 index 0000000..bf5cc36 --- /dev/null +++ b/submodules/renderer/src/nitro/session/furniture/FurnitureData.ts @@ -0,0 +1,222 @@ +import { IFurnitureData } from '../../../api'; + +export class FurnitureData implements IFurnitureData +{ + private _type: string; + private _id: number; + private _className: string; + private _fullName: string; + private _category: string; + private _hasIndexedColor: boolean; + private _colourIndex: number; + private _revision: number; + private _tileSizeX: number; + private _tileSizeY: number; + private _tileSizeZ: number; + private _colors: number[]; + private _localizedName: string; + private _description: string; + private _adUrl: string; + private _purchaseOfferId: number; + private _rentOfferId: number; + private _customParams: string; + private _specialType: number; + private _purchaseCouldBeUsedForBuyout: boolean; + private _rentCouldBeUsedForBuyout: boolean; + private _availableForBuildersClub: boolean; + private _canStandOn: boolean; + private _canSitOn: boolean; + private _canLayOn: boolean; + private _excludedFromDynamic: boolean; + private _furniLine: string; + private _environment: string; + private _rare: boolean; + + constructor(type: string, id: number, fullName: string, className: string, category: string, localizedName: string, description: string, revision: number, tileSizeX: number, tileSizeY: number, tileSizeZ: number, colors: number[], hadIndexedColor: boolean, colorIndex: number, adUrl: string, purchaseOfferId: number, purchaseCouldBeUsedForBuyout: boolean, rentOfferId: number, rentCouldBeUsedForBuyout: boolean, availableForBuildersClub: boolean, customParams: string, specialType: number, canStandOn: boolean, canSitOn: boolean, canLayOn: boolean, excludedfromDynamic: boolean, furniLine: string, environment: string, rare: boolean) + { + this._type = type; + this._id = id; + this._fullName = fullName; + this._className = className; + this._category = category; + this._revision = revision; + this._tileSizeX = tileSizeX; + this._tileSizeY = tileSizeY; + this._tileSizeZ = tileSizeZ; + this._colors = colors; + this._hasIndexedColor = hadIndexedColor; + this._colourIndex = colorIndex; + this._localizedName = localizedName; + this._description = description; + this._adUrl = adUrl; + this._purchaseOfferId = purchaseOfferId; + this._purchaseCouldBeUsedForBuyout = purchaseCouldBeUsedForBuyout; + this._rentOfferId = rentOfferId; + this._rentCouldBeUsedForBuyout = rentCouldBeUsedForBuyout; + this._customParams = customParams; + this._specialType = specialType; + this._availableForBuildersClub = availableForBuildersClub; + this._canStandOn = canStandOn; + this._canSitOn = canSitOn; + this._canLayOn = canLayOn; + this._excludedFromDynamic = excludedfromDynamic; + this._furniLine = furniLine; + this._environment = environment; + this._rare = rare; + } + + public get type(): string + { + return this._type; + } + + public get id(): number + { + return this._id; + } + + public get className(): string + { + return this._className; + } + + public set className(k: string) + { + this._className = k; + } + + public get fullName(): string + { + return this._fullName; + } + + public get category(): string + { + return this._category; + } + + public get hasIndexedColor(): boolean + { + return this._hasIndexedColor; + } + + public get colorIndex(): number + { + return this._colourIndex; + } + + public get revision(): number + { + return this._revision; + } + + public get tileSizeX(): number + { + return this._tileSizeX; + } + + public get tileSizeY(): number + { + return this._tileSizeY; + } + + public get tileSizeZ(): number + { + return this._tileSizeZ; + } + + public get colors(): number[] + { + return this._colors; + } + + public get name(): string + { + return this._localizedName; + } + + public get description(): string + { + return this._description; + } + + public get adUrl(): string + { + return this._adUrl; + } + + public get purchaseOfferId(): number + { + return this._purchaseOfferId; + } + + public get customParams(): string + { + return this._customParams; + } + + public get specialType(): number + { + return this._specialType; + } + + public get rentOfferId(): number + { + return this._rentOfferId; + } + + public get purchaseCouldBeUsedForBuyout(): boolean + { + return this._purchaseCouldBeUsedForBuyout; + } + + public get rentCouldBeUsedForBuyout(): boolean + { + return this._rentCouldBeUsedForBuyout; + } + + public get availableForBuildersClub(): boolean + { + return this._availableForBuildersClub; + } + + public get canStandOn(): boolean + { + return this._canStandOn; + } + + public get canSitOn(): boolean + { + return this._canSitOn; + } + + public get canLayOn(): boolean + { + return this._canLayOn; + } + + public get isExternalImage(): boolean + { + return !(this._className.indexOf('external_image') === -1); + } + + public get excludeDynamic(): boolean + { + return this._excludedFromDynamic; + } + + public get furniLine(): string + { + return this._furniLine; + } + + public get environment(): string + { + return this._environment; + } + + public get rare(): boolean + { + return this._rare; + } +} diff --git a/submodules/renderer/src/nitro/session/furniture/FurnitureDataLoader.ts b/submodules/renderer/src/nitro/session/furniture/FurnitureDataLoader.ts new file mode 100644 index 0000000..d130144 --- /dev/null +++ b/submodules/renderer/src/nitro/session/furniture/FurnitureDataLoader.ts @@ -0,0 +1,130 @@ +import { FurnitureType, IFurnitureData, INitroLocalizationManager, NitroLogger } from '../../../api'; +import { EventDispatcher } from '../../../core'; +import { NitroEvent } from '../../../events'; +import { FurnitureData } from './FurnitureData'; + +export class FurnitureDataLoader extends EventDispatcher +{ + public static FURNITURE_DATA_READY: string = 'FDP_FURNITURE_DATA_READY'; + public static FURNITURE_DATA_ERROR: string = 'FDP_FURNITURE_DATA_ERROR'; + + private _floorItems: Map; + private _wallItems: Map; + private _localization: INitroLocalizationManager; + + constructor(floorItems: Map, wallItems: Map, localization: INitroLocalizationManager) + { + super(); + + this._floorItems = floorItems; + this._wallItems = wallItems; + this._localization = localization; + } + + public loadFurnitureData(url: string): void + { + if(!url) return; + + fetch(url) + .then(response => response.json()) + .then(data => this.onFurnitureDataLoaded(data)) + .catch(err => this.onFurnitureDataError(err)); + } + + private onFurnitureDataLoaded(data: { [index: string]: any }): void + { + if(!data) return; + + if((typeof data.roomitemtypes == 'undefined') || (typeof data.wallitemtypes == 'undefined')) NitroLogger.warn('Could not find `roomitemtypes` or `wallitemtypes` in furnidata.'); + + if(data.roomitemtypes) this.parseFloorItems(data.roomitemtypes); + + if(data.wallitemtypes) this.parseWallItems(data.wallitemtypes); + + this.dispatchEvent(new NitroEvent(FurnitureDataLoader.FURNITURE_DATA_READY)); + } + + private onFurnitureDataError(error: Error): void + { + if(!error) return; + + NitroLogger.error(error); + + this.dispatchEvent(new NitroEvent(FurnitureDataLoader.FURNITURE_DATA_ERROR)); + } + + private parseFloorItems(data: any): void + { + if(!data || !data.furnitype) return; + + for(const furniture of data.furnitype) + { + if(!furniture) continue; + + const colors: number[] = []; + + if(furniture.partcolors) + { + for(const color of furniture.partcolors.color) + { + let colorCode = (color as string); + + if(colorCode.charAt(0) === '#') + { + colorCode = colorCode.replace('#', ''); + + colors.push(parseInt(colorCode, 16)); + } + else + { + colors.push((parseInt(colorCode, 16))); + } + } + } + + const classSplit = (furniture.classname as string).split('*'); + const className = classSplit[0]; + const colorIndex = ((classSplit.length > 1) ? parseInt(classSplit[1]) : 0); + const hasColorIndex = (classSplit.length > 1); + + const furnitureData = new FurnitureData(FurnitureType.FLOOR, furniture.id, furniture.classname, className, furniture.category, furniture.name, furniture.description, furniture.revision, furniture.xdim, furniture.ydim, 0, colors, hasColorIndex, colorIndex, furniture.adurl, furniture.offerid, furniture.buyout, furniture.rentofferid, furniture.rentbuyout, furniture.bc, furniture.customparams, furniture.specialtype, furniture.canstandon, furniture.cansiton, furniture.canlayon, furniture.excludeddynamic, furniture.furniline, furniture.environment, furniture.rare); + + this._floorItems.set(furnitureData.id, furnitureData); + + this.updateLocalizations(furnitureData); + } + } + + private parseWallItems(data: any): void + { + if(!data || !data.furnitype) return; + + for(const furniture of data.furnitype) + { + if(!furniture) continue; + + const furnitureData = new FurnitureData(FurnitureType.WALL, furniture.id, furniture.classname, furniture.classname, furniture.category, furniture.name, furniture.description, furniture.revision, 0, 0, 0, null, false, 0, furniture.adurl, furniture.offerid, furniture.buyout, furniture.rentofferid, furniture.rentbuyout, furniture.bc, null, furniture.specialtype, false, false, false, furniture.excludeddynamic, furniture.furniline, furniture.environment, furniture.rare); + + this._wallItems.set(furnitureData.id, furnitureData); + + this.updateLocalizations(furnitureData); + } + } + + private updateLocalizations(furniture: FurnitureData): void + { + if(!this._localization) return; + + switch(furniture.type) + { + case FurnitureType.FLOOR: + this._localization.setValue(('roomItem.name.' + furniture.id), furniture.name); + this._localization.setValue(('roomItem.desc.' + furniture.id), furniture.description); + return; + case FurnitureType.WALL: + this._localization.setValue(('wallItem.name.' + furniture.id), furniture.name); + this._localization.setValue(('wallItem.desc.' + furniture.id), furniture.description); + return; + } + } +} diff --git a/submodules/renderer/src/nitro/session/furniture/index.ts b/submodules/renderer/src/nitro/session/furniture/index.ts new file mode 100644 index 0000000..6b2d9e3 --- /dev/null +++ b/submodules/renderer/src/nitro/session/furniture/index.ts @@ -0,0 +1,2 @@ +export * from './FurnitureData'; +export * from './FurnitureDataLoader'; diff --git a/submodules/renderer/src/nitro/session/handler/BaseHandler.ts b/submodules/renderer/src/nitro/session/handler/BaseHandler.ts new file mode 100644 index 0000000..0ad97c1 --- /dev/null +++ b/submodules/renderer/src/nitro/session/handler/BaseHandler.ts @@ -0,0 +1,44 @@ +import { IConnection, IRoomHandlerListener } from '../../../api'; +import { Disposable } from '../../../core'; + +export class BaseHandler extends Disposable +{ + private _connection: IConnection; + private _listener: IRoomHandlerListener; + private _roomId: number; + + constructor(connection: IConnection, listener: IRoomHandlerListener) + { + super(); + + this._connection = connection; + this._listener = listener; + this._roomId = 0; + } + + protected onDispose(): void + { + this._connection = null; + this._listener = null; + } + + public setRoomId(id: number): void + { + this._roomId = id; + } + + public get connection(): IConnection + { + return this._connection; + } + + public get listener(): IRoomHandlerListener + { + return this._listener; + } + + public get roomId(): number + { + return this._roomId; + } +} diff --git a/submodules/renderer/src/nitro/session/handler/GenericErrorHandler.ts b/submodules/renderer/src/nitro/session/handler/GenericErrorHandler.ts new file mode 100644 index 0000000..79ed20a --- /dev/null +++ b/submodules/renderer/src/nitro/session/handler/GenericErrorHandler.ts @@ -0,0 +1,42 @@ +import { GenericErrorEnum, IConnection, IRoomHandlerListener } from '../../../api'; +import { RoomSessionErrorMessageEvent } from '../../../events'; +import { GenericErrorEvent } from '../../communication'; +import { BaseHandler } from './BaseHandler'; + +export class GenericErrorHandler extends BaseHandler +{ + constructor(connection: IConnection, listener: IRoomHandlerListener) + { + super(connection, listener); + + connection.addMessageEvent(new GenericErrorEvent(this.onRoomGenericError.bind(this))); + } + + private onRoomGenericError(event: GenericErrorEvent): void + { + if(!(event instanceof GenericErrorEvent)) return; + + const parser = event.getParser(); + + if(!parser) return; + + const roomSession = this.listener.getSession(this.roomId); + + if(!roomSession) return; + + let type: string = null; + + switch(parser.errorCode) + { + case GenericErrorEnum.KICKED_OUT_OF_ROOM: + type = RoomSessionErrorMessageEvent.RSEME_KICKED; + break; + default: + return; + } + + if(!type || type.length == 0) return; + + this.listener.events.dispatchEvent(new RoomSessionErrorMessageEvent(type, roomSession)); + } +} diff --git a/submodules/renderer/src/nitro/session/handler/PetPackageHandler.ts b/submodules/renderer/src/nitro/session/handler/PetPackageHandler.ts new file mode 100644 index 0000000..0ef7f34 --- /dev/null +++ b/submodules/renderer/src/nitro/session/handler/PetPackageHandler.ts @@ -0,0 +1,45 @@ +import { IConnection, IRoomHandlerListener } from '../../../api'; +import { RoomSessionPetPackageEvent } from '../../../events'; +import { OpenPetPackageRequestedMessageEvent, OpenPetPackageResultMessageEvent } from '../../communication'; +import { BaseHandler } from './BaseHandler'; + +export class PetPackageHandler extends BaseHandler +{ + constructor(connection: IConnection, listener: IRoomHandlerListener) + { + super(connection, listener); + + connection.addMessageEvent(new OpenPetPackageRequestedMessageEvent(this.onOpenPetPackageRequested.bind(this))); + connection.addMessageEvent(new OpenPetPackageResultMessageEvent(this.onOpenPetPackageResult.bind(this))); + } + + private onOpenPetPackageRequested(event: OpenPetPackageRequestedMessageEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + this.listener.events.dispatchEvent(new RoomSessionPetPackageEvent(RoomSessionPetPackageEvent.RSOPPE_OPEN_PET_PACKAGE_REQUESTED, session, parser.objectId, parser.figureData, 0, null)); + } + + private onOpenPetPackageResult(event: OpenPetPackageResultMessageEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + this.listener.events.dispatchEvent(new RoomSessionPetPackageEvent(RoomSessionPetPackageEvent.RSOPPE_OPEN_PET_PACKAGE_RESULT, session, parser.objectId, null, parser.nameValidationStatus, parser.nameValidationInfo)); + } +} diff --git a/submodules/renderer/src/nitro/session/handler/PollHandler.ts b/submodules/renderer/src/nitro/session/handler/PollHandler.ts new file mode 100644 index 0000000..d4b06cc --- /dev/null +++ b/submodules/renderer/src/nitro/session/handler/PollHandler.ts @@ -0,0 +1,114 @@ +import { IConnection, IRoomHandlerListener } from '../../../api'; +import { RoomSessionPollEvent, RoomSessionVoteEvent } from '../../../events'; +import { PollContentsEvent, PollErrorEvent, PollOfferEvent, StartRoomPollEvent, RoomPollResultEvent } from '../../communication'; +import { BaseHandler } from './BaseHandler'; + +export class PollHandler extends BaseHandler +{ + constructor(connection: IConnection, listener: IRoomHandlerListener) + { + super(connection, listener); + + connection.addMessageEvent(new PollContentsEvent(this.onPollContentsEvent.bind(this))); + connection.addMessageEvent(new PollOfferEvent(this.onPollOfferEvent.bind(this))); + connection.addMessageEvent(new PollErrorEvent(this.onPollErrorEvent.bind(this))); + connection.addMessageEvent(new StartRoomPollEvent(this.onStartRoomPollEvent.bind(this))); + connection.addMessageEvent(new RoomPollResultEvent(this.onRoomPollResultEvent.bind(this))); + } + + private onPollContentsEvent(event: PollContentsEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + const pollEvent = new RoomSessionPollEvent(RoomSessionPollEvent.CONTENT, session, parser.id); + + pollEvent.startMessage = parser.startMessage; + pollEvent.endMessage = parser.endMessage; + pollEvent.numQuestions = parser.numQuestions; + pollEvent.questionArray = parser.questionArray; + pollEvent.npsPoll = parser.npsPoll; + + this.listener.events.dispatchEvent(pollEvent); + } + + private onPollOfferEvent(event: PollOfferEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + const pollEvent = new RoomSessionPollEvent(RoomSessionPollEvent.OFFER, session, parser.id); + + pollEvent.summary = parser.headline; + pollEvent.summary = parser.summary; + + this.listener.events.dispatchEvent(pollEvent); + } + + private onPollErrorEvent(event: PollErrorEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + const pollEvent = new RoomSessionPollEvent(RoomSessionPollEvent.ERROR, session, -1); + pollEvent.headline = '???'; + pollEvent.summary = '???'; + + this.listener.events.dispatchEvent(pollEvent); + } + + private onStartRoomPollEvent(event: StartRoomPollEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + const pollEvent = new RoomSessionVoteEvent(RoomSessionVoteEvent.VOTE_QUESTION, session, parser.question, parser.choices); + + this.listener.events.dispatchEvent(pollEvent); + } + + private onRoomPollResultEvent(event: RoomPollResultEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + const pollEvent = new RoomSessionVoteEvent(RoomSessionVoteEvent.VOTE_RESULT, session, parser.question, parser.choices, parser.SafeStr_7651, parser.SafeStr_7654); + + this.listener.events.dispatchEvent(pollEvent); + } +} diff --git a/submodules/renderer/src/nitro/session/handler/RoomChatHandler.ts b/submodules/renderer/src/nitro/session/handler/RoomChatHandler.ts new file mode 100644 index 0000000..5f84504 --- /dev/null +++ b/submodules/renderer/src/nitro/session/handler/RoomChatHandler.ts @@ -0,0 +1,173 @@ +import { IConnection, IRoomHandlerListener, SystemChatStyleEnum } from '../../../api'; +import { RoomSessionChatEvent } from '../../../events'; +import { FloodControlEvent, PetRespectNoficationEvent, PetSupplementedNotificationEvent, PetSupplementTypeEnum, RemainingMuteEvent, RespectReceivedEvent, RoomUnitChatEvent, RoomUnitChatShoutEvent, RoomUnitChatWhisperEvent, RoomUnitHandItemReceivedEvent } from '../../communication'; +import { BaseHandler } from './BaseHandler'; + +export class RoomChatHandler extends BaseHandler +{ + constructor(connection: IConnection, listener: IRoomHandlerListener) + { + super(connection, listener); + + connection.addMessageEvent(new RoomUnitChatEvent(this.onRoomUnitChatEvent.bind(this))); + connection.addMessageEvent(new RoomUnitChatShoutEvent(this.onRoomUnitChatEvent.bind(this))); + connection.addMessageEvent(new RoomUnitChatWhisperEvent(this.onRoomUnitChatEvent.bind(this))); + connection.addMessageEvent(new RoomUnitHandItemReceivedEvent(this.onRoomUnitHandItemReceivedEvent.bind(this))); + connection.addMessageEvent(new RespectReceivedEvent(this.onRespectReceivedEvent.bind(this))); + connection.addMessageEvent(new PetRespectNoficationEvent(this.onPetRespectNoficationEvent.bind(this))); + connection.addMessageEvent(new PetSupplementedNotificationEvent(this.onPetSupplementedNotificationEvent.bind(this))); + connection.addMessageEvent(new FloodControlEvent(this.onFloodControlEvent.bind(this))); + connection.addMessageEvent(new RemainingMuteEvent(this.onRemainingMuteEvent.bind(this))); + } + + private onRoomUnitChatEvent(event: RoomUnitChatEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + let chatType: number = RoomSessionChatEvent.CHAT_TYPE_SPEAK; + + if(event instanceof RoomUnitChatShoutEvent) chatType = RoomSessionChatEvent.CHAT_TYPE_SHOUT; + else if(event instanceof RoomUnitChatWhisperEvent) chatType = RoomSessionChatEvent.CHAT_TYPE_WHISPER; + + const chatEvent = new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, parser.roomIndex, parser.message, chatType, parser.bubble); + + this.listener.events.dispatchEvent(chatEvent); + } + + private onRoomUnitHandItemReceivedEvent(event: RoomUnitHandItemReceivedEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, parser.giverUserId, '', RoomSessionChatEvent.CHAT_TYPE_HAND_ITEM_RECEIVED, SystemChatStyleEnum.GENERIC, null, parser.handItemType)); + } + + private onRespectReceivedEvent(event: RespectReceivedEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + const userData = session.userDataManager.getUserData(parser.userId); + + if(!userData) return; + + this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, userData.roomIndex, '', RoomSessionChatEvent.CHAT_TYPE_RESPECT, SystemChatStyleEnum.GENERIC)); + } + + private onPetRespectNoficationEvent(event: PetRespectNoficationEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + const petData = session.userDataManager.getPetData(parser.petData.id); + + if(!petData) return; + + let chatType = RoomSessionChatEvent.CHAT_TYPE_PETRESPECT; + + if(parser.isTreat) chatType = RoomSessionChatEvent.CHAT_TYPE_PETTREAT; + + this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, petData.roomIndex, '', chatType, SystemChatStyleEnum.GENERIC)); + } + + private onPetSupplementedNotificationEvent(event: PetSupplementedNotificationEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + const petData = session.userDataManager.getPetData(parser.petId); + + if(!petData) return; + + let userRoomIndex = -1; + + const userData = session.userDataManager.getUserData(parser.userId); + + if(userData) userRoomIndex = userData.roomIndex; + + let chatType = RoomSessionChatEvent.CHAT_TYPE_PETREVIVE; + + switch(parser.supplementType) + { + case PetSupplementTypeEnum.REVIVE: + chatType = RoomSessionChatEvent.CHAT_TYPE_PETREVIVE; + break; + case PetSupplementTypeEnum.REBREED_FERTILIZER: + chatType = RoomSessionChatEvent.CHAT_TYPE_PET_REBREED_FERTILIZE; + break; + case PetSupplementTypeEnum.SPEED_FERTILIZER: + chatType = RoomSessionChatEvent.CHAT_TYPE_PET_SPEED_FERTILIZE; + break; + } + + this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, petData.roomIndex, '', chatType, SystemChatStyleEnum.GENERIC, null, userRoomIndex)); + } + + private onFloodControlEvent(event: FloodControlEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + const seconds = parser.seconds; + + this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.FLOOD_EVENT, session, -1, seconds.toString(), 0, 0)); + } + + private onRemainingMuteEvent(event: RemainingMuteEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + this.listener.events.dispatchEvent(new RoomSessionChatEvent(RoomSessionChatEvent.CHAT_EVENT, session, session.ownRoomIndex, '', RoomSessionChatEvent.CHAT_TYPE_MUTE_REMAINING, SystemChatStyleEnum.GENERIC, null, parser.seconds)); + } +} diff --git a/submodules/renderer/src/nitro/session/handler/RoomDataHandler.ts b/submodules/renderer/src/nitro/session/handler/RoomDataHandler.ts new file mode 100644 index 0000000..18c3f70 --- /dev/null +++ b/submodules/renderer/src/nitro/session/handler/RoomDataHandler.ts @@ -0,0 +1,40 @@ +import { IConnection, IRoomHandlerListener } from '../../../api'; +import { RoomSessionEvent, RoomSessionPropertyUpdateEvent } from '../../../events'; +import { GetGuestRoomResultEvent } from '../../communication'; +import { BaseHandler } from './BaseHandler'; + +export class RoomDataHandler extends BaseHandler +{ + constructor(connection: IConnection, listener: IRoomHandlerListener) + { + super(connection, listener); + + connection.addMessageEvent(new GetGuestRoomResultEvent(this.onGetGuestRoomResultEvent.bind(this))); + } + + private onGetGuestRoomResultEvent(event: GetGuestRoomResultEvent): void + { + if(!(event instanceof GetGuestRoomResultEvent)) return; + + const parser = event.getParser(); + + if(!parser) return; + + if(parser.roomForward) return; + + const roomSession = this.listener.getSession(this.roomId); + + if(!roomSession) return; + + const roomData = parser.data; + + roomSession.tradeMode = roomData.tradeMode; + roomSession.isGuildRoom = (roomData.habboGroupId !== 0); + roomSession.doorMode = roomData.doorMode; + roomSession.allowPets = roomData.allowPets; + roomSession.moderationSettings = parser.moderation; + + this.listener.events.dispatchEvent(new RoomSessionPropertyUpdateEvent(RoomSessionPropertyUpdateEvent.RSDUE_ALLOW_PETS, roomSession)); + this.listener.events.dispatchEvent(new RoomSessionEvent(RoomSessionEvent.ROOM_DATA, roomSession)); + } +} diff --git a/submodules/renderer/src/nitro/session/handler/RoomDimmerPresetsHandler.ts b/submodules/renderer/src/nitro/session/handler/RoomDimmerPresetsHandler.ts new file mode 100644 index 0000000..e1d0307 --- /dev/null +++ b/submodules/renderer/src/nitro/session/handler/RoomDimmerPresetsHandler.ts @@ -0,0 +1,44 @@ +import { IConnection, IRoomHandlerListener } from '../../../api'; +import { RoomSessionDimmerPresetsEvent } from '../../../events'; +import { RoomDimmerPresetsEvent } from '../../communication'; +import { BaseHandler } from './BaseHandler'; + +export class RoomDimmerPresetsHandler extends BaseHandler +{ + constructor(connection: IConnection, listener: IRoomHandlerListener) + { + super(connection, listener); + + connection.addMessageEvent(new RoomDimmerPresetsEvent(this.onRoomDimmerPresets.bind(this))); + } + + private onRoomDimmerPresets(event: RoomDimmerPresetsEvent): void + { + if(!event) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const presetEvent = new RoomSessionDimmerPresetsEvent(RoomSessionDimmerPresetsEvent.ROOM_DIMMER_PRESETS, session); + + presetEvent.selectedPresetId = parser.selectedPresetId; + + let i = 0; + + while(i < parser.presetCount) + { + const preset = parser.getPreset(i); + + if(preset) presetEvent.storePreset(preset.id, preset.type, preset.color, preset.brightness); + + i++; + } + + this.listener && this.listener.events.dispatchEvent(presetEvent); + } +} diff --git a/submodules/renderer/src/nitro/session/handler/RoomPermissionsHandler.ts b/submodules/renderer/src/nitro/session/handler/RoomPermissionsHandler.ts new file mode 100644 index 0000000..bafbd8f --- /dev/null +++ b/submodules/renderer/src/nitro/session/handler/RoomPermissionsHandler.ts @@ -0,0 +1,48 @@ +import { IConnection, IRoomHandlerListener, RoomControllerLevel } from '../../../api'; +import { RoomRightsClearEvent, RoomRightsEvent, RoomRightsOwnerEvent } from '../../communication'; +import { BaseHandler } from './BaseHandler'; + +export class RoomPermissionsHandler extends BaseHandler +{ + constructor(connection: IConnection, listener: IRoomHandlerListener) + { + super(connection, listener); + + connection.addMessageEvent(new RoomRightsEvent(this.onRoomRightsEvent.bind(this))); + connection.addMessageEvent(new RoomRightsClearEvent(this.onRoomRightsClearEvent.bind(this))); + connection.addMessageEvent(new RoomRightsOwnerEvent(this.onRoomRightsOwnerEvent.bind(this))); + } + + private onRoomRightsEvent(event: RoomRightsEvent): void + { + if(!(event instanceof RoomRightsEvent)) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + session.setControllerLevel(event.getParser().controllerLevel); + } + + private onRoomRightsClearEvent(event: RoomRightsClearEvent): void + { + if(!(event instanceof RoomRightsClearEvent)) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + session.setControllerLevel(RoomControllerLevel.NONE); + } + + private onRoomRightsOwnerEvent(event: RoomRightsOwnerEvent): void + { + if(!(event instanceof RoomRightsOwnerEvent)) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + session.setRoomOwner(); + } +} diff --git a/submodules/renderer/src/nitro/session/handler/RoomPresentHandler.ts b/submodules/renderer/src/nitro/session/handler/RoomPresentHandler.ts new file mode 100644 index 0000000..8ba41da --- /dev/null +++ b/submodules/renderer/src/nitro/session/handler/RoomPresentHandler.ts @@ -0,0 +1,35 @@ +import { IConnection, IRoomHandlerListener } from '../../../api'; +import { RoomSessionPresentEvent } from '../../../events'; +import { PresentOpenedMessageEvent } from '../../communication'; +import { BaseHandler } from './BaseHandler'; + +export class RoomPresentHandler extends BaseHandler +{ + constructor(connection: IConnection, listener: IRoomHandlerListener) + { + super(connection, listener); + + if(!connection) return; + + connection.addMessageEvent(new PresentOpenedMessageEvent(this.onFurnitureGiftOpenedEvent.bind(this))); + } + + private onFurnitureGiftOpenedEvent(event: PresentOpenedMessageEvent): void + { + if(!event) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + if(this.listener && this.listener.events) this.listener.events.dispatchEvent( + new RoomSessionPresentEvent(RoomSessionPresentEvent.RSPE_PRESENT_OPENED, session, parser.classId, parser.itemType, + parser.productCode, parser.placedItemId, parser.placedItemType, parser.placedInRoom, parser.petFigureString)); + + } + +} diff --git a/submodules/renderer/src/nitro/session/handler/RoomSessionHandler.ts b/submodules/renderer/src/nitro/session/handler/RoomSessionHandler.ts new file mode 100644 index 0000000..57ce678 --- /dev/null +++ b/submodules/renderer/src/nitro/session/handler/RoomSessionHandler.ts @@ -0,0 +1,118 @@ +import { IConnection, IRoomHandlerListener } from '../../../api'; +import { RoomSessionDoorbellEvent, RoomSessionSpectatorModeEvent } from '../../../events'; +import { DesktopViewEvent, FlatAccessDeniedMessageEvent, GoToFlatMessageComposer, RoomDoorbellAcceptedEvent, RoomEnterEvent, RoomReadyMessageEvent, YouAreSpectatorMessageEvent } from '../../communication'; +import { BaseHandler } from './BaseHandler'; + +export class RoomSessionHandler extends BaseHandler +{ + public static RS_CONNECTED: string = 'RS_CONNECTED'; + public static RS_READY: string = 'RS_READY'; + public static RS_DISCONNECTED: string = 'RS_DISCONNECTED'; + + constructor(connection: IConnection, listener: IRoomHandlerListener) + { + super(connection, listener); + + connection.addMessageEvent(new RoomEnterEvent(this.onRoomEnterEvent.bind(this))); + connection.addMessageEvent(new RoomReadyMessageEvent(this.onRoomReadyMessageEvent.bind(this))); + connection.addMessageEvent(new DesktopViewEvent(this.onDesktopViewEvent.bind(this))); + connection.addMessageEvent(new RoomDoorbellAcceptedEvent(this.onRoomDoorbellAcceptedEvent.bind(this))); + connection.addMessageEvent(new FlatAccessDeniedMessageEvent(this.onRoomDoorbellRejectedEvent.bind(this))); + connection.addMessageEvent(new YouAreSpectatorMessageEvent(this.onYouAreSpectatorMessageEvent.bind(this))); + } + + private onRoomEnterEvent(event: RoomEnterEvent): void + { + if(!(event instanceof RoomEnterEvent)) return; + + if(this.listener) this.listener.sessionUpdate(this.roomId, RoomSessionHandler.RS_CONNECTED); + } + + private onRoomReadyMessageEvent(event: RoomReadyMessageEvent): void + { + if(!(event instanceof RoomReadyMessageEvent)) return; + + const fromRoomId = this.roomId; + const toRoomId = event.getParser().roomId; + + if(this.listener) + { + this.listener.sessionReinitialize(fromRoomId, toRoomId); + this.listener.sessionUpdate(this.roomId, RoomSessionHandler.RS_READY); + } + } + + private onDesktopViewEvent(event: DesktopViewEvent): void + { + if(!(event instanceof DesktopViewEvent)) return; + + if(this.listener) this.listener.sessionUpdate(this.roomId, RoomSessionHandler.RS_DISCONNECTED); + } + + private onRoomDoorbellAcceptedEvent(event: RoomDoorbellAcceptedEvent): void + { + if(!(event instanceof RoomDoorbellAcceptedEvent) || !this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const username = parser.userName; + + if(!username || !username.length) + { + this.connection.send(new GoToFlatMessageComposer(this.roomId)); + } + else + { + if(this.listener.events) + { + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + this.listener.events.dispatchEvent(new RoomSessionDoorbellEvent(RoomSessionDoorbellEvent.RSDE_ACCEPTED, session, username)); + } + } + } + + private onRoomDoorbellRejectedEvent(event: FlatAccessDeniedMessageEvent): void + { + if(!(event instanceof FlatAccessDeniedMessageEvent) || !this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const username = parser.userName; + + if(!username || !username.length) + { + this.listener.sessionUpdate(this.roomId, RoomSessionHandler.RS_DISCONNECTED); + } + else + { + if(this.listener.events) + { + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + this.listener.events.dispatchEvent(new RoomSessionDoorbellEvent(RoomSessionDoorbellEvent.RSDE_REJECTED, session, username)); + } + } + } + + private onYouAreSpectatorMessageEvent(event: YouAreSpectatorMessageEvent): void + { + if(this.listener) + { + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + session.isSpectator = true; + this.listener.events.dispatchEvent(new RoomSessionSpectatorModeEvent(RoomSessionSpectatorModeEvent.SPECTATOR_MODE, session)); + } + } +} diff --git a/submodules/renderer/src/nitro/session/handler/RoomUsersHandler.ts b/submodules/renderer/src/nitro/session/handler/RoomUsersHandler.ts new file mode 100644 index 0000000..12a2063 --- /dev/null +++ b/submodules/renderer/src/nitro/session/handler/RoomUsersHandler.ts @@ -0,0 +1,475 @@ +import { IConnection, IRoomHandlerListener, IRoomUserData } from '../../../api'; +import { RoomSessionConfirmPetBreedingEvent, RoomSessionConfirmPetBreedingResultEvent, RoomSessionDanceEvent, RoomSessionDoorbellEvent, RoomSessionErrorMessageEvent, RoomSessionFavoriteGroupUpdateEvent, RoomSessionFriendRequestEvent, RoomSessionNestBreedingSuccessEvent, RoomSessionPetBreedingEvent, RoomSessionPetBreedingResultEvent, RoomSessionPetFigureUpdateEvent, RoomSessionPetInfoUpdateEvent, RoomSessionPetLevelUpdateEvent, RoomSessionPetStatusUpdateEvent, RoomSessionUserBadgesEvent, RoomSessionUserDataUpdateEvent, RoomSessionUserFigureUpdateEvent } from '../../../events'; +import { BotErrorEvent, ConfirmBreedingRequestEvent, ConfirmBreedingResultEvent, DoorbellMessageEvent, FavoriteMembershipUpdateMessageEvent, NestBreedingSuccessEvent, NewFriendRequestEvent, PetBreedingMessageEvent, PetBreedingResultEvent, PetFigureUpdateEvent, PetInfoEvent, PetLevelUpdateMessageEvent, PetPlacingErrorEvent, PetStatusUpdateEvent, RoomUnitDanceEvent, RoomUnitEvent, RoomUnitInfoEvent, RoomUnitRemoveEvent, UserCurrentBadgesEvent, UserNameChangeMessageEvent } from '../../communication'; +import { RoomPetData } from '../RoomPetData'; +import { RoomUserData } from '../RoomUserData'; +import { BaseHandler } from './BaseHandler'; + +export class RoomUsersHandler extends BaseHandler +{ + constructor(connection: IConnection, listener: IRoomHandlerListener) + { + super(connection, listener); + + connection.addMessageEvent(new RoomUnitEvent(this.onRoomUnitEvent.bind(this))); + connection.addMessageEvent(new RoomUnitInfoEvent(this.onRoomUnitInfoEvent.bind(this))); + connection.addMessageEvent(new RoomUnitRemoveEvent(this.onRoomUnitRemoveEvent.bind(this))); + connection.addMessageEvent(new RoomUnitDanceEvent(this.onRoomUnitDanceEvent.bind(this))); + connection.addMessageEvent(new UserCurrentBadgesEvent(this.onUserCurrentBadgesEvent.bind(this))); + connection.addMessageEvent(new DoorbellMessageEvent(this.onRoomDoorbellEvent.bind(this))); + connection.addMessageEvent(new UserNameChangeMessageEvent(this.onUserNameChangeMessageEvent.bind(this))); + connection.addMessageEvent(new NewFriendRequestEvent(this.onNewFriendRequestEvent.bind(this))); + connection.addMessageEvent(new PetInfoEvent(this.onPetInfoEvent.bind(this))); + connection.addMessageEvent(new PetStatusUpdateEvent(this.onPetStatusUpdateEvent.bind(this))); + connection.addMessageEvent(new PetBreedingMessageEvent(this.onPetBreedingMessageEvent.bind(this))); + connection.addMessageEvent(new PetLevelUpdateMessageEvent(this.onPetLevelUpdateMessageEvent.bind(this))); + connection.addMessageEvent(new ConfirmBreedingResultEvent(this.onConfirmBreedingResultEvent.bind(this))); + connection.addMessageEvent(new NestBreedingSuccessEvent(this.onNestBreedingSuccessEvent.bind(this))); + connection.addMessageEvent(new ConfirmBreedingRequestEvent(this.onConfirmBreedingRequestEvent.bind(this))); + connection.addMessageEvent(new PetFigureUpdateEvent(this.onPetFigureUpdateEvent.bind(this))); + connection.addMessageEvent(new PetBreedingResultEvent(this.onPetBreedingResultEvent.bind(this))); + connection.addMessageEvent(new PetPlacingErrorEvent(this.onPetPlacingError.bind(this))); + connection.addMessageEvent(new BotErrorEvent(this.onBotError.bind(this))); + connection.addMessageEvent(new FavoriteMembershipUpdateMessageEvent(this.onFavoriteMembershipUpdateMessageEvent.bind(this))); + } + + private onRoomUnitEvent(event: RoomUnitEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const users = event.getParser().users; + + const usersToAdd: IRoomUserData[] = []; + + if(users && users.length) + { + for(const user of users) + { + if(!user) continue; + + const userData = new RoomUserData(user.roomIndex); + + userData.name = user.name; + userData.custom = user.custom; + userData.activityPoints = user.activityPoints; + userData.figure = user.figure; + userData.type = user.userType; + userData.webID = user.webID; + userData.groupId = user.groupID; + userData.groupName = user.groupName; + userData.groupStatus = user.groupStatus; + userData.sex = user.sex; + userData.ownerId = user.ownerId; + userData.ownerName = user.ownerName; + userData.rarityLevel = user.rarityLevel; + userData.hasSaddle = user.hasSaddle; + userData.isRiding = user.isRiding; + userData.canBreed = user.canBreed; + userData.canHarvest = user.canHarvest; + userData.canRevive = user.canRevive; + userData.hasBreedingPermission = user.hasBreedingPermission; + userData.petLevel = user.petLevel; + userData.botSkills = user.botSkills; + userData.isModerator = user.isModerator; + + if(!session.userDataManager.getUserData(user.roomIndex)) usersToAdd.push(userData); + + session.userDataManager.updateUserData(userData); + } + } + + this.listener.events.dispatchEvent(new RoomSessionUserDataUpdateEvent(session, usersToAdd)); + } + + private onRoomUnitInfoEvent(event: RoomUnitInfoEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + session.userDataManager.updateFigure(parser.unitId, parser.figure, parser.gender, false, false); + session.userDataManager.updateMotto(parser.unitId, parser.motto); + session.userDataManager.updateAchievementScore(parser.unitId, parser.achievementScore); + + this.listener.events.dispatchEvent(new RoomSessionUserFigureUpdateEvent(session, parser.unitId, parser.figure, parser.gender, parser.motto, parser.achievementScore)); + + } + + private onRoomUnitRemoveEvent(event: RoomUnitRemoveEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + session.userDataManager.removeUserData(event.getParser().unitId); + } + + private onRoomUnitDanceEvent(event: RoomUnitDanceEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + this.listener.events.dispatchEvent(new RoomSessionDanceEvent(session, parser.unitId, parser.danceId)); + } + + private onUserCurrentBadgesEvent(event: UserCurrentBadgesEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + session.userDataManager.setUserBadges(parser.userId, parser.badges); + + this.listener.events.dispatchEvent(new RoomSessionUserBadgesEvent(session, parser.userId, parser.badges)); + } + + private onRoomDoorbellEvent(event: DoorbellMessageEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const username = parser.userName; + + if(!username || !username.length) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + this.listener.events.dispatchEvent(new RoomSessionDoorbellEvent(RoomSessionDoorbellEvent.DOORBELL, session, username)); + } + + private onUserNameChangeMessageEvent(event: UserNameChangeMessageEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + session.userDataManager.updateName(parser.id, parser.newName); + } + + private onNewFriendRequestEvent(event: NewFriendRequestEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const request = parser.request; + + this.listener.events.dispatchEvent(new RoomSessionFriendRequestEvent(session, request.requestId, request.requesterUserId, request.requesterName)); + } + + private onPetInfoEvent(event: PetInfoEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const petData = new RoomPetData(); + + petData.id = parser.id; + petData.level = parser.level; + petData.maximumLevel = parser.maximumLevel; + petData.experience = parser.experience; + petData.levelExperienceGoal = parser.levelExperienceGoal; + petData.energy = parser.energy; + petData.maximumEnergy = parser.maximumEnergy; + petData.happyness = parser.happyness; + petData.maximumHappyness = parser.maximumHappyness; + petData.ownerId = parser.ownerId; + petData.ownerName = parser.ownerName; + petData.respect = parser.respect; + petData.age = parser.age; + petData.unknownRarity = parser.unknownRarity; + petData.saddle = parser.saddle; + petData.rider = parser.rider; + petData.breedable = parser.breedable; + petData.fullyGrown = parser.fullyGrown; + petData.rarityLevel = parser.rarityLevel; + petData.dead = parser.dead; + petData.skillTresholds = parser.skillTresholds; + petData.publiclyRideable = parser.publiclyRideable; + petData.maximumTimeToLive = parser.maximumTimeToLive; + petData.remainingTimeToLive = parser.remainingTimeToLive; + petData.remainingGrowTime = parser.remainingGrowTime; + petData.publiclyBreedable = parser.publiclyBreedable; + + this.listener.events.dispatchEvent(new RoomSessionPetInfoUpdateEvent(session, petData)); + } + + private onPetStatusUpdateEvent(event: PetStatusUpdateEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + session.userDataManager.updatePetBreedingStatus(parser.roomIndex, parser.canBreed, parser.canHarvest, parser.canRevive, parser.hasBreedingPermission); + + this.listener.events.dispatchEvent(new RoomSessionPetStatusUpdateEvent(session, parser.petId, parser.canBreed, parser.canHarvest, parser.canRevive, parser.hasBreedingPermission)); + } + + private onPetBreedingMessageEvent(event: PetBreedingMessageEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + this.listener.events.dispatchEvent(new RoomSessionPetBreedingEvent(session, parser.state, parser.ownPetId, parser.otherPetId)); + } + + private onPetLevelUpdateMessageEvent(event: PetLevelUpdateMessageEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + session.userDataManager.updatePetLevel(parser.roomIndex, parser.level); + + this.listener.events.dispatchEvent(new RoomSessionPetLevelUpdateEvent(session, parser.petId, parser.level)); + } + + private onConfirmBreedingResultEvent(event: ConfirmBreedingResultEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + this.listener.events.dispatchEvent(new RoomSessionConfirmPetBreedingResultEvent(session, parser.breedingNestStuffId, parser.result)); + } + + private onNestBreedingSuccessEvent(event: NestBreedingSuccessEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + this.listener.events.dispatchEvent(new RoomSessionNestBreedingSuccessEvent(session, parser.petId, parser.rarityCategory)); + } + + private onConfirmBreedingRequestEvent(event: ConfirmBreedingRequestEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + this.listener.events.dispatchEvent(new RoomSessionConfirmPetBreedingEvent(session, parser.nestId, parser.pet1, parser.pet2, parser.rarityCategories, parser.resultPetType)); + } + + private onPetFigureUpdateEvent(event: PetFigureUpdateEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const figure = parser.figureData.figuredata; + + session.userDataManager.updateFigure(parser.roomIndex, figure, '', parser.hasSaddle, parser.isRiding); + + this.listener.events.dispatchEvent(new RoomSessionPetFigureUpdateEvent(session, parser.petId, figure)); + } + + private onPetBreedingResultEvent(event: PetBreedingResultEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + this.listener.events.dispatchEvent(new RoomSessionPetBreedingResultEvent(session, parser.resultData, parser.otherResultData)); + } + + private onPetPlacingError(event: PetPlacingErrorEvent): void + { + if(!event) return; + + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + let type: string = null; + + switch(parser.errorCode) + { + case 0: + type = RoomSessionErrorMessageEvent.RSEME_PETS_FORBIDDEN_IN_HOTEL; + break; + case 1: + type = RoomSessionErrorMessageEvent.RSEME_PETS_FORBIDDEN_IN_FLAT; + break; + case 2: + type = RoomSessionErrorMessageEvent.RSEME_MAX_PETS; + break; + case 3: + type = RoomSessionErrorMessageEvent.RSEME_NO_FREE_TILES_FOR_PET; + break; + case 4: + type = RoomSessionErrorMessageEvent.RSEME_SELECTED_TILE_NOT_FREE_FOR_PET; + break; + case 5: + type = RoomSessionErrorMessageEvent.RSEME_MAX_NUMBER_OF_OWN_PETS; + break; + } + + if(!type || type.length == 0) return; + + this.listener.events.dispatchEvent(new RoomSessionErrorMessageEvent(type, session)); + } + + private onBotError(event: BotErrorEvent): void + { + if(!event) return; + + if(!this.listener) return; + + const parser = event.getParser(); + + if(!parser) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + let type: string = null; + + switch(parser.errorCode) + { + case 0: + type = RoomSessionErrorMessageEvent.RSEME_BOTS_FORBIDDEN_IN_HOTEL; + break; + case 1: + type = RoomSessionErrorMessageEvent.RSEME_BOTS_FORBIDDEN_IN_FLAT; + break; + case 2: + type = RoomSessionErrorMessageEvent.RSEME_BOT_LIMIT_REACHED; + break; + case 3: + type = RoomSessionErrorMessageEvent.RSEME_SELECTED_TILE_NOT_FREE_FOR_BOT; + break; + case 4: + type = RoomSessionErrorMessageEvent.RSEME_BOT_NAME_NOT_ACCEPTED; + break; + } + + if(!type || type.length == 0) return; + + this.listener.events.dispatchEvent(new RoomSessionErrorMessageEvent(type, session)); + } + + private onFavoriteMembershipUpdateMessageEvent(event: FavoriteMembershipUpdateMessageEvent): void + { + if(!this.listener) return; + + const parser = event.getParser(); + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const userData = session.userDataManager.getUserDataByIndex(parser.roomIndex); + + if(!userData) return; + + userData.groupId = parser.groupId; + userData.groupName = parser.groupName; + + this.listener.events.dispatchEvent(new RoomSessionFavoriteGroupUpdateEvent(session, parser.roomIndex, parser.groupId, parser.status, parser.groupName)); + } +} diff --git a/submodules/renderer/src/nitro/session/handler/WordQuizHandler.ts b/submodules/renderer/src/nitro/session/handler/WordQuizHandler.ts new file mode 100644 index 0000000..4907ce3 --- /dev/null +++ b/submodules/renderer/src/nitro/session/handler/WordQuizHandler.ts @@ -0,0 +1,79 @@ +import { IConnection, IRoomHandlerListener } from '../../../api'; +import { RoomSessionWordQuizEvent } from '../../../events'; +import { QuestionAnsweredEvent, QuestionEvent, QuestionFinishedEvent } from '../../communication'; +import { BaseHandler } from './BaseHandler'; + +export class WordQuizHandler extends BaseHandler +{ + constructor(connection: IConnection, listener: IRoomHandlerListener) + { + super(connection, listener); + + connection.addMessageEvent(new QuestionEvent(this.onQuestionEvent.bind(this))); + connection.addMessageEvent(new QuestionAnsweredEvent(this.onQuestionAnsweredEvent.bind(this))); + connection.addMessageEvent(new QuestionFinishedEvent(this.onQuestionFinishedEvent.bind(this))); + } + + private onQuestionEvent(event: QuestionEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + const quizEvent = new RoomSessionWordQuizEvent(RoomSessionWordQuizEvent.QUESTION, session, parser.pollId); + + quizEvent.question = parser.question; + quizEvent.duration = parser.duration; + quizEvent.pollType = parser.pollType; + quizEvent.questionId = parser.questionId; + quizEvent.pollId = parser.pollId; + + this.listener.events.dispatchEvent(quizEvent); + } + + private onQuestionAnsweredEvent(event: QuestionAnsweredEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + const quizEvent = new RoomSessionWordQuizEvent(RoomSessionWordQuizEvent.ANSWERED, session, parser.userId); + + quizEvent.value = parser.value; + quizEvent.userId = parser.userId; + quizEvent.answerCounts = parser.answerCounts; + + this.listener.events.dispatchEvent(quizEvent); + } + + private onQuestionFinishedEvent(event: QuestionFinishedEvent): void + { + if(!this.listener) return; + + const session = this.listener.getSession(this.roomId); + + if(!session) return; + + const parser = event.getParser(); + + if(!parser) return; + + const quizEvent = new RoomSessionWordQuizEvent(RoomSessionWordQuizEvent.FINISHED, session); + quizEvent.questionId = parser.questionId; + quizEvent.answerCounts = parser.answerCounts; + + this.listener.events.dispatchEvent(quizEvent); + } +} diff --git a/submodules/renderer/src/nitro/session/handler/index.ts b/submodules/renderer/src/nitro/session/handler/index.ts new file mode 100644 index 0000000..67d7eb6 --- /dev/null +++ b/submodules/renderer/src/nitro/session/handler/index.ts @@ -0,0 +1,12 @@ +export * from './BaseHandler'; +export * from './GenericErrorHandler'; +export * from './PetPackageHandler'; +export * from './PollHandler'; +export * from './RoomChatHandler'; +export * from './RoomDataHandler'; +export * from './RoomDimmerPresetsHandler'; +export * from './RoomPermissionsHandler'; +export * from './RoomPresentHandler'; +export * from './RoomSessionHandler'; +export * from './RoomUsersHandler'; +export * from './WordQuizHandler'; diff --git a/submodules/renderer/src/nitro/session/index.ts b/submodules/renderer/src/nitro/session/index.ts new file mode 100644 index 0000000..69272cc --- /dev/null +++ b/submodules/renderer/src/nitro/session/index.ts @@ -0,0 +1,13 @@ +export * from './badge'; +export * from './furniture'; +export * from './GroupInformationManager'; +export * from './HabboClubLevelEnum'; +export * from './handler'; +export * from './IgnoredUsersManager'; +export * from './product'; +export * from './RoomPetData'; +export * from './RoomSession'; +export * from './RoomSessionManager'; +export * from './RoomUserData'; +export * from './SessionDataManager'; +export * from './UserDataManager'; diff --git a/submodules/renderer/src/nitro/session/product/ProductData.ts b/submodules/renderer/src/nitro/session/product/ProductData.ts new file mode 100644 index 0000000..e4fe7fd --- /dev/null +++ b/submodules/renderer/src/nitro/session/product/ProductData.ts @@ -0,0 +1,30 @@ +import { IProductData } from '../../../api'; + +export class ProductData implements IProductData +{ + private _type: string; + private _name: string; + private _description: string; + + constructor(type: string, name: string, description: string) + { + this._type = type; + this._name = name; + this._description = description; + } + + public get type(): string + { + return this._type; + } + + public get name(): string + { + return this._name; + } + + public get description(): string + { + return this._description; + } +} diff --git a/submodules/renderer/src/nitro/session/product/ProductDataLoader.ts b/submodules/renderer/src/nitro/session/product/ProductDataLoader.ts new file mode 100644 index 0000000..2eadf72 --- /dev/null +++ b/submodules/renderer/src/nitro/session/product/ProductDataLoader.ts @@ -0,0 +1,57 @@ +import { IProductData } from '../../../api'; +import { EventDispatcher } from '../../../core'; +import { NitroEvent } from '../../../events'; +import { ProductData } from './ProductData'; + +export class ProductDataLoader extends EventDispatcher +{ + public static PDP_PRODUCT_DATA_READY: string = 'PDP_PRODUCT_DATA_READY'; + public static PDP_PRODUCT_DATA_FAILED: string = 'PDP_PRODUCT_DATA_FAILED'; + + private _products: Map; + + constructor(products: Map) + { + super(); + + this._products = products; + } + + public dispose(): void + { + this._products = null; + } + + public loadProductData(url: string): void + { + if(!url) return; + + fetch(url) + .then(response => response.json()) + .then(data => this.onProductDataLoadedEvent(data)) + .catch(err => this.onProductDataError(err)); + } + + private onProductDataLoadedEvent(data: { [index: string]: any }): void + { + if(!data) return; + + this.parseProducts(data.productdata); + + this.dispatchEvent(new NitroEvent(ProductDataLoader.PDP_PRODUCT_DATA_READY)); + } + + private onProductDataError(error: Error): void + { + if(!error) return; + + this.dispatchEvent(new NitroEvent(ProductDataLoader.PDP_PRODUCT_DATA_FAILED)); + } + + private parseProducts(data: { [index: string]: any }): void + { + if(!data) return; + + for(const product of data.product) (product && this._products.set(product.code, new ProductData(product.code, product.name, product.description))); + } +} diff --git a/submodules/renderer/src/nitro/session/product/index.ts b/submodules/renderer/src/nitro/session/product/index.ts new file mode 100644 index 0000000..ad61a98 --- /dev/null +++ b/submodules/renderer/src/nitro/session/product/index.ts @@ -0,0 +1,2 @@ +export * from './ProductData'; +export * from './ProductDataLoader'; diff --git a/submodules/renderer/src/nitro/sound/SoundManager.ts b/submodules/renderer/src/nitro/sound/SoundManager.ts new file mode 100644 index 0000000..9068db1 --- /dev/null +++ b/submodules/renderer/src/nitro/sound/SoundManager.ts @@ -0,0 +1,234 @@ +import { AdvancedMap, IAdvancedMap, IMusicController, INitroEvent, ISoundManager, NitroConfiguration, NitroLogger } from '../../api'; +import { NitroManager } from '../../core'; +import { NitroSettingsEvent, NitroSoundEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomEngineSamplePlaybackEvent } from '../../events'; +import { Nitro } from '../Nitro'; +import { MusicController } from './music/MusicController'; + +export class SoundManager extends NitroManager implements ISoundManager +{ + private _volumeSystem: number; + private _volumeFurni: number; + private _volumeTrax: number; + + private _internalSamples: IAdvancedMap; + private _furniSamples: IAdvancedMap; + private _furnitureBeingPlayed: IAdvancedMap; + + private _musicController: IMusicController; + + constructor() + { + super(); + + this._volumeSystem = 0.5; + this._volumeFurni = 0.5; + this._volumeTrax = 0.5; + + this._internalSamples = new AdvancedMap(); + this._furniSamples = new AdvancedMap(); + this._furnitureBeingPlayed = new AdvancedMap(); + this._musicController = new MusicController(); + + this.onEvent = this.onEvent.bind(this); + } + + public onInit(): void + { + this._musicController.init(); + + Nitro.instance.roomEngine.events.addEventListener(RoomEngineSamplePlaybackEvent.PLAY_SAMPLE, this.onEvent); + Nitro.instance.roomEngine.events.addEventListener(RoomEngineObjectEvent.REMOVED, this.onEvent); + Nitro.instance.roomEngine.events.addEventListener(RoomEngineEvent.DISPOSED, this.onEvent); + Nitro.instance.events.addEventListener(NitroSettingsEvent.SETTINGS_UPDATED, this.onEvent); + Nitro.instance.events.addEventListener(NitroSoundEvent.PLAY_SOUND, this.onEvent); + } + + public onDispose(): void + { + if(this._musicController) + { + this._musicController.dispose(); + this._musicController = null; + } + + Nitro.instance.roomEngine.events.removeEventListener(RoomEngineSamplePlaybackEvent.PLAY_SAMPLE, this.onEvent); + Nitro.instance.roomEngine.events.removeEventListener(RoomEngineObjectEvent.REMOVED, this.onEvent); + Nitro.instance.roomEngine.events.removeEventListener(RoomEngineEvent.DISPOSED, this.onEvent); + Nitro.instance.events.removeEventListener(NitroSettingsEvent.SETTINGS_UPDATED, this.onEvent); + Nitro.instance.events.removeEventListener(NitroSoundEvent.PLAY_SOUND, this.onEvent); + } + + private onEvent(event: INitroEvent) + { + switch(event.type) + { + case RoomEngineSamplePlaybackEvent.PLAY_SAMPLE: { + const castedEvent = (event as RoomEngineSamplePlaybackEvent); + + this.playFurniSample(castedEvent.objectId, castedEvent.sampleId, castedEvent.pitch); + return; + } + case RoomEngineObjectEvent.REMOVED: { + const castedEvent = (event as RoomEngineObjectEvent); + + this.stopFurniSample(castedEvent.objectId); + return; + } + case RoomEngineEvent.DISPOSED: { + this._furnitureBeingPlayed.getKeys().forEach((objectId: number) => + { + this.stopFurniSample(objectId); + }); + return; + } + case NitroSettingsEvent.SETTINGS_UPDATED: { + const castedEvent = (event as NitroSettingsEvent); + + const volumeFurniUpdated = castedEvent.volumeFurni !== this._volumeFurni; + const volumeTraxUpdated = castedEvent.volumeTrax !== this._volumeTrax; + + this._volumeSystem = (castedEvent.volumeSystem / 100); + this._volumeFurni = (castedEvent.volumeFurni / 100); + this._volumeTrax = (castedEvent.volumeTrax / 100); + + if(volumeFurniUpdated) this.updateFurniSamplesVolume(this._volumeFurni); + + if(volumeTraxUpdated) this._musicController?.updateVolume(this._volumeTrax); + + return; + } + case NitroSoundEvent.PLAY_SOUND: { + const castedEvent = (event as NitroSoundEvent); + + this.playInternalSample(castedEvent.sampleCode); + return; + } + } + } + + private playSample(sample: HTMLAudioElement, volume: number, pitch: number = 1): void + { + sample.volume = volume; + sample.currentTime = 0; + + try + { + sample.play(); + } + catch (e) + { + NitroLogger.error(e); + } + } + + private playInternalSample(code: string): void + { + let sample = this._internalSamples.getValue(code); + + if(!sample) + { + const sampleUrl = NitroConfiguration.getValue('sounds.url'); + + sample = new Audio(sampleUrl.replace('%sample%', code)); + this._internalSamples.add(code, sample); + } + + this.playSample(sample, this._volumeSystem); + } + + private playFurniSample(objectId: number, code: number, pitch: number): void + { + let sample = this._furniSamples.getValue(code); + + if(!sample) + { + const sampleUrl = NitroConfiguration.getValue('external.samples.url'); + + sample = new Audio(sampleUrl.replace('%sample%', code.toString())); + this._furniSamples.add(code, sample); + } + + if(!this._furnitureBeingPlayed.hasKey(objectId)) this._furnitureBeingPlayed.add(objectId, code); + + sample.onended = (event) => + { + this.stopFurniSample(objectId); + }; + + sample.onpause = (event) => + { + this.stopFurniSample(objectId); + }; + + sample.onerror = (event) => + { + this.stopFurniSample(objectId); + }; + + this.playSample(sample, this._volumeFurni, pitch); + } + + private stopInternalSample(code: string): void + { + const sample = this._internalSamples.getValue(code); + + if(!sample) return; + + try + { + sample.pause(); + } + catch (e) + { + NitroLogger.error(e); + } + } + + private stopFurniSample(objectId: number): void + { + const furnitureBeingPlayed = this._furnitureBeingPlayed.getValue(objectId); + + if(!furnitureBeingPlayed) return; + + const sample = this._furniSamples.getValue(furnitureBeingPlayed); + + this._furnitureBeingPlayed.remove(objectId); + + if(!sample) return; + + try + { + sample.pause(); + } + catch (e) + { + NitroLogger.error(e); + } + } + + private updateInternalSamplesVolume(volume: number): void + { + this._internalSamples.getValues().forEach((sample: HTMLAudioElement) => + { + sample.volume = volume; + }); + } + + private updateFurniSamplesVolume(volume: number): void + { + this._furniSamples.getValues().forEach((sample: HTMLAudioElement) => + { + sample.volume = volume; + }); + } + + public get traxVolume(): number + { + return this._volumeTrax; + } + + public get musicController(): IMusicController + { + return this._musicController; + } +} diff --git a/submodules/renderer/src/nitro/sound/common/SongDataEntry.ts b/submodules/renderer/src/nitro/sound/common/SongDataEntry.ts new file mode 100644 index 0000000..21ff479 --- /dev/null +++ b/submodules/renderer/src/nitro/sound/common/SongDataEntry.ts @@ -0,0 +1,54 @@ +import { ISongInfo } from '../../../api'; +import { PlayListEntry } from '../../communication/messages/parser/sound/PlayListEntry'; + +export class SongDataEntry extends PlayListEntry implements ISongInfo +{ + private _songData:string; + private _jukeboxDiskId:number = -1; + + constructor(id:number, length:number, name:string, creator:string, songData: string = '') + { + super(id, length, name, creator); + this._songData = songData; + } + + public override get id():number + { + return this._id; + } + + public override get length():number + { + return this._length; + } + + public override get name():string + { + return this._name; + } + + public override get creator():string + { + return this._creator; + } + + public get songData():string + { + return this._songData; + } + + public set songData(k:string) + { + this._songData = k; + } + + public get diskId():number + { + return this._jukeboxDiskId; + } + + public set diskId(k:number) + { + this._jukeboxDiskId = k; + } +} diff --git a/submodules/renderer/src/nitro/sound/common/SongStartRequestData.ts b/submodules/renderer/src/nitro/sound/common/SongStartRequestData.ts new file mode 100644 index 0000000..bbe0729 --- /dev/null +++ b/submodules/renderer/src/nitro/sound/common/SongStartRequestData.ts @@ -0,0 +1,52 @@ + +export class SongStartRequestData +{ + private _songId: number; + private _startPos: number; + private _playLength: number; + private _playRequestTime: number; + private _fadeInSeconds: number; + private _fadeOutSeconds: number; + + constructor(songId: number, startPos: number, playLength: number, fadeInSeconds: number, fadeOutSeconds: number) + { + this._songId = songId; + this._startPos = startPos; + this._playLength = playLength; + this._fadeInSeconds = fadeInSeconds; + this._fadeOutSeconds = fadeOutSeconds; + this._playRequestTime = Date.now(); + } + + public get songId(): number + { + return this._songId; + } + + public get startPos(): number + { + if(this._startPos < 0) return 0; + + return this._startPos + ((Date.now() - this._playRequestTime) / 1000); + } + + public get playLength(): number + { + return this._playLength; + } + + public get playRequestTime(): number + { + return this._playRequestTime; + } + + public get fadeInSeconds(): number + { + return this._fadeInSeconds; + } + + public get fadeOutSeconds(): number + { + return this._fadeOutSeconds; + } +} diff --git a/submodules/renderer/src/nitro/sound/common/index.ts b/submodules/renderer/src/nitro/sound/common/index.ts new file mode 100644 index 0000000..c33b01f --- /dev/null +++ b/submodules/renderer/src/nitro/sound/common/index.ts @@ -0,0 +1,2 @@ +export * from './SongDataEntry'; +export * from './SongStartRequestData'; diff --git a/submodules/renderer/src/nitro/sound/events/NotifyPlayedSongEvent.ts b/submodules/renderer/src/nitro/sound/events/NotifyPlayedSongEvent.ts new file mode 100644 index 0000000..678be47 --- /dev/null +++ b/submodules/renderer/src/nitro/sound/events/NotifyPlayedSongEvent.ts @@ -0,0 +1,27 @@ +import { NitroEvent } from '../../../events'; + +export class NotifyPlayedSongEvent extends NitroEvent +{ + public static readonly NOTIFY_PLAYED_SONG = 'UIEW_NOTIFY_PLAYED_SONG'; + + private _name: string; + private _creator: string; + + constructor(name:string, creator:string) + { + super(NotifyPlayedSongEvent.NOTIFY_PLAYED_SONG); + + this._name = name; + this._creator = creator; + } + + public get name(): string + { + return this._name; + } + + public get creator(): string + { + return this._creator; + } +} diff --git a/submodules/renderer/src/nitro/sound/events/NowPlayingEvent.ts b/submodules/renderer/src/nitro/sound/events/NowPlayingEvent.ts new file mode 100644 index 0000000..967dc8e --- /dev/null +++ b/submodules/renderer/src/nitro/sound/events/NowPlayingEvent.ts @@ -0,0 +1,35 @@ +import { NitroEvent } from '../../../events'; + +export class NowPlayingEvent extends NitroEvent +{ + public static readonly NPE_USER_PLAY_SONG = 'NPE_USER_PLAY_SONG'; + public static readonly NPW_USER_STOP_SONG = 'NPW_USER_STOP_SONG'; + public static readonly NPE_SONG_CHANGED = 'NPE_SONG_CHANGED'; + + private _id:number; + private _position:number; + private _priority:number; + + constructor(k:string, priority:number, id:number, position:number) + { + super(k); + this._id = id; + this._position = position; + this._priority = priority; + } + + public get id():number + { + return this._id; + } + + public get position():number + { + return this._position; + } + + public get priority():number + { + return this._priority; + } +} diff --git a/submodules/renderer/src/nitro/sound/events/PlayListStatusEvent.ts b/submodules/renderer/src/nitro/sound/events/PlayListStatusEvent.ts new file mode 100644 index 0000000..1983717 --- /dev/null +++ b/submodules/renderer/src/nitro/sound/events/PlayListStatusEvent.ts @@ -0,0 +1,12 @@ +import { NitroEvent } from '../../../events'; + +export class PlayListStatusEvent extends NitroEvent +{ + public static readonly PLUE_PLAY_LIST_UPDATED = 'PLUE_PLAY_LIST_UPDATED'; + public static readonly PLUE_PLAY_LIST_FULL = 'PLUE_PLAY_LIST_FULL'; + + constructor(k:string) + { + super(k); + } +} diff --git a/submodules/renderer/src/nitro/sound/events/SongDiskInventoryReceivedEvent.ts b/submodules/renderer/src/nitro/sound/events/SongDiskInventoryReceivedEvent.ts new file mode 100644 index 0000000..cc61c9d --- /dev/null +++ b/submodules/renderer/src/nitro/sound/events/SongDiskInventoryReceivedEvent.ts @@ -0,0 +1,11 @@ +import { NitroEvent } from '../../../events'; + +export class SongDiskInventoryReceivedEvent extends NitroEvent +{ + public static readonly SDIR_SONG_DISK_INVENTORY_RECEIVENT_EVENT = 'SDIR_SONG_DISK_INVENTORY_RECEIVENT_EVENT'; + + constructor(k:string) + { + super(k); + } +} diff --git a/submodules/renderer/src/nitro/sound/events/SongInfoReceivedEvent.ts b/submodules/renderer/src/nitro/sound/events/SongInfoReceivedEvent.ts new file mode 100644 index 0000000..3536a33 --- /dev/null +++ b/submodules/renderer/src/nitro/sound/events/SongInfoReceivedEvent.ts @@ -0,0 +1,19 @@ +import { NitroEvent } from '../../../events'; + +export class SongInfoReceivedEvent extends NitroEvent +{ + public static readonly SIR_TRAX_SONG_INFO_RECEIVED = 'SIR_TRAX_SONG_INFO_RECEIVED'; + + private _id:number; + + constructor(k:string, _arg_2:number) + { + super(k); + this._id = _arg_2; + } + + public get id():number + { + return this._id; + } +} diff --git a/submodules/renderer/src/nitro/sound/events/SoundManagerEvent.ts b/submodules/renderer/src/nitro/sound/events/SoundManagerEvent.ts new file mode 100644 index 0000000..d317b11 --- /dev/null +++ b/submodules/renderer/src/nitro/sound/events/SoundManagerEvent.ts @@ -0,0 +1,19 @@ +import { NitroEvent } from '../../../events'; + +export class SoundManagerEvent extends NitroEvent +{ + public static TRAX_SONG_COMPLETE: string = 'SME_TRAX_SONG_COMPLETE'; + + private _id: number; + + constructor(type: string, id: number) + { + super(type); + this._id = id; + } + + public get id(): number + { + return this._id; + } +} diff --git a/submodules/renderer/src/nitro/sound/events/index.ts b/submodules/renderer/src/nitro/sound/events/index.ts new file mode 100644 index 0000000..6ed30e6 --- /dev/null +++ b/submodules/renderer/src/nitro/sound/events/index.ts @@ -0,0 +1,6 @@ +export * from './NotifyPlayedSongEvent'; +export * from './NowPlayingEvent'; +export * from './PlayListStatusEvent'; +export * from './SongDiskInventoryReceivedEvent'; +export * from './SongInfoReceivedEvent'; +export * from './SoundManagerEvent'; diff --git a/submodules/renderer/src/nitro/sound/index.ts b/submodules/renderer/src/nitro/sound/index.ts new file mode 100644 index 0000000..024ab71 --- /dev/null +++ b/submodules/renderer/src/nitro/sound/index.ts @@ -0,0 +1,5 @@ +export * from './common'; +export * from './events'; +export * from './music'; +export * from './SoundManager'; +export * from './trax'; diff --git a/submodules/renderer/src/nitro/sound/music/JukeboxPlaylistController.ts b/submodules/renderer/src/nitro/sound/music/JukeboxPlaylistController.ts new file mode 100644 index 0000000..184859a --- /dev/null +++ b/submodules/renderer/src/nitro/sound/music/JukeboxPlaylistController.ts @@ -0,0 +1,195 @@ +import { IMessageEvent, IPlaylistController, ISongInfo } from '../../../api'; +import { GetJukeboxPlayListMessageComposer, JukeboxPlayListFullMessageEvent, JukeboxSongDisksMessageEvent, NowPlayingMessageEvent } from '../../communication'; +import { Nitro } from '../../Nitro'; +import { SongDataEntry } from '../common/SongDataEntry'; +import { NowPlayingEvent, PlayListStatusEvent, SongInfoReceivedEvent } from '../events'; +import { MusicPriorities } from './MusicPriorities'; + +export class JukeboxPlaylistController implements IPlaylistController +{ + private _isPlaying = false; + private _entries: ISongInfo[]; + private _currentEntryId: number; + private _missingSongInfo: number[]; + private _playPosition: number; + private _disposed: boolean = false; + + private _messageEvents: IMessageEvent[]; + + constructor() + { + this._entries = []; + this._missingSongInfo = []; + + this._messageEvents = [ + new NowPlayingMessageEvent(this.onNowPlayingMessageEvent.bind(this)), + new JukeboxSongDisksMessageEvent(this.onJukeboxSongDisksMessageEvent.bind(this)), + new JukeboxPlayListFullMessageEvent(this.onJukeboxPlayListFullMessageEvent.bind(this)) + ]; + + this.onSongInfoReceivedEvent = this.onSongInfoReceivedEvent.bind(this); + } + + public init(): void + { + this._messageEvents.forEach(event => Nitro.instance.communication.connection.addMessageEvent(event)); + //this._events.addEventListener(SoundManagerEvent.TRAX_SONG_COMPLETE, this.onSongFinishedPlayingEvent); + Nitro.instance.soundManager.events.addEventListener(SongInfoReceivedEvent.SIR_TRAX_SONG_INFO_RECEIVED, this.onSongInfoReceivedEvent); + } + + public get priority(): number + { + return MusicPriorities.PRIORITY_ROOM_PLAYLIST; + } + + private onNowPlayingMessageEvent(event: NowPlayingMessageEvent): void + { + const parser = event.getParser(); + + this._isPlaying = (parser.currentSongId !== -1); + + if(parser.currentSongId >= 0) + { + Nitro.instance.soundManager.musicController.playSong(parser.currentSongId, MusicPriorities.PRIORITY_ROOM_PLAYLIST, (parser.syncCount / 1000), 0, 1, 1); + this._currentEntryId = parser.currentSongId; + } + else + { + this.stopPlaying(); + } + + if(parser.nextSongId >= 0) Nitro.instance.soundManager.musicController.addSongInfoRequest(parser.nextSongId); + + this._playPosition = parser.currentPosition; + //Dispatch local event NowPlayingEvent + Nitro.instance.soundManager.events.dispatchEvent(new NowPlayingEvent(NowPlayingEvent.NPE_SONG_CHANGED, MusicPriorities.PRIORITY_ROOM_PLAYLIST, parser.currentSongId, parser.currentPosition)); + } + + private onJukeboxSongDisksMessageEvent(event: JukeboxSongDisksMessageEvent): void + { + const parser = event.getParser(); + + this._entries = []; + for(let i = 0; i < parser.songDisks.length; i++) + { + const songId = parser.songDisks.getWithIndex(i); + const diskId = parser.songDisks.getKey(i); + let songInfo = (Nitro.instance.soundManager.musicController.getSongInfo(songId) as SongDataEntry); + if(songInfo == null) + { + songInfo = new SongDataEntry(songId, -1, null, null, null); + if(this._missingSongInfo.indexOf(songId) < 0) + { + this._missingSongInfo.push(songId); + Nitro.instance.soundManager.musicController.requestSongInfoWithoutSamples(songId); + } + } + songInfo.diskId = diskId; + this._entries.push(songInfo); + } + if(this._missingSongInfo.length == 0) + { + Nitro.instance.soundManager.events.dispatchEvent(new PlayListStatusEvent(PlayListStatusEvent.PLUE_PLAY_LIST_UPDATED)); + } + } + + private onJukeboxPlayListFullMessageEvent(event: JukeboxPlayListFullMessageEvent): void + { + Nitro.instance.soundManager.events.dispatchEvent(new PlayListStatusEvent(PlayListStatusEvent.PLUE_PLAY_LIST_FULL)); + } + + private onSongInfoReceivedEvent(songInfoEvent: SongInfoReceivedEvent): void + { + for(let i = 0; i < this.length; i++) + { + const songData = this._entries[i]; + if(songData.id === songInfoEvent.id) + { + const diskId = songData.diskId; + const updatedSongData = Nitro.instance.soundManager.musicController.getSongInfo(songInfoEvent.id); + if(updatedSongData != null) + { + updatedSongData.diskId = diskId; + this._entries[i] = updatedSongData; + } + break; + } + } + const _local_3 = this._missingSongInfo.indexOf(songInfoEvent.id); + if(_local_3 >= 0) + { + this._missingSongInfo.splice(_local_3, 1); + } + if(this._missingSongInfo.length == 0) + { + Nitro.instance.soundManager.events.dispatchEvent(new PlayListStatusEvent(PlayListStatusEvent.PLUE_PLAY_LIST_UPDATED)); + } + } + + public stopPlaying(): void + { + Nitro.instance.soundManager.musicController.stop(this.priority); + this._currentEntryId = -1; + this._playPosition = -1; + this._isPlaying = false; + } + + public get length(): number + { + if(!this._entries) + { + return 0; + } + return this._entries.length; + } + + public get playPosition(): number + { + return this._playPosition; + } + + public get nowPlayingSongId(): number + { + return this._currentEntryId; + } + + public get isPlaying(): boolean + { + return this._isPlaying; + } + + public get entries(): ISongInfo[] + { + return this._entries; + } + + public getEntry(k: number): ISongInfo + { + if(((k < 0) || (k >= this._entries.length))) + { + return null; + } + return this._entries[k]; + } + + public requestPlayList(): void + { + Nitro.instance.communication.connection.send(new GetJukeboxPlayListMessageComposer()); + } + + public dispose(): void + { + if(!this._disposed) + { + this._disposed = true; + this.stopPlaying(); + if(Nitro.instance.soundManager.events) + { + Nitro.instance.soundManager.events.removeEventListener(SongInfoReceivedEvent.SIR_TRAX_SONG_INFO_RECEIVED, this.onSongInfoReceivedEvent); + } + this._messageEvents.forEach(event => Nitro.instance.communication.connection.removeMessageEvent(event)); + this._messageEvents = null; + //this._events.removeEventListener(SoundControllerEvent.TRAX_SONG_COMPLETE, this.onSongFinishedPlayingEvent); + } + } +} diff --git a/submodules/renderer/src/nitro/sound/music/MusicController.ts b/submodules/renderer/src/nitro/sound/music/MusicController.ts new file mode 100644 index 0000000..431eadf --- /dev/null +++ b/submodules/renderer/src/nitro/sound/music/MusicController.ts @@ -0,0 +1,580 @@ +import { AdvancedMap, IAdvancedMap, IMessageEvent, IMusicController, IPlaylistController, ISongInfo } from '../../../api'; +import { RoomObjectSoundMachineEvent } from '../../../events'; +import { GetNowPlayingMessageComposer, GetSongInfoMessageComposer, GetUserSongDisksMessageComposer, TraxSongInfoMessageEvent, UserSongDisksInventoryMessageEvent } from '../../communication'; +import { Nitro } from '../../Nitro'; +import { SongDataEntry } from '../common/SongDataEntry'; +import { SongStartRequestData } from '../common/SongStartRequestData'; +import { NotifyPlayedSongEvent, NowPlayingEvent, SongDiskInventoryReceivedEvent, SongInfoReceivedEvent, SoundManagerEvent } from '../events'; +import { TraxData } from '../trax/TraxData'; +import { JukeboxPlaylistController } from './JukeboxPlaylistController'; +import { MusicPlayer } from './MusicPlayer'; +import { MusicPriorities } from './MusicPriorities'; + +export class MusicController implements IMusicController +{ + public static readonly SKIP_POSITION_SET: number = -1; + private static readonly MAXIMUM_NOTIFY_PRIORITY: number = MusicPriorities.PRIORITY_ROOM_PLAYLIST; + + private _timerInstance: number; + private _songRequestList: number[]; + private _requestedSongs: Map; + private _availableSongs: Map; + private _songRequestsPerPriority: SongStartRequestData[]; + private _songRequestCountsPerPriority: number[]; + private _diskInventoryMissingData: number[]; + private _songDiskInventory: IAdvancedMap; + private _priorityPlaying: number = -1; + private _requestNumberPlaying: number = -1; + private _messageEvents: IMessageEvent[]; + private _roomItemPlaylist: IPlaylistController; + private _musicPlayer: MusicPlayer; + + private _songIdPlaying: number; + private _previousNotifiedSongId: number; + private _previousNotificationTime: number = -1; + + constructor() + { + this._timerInstance = -1; + this._songRequestList = []; + this._requestedSongs = new Map(); + this._availableSongs = new Map(); + this._songDiskInventory = new AdvancedMap(); + this._songRequestsPerPriority = []; + this._songRequestCountsPerPriority = []; + this._diskInventoryMissingData = []; + this._songIdPlaying = -1; + this._previousNotifiedSongId = -1; + + + this._messageEvents = [ + new TraxSongInfoMessageEvent(this.onTraxSongInfoMessageEvent.bind(this)), + new UserSongDisksInventoryMessageEvent(this.onSongDiskInventoryMessage.bind(this)) + ]; + + this.onJukeboxInit = this.onJukeboxInit.bind(this); + this.onJukeboxDispose = this.onJukeboxDispose.bind(this); + this.onSoundMachineInit = this.onSoundMachineInit.bind(this); + this.onSoundMachineDispose = this.onSoundMachineDispose.bind(this); + + this.onTraxSongComplete = this.onTraxSongComplete.bind(this); + } + + public init(): void + { + this._timerInstance = window.setInterval(this.onTick.bind(this), 1000); + this._musicPlayer = new MusicPlayer(Nitro.instance.getConfiguration('external.samples.url')); + + this._messageEvents.forEach(event => Nitro.instance.communication.connection.addMessageEvent(event)); + + Nitro.instance.roomEngine.events.addEventListener(RoomObjectSoundMachineEvent.JUKEBOX_INIT, this.onJukeboxInit); + Nitro.instance.roomEngine.events.addEventListener(RoomObjectSoundMachineEvent.JUKEBOX_DISPOSE, this.onJukeboxDispose); + Nitro.instance.roomEngine.events.addEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_INIT, this.onSoundMachineInit); + Nitro.instance.roomEngine.events.addEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_DISPOSE, this.onSoundMachineDispose); + + Nitro.instance.soundManager.events.addEventListener(SoundManagerEvent.TRAX_SONG_COMPLETE, this.onTraxSongComplete); + } + + public getRoomItemPlaylist(_arg_1?: number): IPlaylistController + { + return this._roomItemPlaylist; + } + + public get songDiskInventory(): IAdvancedMap + { + return this._songDiskInventory; + } + + public getSongDiskInventorySize(): number + { + return this._songDiskInventory.length; + } + + public getSongDiskInventoryDiskId(k: number): number + { + if(((k >= 0) && (k < this._songDiskInventory.length))) + { + return this._songDiskInventory.getKey(k); + } + return -1; + } + + public getSongDiskInventorySongId(k: number): number + { + if(((k >= 0) && (k < this._songDiskInventory.length))) + { + return this._songDiskInventory.getWithIndex(k); + } + return -1; + } + + public getSongInfo(k: number): ISongInfo + { + const _local_2: SongDataEntry = this.getSongDataEntry(k); + if(!_local_2) + { + this.requestSongInfoWithoutSamples(k); + } + return _local_2; + } + + public getSongIdPlayingAtPriority(priority: number): number + { + if(priority !== this._priorityPlaying) + { + return -1; + } + return this._songIdPlaying; + } + + public stop(priority: number): void + { + const isCurrentPlayingPriority = (priority === this._priorityPlaying); + const isTopRequestPriority = (this.getTopRequestPriority() === priority); + if(isCurrentPlayingPriority) + { + this.resetSongStartRequest(priority); + this.stopSongAtPriority(priority); + } + else + { + this.resetSongStartRequest(priority); + if(isTopRequestPriority) + { + this.reRequestSongAtPriority(this._priorityPlaying); + } + } + } + + public addSongInfoRequest(k: number): void + { + this.requestSong(k, true); + } + + public requestSongInfoWithoutSamples(k: number): void + { + this.requestSong(k, false); + } + + public requestUserSongDisks(): void + { + Nitro.instance.communication.connection.send(new GetUserSongDisksMessageComposer()); + } + + public updateVolume(_arg_1: number): void + { + this._musicPlayer.setVolume(_arg_1); + } + + public dispose(): void + { + if(this._timerInstance) + { + clearInterval(this._timerInstance); + this._timerInstance = undefined; + } + + this._messageEvents.forEach(event => Nitro.instance.communication.connection.removeMessageEvent(event)); + + Nitro.instance.roomEngine.events.removeEventListener(RoomObjectSoundMachineEvent.JUKEBOX_INIT, this.onJukeboxInit); + Nitro.instance.roomEngine.events.removeEventListener(RoomObjectSoundMachineEvent.JUKEBOX_DISPOSE, this.onJukeboxDispose); + Nitro.instance.roomEngine.events.removeEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_INIT, this.onSoundMachineInit); + Nitro.instance.roomEngine.events.removeEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_DISPOSE, this.onSoundMachineDispose); + Nitro.instance.soundManager.events.removeEventListener(SoundManagerEvent.TRAX_SONG_COMPLETE, this.onTraxSongComplete); + } + + public get samplesIdsInUse(): number[] + { + let _local_3: SongStartRequestData; + let _local_4: SongDataEntry; + let k = []; + for(let i = 0; i < this._songRequestsPerPriority.length; i++) + { + if(this._songRequestsPerPriority[i]) + { + _local_3 = this._songRequestsPerPriority[i]; + _local_4 = this._availableSongs.get(_local_3.songId); + if(_local_4) + { + const songData = _local_4.songData; + if(songData.length > 0) + { + const traxData = new TraxData(songData); + k = k.concat(traxData.getSampleIds()); + } + } + } + } + return k; + } + + public onSongLoaded(songId: number): void + { + const priority = this.getTopRequestPriority(); + if(priority >= 0) + { + const songIdAtTopPriority = this.getSongIdRequestedAtPriority(priority); + if(songId === songIdAtTopPriority) + { + this.playSongObject(priority, songId); + } + } + } + + public samplesUnloaded(_arg_1: number[]): void + { + throw new Error('Method not implemented.'); + } + + protected onTraxSongComplete(k: SoundManagerEvent): void + { + if(this.getSongIdPlayingAtPriority(this._priorityPlaying) === k.id) + { + if(((this.getTopRequestPriority() === this._priorityPlaying) && (this.getSongRequestCountAtPriority(this._priorityPlaying) == this._requestNumberPlaying))) + { + this.resetSongStartRequest(this._priorityPlaying); + } + const priorityPlaying = this._priorityPlaying; + this.playSongWithHighestPriority(); + if(priorityPlaying >= MusicPriorities.PRIORITY_SONG_PLAY) + { + Nitro.instance.soundManager.events.dispatchEvent(new NowPlayingEvent(NowPlayingEvent.NPW_USER_STOP_SONG, priorityPlaying, k.id, -1)); + } + } + } + + private onTraxSongInfoMessageEvent(event: TraxSongInfoMessageEvent): void + { + const parser = event.getParser(); + + for(const song of parser.songs) + { + const songAvailable = !!this.getSongDataEntry(song.id); + const areSamplesRequested = !!this.areSamplesRequested(song.id); + + if(!songAvailable) + { + if(!areSamplesRequested) + { + //_local_9 = this._soundManager.loadTraxSong(_local_6.id, _local_6.data); + } + + const songInfoEntry: SongDataEntry = new SongDataEntry(song.id, song.length, song.name, song.creator, song.data); + this._availableSongs.set(song.id, songInfoEntry); + + const topRequestPriotityIndex: number = this.getTopRequestPriority(); + const songId: number = this.getSongIdRequestedAtPriority(topRequestPriotityIndex); + if(song.id === songId) + { + this.playSongObject(topRequestPriotityIndex, songId); + } + Nitro.instance.soundManager.events.dispatchEvent(new SongInfoReceivedEvent(SongInfoReceivedEvent.SIR_TRAX_SONG_INFO_RECEIVED, song.id)); + while(this._diskInventoryMissingData.indexOf(song.id) != -1) + { + this._diskInventoryMissingData.splice(this._diskInventoryMissingData.indexOf(song.id), 1); + if(this._diskInventoryMissingData.length === 0) + { + Nitro.instance.soundManager.events.dispatchEvent(new SongDiskInventoryReceivedEvent(SongDiskInventoryReceivedEvent.SDIR_SONG_DISK_INVENTORY_RECEIVENT_EVENT)); + } + } + + } + } + } + + private onSongDiskInventoryMessage(event: UserSongDisksInventoryMessageEvent): void + { + const parser = event.getParser(); + + this._songDiskInventory.reset(); + for(let i = 0; i < parser.songDiskCount; i++) + { + const diskId = parser.getDiskId(i); + const songId = parser.getSongId(i); + this._songDiskInventory.add(diskId, songId); + + if(!this._availableSongs.get(songId)) + { + this._diskInventoryMissingData.push(songId); + this.requestSongInfoWithoutSamples(songId); + } + } + if(this._diskInventoryMissingData.length === 0) + { + Nitro.instance.soundManager.events.dispatchEvent(new SongDiskInventoryReceivedEvent(SongDiskInventoryReceivedEvent.SDIR_SONG_DISK_INVENTORY_RECEIVENT_EVENT)); + } + } + + private onTick(): void + { + if(this._songRequestList.length === 0) return; + + Nitro.instance.communication.connection.send(new GetSongInfoMessageComposer(...this._songRequestList)); + this._songRequestList = []; + } + + private requestSong(songId: number, arg2: boolean): void + { + if(this._requestedSongs.get(songId) === undefined) + { + this._requestedSongs.set(songId, arg2); + this._songRequestList.push(songId); + } + } + + private areSamplesRequested(k: number): boolean + { + if(!this._requestedSongs.get(k)) + { + return false; + } + return this._requestedSongs.get(k); + } + + private processSongEntryForPlaying(k: number, _arg_2: boolean = true): boolean + { + const songData: SongDataEntry = this.getSongDataEntry(k); + if(!songData) + { + this.addSongInfoRequest(k); + return false; + } + /* if(_local_3.soundObject == null) + { + _local_3.soundObject = this._soundManager.loadTraxSong(_local_3.id, _local_3.songData); + } + const _local_4:IHabboSound = _local_3.soundObject; + if(!_local_4.ready) + { + return false; + } */ + return true; + } + + public playSong(songId: number, priority: number, startPos: number = 0, playLength: number = 0, fadeInSeconds: number = 0.5, fadeOutSeconds: number = 0.5): boolean + { + if(!this.addSongStartRequest(priority, songId, startPos, playLength, fadeInSeconds, fadeOutSeconds)) + { + return false; + } + if(!this.processSongEntryForPlaying(songId)) + { + return false; + } + if(priority >= this._priorityPlaying) + { + this.playSongObject(priority, songId); + } + return true; + } + + private playSongObject(priority: number, songId: number): boolean + { + if((((songId === -1) || (priority < 0)) || (priority >= MusicPriorities.PRIORITY_COUNT))) + { + return false; + } + let _local_3 = false; + if(this.stopSongAtPriority(this._priorityPlaying)) + { + _local_3 = true; + } + const songData: SongDataEntry = this.getSongDataEntry(songId); + if(!songData) + { + return false; + } + if(_local_3) + { + return true; + } + this._musicPlayer.setVolume(Nitro.instance.soundManager.traxVolume); + let startPos = MusicController.SKIP_POSITION_SET; + let playLength = 0; + let fadeInSeconds = 2; + let fadeOutSeconds = 1; + + const songRequestData: SongStartRequestData = this.getSongStartRequest(priority); + + if(songRequestData) + { + startPos = songRequestData.startPos; + playLength = songRequestData.playLength; + fadeInSeconds = songRequestData.fadeInSeconds; + fadeOutSeconds = songRequestData.fadeOutSeconds; + } + if(startPos >= (songData.length / 1000)) + { + return false; + } + if(startPos <= MusicController.SKIP_POSITION_SET) + { + startPos = 0; + } + + startPos = Math.trunc(startPos); + /* + _local_5.fadeInSeconds = _local_8; + _local_5.fadeOutSeconds = _local_9; + _local_5.position = _local_6; + _local_5.play(_local_7); + */ + + this._priorityPlaying = priority; + this._requestNumberPlaying = this.getSongRequestCountAtPriority(priority); + this._songIdPlaying = songId; + if(this._priorityPlaying <= MusicController.MAXIMUM_NOTIFY_PRIORITY) + { + this.notifySongPlaying(songData); + } + this._musicPlayer.preloadSamplesForSong(songData.songData).then(() => this._musicPlayer.play(songData.songData, songData.id, startPos, playLength)); + if(priority > MusicPriorities.PRIORITY_ROOM_PLAYLIST) + { + Nitro.instance.soundManager.events.dispatchEvent(new NowPlayingEvent(NowPlayingEvent.NPE_USER_PLAY_SONG, priority, songData.id, -1)); + } + return true; + } + + private notifySongPlaying(k: SongDataEntry): void + { + const _local_2 = 8000; + const timeNow = Date.now(); + if(((k.length >= _local_2) && ((!(this._previousNotifiedSongId == k.id)) || (timeNow > (this._previousNotificationTime + _local_2))))) + { + Nitro.instance.soundManager.events.dispatchEvent(new NotifyPlayedSongEvent(k.name, k.creator)); + this._previousNotifiedSongId = k.id; + this._previousNotificationTime = timeNow; + } + } + + private addSongStartRequest(priority: number, songId: number, startPos: number, playLength: number, fadeInSeconds: number, fadeOutSeconds: number): boolean + { + if(((priority < 0) || (priority >= MusicPriorities.PRIORITY_COUNT))) + { + return false; + } + const songStartRequest = new SongStartRequestData(songId, startPos, playLength, fadeInSeconds, fadeOutSeconds); + this._songRequestsPerPriority[priority] = songStartRequest; + this._songRequestCountsPerPriority[priority] = (this._songRequestCountsPerPriority[priority] + 1); + return true; + } + + private getSongDataEntry(k: number): SongDataEntry + { + let entry: SongDataEntry; + if(this._availableSongs) + { + entry = (this._availableSongs.get(k)); + } + return entry; + } + + private getSongStartRequest(k: number): SongStartRequestData + { + return this._songRequestsPerPriority[k]; + } + + private getTopRequestPriority(): number + { + return this._songRequestsPerPriority.length - 1; + } + + private getSongIdRequestedAtPriority(priorityIndex: number): number + { + if(priorityIndex < 0 || priorityIndex >= MusicPriorities.PRIORITY_COUNT) return -1; + + if(!this._songRequestsPerPriority[priorityIndex]) return -1; + + return this._songRequestsPerPriority[priorityIndex].songId; + } + + private getSongRequestCountAtPriority(k: number): number + { + if(((k < 0) || (k >= MusicPriorities.PRIORITY_COUNT))) + { + return -1; + } + return this._songRequestCountsPerPriority[k]; + } + + private playSongWithHighestPriority(): void + { + let _local_3: number; + this._priorityPlaying = -1; + this._songIdPlaying = -1; + this._requestNumberPlaying = -1; + const k = this.getTopRequestPriority(); + let _local_2 = k; + while(_local_2 >= 0) + { + _local_3 = this.getSongIdRequestedAtPriority(_local_2); + if(((_local_3 >= 0) && (this.playSongObject(_local_2, _local_3)))) + { + return; + } + _local_2--; + } + } + + private resetSongStartRequest(priority: number): void + { + if(((priority >= 0) && (priority < MusicPriorities.PRIORITY_COUNT))) + { + this._songRequestsPerPriority[priority] = undefined; + } + } + + private reRequestSongAtPriority(k: number): void + { + this._songRequestCountsPerPriority[k] = (this._songRequestCountsPerPriority[k] + 1); + } + + private stopSongAtPriority(priority: number): boolean + { + if(((priority === this._priorityPlaying) && (this._priorityPlaying >= 0))) + { + const songIdAtPriority = this.getSongIdPlayingAtPriority(priority); + if(songIdAtPriority >= 0) + { + const songData = this.getSongDataEntry(songIdAtPriority); + //this.stopSongDataEntry(_local_3); + this._musicPlayer.stop(); + return true; + } + } + return false; + } + + private onSoundMachineInit(k: Event): void + { + this.disposeRoomPlaylist(); + //this._roomItemPlaylist = (new SoundMachinePlayListController(this._soundManager, this, this._events) as IPlaylistController); + } + + private onSoundMachineDispose(k: Event): void + { + this.disposeRoomPlaylist(); + } + + private onJukeboxInit(k: Event): void + { + this.disposeRoomPlaylist(); + this._roomItemPlaylist = (new JukeboxPlaylistController() as IPlaylistController); + this._roomItemPlaylist.init(); + Nitro.instance.communication.connection.send(new GetNowPlayingMessageComposer()); + } + + private onJukeboxDispose(k: Event): void + { + this.disposeRoomPlaylist(); + } + + private disposeRoomPlaylist(): void + { + if(this._roomItemPlaylist) + { + this._roomItemPlaylist.dispose(); + this._roomItemPlaylist = undefined; + } + } +} diff --git a/submodules/renderer/src/nitro/sound/music/MusicPlayer.ts b/submodules/renderer/src/nitro/sound/music/MusicPlayer.ts new file mode 100644 index 0000000..936ec21 --- /dev/null +++ b/submodules/renderer/src/nitro/sound/music/MusicPlayer.ts @@ -0,0 +1,241 @@ +import { Howl, Howler } from 'howler'; +import { NitroLogger } from '../../../api'; +import { Nitro } from '../../Nitro'; +import { SoundManagerEvent } from '../events'; +import { TraxData } from '../trax/TraxData'; + +export class MusicPlayer +{ + private _currentSong: TraxData | undefined; + private _currentSongId: number; + private _startPos: number; + private _playLength: number; + private _isPlaying: boolean; + private _currentPos: number; + private _cache: Map; + private _sampleUrl: string; + + private _tickerInterval: number | undefined; + private _sequence: ISequenceEntry[][]; + + constructor(sampleUrl: string) + { + this._sampleUrl = sampleUrl; + this._isPlaying = false; + this._startPos = 0; + this._currentPos = 0; + this._playLength = 0; + this._sequence = []; + this._cache = new Map(); + } + + public async play(song: string, currentSongId: number, startPos: number = 0, playLength: number = -1): Promise + { + this.reset(); + + this._currentSong = new TraxData(song); + this._startPos = Math.trunc(startPos); + this._playLength = playLength; + this._currentPos = this._startPos; + this._currentSongId = currentSongId; + //this.emit('loading'); + await this.preload(); + this._isPlaying = true; + //this.emit('playing', this._currentPos, this._playLength - 1); + this.tick(); // to evade initial 1 sec delay + this._tickerInterval = window.setInterval(() => this.tick(), 1000); + } + + private reset(): void + { + this._isPlaying = false; + window.clearInterval(this._tickerInterval); + + Howler.stop(); + this._currentSongId = -1; + this._currentSong = undefined; + this._tickerInterval = undefined; + this._startPos = 0; + this._playLength = 0; + this._sequence = []; + this._currentPos = 0; + } + + public pause(): void + { + this._isPlaying = false; + //this.emit('paused', this._currentPos); + + Howler.stop(); + } + + public resume(): void + { + this._isPlaying = true; + //this.emit('playing', this._currentPos, this._playLength - 1 ); + } + + public stop(): void + { + const songId = this._currentSongId; + this.reset(); + Nitro.instance.soundManager.events.dispatchEvent(new SoundManagerEvent(SoundManagerEvent.TRAX_SONG_COMPLETE, songId)); + //this.emit('stopped'); + } + + /** + * Sets global howler volume for all sounds + * @param volume value from 0.0 to 1.0 + */ + public setVolume(volume: number): void + { + Howler.volume(volume); + } + + /** + * Gets global howler volume for all sounds + * @returns value from 0.0 to 1.0 + */ + public getVolume(): number + { + return Howler.volume(); + } + + /** + * Gets sample from cache or loads it if not in cache + * @param id sample id + * @returns howl sound object + */ + public async getSample(id: number): Promise + { + let sample = this._cache.get(id); + + if(!sample) sample = await this.loadSong(id); + + return Promise.resolve(sample); + } + + private async preload(): Promise + { + this._sequence = []; + + if(!this._currentSong) return; + + for(const channel of this._currentSong.channels) + { + const sequenceEntryArray: ISequenceEntry[] = []; + for(const sample of channel.items) + { + const sampleSound = await this.getSample(sample.id); + + const sampleCount = Math.ceil((sample.length * 2) / Math.ceil(sampleSound.duration())); + + for(let i = 0; i < sampleCount; i++) + { + for(let j = 0; j < Math.ceil(sampleSound.duration()); j++) + { + sequenceEntryArray.push({ sampleId: sample.id, offset: j }); + } + } + } + + this._sequence.push(sequenceEntryArray); + } + + if(this._playLength <= 0) this._playLength = Math.max(...this._sequence.map((value: ISequenceEntry[]) => value.length)); + } + + public async preloadSamplesForSong(song: string): Promise + { + const traxData = new TraxData(song); + + await Promise.all(traxData.getSampleIds().map(id => this.getSample(id))); + } + + private async loadSong(songId: number): Promise + { + return new Promise((resolve, reject) => + { + const sample = new Howl({ + src: [this._sampleUrl.replace('%sample%', songId.toString())], + preload: true, + }); + + sample.once('load', () => + { + this._cache.set(songId, sample); + resolve(sample); + }); + + sample.once('loaderror', () => + { + NitroLogger.error('failed to load sample ' + songId); + reject('failed to load sample ' + songId); + }); + }); + } + + + private tick(): void + { + if(this._currentPos > this._playLength - 1) + { + this.stop(); + } + + if(this._isPlaying) + { + if(this._currentSong) + { + //this.emit('time', this._currentPos); + this.playPosition(this._currentPos); + } + + this._currentPos++; + } + } + + private playPosition(pos: number): void + { + if(!this._currentSong || !this._sequence) return; + + //@ts-ignore + if(!Howler._audioUnlocked) + { + //console.log('skipping due to locked audio'); + return; + } + + for(const sequencyEntry of this._sequence) + { + const entry = sequencyEntry[pos]; + + if(!entry) continue; + + // sample -1 is play none + // sample 0 is 1 second of empty noise + if(entry.sampleId === -1 || entry.sampleId === 0) continue; + + const sampleAudio = this._cache.get(entry.sampleId); + + if(!sampleAudio) continue; + + if(entry.offset === 0) + { + sampleAudio.play(); + } + else if(!sampleAudio.playing()) + { + sampleAudio.seek(entry.offset); + sampleAudio.play(); + } + } + } + +} + +interface ISequenceEntry +{ + sampleId: number; + offset: number; +} diff --git a/submodules/renderer/src/nitro/sound/music/MusicPriorities.ts b/submodules/renderer/src/nitro/sound/music/MusicPriorities.ts new file mode 100644 index 0000000..3fb0599 --- /dev/null +++ b/submodules/renderer/src/nitro/sound/music/MusicPriorities.ts @@ -0,0 +1,8 @@ +export class MusicPriorities +{ + public static readonly PRIORITY_ROOM_PLAYLIST: number = 0; + public static readonly PRIORITY_USER_PLAYLIST: number = 1; + public static readonly PRIORITY_SONG_PLAY: number = 2; + public static readonly PRIORITY_PURCHASE_PREVIEW: number = 3; + public static readonly PRIORITY_COUNT: number = 4; +} diff --git a/submodules/renderer/src/nitro/sound/music/index.ts b/submodules/renderer/src/nitro/sound/music/index.ts new file mode 100644 index 0000000..d3553d4 --- /dev/null +++ b/submodules/renderer/src/nitro/sound/music/index.ts @@ -0,0 +1,3 @@ +export * from './JukeboxPlaylistController'; +export * from './MusicController'; +export * from './MusicPriorities'; diff --git a/submodules/renderer/src/nitro/sound/trax/TraxChannel.ts b/submodules/renderer/src/nitro/sound/trax/TraxChannel.ts new file mode 100644 index 0000000..02d2ade --- /dev/null +++ b/submodules/renderer/src/nitro/sound/trax/TraxChannel.ts @@ -0,0 +1,23 @@ +import { TraxChannelItem } from './TraxChannelItem'; + +export class TraxChannel +{ + private _id: number; + private _items: TraxChannelItem[]; + + constructor(id: number) + { + this._id = id; + this._items = []; + } + + public addChannelItem(item: TraxChannelItem): void + { + this._items.push(item); + } + + public get items(): TraxChannelItem[] + { + return this._items; + } +} diff --git a/submodules/renderer/src/nitro/sound/trax/TraxChannelItem.ts b/submodules/renderer/src/nitro/sound/trax/TraxChannelItem.ts new file mode 100644 index 0000000..7f08c26 --- /dev/null +++ b/submodules/renderer/src/nitro/sound/trax/TraxChannelItem.ts @@ -0,0 +1,21 @@ +export class TraxChannelItem +{ + private _id: number; + private _length: number; + + constructor(id: number, length: number) + { + this._id = id; + this._length = length; + } + + public get id(): number + { + return this._id; + } + + public get length(): number + { + return this._length; + } +} diff --git a/submodules/renderer/src/nitro/sound/trax/TraxData.ts b/submodules/renderer/src/nitro/sound/trax/TraxData.ts new file mode 100644 index 0000000..57545d3 --- /dev/null +++ b/submodules/renderer/src/nitro/sound/trax/TraxData.ts @@ -0,0 +1,97 @@ +import { TraxChannel } from './TraxChannel'; +import { TraxChannelItem } from './TraxChannelItem'; + +export class TraxData +{ + private _channels: TraxChannel[]; + private _metaData: Map; + + constructor(data: string) + { + this._channels = []; + this._metaData = new Map(); + + let channelLines: string[] = []; + + const lines: string[] = data.split(':'); + const lastLine: string = lines[lines.length - 1]; + + if(lastLine.indexOf('meta') > -1) + { + const metaData: string[] = lastLine.split(';'); + + for(const meta of metaData) + { + const metaAttributes: string[] = meta.split(','); + this._metaData.set(metaAttributes[0], metaAttributes[1]); + } + + channelLines = lines.slice(0, lines.length - 1); + } + else + { + channelLines = lines; + } + + for(let i = 0; i < channelLines.length / 2; i++) + { + if(channelLines[i * 2].length > 0) + { + const channelId: number = parseInt(channelLines[i * 2]); + const channelItemSets: string[] = channelLines[(i * 2) + 1].split(';'); + + const channel: TraxChannel = new TraxChannel(channelId); + + for(const channelItemSet of channelItemSets) + { + const channelItemData: string[] = channelItemSet.split(','); + + if(channelItemData.length !== 2) return; + + channel.addChannelItem(new TraxChannelItem(parseInt(channelItemData[0]), parseInt(channelItemData[1]))); + } + + this._channels.push(channel); + } + } + } + + public get channels(): TraxChannel[] + { + return this._channels; + } + + public getSampleIds(): number[] + { + const ids: number[] = []; + + for(const channel of this._channels) + { + for(const item of channel.items) + { + if(ids.indexOf(item.id) === -1) ids.push(item.id); + } + } + + return ids; + } + + public get hasMetaData(): boolean + { + return this._metaData.has('meta'); + } + + public get metaCutMode(): boolean + { + return this._metaData.has('c'); + } + + public get metaTempo(): number | null + { + const tempo = this._metaData.get('t'); + + if(!tempo) return null; + + return parseInt(tempo); + } +} diff --git a/submodules/renderer/src/nitro/sound/trax/index.ts b/submodules/renderer/src/nitro/sound/trax/index.ts new file mode 100644 index 0000000..d0b4128 --- /dev/null +++ b/submodules/renderer/src/nitro/sound/trax/index.ts @@ -0,0 +1,3 @@ +export * from './TraxChannel'; +export * from './TraxChannelItem'; +export * from './TraxData'; diff --git a/submodules/renderer/src/nitro/utils/FigureDataContainer.ts b/submodules/renderer/src/nitro/utils/FigureDataContainer.ts new file mode 100644 index 0000000..71dd487 --- /dev/null +++ b/submodules/renderer/src/nitro/utils/FigureDataContainer.ts @@ -0,0 +1,241 @@ +export class FigureDataContainer +{ + private static MALE: string = 'M'; + private static FEMALE: string = 'F'; + private static UNISEX: string = 'U'; + private static SCALE: string = 'h'; + private static STD: string = 'std'; + private static DEFAULT_FRAME: string = '0'; + private static HD: string = 'hd'; + private static HAIR: string = 'hr'; + private static HAT: string = 'ha'; + private static HEAD_ACCESSORIES: string = 'he'; + private static EYE_ACCESSORIES: string = 'ea'; + private static FACE_ACCESSORIES: string = 'fa'; + private static JACKET: string = 'cc'; + private static SHIRT: string = 'ch'; + private static CHEST_ACCESSORIES: string = 'ca'; + private static CHEST_PRINTS: string = 'cp'; + private static TROUSERS: string = 'lg'; + private static SHOES: string = 'sh'; + private static TROUSER_ACCESSORIES: string = 'wa'; + private static BLOCKED_FX_TYPES: number[] = [28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 68]; + + private _data: Map; + private _colors: Map; + private _gender: string = 'M'; + private _isDisposed: boolean; + private _avatarEffectType: number = -1; + + public loadAvatarData(figure: string, gender: string): void + { + this._data = new Map(); + this._colors = new Map(); + this._gender = gender; + + this.parseFigureString(figure); + } + + public dispose(): void + { + this._data = null; + this._colors = null; + this._isDisposed = true; + } + + public get disposed(): boolean + { + return this._isDisposed; + } + + private parseFigureString(k: string): void + { + if(!k) return; + + for(const set of k.split('.')) + { + const _local_3 = set.split('-'); + + if(_local_3.length > 0) + { + const part = _local_3[0]; + const setId = parseInt(_local_3[1]); + const colors: number[] = []; + + let i = 2; + + while(i < _local_3.length) + { + colors.push(parseInt(_local_3[i])); + + i++; + } + + if(!colors.length) colors.push(0); + + this.savePartSetId(part, setId, false); + this.savePartSetColourId(part, colors, false); + } + } + } + + public hasSetType(k: string): boolean + { + return !!this._data.get(k); + } + + public getPartSetId(k: string): number + { + if(this.hasSetType(k)) return this._data.get(k); + + return -1; + } + + public getColourIds(k: string): number[] + { + if(this._colors.get(k)) return this._colors.get(k); + + return []; + } + + public getFigureString(): string + { + let figure = ''; + + const sets: string[] = []; + + for(const [key, value] of this._data.entries()) + { + let set = ((key + '-') + value); + + const colors = this._colors.get(key); + + if(colors) for(const color of colors) set = (set + ('-' + color)); + + sets.push(set); + } + + let i = 0; + + while(i < sets.length) + { + figure = (figure + sets[i]); + + if(i < (sets.length - 1)) figure = (figure + '.'); + + i++; + } + + return figure; + } + + public savePartData(k: string, _arg_2: number, _arg_3: number[], _arg_4: boolean = false): void + { + this.savePartSetId(k, _arg_2, _arg_4); + this.savePartSetColourId(k, _arg_3, _arg_4); + } + + private savePartSetId(k: string, _arg_2: number, _arg_3: boolean = true): void + { + switch(k) + { + case FigureDataContainer.HD: + case FigureDataContainer.HAIR: + case FigureDataContainer.HAT: + case FigureDataContainer.HEAD_ACCESSORIES: + case FigureDataContainer.EYE_ACCESSORIES: + case FigureDataContainer.FACE_ACCESSORIES: + case FigureDataContainer.SHIRT: + case FigureDataContainer.JACKET: + case FigureDataContainer.CHEST_ACCESSORIES: + case FigureDataContainer.CHEST_PRINTS: + case FigureDataContainer.TROUSERS: + case FigureDataContainer.SHOES: + case FigureDataContainer.TROUSER_ACCESSORIES: + if(_arg_2 >= 0) + { + this._data.set(k, _arg_2); + } + else + { + this._data.delete(k); + } + } + } + + public savePartSetColourId(k: string, _arg_2: number[], _arg_3: boolean = true): void + { + switch(k) + { + case FigureDataContainer.HD: + case FigureDataContainer.HAIR: + case FigureDataContainer.HAT: + case FigureDataContainer.HEAD_ACCESSORIES: + case FigureDataContainer.EYE_ACCESSORIES: + case FigureDataContainer.FACE_ACCESSORIES: + case FigureDataContainer.SHIRT: + case FigureDataContainer.JACKET: + case FigureDataContainer.CHEST_ACCESSORIES: + case FigureDataContainer.CHEST_PRINTS: + case FigureDataContainer.TROUSERS: + case FigureDataContainer.SHOES: + case FigureDataContainer.TROUSER_ACCESSORIES: + this._colors.set(k, _arg_2); + return; + } + } + + public getFigureStringWithFace(k: number): string + { + const partSets: string[] = [FigureDataContainer.HD]; + + let figure = ''; + const sets: string[] = []; + + for(const part of partSets) + { + const colors = this._colors.get(part); + + if(colors) + { + let setId = this._data.get(part); + + if(part === FigureDataContainer.HD) setId = k; + + let set = ((part + '-') + setId); + + if(setId >= 0) + { + let i = 0; + + while(i < colors.length) + { + set = (set + ('-' + colors[i])); + + i++; + } + } + + sets.push(set); + } + } + + let i = 0; + + while(i < sets.length) + { + figure = (figure + sets[i]); + + if(i < (sets.length - 1)) figure = (figure + '.'); + + i++; + } + + return figure; + } + + public get gender(): string + { + return this._gender; + } +} diff --git a/submodules/renderer/src/nitro/utils/FixedSizeStack.ts b/submodules/renderer/src/nitro/utils/FixedSizeStack.ts new file mode 100644 index 0000000..af8e09a --- /dev/null +++ b/submodules/renderer/src/nitro/utils/FixedSizeStack.ts @@ -0,0 +1,65 @@ +export class FixedSizeStack +{ + private _data: number[]; + private _maxSize: number; + private _index: number; + + constructor(k: number) + { + this._data = []; + this._maxSize = k; + this._index = 0; + } + + public reset(): void + { + this._data = []; + this._index = 0; + } + + public addValue(k: number): void + { + if(this._data.length < this._maxSize) + { + this._data.push(k); + } + else + { + this._data[this._index] = k; + } + + this._index = ((this._index + 1) % this._maxSize); + } + + public getMax(): number + { + let k = Number.MIN_VALUE; + + let _local_2 = 0; + + while(_local_2 < this._maxSize) + { + if(this._data[_local_2] > k) k = this._data[_local_2]; + + _local_2++; + } + + return k; + } + + public getMin(): number + { + let k = Number.MAX_VALUE; + + let _local_2 = 0; + + while(_local_2 < this._maxSize) + { + if(this._data[_local_2] < k) k = this._data[_local_2]; + + _local_2++; + } + + return k; + } +} diff --git a/submodules/renderer/src/nitro/utils/FriendlyTime.ts b/submodules/renderer/src/nitro/utils/FriendlyTime.ts new file mode 100644 index 0000000..f6e0840 --- /dev/null +++ b/submodules/renderer/src/nitro/utils/FriendlyTime.ts @@ -0,0 +1,47 @@ +import { Nitro } from '../Nitro'; + +export class FriendlyTime +{ + private static MINUTE: number = 60; + private static HOUR: number = (60 * FriendlyTime.MINUTE); + private static DAY: number = (24 * FriendlyTime.HOUR); + private static WEEK: number = (7 * FriendlyTime.DAY); + private static MONTH: number = (30 * FriendlyTime.DAY); + private static YEAR: number = (365 * FriendlyTime.DAY); + + + public static format(seconds: number, key: string = '', threshold: number = 3): string + { + if(seconds > (threshold * FriendlyTime.YEAR)) return FriendlyTime.getLocalization(('friendlytime.years' + key), Math.round((seconds / FriendlyTime.YEAR))); + + if(seconds > (threshold * FriendlyTime.MONTH)) return FriendlyTime.getLocalization(('friendlytime.months' + key), Math.round((seconds / FriendlyTime.MONTH))); + + if(seconds > (threshold * FriendlyTime.DAY)) return FriendlyTime.getLocalization(('friendlytime.days' + key), Math.round((seconds / FriendlyTime.DAY))); + + if(seconds > (threshold * FriendlyTime.HOUR)) return FriendlyTime.getLocalization(('friendlytime.hours' + key), Math.round((seconds / FriendlyTime.HOUR))); + + if(seconds > (threshold * FriendlyTime.MINUTE)) return FriendlyTime.getLocalization(('friendlytime.minutes' + key), Math.round((seconds / FriendlyTime.MINUTE))); + + return FriendlyTime.getLocalization(('friendlytime.seconds' + key), Math.round(seconds)); + } + + public static shortFormat(seconds: number, key: string = '', threshold: number = 3): string + { + if(seconds > (threshold * FriendlyTime.YEAR)) return FriendlyTime.getLocalization(('friendlytime.years.short' + key), Math.round((seconds / FriendlyTime.YEAR))); + + if(seconds > (threshold * FriendlyTime.MONTH)) return FriendlyTime.getLocalization(('friendlytime.months.short' + key), Math.round((seconds / FriendlyTime.MONTH))); + + if(seconds > (threshold * FriendlyTime.DAY)) return FriendlyTime.getLocalization(('friendlytime.days.short' + key), Math.round((seconds / FriendlyTime.DAY))); + + if(seconds > (threshold * FriendlyTime.HOUR)) return FriendlyTime.getLocalization(('friendlytime.hours.short' + key), Math.round((seconds / FriendlyTime.HOUR))); + + if(seconds > (threshold * FriendlyTime.MINUTE)) return FriendlyTime.getLocalization(('friendlytime.minutes.short' + key), Math.round((seconds / FriendlyTime.MINUTE))); + + return FriendlyTime.getLocalization(('friendlytime.seconds.short' + key), Math.round(seconds)); + } + + public static getLocalization(key: string, amount: number): string + { + return Nitro.instance.getLocalizationWithParameter(key, 'amount', amount.toString()); + } +} diff --git a/submodules/renderer/src/nitro/utils/FurniId.ts b/submodules/renderer/src/nitro/utils/FurniId.ts new file mode 100644 index 0000000..92bad2b --- /dev/null +++ b/submodules/renderer/src/nitro/utils/FurniId.ts @@ -0,0 +1,9 @@ +export class FurniId +{ + private static BUILDER_CLUB_FURNI_ID_BASE: number = 0x7FFF0000; + + public static isBuilderClubId(k: number): boolean + { + return (k >= FurniId.BUILDER_CLUB_FURNI_ID_BASE); + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/utils/HabboWebTools.ts b/submodules/renderer/src/nitro/utils/HabboWebTools.ts new file mode 100644 index 0000000..f83dbfc --- /dev/null +++ b/submodules/renderer/src/nitro/utils/HabboWebTools.ts @@ -0,0 +1,338 @@ +import { NitroLogger } from '../../api'; +import { LegacyExternalInterface } from '../externalInterface/LegacyExternalInterface'; + +export class HabboWebTools +{ + public static ADVERTISEMENT: string = 'advertisement'; + public static OPENLINK: string = 'openlink'; + public static OPENROOM: string = 'openroom'; + + public static logEventLog(data: string): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.call('logEventLog', data); + } + } + + catch (e) + { + NitroLogger.log('External interface not working, failed to log event log.'); + } + } + + public static openPage(pageUrl: string): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.call('openPage', pageUrl); + } + else + { + NitroLogger.log('External interface not available, openPage failed.'); + } + } + + catch (e) + { + NitroLogger.log('Failed to open web page', pageUrl); + } + } + + public static openWebPage(pageUrl: string): void + { + window.open(pageUrl); + } + + public static sendHeartBeat(): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.call('heartBeat'); + } + } + + catch (e) + { + NitroLogger.log('Failed to send heartbeat'); + } + } + + public static openWebPageAndMinimizeClient(pageUrl: string): void + { + try + { + if(LegacyExternalInterface.available) + { + HabboWebTools.openPage(pageUrl); + } + } + + catch (e) + { + NitroLogger.log('Failed to open web page', pageUrl); + } + } + + public static closeWebPageAndRestoreClient(): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.call('closeWebPageAndRestoreClient'); + } + } + + catch (e) + { + NitroLogger.log('Failed to close web page and restore client!'); + } + } + + public static openHabblet(name: string, param: string = null): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.call('openHabblet', name, param); + } + } + + catch (e) + { + NitroLogger.log('Failed to open Habblet', name); + } + } + + public static closeHabblet(name: string, param: string = null): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.call('closeHabblet', name, param); + } + } + + catch (e) + { + NitroLogger.log('Failed to close Habblet', name); + } + } + + public static send(reasonCode: number, reasonString: string): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.call('disconnect', reasonCode, reasonString); + } + } + + catch (e) + { + NitroLogger.log('Failed to close send '); + } + } + + public static showGame(gameUrl: string): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.callGame('showGame', gameUrl); + } + } + + catch (e) + { + NitroLogger.log('Failed to open game', e); + } + } + + public static hideGame(): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.callGame('hideGame'); + } + } + + catch (e) + { + NitroLogger.log('Failed to hide game'); + } + } + + public static open(url: string): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.call('openExternalLink', escape(url)); + } + else + { + NitroLogger.log(('External interface not available. Could not request to open: ' + url)); + } + } + + catch (e) + { + NitroLogger.log(('External interface not working. Could not request to open: ' + url)); + } + } + + public static roomVisited(roomId: number): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.call('roomVisited', roomId); + } + else + { + NitroLogger.log('External interface not available. Could not store last room visit.'); + } + } + + catch (e) + { + NitroLogger.log('External interface not working. Could not store last room visit.'); + } + } + + public static openMinimail(target: string): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.call('openMinimail', target); + } + else + { + NitroLogger.log('External interface not available. Could not open minimail.'); + } + } + + catch (e) + { + NitroLogger.log('External interface not working. Could not open minimail.'); + } + } + + public static openNews(): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.call('openNews'); + } + else + { + NitroLogger.log('External interface not available. Could not open news.'); + } + } + + catch (e) + { + NitroLogger.log('External interface not working. Could not open news.'); + } + } + + public static closeNews(): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.call('closeNews'); + } + else + { + NitroLogger.log('External interface not available. Could not close news.'); + } + } + + catch (e) + { + NitroLogger.log('External interface not working. Could not close news.'); + } + } + + public static openAvatars(): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.call('openAvatars'); + } + else + { + NitroLogger.log('External interface not available. Could not open avatars.'); + } + } + + catch (e) + { + NitroLogger.log('External interface not working. Could not open avatars.'); + } + } + + public static openRoomEnterAd(): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.call('openRoomEnterAd'); + } + else + { + NitroLogger.log('External interface not available. Could not open roomenterad.'); + } + } + + catch (e) + { + NitroLogger.log('External interface not working. Could not open roomenterad.'); + } + } + + public static updateFigure(figure: string): void + { + try + { + if(LegacyExternalInterface.available) + { + LegacyExternalInterface.call('updateFigure', figure); + } + else + { + NitroLogger.log('External interface not available. Could not update figure.'); + } + } + + catch (e) + { + NitroLogger.log('External interface not working. Could not update figure.'); + } + } +} diff --git a/submodules/renderer/src/nitro/utils/Int32.ts b/submodules/renderer/src/nitro/utils/Int32.ts new file mode 100644 index 0000000..1267f48 --- /dev/null +++ b/submodules/renderer/src/nitro/utils/Int32.ts @@ -0,0 +1,13 @@ +const toUint32 = (x: number) => x >>> 0; + +export const ToInt32 = (x: number) => +{ + const uint32 = toUint32(x); + + if(uint32 >= Math.pow(2, 31)) + { + return uint32 - Math.pow(2, 32); + } + + return uint32; +}; diff --git a/submodules/renderer/src/nitro/utils/index.ts b/submodules/renderer/src/nitro/utils/index.ts new file mode 100644 index 0000000..a09920d --- /dev/null +++ b/submodules/renderer/src/nitro/utils/index.ts @@ -0,0 +1,6 @@ +export * from './FigureDataContainer'; +export * from './FixedSizeStack'; +export * from './FriendlyTime'; +export * from './FurniId'; +export * from './HabboWebTools'; +export * from './Int32'; diff --git a/submodules/renderer/src/nitro/window/index.ts b/submodules/renderer/src/nitro/window/index.ts new file mode 100644 index 0000000..b9d7075 --- /dev/null +++ b/submodules/renderer/src/nitro/window/index.ts @@ -0,0 +1 @@ +export * from './motion'; diff --git a/submodules/renderer/src/nitro/window/motion/Callback.ts b/submodules/renderer/src/nitro/window/motion/Callback.ts new file mode 100644 index 0000000..259f13c --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/Callback.ts @@ -0,0 +1,30 @@ +import { Motion } from './Motion'; + +export class Callback extends Motion +{ + protected _callback: Function; + + constructor(k: Function) + { + super(null); + + this._callback = k; + } + + public get running(): boolean + { + return (this._running && !!this._callback); + } + + public tick(k: number): void + { + super.tick(k); + + if(this._callback) + { + this._callback(); + + this._callback = null; + } + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/window/motion/Combo.ts b/submodules/renderer/src/nitro/window/motion/Combo.ts new file mode 100644 index 0000000..a5450c6 --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/Combo.ts @@ -0,0 +1,61 @@ +import { Motion } from './Motion'; + +export class Combo extends Motion +{ + private _runningMotions: Motion[]; + private _removedMotions: Motion[]; + + constructor(...motions: Motion[]) + { + super((motions && motions.length) ? motions[0].target : null); + + this._runningMotions = []; + this._removedMotions = []; + + for(const motion of motions) this._runningMotions.push(motion); + } + + public start(): void + { + super.start(); + + for(const motion of this._runningMotions) motion.start(); + } + + public tick(k: number): void + { + super.tick(k); + + let motion: Motion = null; + + while(((motion = this._removedMotions.pop()) !== null)) + { + this._runningMotions.splice(this._removedMotions.indexOf(motion), 1); + + if(motion.running) motion.stop(); + } + + for(const motion of this._runningMotions) + { + if(motion.running) motion.tick(k); + + if(motion.complete) this._removedMotions.push(motion); + } + + if(this._runningMotions.length > 0) + { + for(const motion of this._runningMotions) + { + this._target = motion.target; + + if(this._target) break; + } + + this._complete = false; + } + else + { + this._complete = true; + } + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/window/motion/Dispose.ts b/submodules/renderer/src/nitro/window/motion/Dispose.ts new file mode 100644 index 0000000..252b8e3 --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/Dispose.ts @@ -0,0 +1,21 @@ +import { Motion } from './Motion'; + +export class Dispose extends Motion +{ + constructor(k: HTMLElement) + { + super(k); + } + + public tick(k: number): void + { + super.tick(k); + + if(this.target) + { + this.target.remove(); + + this.target = null; + } + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/window/motion/DropBounce.ts b/submodules/renderer/src/nitro/window/motion/DropBounce.ts new file mode 100644 index 0000000..7b52fce --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/DropBounce.ts @@ -0,0 +1,60 @@ +import { Interval } from './Interval'; + +export class DropBounce extends Interval +{ + private _height: number; + private _offset: number; + + constructor(target: HTMLElement, duration: number, height: number) + { + super(target, duration); + + this._height = height; + } + + public start(): void + { + super.start(); + + this._offset = 0; + + this.target.style.top = ((this._offset - this._height) + 'px'); + } + + public update(time: number): void + { + super.update(time); + + this.target.style.top = (((this._offset - this._height) + (this.getBounceOffset(time) * this._height)) + 'px'); + } + + protected getBounceOffset(k: number): number + { + if(k < 0.364) return (7.5625 * k) * k; + + if(k < 0.727) + { + k = (k - 0.545); + + return ((7.5625 * k) * k) + 0.75; + } + + if(k < 0.909) + { + k = (k - 0.9091); + + return ((7.5625 * k) * k) + 0.9375; + } + + k = (k - 0.955); + + return ((7.5625 * k) * k) + 0.984375; + } + + public stop(): void + { + this.target.style.top = (this._offset + 'px'); + + super.stop(); + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/window/motion/Ease.ts b/submodules/renderer/src/nitro/window/motion/Ease.ts new file mode 100644 index 0000000..1034cdf --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/Ease.ts @@ -0,0 +1,34 @@ +import { Interval } from './Interval'; + +export class Ease extends Interval +{ + protected _interval: Interval; + + constructor(k: Interval) + { + super(k.target, k.duration); + + this._interval = k; + } + + public start(): void + { + super.start(); + + this._interval.start(); + } + + public update(k: number): void + { + super.update(k); + + this._interval.update(k); + } + + public stop(): void + { + super.stop(); + + this._interval.stop(); + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/window/motion/EaseOut.ts b/submodules/renderer/src/nitro/window/motion/EaseOut.ts new file mode 100644 index 0000000..d59fb0f --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/EaseOut.ts @@ -0,0 +1,15 @@ +import { EaseRate } from './EaseRate'; +import { Interval } from './Interval'; + +export class EaseOut extends EaseRate +{ + constructor(k: Interval, _arg_2: number) + { + super(k, _arg_2); + } + + public update(k: number): void + { + this._interval.update(Math.pow(k, (1 / this._rate))); + } +} diff --git a/submodules/renderer/src/nitro/window/motion/EaseRate.ts b/submodules/renderer/src/nitro/window/motion/EaseRate.ts new file mode 100644 index 0000000..d5308cc --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/EaseRate.ts @@ -0,0 +1,14 @@ +import { Ease } from './Ease'; +import { Interval } from './Interval'; + +export class EaseRate extends Ease +{ + protected _rate: number; + + constructor(k: Interval, _arg_2: number) + { + super(k); + + this._rate = _arg_2; + } +} diff --git a/submodules/renderer/src/nitro/window/motion/Interval.ts b/submodules/renderer/src/nitro/window/motion/Interval.ts new file mode 100644 index 0000000..77b2707 --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/Interval.ts @@ -0,0 +1,47 @@ +import { GetTickerTime } from '../../../pixi-proxy'; +import { Motion } from './Motion'; + +export class Interval extends Motion +{ + private _startTimeMs: number; + private _duration: number; + + constructor(target: HTMLElement, duration: number) + { + super(target); + + this._complete = false; + this._duration = duration; + } + + public get duration(): number + { + return this._duration; + } + + public start(): void + { + super.start(); + + this._complete = false; + this._startTimeMs = GetTickerTime(); + } + + public tick(time: number): void + { + super.tick(time); + + const elapsed = ((time - this._startTimeMs) / this._duration); + + if(elapsed < 1) + { + this.update(elapsed); + } + else + { + this.update(1); + + this._complete = true; + } + } +} diff --git a/submodules/renderer/src/nitro/window/motion/JumpBy.ts b/submodules/renderer/src/nitro/window/motion/JumpBy.ts new file mode 100644 index 0000000..1b956c9 --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/JumpBy.ts @@ -0,0 +1,37 @@ +import { Interval } from './Interval'; + +export class JumpBy extends Interval +{ + protected _startX: number; + protected _startY: number; + protected _deltaX: number; + protected _deltaY: number; + protected _height: number; + protected _numJumps: number; + + constructor(target: HTMLElement, duration: number, deltaX: number, deltaY: number, height: number, numJumps: number) + { + super(target, duration); + + this._deltaX = deltaX; + this._deltaY = deltaY; + this._height = -(height); + this._numJumps = numJumps; + } + + public start(): void + { + super.start(); + + this._startX = this.target.offsetLeft; + this._startY = this.target.offsetTop; + } + + public update(k: number): void + { + super.update(k); + + this.target.style.left = ((this._startX + (this._deltaX * k)) + 'px'); + this.target.style.top = (((this._startY + (this._height * Math.abs(Math.sin(((k * Math.PI) * this._numJumps))))) + (this._deltaY * k)) + 'px'); + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/window/motion/Motion.ts b/submodules/renderer/src/nitro/window/motion/Motion.ts new file mode 100644 index 0000000..acf6f58 --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/Motion.ts @@ -0,0 +1,61 @@ +export class Motion +{ + protected _target: HTMLElement; + protected _running: boolean; + protected _complete: boolean = true; + protected _tag: string; + + constructor(target: HTMLElement) + { + this._target = target; + } + + public get running(): boolean + { + return ((this._running) && (!!this._target)); + } + + public get complete(): boolean + { + return this._complete; + } + + public set target(k: HTMLElement) + { + this._target = k; + } + + public get target(): HTMLElement + { + return this._target; + } + + public set tag(k: string) + { + this._tag = k; + } + + public get tag(): string + { + return this._tag; + } + + public start(): void + { + this._running = true; + } + + public update(k: number): void + { + } + + public stop(): void + { + this._target = null; + this._running = false; + } + + public tick(k: number): void + { + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/window/motion/Motions.ts b/submodules/renderer/src/nitro/window/motion/Motions.ts new file mode 100644 index 0000000..2f9a715 --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/Motions.ts @@ -0,0 +1,193 @@ +import { GetTickerFPS, GetTickerTime } from '../../../pixi-proxy'; +import { Motion } from './Motion'; + +export class Motions +{ + private static _QUEUED_MOTIONS: Motion[] = []; + private static _RUNNING_MOTIONS: Motion[] = []; + private static _REMOVED_MOTIONS: Motion[] = []; + private static _TIMER: ReturnType = null; + private static _IS_UPDATING: boolean = false; + + public static get TIMER_TIME(): number + { + return (1000 / GetTickerFPS()); + } + + public static runMotion(k: Motion): Motion + { + if(((Motions._RUNNING_MOTIONS.indexOf(k) === -1) && (Motions._QUEUED_MOTIONS.indexOf(k) === -1))) + { + if(Motions._IS_UPDATING) + { + Motions._QUEUED_MOTIONS.push(k); + } + else + { + Motions._RUNNING_MOTIONS.push(k); + + k.start(); + } + + Motions.startTimer(); + } + + return k; + } + + public static removeMotion(k: Motion): void + { + let _local_2: number = Motions._RUNNING_MOTIONS.indexOf(k); + + if(_local_2 > -1) + { + if(Motions._IS_UPDATING) + { + _local_2 = Motions._REMOVED_MOTIONS.indexOf(k); + + if(_local_2 == -1) Motions._REMOVED_MOTIONS.push(k); + } + else + { + Motions._RUNNING_MOTIONS.splice(_local_2, 1); + + if(k.running) k.stop(); + + if(!Motions._RUNNING_MOTIONS.length) Motions.stopTimer(); + } + } + else + { + _local_2 = Motions._QUEUED_MOTIONS.indexOf(k); + + if(_local_2 > -1) Motions._QUEUED_MOTIONS.splice(_local_2, 1); + } + } + + public static getMotionByTag(k: string): Motion + { + for(const _local_2 of Motions._RUNNING_MOTIONS) + { + if(_local_2.tag == k) return _local_2; + } + + for(const _local_2 of Motions._QUEUED_MOTIONS) + { + if(_local_2.tag == k) return _local_2; + } + + return null; + } + + public static getMotionByTarget(k: HTMLElement): Motion + { + for(const _local_2 of Motions._RUNNING_MOTIONS) + { + if(_local_2.target == k) return _local_2; + } + + for(const _local_2 of Motions._QUEUED_MOTIONS) + { + if(_local_2.target == k) return _local_2; + } + + return null; + } + + public static getMotionByTagAndTarget(k: string, _arg_2: HTMLElement): Motion + { + for(const _local_3 of Motions._RUNNING_MOTIONS) + { + if(((_local_3.tag == k) && (_local_3.target == _arg_2))) return _local_3; + } + + for(const _local_3 of Motions._QUEUED_MOTIONS) + { + if(((_local_3.tag == k) && (_local_3.target == _arg_2))) return _local_3; + } + + return null; + } + + public static get isRunning(): boolean + { + return !!Motions._TIMER; + } + + public static get isUpdating(): boolean + { + return Motions._IS_UPDATING; + } + + private static onTick(): void + { + Motions._IS_UPDATING = true; + + const _local_2: number = GetTickerTime(); + + let _local_3: Motion = null; + + // eslint-disable-next-line no-cond-assign + while(_local_3 = Motions._QUEUED_MOTIONS.pop()) Motions._RUNNING_MOTIONS.push(_local_3); + + // eslint-disable-next-line no-cond-assign + while(_local_3 = Motions._REMOVED_MOTIONS.pop()) + { + Motions._RUNNING_MOTIONS.splice(Motions._RUNNING_MOTIONS.indexOf(_local_3), 1); + + if(_local_3.running) _local_3.stop(); + } + + for(_local_3 of Motions._RUNNING_MOTIONS) + { + if(_local_3.running) + { + _local_3.tick(_local_2); + + if(_local_3.complete) + { + Motions.removeMotion(_local_3); + } + } + else + { + Motions.removeMotion(_local_3); + } + } + + if(!Motions._RUNNING_MOTIONS.length) Motions.stopTimer(); + + Motions._IS_UPDATING = false; + } + + private static startTimer(): void + { + if(!Motions._TIMER) + { + Motions._TIMER = setInterval(Motions.onTick, Motions.TIMER_TIME); + } + } + + private static stopTimer(): void + { + if(Motions._TIMER) + { + clearInterval(Motions._TIMER); + + Motions._TIMER = null; + } + } + + + public getNumRunningMotions(k: HTMLElement): number + { + let _local_2 = 0; + + for(const _local_3 of Motions._RUNNING_MOTIONS) + { + if(_local_3.target === k) _local_2++; + } + + return _local_2; + } +} diff --git a/submodules/renderer/src/nitro/window/motion/MoveBy.ts b/submodules/renderer/src/nitro/window/motion/MoveBy.ts new file mode 100644 index 0000000..1639901 --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/MoveBy.ts @@ -0,0 +1,17 @@ +import { MoveTo } from './MoveTo'; + +export class MoveBy extends MoveTo +{ + constructor(k: HTMLElement, _arg_2: number, _arg_3: number, _arg_4: number) + { + super(k, _arg_2, _arg_3, _arg_4); + } + + public start(): void + { + this._endX = (this.target.offsetLeft + this._endX); + this._endY = (this.target.offsetTop + this._endY); + + super.start(); + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/window/motion/MoveTo.ts b/submodules/renderer/src/nitro/window/motion/MoveTo.ts new file mode 100644 index 0000000..3d7fe2a --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/MoveTo.ts @@ -0,0 +1,35 @@ +import { Interval } from './Interval'; + +export class MoveTo extends Interval +{ + protected _startX: number; + protected _startY: number; + protected _endX: number; + protected _endY: number; + protected _deltaX: number; + protected _deltaY: number; + + constructor(k: HTMLElement, _arg_2: number, _arg_3: number, _arg_4: number) + { + super(k, _arg_2); + + this._endX = _arg_3; + this._endY = _arg_4; + } + + public start(): void + { + super.start(); + + this._startX = this.target.offsetLeft; + this._startY = this.target.offsetTop; + this._deltaX = (this._endX - this._startX); + this._deltaY = (this._endY - this._startY); + } + + public update(k: number): void + { + this.target.style.left = ((this._startX + (this._deltaX * k)) + 'px'); + this.target.style.top = ((this._startY + (this._deltaY * k)) + 'px'); + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/window/motion/Queue.ts b/submodules/renderer/src/nitro/window/motion/Queue.ts new file mode 100644 index 0000000..990d9da --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/Queue.ts @@ -0,0 +1,71 @@ +import { Motion } from './Motion'; + +export class Queue extends Motion +{ + private _motion: Motion; + private _queue: Motion[]; + + constructor(...motions: Motion[]) + { + super((motions ? motions[0].target : null)); + + this._queue = []; + + for(const motion of motions) this._queue.push(motion); + + this._motion = motions[0]; + this._complete = !this._motion; + } + + public get running(): boolean + { + return ((this._running && this._motion) ? this._motion.running : false); + } + + public start(): void + { + super.start(); + + this._motion.start(); + } + + public update(k: number): void + { + super.update(k); + + if(this._motion.running) this._motion.update(k); + } + + public stop(): void + { + super.stop(); + + this._motion.stop(); + } + + public tick(k: number): void + { + super.tick(k); + + this._motion.tick(k); + + if(this._motion.complete) + { + this._motion.stop(); + + const index = this._queue.indexOf(this._motion); + + if(index < (this._queue.length - 1)) + { + this._motion = this._queue[(index + 1)]; + this._target = this._motion.target; + + this._motion.start(); + } + else + { + this._complete = true; + } + } + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/window/motion/ResizeTo.ts b/submodules/renderer/src/nitro/window/motion/ResizeTo.ts new file mode 100644 index 0000000..d5e706b --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/ResizeTo.ts @@ -0,0 +1,35 @@ +import { Interval } from './Interval'; + +export class ResizeTo extends Interval +{ + protected _startW: number; + protected _startH: number; + protected _endW: number; + protected _endH: number; + protected _deltaW: number; + protected _deltaH: number; + + constructor(k: HTMLElement, _arg_2: number, _arg_3: number, _arg_4: number) + { + super(k, _arg_2); + + this._endW = _arg_3; + this._endH = _arg_4; + } + + public start(): void + { + super.start(); + + this._startW = this.target.offsetWidth; + this._startH = this.target.offsetHeight; + this._deltaW = (this._endW - this._startW); + this._deltaH = (this._endH - this._startH); + } + + public update(k: number): void + { + this.target.style.width = ((this._startW + (this._deltaW * k)) + 'px'); + this.target.style.height = ((this._startH + (this._deltaH * k)) + 'px'); + } +} \ No newline at end of file diff --git a/submodules/renderer/src/nitro/window/motion/Wait.ts b/submodules/renderer/src/nitro/window/motion/Wait.ts new file mode 100644 index 0000000..feb2325 --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/Wait.ts @@ -0,0 +1,37 @@ +import { GetTickerTime } from '../../../pixi-proxy'; +import { Motion } from './Motion'; + +export class Wait extends Motion +{ + private _startTimeMs: number; + private _waitTimeMs: number; + + constructor(k: number) + { + super(null); + + this._waitTimeMs = k; + } + + public get running(): boolean + { + return this._running; + } + + public start(): void + { + super.start(); + + this._complete = false; + this._startTimeMs = GetTickerTime(); + } + + public tick(k: number): void + { + super.tick(k); + + this._complete = ((k - this._startTimeMs) >= this._waitTimeMs); + + if(this._complete) this.stop(); + } +} diff --git a/submodules/renderer/src/nitro/window/motion/index.ts b/submodules/renderer/src/nitro/window/motion/index.ts new file mode 100644 index 0000000..e9d75df --- /dev/null +++ b/submodules/renderer/src/nitro/window/motion/index.ts @@ -0,0 +1,16 @@ +export * from './Callback'; +export * from './Combo'; +export * from './Dispose'; +export * from './DropBounce'; +export * from './Ease'; +export * from './EaseOut'; +export * from './EaseRate'; +export * from './Interval'; +export * from './JumpBy'; +export * from './Motion'; +export * from './Motions'; +export * from './MoveBy'; +export * from './MoveTo'; +export * from './Queue'; +export * from './ResizeTo'; +export * from './Wait'; diff --git a/submodules/renderer/src/pixi-proxy/CopyChannelFilter.ts b/submodules/renderer/src/pixi-proxy/CopyChannelFilter.ts new file mode 100644 index 0000000..70dd774 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/CopyChannelFilter.ts @@ -0,0 +1,49 @@ +import { Filter, RenderTexture } from '@pixi/core'; + +const vertex = ` +attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; +uniform mat3 projectionMatrix; +varying vec2 vTextureCoord; +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`; + +const fragment = ` +varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform sampler2D mask; +uniform int fromChannel; +uniform int toChannel; + +void main(void) { + vec4 maskColor = texture2D(mask, vTextureCoord); + vec4 currentColor = texture2D(uSampler, vTextureCoord); + vec4 adjusted = currentColor; + + if(maskColor.r == 0.0 && maskColor.g == 0.0 && maskColor.b == 0.0) + { + adjusted.a = 0.0; + } + + gl_FragColor = vec4(adjusted.r, adjusted.g, adjusted.b, adjusted.a); +}`; + +export class CopyChannelFilter extends Filter +{ + public static readonly CHANNEL_RED = 0; + public static readonly CHANNEL_GREEN = 1; + public static readonly CHANNEL_BLUE = 2; + public static readonly CHANNEL_ALPHA = 3; + + constructor(mask: RenderTexture, fromChannel: number, toChannel: number) + { + super(vertex, fragment, { + mask: mask.castToBaseTexture(), + fromChannel, + toChannel + }); + } +} diff --git a/submodules/renderer/src/pixi-proxy/GetTicker.ts b/submodules/renderer/src/pixi-proxy/GetTicker.ts new file mode 100644 index 0000000..cddd4a2 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/GetTicker.ts @@ -0,0 +1,3 @@ +import { PixiApplicationProxy } from './PixiApplicationProxy'; + +export const GetTicker = () => (PixiApplicationProxy.instance?.ticker || null); diff --git a/submodules/renderer/src/pixi-proxy/GetTickerFPS.ts b/submodules/renderer/src/pixi-proxy/GetTickerFPS.ts new file mode 100644 index 0000000..26224f6 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/GetTickerFPS.ts @@ -0,0 +1,3 @@ +import { GetTicker } from './GetTicker'; + +export const GetTickerFPS = () => (GetTicker()?.FPS || 0); diff --git a/submodules/renderer/src/pixi-proxy/GetTickerTime.ts b/submodules/renderer/src/pixi-proxy/GetTickerTime.ts new file mode 100644 index 0000000..f5987e4 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/GetTickerTime.ts @@ -0,0 +1,3 @@ +import { GetTicker } from './GetTicker'; + +export const GetTickerTime = () => (GetTicker()?.lastTime || 0); diff --git a/submodules/renderer/src/pixi-proxy/INitroPoint.ts b/submodules/renderer/src/pixi-proxy/INitroPoint.ts new file mode 100644 index 0000000..3001480 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/INitroPoint.ts @@ -0,0 +1,3 @@ +import { IPoint } from '@pixi/math'; + +export type INitroPoint = IPoint diff --git a/submodules/renderer/src/pixi-proxy/NitroAlphaFilter.ts b/submodules/renderer/src/pixi-proxy/NitroAlphaFilter.ts new file mode 100644 index 0000000..26eba36 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/NitroAlphaFilter.ts @@ -0,0 +1,4 @@ +import { AlphaFilter } from '@pixi/filter-alpha'; + +export class NitroAlphaFilter extends AlphaFilter +{} diff --git a/submodules/renderer/src/pixi-proxy/NitroBaseTexture.ts b/submodules/renderer/src/pixi-proxy/NitroBaseTexture.ts new file mode 100644 index 0000000..bf75bf0 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/NitroBaseTexture.ts @@ -0,0 +1,4 @@ +import { BaseTexture } from '@pixi/core'; + +export class NitroBaseTexture extends BaseTexture +{} diff --git a/submodules/renderer/src/pixi-proxy/NitroContainer.ts b/submodules/renderer/src/pixi-proxy/NitroContainer.ts new file mode 100644 index 0000000..bd8e447 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/NitroContainer.ts @@ -0,0 +1,4 @@ +import { Container } from '@pixi/display'; + +export class NitroContainer extends Container +{} diff --git a/submodules/renderer/src/pixi-proxy/NitroFilter.ts b/submodules/renderer/src/pixi-proxy/NitroFilter.ts new file mode 100644 index 0000000..85c4009 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/NitroFilter.ts @@ -0,0 +1,4 @@ +import { Filter } from '@pixi/core'; + +export class NitroFilter extends Filter +{} diff --git a/submodules/renderer/src/pixi-proxy/NitroPoint.ts b/submodules/renderer/src/pixi-proxy/NitroPoint.ts new file mode 100644 index 0000000..f1b9e4d --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/NitroPoint.ts @@ -0,0 +1,5 @@ +import { Point } from '@pixi/math'; +import { INitroPoint } from './INitroPoint'; + +export class NitroPoint extends Point implements INitroPoint +{} diff --git a/submodules/renderer/src/pixi-proxy/NitroPolygon.ts b/submodules/renderer/src/pixi-proxy/NitroPolygon.ts new file mode 100644 index 0000000..de94608 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/NitroPolygon.ts @@ -0,0 +1,4 @@ +import { Polygon } from '@pixi/math'; + +export class NitroPolygon extends Polygon +{} diff --git a/submodules/renderer/src/pixi-proxy/NitroRectangle.ts b/submodules/renderer/src/pixi-proxy/NitroRectangle.ts new file mode 100644 index 0000000..a612d61 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/NitroRectangle.ts @@ -0,0 +1,4 @@ +import { Rectangle } from '@pixi/math'; + +export class NitroRectangle extends Rectangle +{} diff --git a/submodules/renderer/src/pixi-proxy/NitroRenderTexture.ts b/submodules/renderer/src/pixi-proxy/NitroRenderTexture.ts new file mode 100644 index 0000000..1b89778 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/NitroRenderTexture.ts @@ -0,0 +1,4 @@ +import { RenderTexture } from '@pixi/core'; + +export class NitroRenderTexture extends RenderTexture +{} diff --git a/submodules/renderer/src/pixi-proxy/NitroSprite.ts b/submodules/renderer/src/pixi-proxy/NitroSprite.ts new file mode 100644 index 0000000..8268d1c --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/NitroSprite.ts @@ -0,0 +1,5 @@ +import { Sprite as SpriteBase } from '@pixi/sprite'; + +export class NitroSprite extends SpriteBase +{ +} diff --git a/submodules/renderer/src/pixi-proxy/NitroSpritesheet.ts b/submodules/renderer/src/pixi-proxy/NitroSpritesheet.ts new file mode 100644 index 0000000..25fdfce --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/NitroSpritesheet.ts @@ -0,0 +1,4 @@ +import { Spritesheet } from '@pixi/spritesheet'; + +export class NitroSpritesheet extends Spritesheet +{} diff --git a/submodules/renderer/src/pixi-proxy/NitroTexture.ts b/submodules/renderer/src/pixi-proxy/NitroTexture.ts new file mode 100644 index 0000000..941277f --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/NitroTexture.ts @@ -0,0 +1,4 @@ +import { Texture } from '@pixi/core'; + +export class NitroTexture extends Texture +{} diff --git a/submodules/renderer/src/pixi-proxy/NitroTilemap.ts b/submodules/renderer/src/pixi-proxy/NitroTilemap.ts new file mode 100644 index 0000000..0047777 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/NitroTilemap.ts @@ -0,0 +1,6 @@ +import { Tilemap } from '@pixi/tilemap'; + +export class NitroTilemap extends Tilemap +{ + +} diff --git a/submodules/renderer/src/pixi-proxy/PaletteMapFilter.ts b/submodules/renderer/src/pixi-proxy/PaletteMapFilter.ts new file mode 100644 index 0000000..b7b2ff2 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/PaletteMapFilter.ts @@ -0,0 +1,94 @@ +import { NitroBaseTexture } from './NitroBaseTexture'; +import { NitroFilter } from './NitroFilter'; + +const vertex = ` +attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; +uniform mat3 projectionMatrix; +varying vec2 vTextureCoord; +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`; + +const fragment = ` +varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform sampler2D lut; +uniform int channel; + +void main(void) { + vec4 currentColor = texture2D(uSampler, vTextureCoord); + vec4 adjusted = currentColor; + + if(currentColor.a > 0.0) + { + if(channel == 0) + { + adjusted = texture2D(lut, vec2((currentColor.r * 255.0 + 0.5) / 256.0, 0.5)); + } else if(channel == 1) { + adjusted = texture2D(lut, vec2((currentColor.g * 255.0 + 0.5) / 256.0, 0.5)); + } else if(channel == 2) { + adjusted = texture2D(lut, vec2((currentColor.b * 255.0 + 0.5) / 256.0, 0.5)); + } else if(channel == 3) { + adjusted = texture2D(lut, vec2((currentColor.a * 255.0 + 0.5) / 256.0, 0.5)); + } + } + + gl_FragColor = vec4(adjusted.r, adjusted.g, adjusted.b, currentColor.a); +}`; + +export class PaletteMapFilter extends NitroFilter +{ + public static readonly CHANNEL_RED = 0; + public static readonly CHANNEL_GREEN = 1; + public static readonly CHANNEL_BLUE = 2; + public static readonly CHANNEL_ALPHA = 3; + + private _lut: NitroBaseTexture; + private _channel: number; + + constructor(palette: number[], channel = PaletteMapFilter.CHANNEL_RED) + { + super(vertex, fragment); + this._channel = channel; + let lut: number[] = []; + + lut = this.getLutForPalette(palette); + + this._lut = NitroBaseTexture.fromBuffer(Uint8Array.from(lut), lut.length / 4, 1, { mipmap: 0, scaleMode: 0 }); + + this.uniforms.lut = this._lut; + this.uniforms.channel = this._channel; + } + + private getLutForPalette(data: number[]): number[] + { + const lut = []; + + for(let i = 0; i < data.length; i++) + { + // R + lut[(i * 4) + PaletteMapFilter.CHANNEL_RED] = ((data[i] >> 16) & 0xFF); + // G + lut[(i * 4) + PaletteMapFilter.CHANNEL_GREEN] = ((data[i] >> 8) & 0xFF); + // B + lut[(i * 4) + PaletteMapFilter.CHANNEL_BLUE] = (data[i] & 0xFF); + // A + lut[(i * 4) + PaletteMapFilter.CHANNEL_ALPHA] = ((data[i] >> 24) & 0xFF); + } + + return lut; + } + + public get lut(): NitroBaseTexture + { + return this._lut; + } + + public get channel(): number + { + return this._channel; + } +} diff --git a/submodules/renderer/src/pixi-proxy/PixiApplicationProxy.ts b/submodules/renderer/src/pixi-proxy/PixiApplicationProxy.ts new file mode 100644 index 0000000..f026530 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/PixiApplicationProxy.ts @@ -0,0 +1,18 @@ +import { Application, IApplicationOptions } from '@pixi/app'; + +export class PixiApplicationProxy extends Application +{ + private static INSTANCE: Application = null; + + constructor(options?: IApplicationOptions) + { + super(options); + + if(!PixiApplicationProxy.INSTANCE) PixiApplicationProxy.INSTANCE = this; + } + + public static get instance(): Application + { + return this.INSTANCE || null; + } +} diff --git a/submodules/renderer/src/pixi-proxy/PixiInteractionEventProxy.ts b/submodules/renderer/src/pixi-proxy/PixiInteractionEventProxy.ts new file mode 100644 index 0000000..ba87590 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/PixiInteractionEventProxy.ts @@ -0,0 +1,4 @@ +import { InteractionEvent } from '@pixi/interaction'; + +export class PixiInteractionEventProxy extends InteractionEvent +{} diff --git a/submodules/renderer/src/pixi-proxy/RoomTextureUtils.ts b/submodules/renderer/src/pixi-proxy/RoomTextureUtils.ts new file mode 100644 index 0000000..f1f0579 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/RoomTextureUtils.ts @@ -0,0 +1,129 @@ +import { AbstractRenderer, Renderer, RenderTexture, Texture } from '@pixi/core'; +import { DisplayObject } from '@pixi/display'; +import { Extract } from '@pixi/extract'; +import { Matrix, Rectangle } from '@pixi/math'; +import { Sprite } from '@pixi/sprite'; +import { PixiApplicationProxy } from './PixiApplicationProxy'; + +export class PlaneTextureCache +{ + private static DEFAULT_PLANE_ID = 'DEFAULT'; + + public RENDER_TEXTURE_POOL: Map = new Map(); + public RENDER_TEXTURE_CACHE: RenderTexture[] = []; + + public clearCache(): void + { + this.RENDER_TEXTURE_POOL.forEach(renderTexture => renderTexture?.destroy(true)); + + this.RENDER_TEXTURE_POOL.clear(); + this.RENDER_TEXTURE_CACHE = []; + } + + public clearRenderTexture(renderTexture: RenderTexture): RenderTexture + { + if(!renderTexture) return null; + + return this.writeToRenderTexture(new Sprite(Texture.EMPTY), renderTexture); + } + + private getTextureIdentifier(width: number, height: number, planeId: string): string + { + return `${ planeId ?? PlaneTextureCache.DEFAULT_PLANE_ID }:${ width }:${ height }`; + } + + public createRenderTexture(width: number, height: number, planeId: string = null): RenderTexture + { + if((width < 0) || (height < 0)) return null; + + if(!planeId) + { + const renderTexture = RenderTexture.create({ + width, + height + }); + + this.RENDER_TEXTURE_CACHE.push(renderTexture); + + return renderTexture; + } + + planeId = this.getTextureIdentifier(width, height, planeId); + + let renderTexture = this.RENDER_TEXTURE_POOL.get(planeId); + + if(!renderTexture) + { + renderTexture = RenderTexture.create({ + width, + height + }); + + this.RENDER_TEXTURE_CACHE.push(renderTexture); + + this.RENDER_TEXTURE_POOL.set(planeId, renderTexture); + } + + return renderTexture; + } + + public createAndFillRenderTexture(width: number, height: number, planeId = null, color: number = 16777215): RenderTexture + { + if((width < 0) || (height < 0)) return null; + + const renderTexture = this.createRenderTexture(width, height, planeId); + + return this.clearAndFillRenderTexture(renderTexture, color); + } + + public createAndWriteRenderTexture(width: number, height: number, displayObject: DisplayObject, planeId: string = null, transform: Matrix = null): RenderTexture + { + if((width < 0) || (height < 0)) return null; + + const renderTexture = this.createRenderTexture(width, height, planeId); + + return this.writeToRenderTexture(displayObject, renderTexture, true, transform); + } + + public clearAndFillRenderTexture(renderTexture: RenderTexture, color: number = 16777215): RenderTexture + { + if(!renderTexture) return null; + + const sprite = new Sprite(Texture.WHITE); + + sprite.tint = color; + + sprite.width = renderTexture.width; + sprite.height = renderTexture.height; + + return this.writeToRenderTexture(sprite, renderTexture); + } + + public writeToRenderTexture(displayObject: DisplayObject, renderTexture: RenderTexture, clear: boolean = true, transform: Matrix = null): RenderTexture + { + if(!displayObject || !renderTexture) return null; + + this.getRenderer().render(displayObject, { + renderTexture, + clear, + transform + }); + + return renderTexture; + } + + public getPixels(displayObject: DisplayObject | RenderTexture, frame: Rectangle = null): Uint8Array + { + return this.getExtractor().pixels(displayObject); + } + + public getRenderer(): Renderer | AbstractRenderer + { + return PixiApplicationProxy.instance.renderer; + } + + public getExtractor(): Extract + { + return (this.getRenderer().plugins.extract as Extract); + } +} diff --git a/submodules/renderer/src/pixi-proxy/TextureUtils.ts b/submodules/renderer/src/pixi-proxy/TextureUtils.ts new file mode 100644 index 0000000..de4ab8f --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/TextureUtils.ts @@ -0,0 +1,128 @@ +import { AbstractRenderer, Renderer, RenderTexture, Resource, Texture } from '@pixi/core'; +import { DisplayObject } from '@pixi/display'; +import { Extract } from '@pixi/extract'; +import { Matrix, Rectangle } from '@pixi/math'; +import { settings } from '@pixi/settings'; +import { Sprite } from '@pixi/sprite'; +import { PixiApplicationProxy } from './PixiApplicationProxy'; + +export class TextureUtils +{ + public static generateTexture(displayObject: DisplayObject, region: Rectangle = null, scaleMode: number = null, resolution: number = 1): RenderTexture + { + if(!displayObject) return null; + + if(scaleMode === null) scaleMode = settings.SCALE_MODE; + + return this.getRenderer().generateTexture(displayObject, { + scaleMode, + resolution, + region + }); + } + + public static generateTextureFromImage(image: HTMLImageElement): Texture + { + if(!image) return null; + + return Texture.from(image); + } + + public static generateImage(target: DisplayObject | RenderTexture): HTMLImageElement + { + if(!target) return null; + + return this.getExtractor().image(target); + } + + public static generateImageUrl(target: DisplayObject | RenderTexture): string + { + if(!target) return null; + + return this.getExtractor().base64(target); + } + + public static generateCanvas(target: DisplayObject | RenderTexture): HTMLCanvasElement + { + if(!target) return null; + + return this.getExtractor().canvas(target); + } + + public static clearRenderTexture(renderTexture: RenderTexture): RenderTexture + { + if(!renderTexture) return null; + + return this.writeToRenderTexture(new Sprite(Texture.EMPTY), renderTexture); + } + + public static createRenderTexture(width: number, height: number): RenderTexture + { + if((width < 0) || (height < 0)) return null; + + return RenderTexture.create({ + width, + height + }); + } + + public static createAndFillRenderTexture(width: number, height: number, color: number = 16777215): RenderTexture + { + if((width < 0) || (height < 0)) return null; + + const renderTexture = this.createRenderTexture(width, height); + + return this.clearAndFillRenderTexture(renderTexture, color); + } + + public static createAndWriteRenderTexture(width: number, height: number, displayObject: DisplayObject, transform: Matrix = null): RenderTexture + { + if((width < 0) || (height < 0)) return null; + + const renderTexture = this.createRenderTexture(width, height); + + return this.writeToRenderTexture(displayObject, renderTexture, true, transform); + } + + public static clearAndFillRenderTexture(renderTexture: RenderTexture, color: number = 16777215): RenderTexture + { + if(!renderTexture) return null; + + const sprite = new Sprite(Texture.WHITE); + + sprite.tint = color; + + sprite.width = renderTexture.width; + sprite.height = renderTexture.height; + + return this.writeToRenderTexture(sprite, renderTexture); + } + + public static writeToRenderTexture(displayObject: DisplayObject, renderTexture: RenderTexture, clear: boolean = true, transform: Matrix = null): RenderTexture + { + if(!displayObject || !renderTexture) return null; + + this.getRenderer().render(displayObject, { + renderTexture, + clear, + transform + }); + + return renderTexture; + } + + public static getPixels(displayObject: DisplayObject | RenderTexture, frame: Rectangle = null): Uint8Array + { + return this.getExtractor().pixels(displayObject); + } + + public static getRenderer(): Renderer | AbstractRenderer + { + return PixiApplicationProxy.instance.renderer; + } + + public static getExtractor(): Extract + { + return (this.getRenderer().plugins.extract as Extract); + } +} diff --git a/submodules/renderer/src/pixi-proxy/adjustment-filter/AdjustmentFilter.ts b/submodules/renderer/src/pixi-proxy/adjustment-filter/AdjustmentFilter.ts new file mode 100644 index 0000000..118c9a0 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/adjustment-filter/AdjustmentFilter.ts @@ -0,0 +1,120 @@ +import { CLEAR_MODES } from '@pixi/constants'; +import { Filter, FilterSystem, RenderTexture } from '@pixi/core'; + +interface AdjustmentFilterOptions +{ + gamma: number; + saturation: number; + contrast: number; + brightness: number; + red: number; + green: number; + blue: number; + alpha: number; +} + +export class AdjustmentFilter extends Filter +{ + /** The amount of luminance */ + public gamma = 1; + + /** The amount of saturation */ + public saturation = 1; + + /** The amount of contrast */ + public contrast = 1; + + /** The amount of brightness */ + public brightness = 1; + + /** The amount of red channel */ + public red = 1; + + /** The amount of green channel */ + public green = 1; + + /** The amount of blue channel */ + public blue = 1; + + /** The amount of alpha channel */ + public alpha = 1; + + /** + * @param {object|number} [options] - The optional parameters of the filter. + * @param {number} [options.gamma=1] - The amount of luminance + * @param {number} [options.saturation=1] - The amount of color saturation + * @param {number} [options.contrast=1] - The amount of contrast + * @param {number} [options.brightness=1] - The overall brightness + * @param {number} [options.red=1] - The multipled red channel + * @param {number} [options.green=1] - The multipled green channel + * @param {number} [options.blue=1] - The multipled blue channel + * @param {number} [options.alpha=1] - The overall alpha amount + */ + constructor(options?: Partial) + { + super( + `attribute vec2 aVertexPosition; + attribute vec2 aTextureCoord; + + uniform mat3 projectionMatrix; + + varying vec2 vTextureCoord; + + void main(void) + { + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; + }`, + `varying vec2 vTextureCoord; + uniform sampler2D uSampler; + + uniform float gamma; + uniform float contrast; + uniform float saturation; + uniform float brightness; + uniform float red; + uniform float green; + uniform float blue; + uniform float alpha; + + void main(void) + { + vec4 c = texture2D(uSampler, vTextureCoord); + + if (c.a > 0.0) { + c.rgb /= c.a; + + vec3 rgb = pow(c.rgb, vec3(1. / gamma)); + rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast); + rgb.r *= red; + rgb.g *= green; + rgb.b *= blue; + c.rgb = rgb * brightness; + + c.rgb *= c.a; + } + + gl_FragColor = c * alpha; + }`); + + Object.assign(this, options); + } + + /** + * Override existing apply method in PIXI.Filter + * @ignore + */ + apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clear: CLEAR_MODES): void + { + this.uniforms.gamma = Math.max(this.gamma, 0.0001); + this.uniforms.saturation = this.saturation; + this.uniforms.contrast = this.contrast; + this.uniforms.brightness = this.brightness; + this.uniforms.red = this.red; + this.uniforms.green = this.green; + this.uniforms.blue = this.blue; + this.uniforms.alpha = this.alpha; + + filterManager.applyFilter(this, input, output, clear); + } +} diff --git a/submodules/renderer/src/pixi-proxy/adjustment-filter/index.ts b/submodules/renderer/src/pixi-proxy/adjustment-filter/index.ts new file mode 100644 index 0000000..1f6c0ff --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/adjustment-filter/index.ts @@ -0,0 +1 @@ +export * from './AdjustmentFilter'; diff --git a/submodules/renderer/src/pixi-proxy/index.ts b/submodules/renderer/src/pixi-proxy/index.ts new file mode 100644 index 0000000..0a12f16 --- /dev/null +++ b/submodules/renderer/src/pixi-proxy/index.ts @@ -0,0 +1,24 @@ +export { POINT_STRUCT_SIZE } from '@pixi/tilemap'; +export * from './adjustment-filter'; +export * from './CopyChannelFilter'; +export * from './GetTicker'; +export * from './GetTickerFPS'; +export * from './GetTickerTime'; +export * from './INitroPoint'; +export * from './NitroAlphaFilter'; +export * from './NitroBaseTexture'; +export * from './NitroContainer'; +export * from './NitroFilter'; +export * from './NitroPoint'; +export * from './NitroPolygon'; +export * from './NitroRectangle'; +export * from './NitroRenderTexture'; +export * from './NitroSprite'; +export * from './NitroSpritesheet'; +export * from './NitroTexture'; +export * from './NitroTilemap'; +export * from './PaletteMapFilter'; +export * from './PixiApplicationProxy'; +export * from './PixiInteractionEventProxy'; +export * from './RoomTextureUtils'; +export * from './TextureUtils'; diff --git a/submodules/renderer/src/room/RoomInstance.ts b/submodules/renderer/src/room/RoomInstance.ts new file mode 100644 index 0000000..6621c09 --- /dev/null +++ b/submodules/renderer/src/room/RoomInstance.ts @@ -0,0 +1,294 @@ +import { IRoomInstance, IRoomInstanceContainer, IRoomObject, IRoomObjectController, IRoomObjectManager, IRoomObjectModel, IRoomRendererBase } from '../api'; +import { Disposable } from '../core'; +import { RoomObjectModel } from './object'; + +export class RoomInstance extends Disposable implements IRoomInstance +{ + private _id: string; + private _container: IRoomInstanceContainer; + private _renderer: IRoomRendererBase; + private _managers: Map; + private _updateCategories: number[]; + private _model: IRoomObjectModel; + + constructor(id: string, container: IRoomInstanceContainer) + { + super(); + + this._id = id; + this._container = container; + this._renderer = null; + this._managers = new Map(); + this._updateCategories = []; + this._model = new RoomObjectModel(); + } + + protected onDispose(): void + { + this.removeAllManagers(); + + this.destroyRenderer(); + + this._container = null; + + this._model.dispose(); + } + + public setRenderer(renderer: IRoomRendererBase): void + { + if(renderer === this._renderer) return; + + if(this._renderer) this.destroyRenderer(); + + this._renderer = renderer; + + if(!this._renderer) return; + + this._renderer.reset(); + + if(this._managers.size) + { + for(const manager of this._managers.values()) + { + if(!manager) continue; + + const objects = manager.objects; + + if(!objects.length) continue; + + for(const object of objects.getValues()) + { + if(!object) continue; + + this._renderer.addObject(object); + } + } + } + } + + private destroyRenderer(): void + { + if(!this._renderer) return; + + this._renderer.dispose(); + + this._renderer = null; + } + + public getManager(category: number): IRoomObjectManager + { + const manager = this._managers.get(category); + + if(!manager) return null; + + return manager; + } + + private getManagerOrCreate(category: number): IRoomObjectManager + { + let manager = this.getManager(category); + + if(manager) return manager; + + manager = this._container.createRoomObjectManager(category); + + if(!manager) return null; + + this._managers.set(category, manager); + + return manager; + } + + public getTotalObjectsForManager(category: number): number + { + const manager = this.getManager(category); + + if(!manager) return 0; + + return manager.totalObjects; + } + + public getRoomObject(id: number, category: number): IRoomObject + { + const manager = this.getManager(category); + + if(!manager) return null; + + const object = manager.getObject(id); + + if(!object) return null; + + return object; + } + + public getRoomObjectsForCategory(category: number): IRoomObject[] + { + const manager = this.getManager(category); + + return (manager ? manager.objects.getValues() : []); + } + + public getRoomObjectByIndex(index: number, category: number): IRoomObject + { + const manager = this.getManager(category); + + if(!manager) return null; + + const object = manager.getObjectByIndex(index); + + if(!object) return null; + + return object; + } + + public createRoomObject(id: number, stateCount: number, type: string, category: number): IRoomObjectController + { + const manager = this.getManagerOrCreate(category); + + if(!manager) return null; + + const object = manager.createObject(id, stateCount, type); + + if(!object) return null; + + if(this._renderer) this._renderer.addObject(object); + + return object; + } + + public createRoomObjectAndInitalize(objectId: number, type: string, category: number): IRoomObject + { + if(!this._container) return null; + + return this._container.createRoomObjectAndInitalize(this._id, objectId, type, category); + } + + public removeRoomObject(id: number, category: number): void + { + const manager = this.getManager(category); + + if(!manager) return; + + const object = manager.getObject(id); + + if(!object) return; + + object.tearDown(); + + if(this._renderer) this._renderer.removeObject(object); + + manager.removeObject(id); + } + + public removeAllManagers(): void + { + for(const manager of this._managers.values()) + { + if(!manager) continue; + + if(this._renderer) + { + const objects = manager.objects; + + if(objects.length) + { + for(const object of objects.getValues()) + { + if(!object) continue; + + this._renderer.removeObject(object); + } + } + } + + manager.dispose(); + } + + this._managers.clear(); + } + + public addUpdateCategory(category: number): void + { + const index = this._updateCategories.indexOf(category); + + if(index >= 0) return; + + this._updateCategories.push(category); + } + + public removeUpdateCategory(category: number): void + { + const index = this._updateCategories.indexOf(category); + + if(index === -1) return; + + this._updateCategories.splice(index, 1); + } + + public update(time: number, update: boolean = false): void + { + for(const category of this._updateCategories) + { + const manager = this.getManager(category); + + if(!manager) continue; + + const objects = manager.objects; + + if(!objects.length) continue; + + for(const object of objects.getValues()) + { + if(!object) continue; + + const logic = object.logic; + + (logic && logic.update(time)); + } + } + + this._renderer && this._renderer.update(time, update); + } + + public hasUninitializedObjects(): boolean + { + for(const manager of this._managers.values()) + { + if(!manager) continue; + + for(const object of manager.objects.getValues()) + { + if(!object) continue; + + if(!object.isReady) return true; + } + } + + return false; + } + + public get id(): string + { + return this._id; + } + + public get container(): IRoomInstanceContainer + { + return this._container; + } + + public get renderer(): IRoomRendererBase + { + return this._renderer; + } + + public get managers(): Map + { + return this._managers; + } + + public get model(): IRoomObjectModel + { + return this._model; + } +} diff --git a/submodules/renderer/src/room/RoomManager.ts b/submodules/renderer/src/room/RoomManager.ts new file mode 100644 index 0000000..1feb872 --- /dev/null +++ b/submodules/renderer/src/room/RoomManager.ts @@ -0,0 +1,403 @@ +import { IGraphicAssetCollection, IRoomContentLoader, IRoomInstance, IRoomInstanceContainer, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectManager, IRoomObjectVisualizationFactory, NitroLogger } from '../api'; +import { NitroManager } from '../core'; +import { RoomContentLoadedEvent } from '../events'; +import { RoomContentLoader } from '../nitro/room/RoomContentLoader'; +import { RoomInstance } from './RoomInstance'; +import { RoomObjectManager } from './RoomObjectManager'; + +export class RoomManager extends NitroManager implements IRoomManager, IRoomInstanceContainer +{ + public static ROOM_MANAGER_ERROR: number = -1; + public static ROOM_MANAGER_LOADING: number = 0; + public static ROOM_MANAGER_LOADED: number = 1; + public static ROOM_MANAGER_INITIALIZING: number = 2; + public static ROOM_MANAGER_INITIALIZED: number = 3; + private static CONTENT_PROCESSING_TIME_LIMIT_MILLISECONDS: number = 40; + + private _state: number; + private _rooms: Map; + private _contentLoader: IRoomContentLoader; + private _updateCategories: number[]; + + private _listener: IRoomManagerListener; + private _visualizationFactory: IRoomObjectVisualizationFactory; + private _logicFactory: IRoomObjectLogicFactory; + + private _initialLoadList: string[]; + private _pendingContentTypes: string[]; + private _skipContentProcessing: boolean; + + private _disposed: boolean; + + constructor(listener: IRoomManagerListener, visualizationFactory: IRoomObjectVisualizationFactory, logicFactory: IRoomObjectLogicFactory) + { + super(); + + this._state = RoomManager.ROOM_MANAGER_LOADED; + this._rooms = new Map(); + this._contentLoader = null; + this._updateCategories = []; + + this._listener = listener; + this._visualizationFactory = visualizationFactory; + this._logicFactory = logicFactory; + + this._initialLoadList = []; + this._pendingContentTypes = []; + this._skipContentProcessing = false; + + this._disposed = false; + + this.onRoomContentLoadedEvent = this.onRoomContentLoadedEvent.bind(this); + + this.events.addEventListener(RoomContentLoadedEvent.RCLE_SUCCESS, this.onRoomContentLoadedEvent); + this.events.addEventListener(RoomContentLoadedEvent.RCLE_FAILURE, this.onRoomContentLoadedEvent); + this.events.addEventListener(RoomContentLoadedEvent.RCLE_CANCEL, this.onRoomContentLoadedEvent); + } + + public onInit(): void + { + if(this._state >= RoomManager.ROOM_MANAGER_INITIALIZING || !this._contentLoader) return; + + const mandatoryLibraries = RoomContentLoader.MANDATORY_LIBRARIES; + + for(const library of mandatoryLibraries) + { + if(!library) continue; + + if(this._initialLoadList.indexOf(library) === -1) + { + this._contentLoader.downloadAsset(library, this.events); + + this._initialLoadList.push(library); + } + } + + this._state = RoomManager.ROOM_MANAGER_INITIALIZING; + } + + public getRoomInstance(roomId: string): IRoomInstance + { + const existing = this._rooms.get(roomId); + + if(!existing) return null; + + return existing; + } + + public createRoomInstance(roomId: string): IRoomInstance + { + if(this._rooms.get(roomId)) return null; + + const instance = new RoomInstance(roomId, this); + + this._rooms.set(instance.id, instance); + + if(this._updateCategories.length) + { + for(const category of this._updateCategories) + { + instance.addUpdateCategory(category); + } + } + + return instance; + } + + public removeRoomInstance(roomId: string): boolean + { + const existing = this._rooms.get(roomId); + + if(!existing) return false; + + this._rooms.delete(roomId); + + existing.dispose(); + + return true; + } + + public createRoomObjectAndInitalize(roomId: string, objectId: number, type: string, category: number): IRoomObject + { + const instance = this.getRoomInstance(roomId); + + if(!instance) return null; + + let visualization = type; + let logic = type; + let assetName = type; + let asset: IGraphicAssetCollection = null; + let isLoading = false; + + if(this._contentLoader.isLoaderType(type)) + { + asset = this._contentLoader.getCollection(type); + + if(!asset) + { + isLoading = true; + + this._contentLoader.downloadAsset(type, this.events); + + assetName = this._contentLoader.getPlaceholderName(type); + asset = this._contentLoader.getCollection(assetName); + + if(!asset) return null; + } + + visualization = asset.data.visualizationType; + logic = asset.data.logicType; + } + + const object = (instance.createRoomObject(objectId, 1, type, category) as IRoomObjectController); + + if(!object) return null; + + if(this._visualizationFactory) + { + const visualizationInstance = this._visualizationFactory.getVisualization(visualization); + + if(!visualizationInstance) + { + instance.removeRoomObject(objectId, category); + + return null; + } + + visualizationInstance.asset = asset; + + const visualizationData = this._visualizationFactory.getVisualizationData(assetName, visualization, ((asset && asset.data) || null)); + + if(!visualizationData || !visualizationInstance.initialize(visualizationData)) + { + instance.removeRoomObject(objectId, category); + + return null; + } + + object.setVisualization(visualizationInstance); + } + + if(this._logicFactory) + { + const logicInstance = this._logicFactory.getLogic(logic); + + object.setLogic(logicInstance); + + if(logicInstance) + { + logicInstance.initialize((asset && asset.data) || null); + } + } + + if(!isLoading) object.isReady = true; + + this._contentLoader.setRoomObjectRoomId(object, roomId); + + return object; + } + + private reinitializeRoomObjectsByType(type: string): void + { + if(!type || !this._contentLoader || !this._visualizationFactory || !this._logicFactory) return; + + const asset = this._contentLoader.getCollection(type); + + if(!asset) return; + + const visualization = asset.data.visualizationType; + const logic = asset.data.logicType; + const visualizationData = this._visualizationFactory.getVisualizationData(type, visualization, asset.data); + + for(const room of this._rooms.values()) + { + if(!room) continue; + + for(const [category, manager] of room.managers.entries()) + { + if(!manager) continue; + + for(const object of manager.objects.getValues()) + { + if(!object || object.type !== type) continue; + + const visualizationInstance = this._visualizationFactory.getVisualization(visualization); + + if(visualizationInstance) + { + visualizationInstance.asset = asset; + + if(!visualizationData || !visualizationInstance.initialize(visualizationData)) + { + manager.removeObject(object.id); + } + else + { + object.setVisualization(visualizationInstance); + + const logicInstance = this._logicFactory.getLogic(logic); + + object.setLogic(logicInstance); + + if(logicInstance) + { + logicInstance.initialize(asset.data); + } + + object.isReady = true; + + if(this._listener) this._listener.objectInitialized(room.id, object.id, category); + } + } + else + { + manager.removeObject(object.id); + } + } + } + } + } + + public addUpdateCategory(category: number): void + { + const index = this._updateCategories.indexOf(category); + + if(index >= 0) return; + + this._updateCategories.push(category); + + if(!this._rooms.size) return; + + for(const room of this._rooms.values()) + { + if(!room) continue; + + room.addUpdateCategory(category); + } + } + + public removeUpdateCategory(category: number): void + { + const index = this._updateCategories.indexOf(category); + + if(index === -1) return; + + this._updateCategories.splice(index, 1); + + if(!this._rooms.size) return; + + for(const room of this._rooms.values()) + { + if(!room) continue; + + room.removeUpdateCategory(category); + } + } + + public setContentLoader(loader: IRoomContentLoader): void + { + if(this._contentLoader) this._contentLoader.dispose(); + + this._contentLoader = loader; + } + + private processPendingContentTypes(time: number): void + { + if(this._skipContentProcessing) + { + this._skipContentProcessing = false; + + return; + } + + while(this._pendingContentTypes.length) + { + const type = this._pendingContentTypes.shift(); + + const collection = this._contentLoader.getCollection(type); + + if(!collection) + { + if(this._listener) + { + this._listener.initalizeTemporaryObjectsByType(type, false); + } + + NitroLogger.log('Invalid Collection', type); + + continue; + } + + this.reinitializeRoomObjectsByType(type); + + if(this._listener) this._listener.initalizeTemporaryObjectsByType(type, true); + + if(this._initialLoadList.length > 0) this.removeFromInitialLoad(type); + } + } + + private removeFromInitialLoad(type: string): void + { + if(!type || this._state === RoomManager.ROOM_MANAGER_ERROR) return; + + if(!this._contentLoader) this._state = RoomManager.ROOM_MANAGER_ERROR; + + if(this._contentLoader.getCollection(type)) + { + const i = this._initialLoadList.indexOf(type); + + if(i >= 0) this._initialLoadList.splice(i, 1); + + if(!this._initialLoadList.length) + { + this._state = RoomManager.ROOM_MANAGER_INITIALIZED; + + if(this._listener) + { + this._listener.onRoomEngineInitalized(true); + } + } + } + else + { + this._state = RoomManager.ROOM_MANAGER_ERROR; + + if(this._listener) this._listener.onRoomEngineInitalized(false); + } + } + + private onRoomContentLoadedEvent(event: RoomContentLoadedEvent): void + { + if(!this._contentLoader) return; + + const contentType = event.contentType; + + if(this._pendingContentTypes.indexOf(contentType) >= 0) return; + + this._pendingContentTypes.push(contentType); + } + + public update(time: number, update: boolean = false): void + { + this.processPendingContentTypes(time); + + if(!this._rooms.size) return; + + for(const room of this._rooms.values()) room && room.update(time, update); + } + + public createRoomObjectManager(category: number): IRoomObjectManager + { + return new RoomObjectManager(); + } + + public get rooms(): Map + { + return this._rooms; + } + + public get disposed(): boolean + { + return this._disposed; + } +} diff --git a/submodules/renderer/src/room/RoomObjectManager.ts b/submodules/renderer/src/room/RoomObjectManager.ts new file mode 100644 index 0000000..147379b --- /dev/null +++ b/submodules/renderer/src/room/RoomObjectManager.ts @@ -0,0 +1,129 @@ +import { AdvancedMap, IAdvancedMap, IRoomObjectController, IRoomObjectManager } from '../api'; +import { RoomObject } from './object'; + +export class RoomObjectManager implements IRoomObjectManager +{ + private _objects: IAdvancedMap; + private _objectsPerType: IAdvancedMap>; + + constructor() + { + this._objects = new AdvancedMap(); + this._objectsPerType = new AdvancedMap(); + } + + public dispose(): void + { + this.removeAllObjects(); + } + + public getObject(id: number): IRoomObjectController + { + const object = this._objects.getValue(id); + + if(!object) return null; + + return object; + } + + public getObjectByIndex(index: number): IRoomObjectController + { + const object = this._objects.getWithIndex(index); + + if(!object) return null; + + return object; + } + + public createObject(id: number, stateCount: number, type: string): IRoomObjectController + { + const object = new RoomObject(id, stateCount, type); + + return this.addObject(id, type, object); + } + + private addObject(id: number, type: string, object: IRoomObjectController): IRoomObjectController + { + if(this._objects.getValue(id)) + { + object.dispose(); + + return null; + } + + this._objects.add(id, object); + + const typeMap = this.getTypeMap(type); + + if(typeMap) typeMap.add(id, object); + + return object; + } + + public removeObject(id: number): void + { + const object = this._objects.remove(id); + + if(object) + { + const typeMap = this.getTypeMap(object.type); + + if(typeMap) typeMap.remove(object.id); + + object.dispose(); + } + } + + public removeAllObjects(): void + { + let i = 0; + + while(i < this._objects.length) + { + const object = this._objects.getWithIndex(i); + + if(object) object.dispose(); + + i++; + } + + this._objects.reset(); + + i = 0; + + while(i < this._objectsPerType.length) + { + const typeMap = this._objectsPerType.getWithIndex(i); + + if(typeMap) typeMap.dispose(); + + i++; + } + + this._objectsPerType.reset(); + } + + private getTypeMap(k: string, _arg_2: boolean = true): IAdvancedMap + { + let existing = this._objectsPerType.getValue(k); + + if(!existing && _arg_2) + { + existing = new AdvancedMap(); + + this._objectsPerType.add(k, existing); + } + + return existing; + } + + public get objects(): IAdvancedMap + { + return this._objects; + } + + public get totalObjects(): number + { + return this._objects.length; + } +} diff --git a/submodules/renderer/src/room/index.ts b/submodules/renderer/src/room/index.ts new file mode 100644 index 0000000..0279694 --- /dev/null +++ b/submodules/renderer/src/room/index.ts @@ -0,0 +1,11 @@ +export * from './messages'; +export * from './object'; +export * from './object/logic'; +export * from './object/visualization'; +export * from './renderer'; +export * from './renderer/cache'; +export * from './renderer/utils'; +export * from './RoomInstance'; +export * from './RoomManager'; +export * from './RoomObjectManager'; +export * from './utils'; diff --git a/submodules/renderer/src/room/messages/RoomObjectUpdateMessage.ts b/submodules/renderer/src/room/messages/RoomObjectUpdateMessage.ts new file mode 100644 index 0000000..af48569 --- /dev/null +++ b/submodules/renderer/src/room/messages/RoomObjectUpdateMessage.ts @@ -0,0 +1,23 @@ +import { IVector3D } from '../../api'; + +export class RoomObjectUpdateMessage +{ + private _location: IVector3D; + private _direction: IVector3D; + + constructor(location: IVector3D, direction: IVector3D) + { + this._location = location; + this._direction = direction; + } + + public get location(): IVector3D + { + return this._location; + } + + public get direction(): IVector3D + { + return this._direction; + } +} diff --git a/submodules/renderer/src/room/messages/index.ts b/submodules/renderer/src/room/messages/index.ts new file mode 100644 index 0000000..21f1ea8 --- /dev/null +++ b/submodules/renderer/src/room/messages/index.ts @@ -0,0 +1 @@ +export * from './RoomObjectUpdateMessage'; diff --git a/submodules/renderer/src/room/object/RoomObject.ts b/submodules/renderer/src/room/object/RoomObject.ts new file mode 100644 index 0000000..f900839 --- /dev/null +++ b/submodules/renderer/src/room/object/RoomObject.ts @@ -0,0 +1,245 @@ +import { IRoomObjectController, IRoomObjectEventHandler, IRoomObjectModel, IRoomObjectMouseHandler, IRoomObjectUpdateMessage, IRoomObjectVisualization, IVector3D, Vector3d } from '../../api'; +import { Disposable } from '../../core'; +import { RoomObjectModel } from './RoomObjectModel'; + +export class RoomObject extends Disposable implements IRoomObjectController +{ + private static OBJECT_COUNTER: number = 0; + + private _id: number; + private _instanceId: number; + private _type: string; + private _model: IRoomObjectModel; + + private _location: IVector3D; + private _direction: IVector3D; + private _states: number[]; + + private _visualization: IRoomObjectVisualization; + private _logic: IRoomObjectEventHandler; + private _pendingLogicMessages: IRoomObjectUpdateMessage[]; + + private _updateCounter: number; + private _isReady: boolean; + + constructor(id: number, stateCount: number, type: string) + { + super(); + + this._id = id; + this._instanceId = RoomObject.OBJECT_COUNTER++; + this._type = type; + this._model = new RoomObjectModel(); + + this._location = new Vector3d(); + this._direction = new Vector3d(); + this._states = []; + + this._visualization = null; + this._logic = null; + this._pendingLogicMessages = []; + + this._updateCounter = 0; + this._isReady = false; + + let i = (stateCount - 1); + + while(i >= 0) + { + this._states[i] = 0; + + i--; + } + } + + protected onDispose(): void + { + this._pendingLogicMessages = []; + + this.setVisualization(null); + this.setLogic(null); + + if(this._model) this._model.dispose(); + + super.onDispose(); + } + + public getLocation(): IVector3D + { + return this._location; + } + + public setLocation(vector: IVector3D): void + { + if(!vector) return; + + if((vector.x === this._location.x) && (vector.y === this._location.y) && (vector.z === this._location.z)) return; + + this._location.x = vector.x; + this._location.y = vector.y; + this._location.z = vector.z; + + this._updateCounter++; + } + + public getDirection(): IVector3D + { + return this._direction; + } + + public setDirection(vector: IVector3D): void + { + if(!vector) return; + + if((vector.x === this._direction.x) && (vector.y === this._direction.y) && (vector.z === this._direction.z)) return; + + this._direction.x = (((vector.x % 360) + 360) % 360); + this._direction.y = (((vector.y % 360) + 360) % 360); + this._direction.z = (((vector.z % 360) + 360) % 360); + + this._updateCounter++; + } + + public getState(index: number = 0): number + { + if((index >= 0) && (index < this._states.length)) + { + return this._states[index]; + } + + return -1; + } + + public setState(state: number, index: number = 0): boolean + { + if((index >= 0) && (index < this._states.length)) + { + if(this._states[index] !== state) + { + this._states[index] = state; + + this._updateCounter++; + } + + return true; + } + + return false; + } + + public setVisualization(visualization: IRoomObjectVisualization): void + { + if(this._visualization === visualization) return; + + if(this._visualization) this._visualization.dispose(); + + this._visualization = visualization; + + if(this._visualization) this._visualization.object = this; + } + + public setLogic(logic: IRoomObjectEventHandler): void + { + if(this._logic === logic) return; + + const eventHandler = this._logic; + + if(eventHandler) + { + this._logic = null; + + eventHandler.setObject(null); + } + + this._logic = logic; + + if(this._logic) + { + this._logic.setObject(this); + + while(this._pendingLogicMessages.length) + { + const message = this._pendingLogicMessages.shift(); + + this._logic.processUpdateMessage(message); + } + } + } + + public processUpdateMessage(message: IRoomObjectUpdateMessage): void + { + if(this._logic) return this._logic.processUpdateMessage(message); + + this._pendingLogicMessages.push(message); + } + + public tearDown(): void + { + if(this._logic) this._logic.tearDown(); + } + + public get id(): number + { + return this._id; + } + + public get instanceId(): number + { + return this._instanceId; + } + + public get type(): string + { + return this._type; + } + + public get model(): IRoomObjectModel + { + return this._model; + } + + public get visualization(): IRoomObjectVisualization + { + return this._visualization; + } + + public get mouseHandler(): IRoomObjectMouseHandler + { + return this._logic as IRoomObjectMouseHandler; + } + + public get logic(): IRoomObjectEventHandler + { + return this._logic; + } + + public get location(): IVector3D + { + return this._location; + } + + public get direction(): IVector3D + { + return this._direction; + } + + public get updateCounter(): number + { + return this._updateCounter; + } + + public set updateCounter(count: number) + { + this._updateCounter = count; + } + + public get isReady(): boolean + { + return this._isReady; + } + + public set isReady(flag: boolean) + { + this._isReady = flag; + } +} diff --git a/submodules/renderer/src/room/object/RoomObjectModel.ts b/submodules/renderer/src/room/object/RoomObjectModel.ts new file mode 100644 index 0000000..9d7b05d --- /dev/null +++ b/submodules/renderer/src/room/object/RoomObjectModel.ts @@ -0,0 +1,53 @@ +import { IRoomObjectModel } from '../../api'; + +export class RoomObjectModel implements IRoomObjectModel +{ + private _map: Map; + private _updateCounter: number; + + constructor() + { + this._map = new Map(); + this._updateCounter = 0; + } + + public dispose(): void + { + this._map.clear(); + + this._updateCounter = 0; + } + + public getValue(key: string): T + { + const existing = this._map.get(key); + + return (existing as T); + } + + public setValue(key: string, value: T): void + { + if(this._map.has(key)) + { + if(this._map.get(key) === value) return; + } + + this._map.set(key, (value as T)); + + this._updateCounter++; + } + + public removeKey(key: string): void + { + if(!key) return; + + this._map.delete(key); + + this._updateCounter++; + } + + public get updateCounter(): number + { + return this._updateCounter; + } +} diff --git a/submodules/renderer/src/room/object/index.ts b/submodules/renderer/src/room/object/index.ts new file mode 100644 index 0000000..0ef0867 --- /dev/null +++ b/submodules/renderer/src/room/object/index.ts @@ -0,0 +1,4 @@ +export * from './logic'; +export * from './RoomObject'; +export * from './RoomObjectModel'; +export * from './visualization'; diff --git a/submodules/renderer/src/room/object/logic/RoomObjectLogicBase.ts b/submodules/renderer/src/room/object/logic/RoomObjectLogicBase.ts new file mode 100644 index 0000000..e70d315 --- /dev/null +++ b/submodules/renderer/src/room/object/logic/RoomObjectLogicBase.ts @@ -0,0 +1,132 @@ +import { IEventDispatcher, IRoomGeometry, IRoomObjectController, IRoomObjectEventHandler, IRoomObjectUpdateMessage } from '../../../api'; +import { Disposable } from '../../../core'; +import { RoomSpriteMouseEvent } from '../../../events'; + +export class RoomObjectLogicBase extends Disposable implements IRoomObjectEventHandler +{ + private _events: IEventDispatcher; + private _object: IRoomObjectController; + + private _time: number; + + constructor() + { + super(); + + this._object = null; + this._events = null; + + this._time = 0; + } + + public initialize(data: unknown): void + { + return; + } + + protected onDispose(): void + { + this._object = null; + } + + public update(time: number): void + { + this._time = time; + + return; + } + + public processUpdateMessage(message: IRoomObjectUpdateMessage): void + { + if(!message || !this._object) return; + + this._object.setLocation(message.location); + this._object.setDirection(message.direction); + } + + public getEventTypes(): string[] + { + return []; + } + + protected mergeTypes(k: string[], _arg_2: string[]): string[] + { + const types = k.concat(); + + for(const type of _arg_2) + { + if(!type || (types.indexOf(type) >= 0)) continue; + + types.push(type); + } + + return types; + } + + public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void + { + return; + } + + public useObject(): void + { + return; + } + + public setObject(object: IRoomObjectController): void + { + if(this._object === object) return; + + if(this._object) + { + this._object.setLogic(null); + } + + if(!object) + { + this.dispose(); + + this._object = null; + + return; + } + + this._object = object; + this._object.setLogic(this); + } + + public tearDown(): void + { + return; + } + + public get object(): IRoomObjectController + { + return this._object; + } + + public get eventDispatcher(): IEventDispatcher + { + return this._events; + } + + public set eventDispatcher(events: IEventDispatcher) + { + this._events = events; + } + + public get widget(): string + { + return null; + } + + public get contextMenu(): string + { + return null; + } + + public get time(): number + { + return this._time; + } +} diff --git a/submodules/renderer/src/room/object/logic/index.ts b/submodules/renderer/src/room/object/logic/index.ts new file mode 100644 index 0000000..17132cb --- /dev/null +++ b/submodules/renderer/src/room/object/logic/index.ts @@ -0,0 +1 @@ +export * from './RoomObjectLogicBase'; diff --git a/submodules/renderer/src/room/object/visualization/RoomObjectSprite.ts b/submodules/renderer/src/room/object/visualization/RoomObjectSprite.ts new file mode 100644 index 0000000..15616e6 --- /dev/null +++ b/submodules/renderer/src/room/object/visualization/RoomObjectSprite.ts @@ -0,0 +1,422 @@ +import { BLEND_MODES } from '@pixi/constants'; +import { Filter, Resource, Texture } from '@pixi/core'; +import { Container } from '@pixi/display'; +import { AlphaTolerance, IRoomObjectSprite, RoomObjectSpriteType } from '../../../api'; + +export class RoomObjectSprite implements IRoomObjectSprite +{ + private static SPRITE_COUNTER: number = 0; + + private _id: number; + private _name: string; + private _type: string; + private _spriteType: number; + private _texture: Texture; + private _container: Container; + + private _width: number; + private _height: number; + private _offsetX: number; + private _offsetY: number; + private _flipH: boolean; + private _flipV: boolean; + private _direction: number; + + private _alpha: number; + private _blendMode: number; + private _color: number; + private _relativeDepth: number; + private _varyingDepth: boolean; + private _libraryAssetName: string; + private _clickHandling: boolean; + private _visible: boolean; + private _tag: string; + private _posture: string; + private _alphaTolerance: number; + private _filters: Filter[]; + + private _updateCounter: number; + private _updateContainer: boolean; + + constructor() + { + this._id = RoomObjectSprite.SPRITE_COUNTER++; + this._name = ''; + this._type = ''; + this._spriteType = RoomObjectSpriteType.DEFAULT; + this._texture = null; + this._container = null; + + this._width = 0; + this._height = 0; + this._offsetX = 0; + this._offsetY = 0; + this._flipH = false; + this._flipV = false; + this._direction = 0; + + this._alpha = 255; + this._blendMode = BLEND_MODES.NORMAL; + this._color = 0xFFFFFF; + this._relativeDepth = 0; + this._varyingDepth = false; + this._libraryAssetName = ''; + this._clickHandling = false; + this._visible = true; + this._tag = ''; + this._posture = null; + this._alphaTolerance = AlphaTolerance.MATCH_OPAQUE_PIXELS; + this._filters = []; + + this._updateCounter = 0; + this._updateContainer = false; + } + + public dispose(): void + { + this._texture = null; + this._width = 0; + this._height = 0; + } + + public get id(): number + { + return this._id; + } + + public set id(id: number) + { + this._id = id; + } + + public get name(): string + { + return this._name; + } + + public set name(name: string) + { + if(this._name === name) return; + + this._name = name; + + this._updateCounter++; + } + + public get type(): string + { + return this._type; + } + + public set type(type: string) + { + this._type = type; + } + + public get spriteType(): number + { + return this._spriteType; + } + + public set spriteType(type: number) + { + this._spriteType = type; + } + + public get texture(): Texture + { + return this._texture; + } + + public set texture(texture: Texture) + { + if(this._texture === texture) return; + + if(texture) + { + this._width = texture.width; + this._height = texture.height; + } + + this._texture = texture; + + this._updateCounter++; + } + + public get container(): Container + { + return this._container; + } + + public set container(container: Container) + { + if(this._container === container) return; + + this.texture = Texture.EMPTY; + + if(container) + { + this._width = container.width; + this._height = container.height; + } + + this._container = container; + + this._updateCounter++; + + this._updateContainer = true; + } + + public get width(): number + { + return this._width; + } + + public get height(): number + { + return this._height; + } + + public get offsetX(): number + { + return this._offsetX; + } + + public set offsetX(x: number) + { + if(this._offsetX === x) return; + + this._offsetX = x; + + this._updateCounter++; + } + + public get offsetY(): number + { + return this._offsetY; + } + + public set offsetY(y: number) + { + if(this._offsetY === y) return; + + this._offsetY = y; + + this._updateCounter++; + } + + public get flipH(): boolean + { + return this._flipH; + } + + public set flipH(flip: boolean) + { + if(this._flipH === flip) return; + + this._flipH = flip; + + this._updateCounter++; + } + + public get flipV(): boolean + { + return this._flipV; + } + + public set flipV(flip: boolean) + { + if(this._flipV === flip) return; + + this._flipV = flip; + + this._updateCounter++; + } + + public get direction(): number + { + return this._direction; + } + + public set direction(direction: number) + { + this._direction = direction; + } + + public get alpha(): number + { + return this._alpha; + } + + public set alpha(alpha: number) + { + alpha = (alpha & 0xFF); + + if(this._alpha === alpha) return; + + this._alpha = alpha; + + this._updateCounter++; + } + + public get blendMode(): number + { + return this._blendMode; + } + + public set blendMode(blend: number) + { + if(this._blendMode === blend) return; + + this._blendMode = blend; + + this._updateCounter++; + } + + public get color(): number + { + return this._color; + } + + public set color(color: number) + { + color = (color & 0xFFFFFF); + + if(this._color === color) return; + + this._color = color; + + this._updateCounter++; + } + + public get relativeDepth(): number + { + return this._relativeDepth; + } + + public set relativeDepth(depth: number) + { + if(this._relativeDepth === depth) return; + + this._relativeDepth = depth; + + this._updateCounter++; + } + + public get varyingDepth(): boolean + { + return this._varyingDepth; + } + + public set varyingDepth(flag: boolean) + { + if(flag === this._varyingDepth) return; + + this._varyingDepth = flag; + + this._updateCounter++; + } + + public get libraryAssetName(): string + { + return this._libraryAssetName; + } + + public set libraryAssetName(value: string) + { + this._libraryAssetName = value; + } + + public get clickHandling(): boolean + { + return this._clickHandling; + } + + public set clickHandling(flag: boolean) + { + this._clickHandling = flag; + } + + public get visible(): boolean + { + return this._visible; + } + + public set visible(visible: boolean) + { + if(this._visible === visible) return; + + this._visible = visible; + + this._updateCounter++; + } + + public get tag(): string + { + return this._tag; + } + + public set tag(tag: string) + { + if(this._tag === tag) return; + + this._tag = tag; + + this._updateCounter++; + } + + public get posture(): string + { + return this._posture; + } + + public set posture(posture: string) + { + if(this._posture === posture) return; + + this._posture = posture; + + this._updateCounter++; + } + + public get alphaTolerance(): number + { + return this._alphaTolerance; + } + + public set alphaTolerance(tolerance: number) + { + if(this._alphaTolerance === tolerance) return; + + this._alphaTolerance = tolerance; + + this._updateCounter++; + } + + public get filters(): Filter[] + { + return this._filters; + } + + public set filters(filters: Filter[]) + { + this._filters = filters; + + this._updateCounter++; + } + + public get updateCounter(): number + { + return this._updateCounter; + } + + public get updateContainer(): boolean + { + return this._updateContainer; + } + + public set updateContainer(flag: boolean) + { + this._updateContainer = flag; + } +} diff --git a/submodules/renderer/src/room/object/visualization/RoomObjectSpriteVisualization.ts b/submodules/renderer/src/room/object/visualization/RoomObjectSpriteVisualization.ts new file mode 100644 index 0000000..d753b32 --- /dev/null +++ b/submodules/renderer/src/room/object/visualization/RoomObjectSpriteVisualization.ts @@ -0,0 +1,304 @@ +import { RenderTexture } from '@pixi/core'; +import { Point, Rectangle } from '@pixi/math'; +import { IGraphicAssetCollection, IObjectVisualizationData, IRoomGeometry, IRoomObjectController, IRoomObjectSprite, IRoomObjectSpriteVisualization, RoomObjectSpriteData } from '../../../api'; +import { NitroContainer, NitroSprite, TextureUtils } from '../../../pixi-proxy'; +import { RoomObjectSprite } from './RoomObjectSprite'; + +export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualization +{ + private static VISUALIZATION_COUNTER: number = 0; + + private _id: number; + private _object: IRoomObjectController; + private _asset: IGraphicAssetCollection; + private _sprites: IRoomObjectSprite[]; + + protected _scale: number; + + private _updateObjectCounter: number; + private _updateModelCounter: number; + private _updateSpriteCounter: number; + + constructor() + { + this._id = RoomObjectSpriteVisualization.VISUALIZATION_COUNTER++; + this._object = null; + this._asset = null; + this._sprites = []; + + this._scale = -1; + + this._updateObjectCounter = -1; + this._updateModelCounter = -1; + this._updateSpriteCounter = -1; + } + + public initialize(data: IObjectVisualizationData): boolean + { + return false; + } + + public update(geometry: IRoomGeometry, time: number, update: boolean, skipUpdate: boolean): void + { + return; + } + + protected reset(): void + { + this._scale = -1; + } + + public dispose(): void + { + if(this._sprites) + { + while(this._sprites.length) + { + const sprite = (this._sprites[0] as RoomObjectSprite); + + if(sprite) sprite.dispose(); + + this._sprites.pop(); + } + + this._sprites = null; + } + + this._object = null; + this._asset = null; + } + + public getSprite(index: number): IRoomObjectSprite + { + if((index >= 0) && (index < this._sprites.length)) return this._sprites[index]; + + return null; + } + + public getSpriteList(): RoomObjectSpriteData[] + { + return null; + } + + public createSprite(): IRoomObjectSprite + { + return this.createSpriteAtIndex(this._sprites.length); + } + + public createSpriteAtIndex(index: number): IRoomObjectSprite + { + const sprite = new RoomObjectSprite(); + + if(index >= this._sprites.length) + { + this._sprites.push(sprite); + } + else + { + this._sprites.splice(index, 0, sprite); + } + + return sprite; + } + + protected createSprites(count: number): void + { + while(this._sprites.length > count) + { + const sprite = this._sprites[(this._sprites.length - 1)] as RoomObjectSprite; + + if(sprite) sprite.dispose(); + + this._sprites.pop(); + } + + while(this._sprites.length < count) + { + this._sprites.push(new RoomObjectSprite()); + } + } + + public get image(): RenderTexture + { + return this.getImage(0, -1); + } + + public getImage(bgColor: number, originalId: number): RenderTexture + { + const boundingRectangle = this.getBoundingRectangle(); + + if((boundingRectangle.width * boundingRectangle.height) === 0) return null; + + const spriteCount = this.totalSprites; + const spriteList: IRoomObjectSprite[] = []; + + let index = 0; + + while(index < spriteCount) + { + const objectSprite = this.getSprite(index); + + if(objectSprite && objectSprite.visible && objectSprite.texture) spriteList.push(objectSprite); + + index++; + } + + spriteList.sort((a, b) => + { + return b.relativeDepth - a.relativeDepth; + }); + + const container = new NitroContainer(); + + index = 0; + + while(index < spriteList.length) + { + const objectSprite = spriteList[index]; + const texture = objectSprite.texture; + + if(texture) + { + const sprite = new NitroSprite(texture); + + sprite.alpha = (objectSprite.alpha / 255); + sprite.tint = objectSprite.color; + sprite.x = objectSprite.offsetX; + sprite.y = objectSprite.offsetY; + sprite.blendMode = objectSprite.blendMode; + sprite.filters = objectSprite.filters; + + if(objectSprite.flipH) sprite.scale.x = -1; + + if(objectSprite.flipV) sprite.scale.y = -1; + + container.addChild(sprite); + } + + index++; + } + + const texture = TextureUtils.generateTexture(container); + + if(!texture) return null; + + return texture; + } + + public getBoundingRectangle(): Rectangle + { + const totalSprites = this.totalSprites; + const rectangle = new Rectangle(); + + let iterator = 0; + + while(iterator < totalSprites) + { + const sprite = this.getSprite(iterator); + + if(sprite && sprite.texture && sprite.visible) + { + const offsetX = ((sprite.flipH) ? (-(sprite.width) + sprite.offsetX) : sprite.offsetX); + const offsetY = ((sprite.flipV) ? (-(sprite.height) + sprite.offsetY) : sprite.offsetY); + + const point = new Point(offsetX, offsetY); + + if(iterator === 0) + { + rectangle.x = point.x; + rectangle.y = point.y; + rectangle.width = sprite.width; + rectangle.height = sprite.height; + } + else + { + if(point.x < rectangle.x) rectangle.x = point.x; + + if(point.y < rectangle.y) rectangle.y = point.y; + + if((point.x + sprite.width) > rectangle.right) rectangle.width = ((point.x + sprite.width) - rectangle.x); + + if((point.y + sprite.height) > rectangle.bottom) rectangle.height = ((point.y + sprite.height) - rectangle.y); + } + } + + iterator++; + } + + return rectangle; + } + + public get instanceId(): number + { + return this._id; + } + + public get object(): IRoomObjectController + { + return this._object; + } + + public set object(object: IRoomObjectController) + { + this._object = object; + } + + public get asset(): IGraphicAssetCollection + { + return this._asset; + } + + public set asset(asset: IGraphicAssetCollection) + { + if(this._asset) this._asset.removeReference(); + + this._asset = asset; + + if(this._asset) this._asset.addReference(); + } + + public get sprites(): IRoomObjectSprite[] + { + return this._sprites; + } + + public get totalSprites(): number + { + return this._sprites.length; + } + + public get updateObjectCounter(): number + { + return this._updateObjectCounter; + } + + public set updateObjectCounter(count: number) + { + this._updateObjectCounter = count; + } + + public get updateModelCounter(): number + { + return this._updateModelCounter; + } + + public set updateModelCounter(count: number) + { + this._updateModelCounter = count; + } + + public get updateSpriteCounter(): number + { + return this._updateSpriteCounter; + } + + public set updateSpriteCounter(count: number) + { + this._updateSpriteCounter = count; + } + + public get spriteCount(): number + { + return this._sprites.length; + } +} diff --git a/submodules/renderer/src/room/object/visualization/index.ts b/submodules/renderer/src/room/object/visualization/index.ts new file mode 100644 index 0000000..f87ef16 --- /dev/null +++ b/submodules/renderer/src/room/object/visualization/index.ts @@ -0,0 +1,2 @@ +export * from './RoomObjectSprite'; +export * from './RoomObjectSpriteVisualization'; diff --git a/submodules/renderer/src/room/renderer/RoomRenderer.ts b/submodules/renderer/src/room/renderer/RoomRenderer.ts new file mode 100644 index 0000000..db1ef57 --- /dev/null +++ b/submodules/renderer/src/room/renderer/RoomRenderer.ts @@ -0,0 +1,169 @@ +import { IRoomObject, IRoomRenderer, IRoomRenderingCanvas, IRoomSpriteCanvasContainer } from '../../api'; +import { RoomSpriteCanvas } from './RoomSpriteCanvas'; + +export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer +{ + private _objects: Map; + private _canvases: Map; + + private _disposed: boolean; + private _roomObjectVariableAccurateZ: string; + + constructor() + { + this._objects = new Map(); + this._canvases = new Map(); + + this._disposed = false; + this._roomObjectVariableAccurateZ = null; + } + + public dispose(): void + { + if(this._disposed) return; + + if(this._canvases) + { + for(const [key, canvas] of this._canvases.entries()) + { + this._canvases.delete(key); + + if(!canvas) continue; + + canvas.dispose(); + } + + this._canvases = null; + } + + if(this._objects) + { + this._objects = null; + } + + this._disposed = true; + } + + public reset(): void + { + this._objects.clear(); + } + + public getInstanceId(object: IRoomObject): number + { + if(!object) return -1; + + return object.instanceId; + } + + public getRoomObject(instanceId: number): IRoomObject + { + return this._objects.get(instanceId); + } + + public addObject(object: IRoomObject): void + { + if(!object) return; + + this._objects.set(this.getInstanceId(object), object); + } + + public removeObject(object: IRoomObject): void + { + const instanceId = this.getInstanceId(object); + + this._objects.delete(instanceId); + + for(const canvas of this._canvases.values()) + { + if(!canvas) continue; + + const spriteCanvas = canvas as RoomSpriteCanvas; + + spriteCanvas.removeFromCache(instanceId.toString()); + } + } + + public render(time: number, update: boolean = false): void + { + if(!this._canvases || !this._canvases.size) return; + + for(const canvas of this._canvases.values()) canvas && canvas.render(time, update); + } + + public update(time: number, update: boolean = false): void + { + if(!this._canvases || !this._canvases.size) return; + + this.render(time, update); + + for(const canvas of this._canvases.values()) canvas && canvas.update(); + } + + public getCanvas(id: number): IRoomRenderingCanvas + { + const existing = this._canvases.get(id); + + if(!existing) return null; + + return existing; + } + + public createCanvas(id: number, width: number, height: number, scale: number): IRoomRenderingCanvas + { + const existing = this._canvases.get(id) as IRoomRenderingCanvas; + + if(existing) + { + existing.initialize(width, height); + + if(existing.geometry) existing.geometry.scale = scale; + + return existing; + } + + const canvas = this.createSpriteCanvas(id, width, height, scale); + + if(!canvas) return; + + this._canvases.set(id, canvas); + + return canvas; + } + + private createSpriteCanvas(id: number, width: number, height: number, scale: number): IRoomRenderingCanvas + { + return new RoomSpriteCanvas(this, id, width, height, scale); + } + + public removeCanvas(id: number): void + { + const existing = this._canvases.get(id); + + if(!existing) return; + + this._canvases.delete(id); + + existing.dispose(); + } + + public get objects(): Map + { + return this._objects; + } + + public get disposed(): boolean + { + return this._disposed; + } + + public get roomObjectVariableAccurateZ(): string + { + return this._roomObjectVariableAccurateZ; + } + + public set roomObjectVariableAccurateZ(z: string) + { + this._roomObjectVariableAccurateZ = z; + } +} diff --git a/submodules/renderer/src/room/renderer/RoomRendererFactory.ts b/submodules/renderer/src/room/renderer/RoomRendererFactory.ts new file mode 100644 index 0000000..9de8de8 --- /dev/null +++ b/submodules/renderer/src/room/renderer/RoomRendererFactory.ts @@ -0,0 +1,10 @@ +import { IRoomRenderer, IRoomRendererFactory } from '../../api'; +import { RoomRenderer } from './RoomRenderer'; + +export class RoomRendererFactory implements IRoomRendererFactory +{ + public createRenderer(): IRoomRenderer + { + return new RoomRenderer(); + } +} diff --git a/submodules/renderer/src/room/renderer/RoomSpriteCanvas.ts b/submodules/renderer/src/room/renderer/RoomSpriteCanvas.ts new file mode 100644 index 0000000..6a88da8 --- /dev/null +++ b/submodules/renderer/src/room/renderer/RoomSpriteCanvas.ts @@ -0,0 +1,1276 @@ +import { RenderTexture } from '@pixi/core'; +import { Container, DisplayObject } from '@pixi/display'; +import { Graphics } from '@pixi/graphics'; +import { Matrix, Point, Rectangle } from '@pixi/math'; +import { Sprite } from '@pixi/sprite'; +import { IRoomCanvasMouseListener, IRoomGeometry, IRoomObject, IRoomObjectSprite, IRoomObjectSpriteVisualization, IRoomRenderingCanvas, IRoomSpriteCanvasContainer, IRoomSpriteMouseEvent, MouseEventType, RoomObjectSpriteData, RoomObjectSpriteType, Vector3d } from '../../api'; +import { RoomSpriteMouseEvent } from '../../events'; +import { Nitro } from '../../nitro/Nitro'; +import { GetTicker, NitroContainer, NitroSprite, PixiApplicationProxy } from '../../pixi-proxy'; +import { RoomEnterEffect, RoomGeometry, RoomRotatingEffect, RoomShakingEffect } from '../utils'; +import { RoomObjectCache, RoomObjectCacheItem } from './cache'; +import { ExtendedSprite, ObjectMouseData, SortableSprite } from './utils'; + +export class RoomSpriteCanvas implements IRoomRenderingCanvas +{ + private _id: number; + private _container: IRoomSpriteCanvasContainer; + + private _geometry: RoomGeometry; + private _animationFPS: number; + private _renderTimestamp: number; + private _totalTimeRunning: number; + private _lastFrame: number; + + private _master: Sprite; + private _display: Container; + private _mask: Graphics; + + private _sortableSprites: SortableSprite[]; + private _spriteCount: number; + private _activeSpriteCount: number; + private _spritePool: ExtendedSprite[]; + private _skipObjectUpdate: boolean; + private _runningSlow: boolean; + + private _width: number; + private _height: number; + private _renderedWidth: number; + private _renderedHeight: number; + private _screenOffsetX: number; + private _screenOffsetY: number; + private _mouseLocation: Point; + private _mouseOldX: number; + private _mouseOldY: number; + private _mouseCheckCount: number; + private _mouseSpriteWasHit: boolean; + private _mouseActiveObjects: Map; + private _eventCache: Map; + private _eventId: number; + private _scale: number; + + private _SafeStr_4507: boolean = false; + private _rotation: number = 0; + private _rotationOrigin: Vector3d = null; + private _rotationRodLength: number = 0; + private _effectDirection: Vector3d; + private _effectLocation: Vector3d; + private _SafeStr_795: number = 0; + + private _restrictsScaling: boolean; + private _noSpriteVisibilityChecking: boolean; + private _usesExclusionRectangles: boolean; + private _usesMask: boolean; + private _canvasUpdated: boolean; + + private _objectCache: RoomObjectCache; + + private _mouseListener: IRoomCanvasMouseListener; + + constructor(container: IRoomSpriteCanvasContainer, id: number, width: number, height: number, scale: number) + { + this._id = id; + this._container = container; + + this._geometry = new RoomGeometry(scale, new Vector3d(-135, 30, 0), new Vector3d(11, 11, 5), new Vector3d(-135, 0.5, 0)); + this._animationFPS = Nitro.instance.getConfiguration('system.fps.animation', 24); + this._renderTimestamp = 0; + this._totalTimeRunning = 0; + this._lastFrame = 0; + + this._master = null; + this._display = null; + this._mask = null; + + this._sortableSprites = []; + this._spriteCount = 0; + this._activeSpriteCount = 0; + this._spritePool = []; + this._skipObjectUpdate = false; + this._runningSlow = false; + + this._width = 0; + this._height = 0; + this._renderedWidth = 0; + this._renderedHeight = 0; + this._screenOffsetX = 0; + this._screenOffsetY = 0; + this._mouseLocation = new Point; + this._mouseOldX = 0; + this._mouseOldY = 0; + this._mouseCheckCount = 0; + this._mouseSpriteWasHit = false; + this._mouseActiveObjects = new Map(); + this._eventCache = new Map(); + this._eventId = 0; + this._scale = 1; + + this._restrictsScaling = false; + this._noSpriteVisibilityChecking = false; + this._usesExclusionRectangles = false; + this._usesMask = true; + this._canvasUpdated = false; + + this._objectCache = new RoomObjectCache(this._container.roomObjectVariableAccurateZ); + + this._mouseListener = null; + + this.setupCanvas(); + this.initialize(width, height); + } + + private setupCanvas(): void + { + if(!this._master) + { + this._master = new NitroSprite(); + + this._master.interactiveChildren = false; + } + + if(!this._display) + { + const display = new NitroContainer(); + + this._master.addChild(display); + + this._display = display; + } + } + + public dispose(): void + { + this.cleanSprites(0, true); + + if(this._geometry) + { + this._geometry.dispose(); + + this._geometry = null; + } + + if(this._mask) this._mask = null; + + if(this._objectCache) + { + this._objectCache.dispose(); + + this._objectCache = null; + } + + if(this._master) + { + while(this._master.children.length) + { + const child = this._master.removeChildAt(0); + + child.destroy(); + } + + if(this._master.parent) this._master.parent.removeChild(this._master); + + this._master.destroy(); + + this._master = null; + } + + this._display = null; + this._sortableSprites = []; + + if(this._mouseActiveObjects) + { + this._mouseActiveObjects.clear(); + + this._mouseActiveObjects = null; + } + + if(this._spritePool) + { + for(const sprite of this._spritePool) + { + this.cleanSprite(sprite, true); + } + + this._spritePool = []; + } + + if(this._eventCache) + { + this._eventCache.clear(); + + this._eventCache = null; + } + + this._mouseListener = null; + } + + public initialize(width: number, height: number): void + { + width = width < 1 ? 1 : width; + height = height < 1 ? 1 : height; + + if(this._usesMask) + { + if(!this._mask) + { + this._mask = new Graphics() + .beginFill(0xFF0000) + .drawRect(0, 0, width, height) + .endFill(); + + if(this._master) + { + this._master.addChild(this._mask); + + if(this._display) this._display.mask = this._mask; + } + } + else + { + this._mask + .clear() + .beginFill(0xFF0000) + .drawRect(0, 0, width, height) + .endFill(); + } + } + + if(this._master) + { + if(this._master.hitArea) + { + const hitArea = (this._master.hitArea as Rectangle); + + hitArea.width = width; + hitArea.height = height; + } + else + { + this._master.hitArea = new Rectangle(0, 0, width, height); + } + + if(this._master.filterArea) + { + const filterArea = this._master.filterArea; + + filterArea.width = width; + filterArea.height = height; + } + else + { + this._master.filterArea = new Rectangle(0, 0, width, height); + } + } + + this._width = width; + this._height = height; + } + + public setMask(flag: boolean): void + { + if(flag && !this._usesMask) + { + this._usesMask = true; + + if(this._mask && (this._mask.parent !== this._master)) + { + this._master.addChild(this._mask); + + this._display.mask = this._mask; + } + } + + else if(!flag && this._usesMask) + { + this._usesMask = false; + + if(this._mask && (this._mask.parent === this._master)) + { + this._master.removeChild(this._mask); + + this._display.mask = null; + } + } + } + + public setScale(scale: number, point: Point = null, offsetPoint: Point = null, override: boolean = false, asDelta: boolean = false): void + { + if(!this._master || !this._display) return; + + if(this._restrictsScaling && !override) return; + + if(!point) point = new Point((this._width / 2), (this._height / 2)); + + if(!offsetPoint) offsetPoint = point; + + point = this._display.toLocal(point); + + if(asDelta) + { + this._scale *= scale; + } + else + { + this._scale = scale; + } + + this.screenOffsetX = (offsetPoint.x - (point.x * this._scale)); + this.screenOffsetY = (offsetPoint.y - (point.y * this._scale)); + } + + public render(time: number, update: boolean = false): void + { + this._canvasUpdated = false; + + this._totalTimeRunning += GetTicker().deltaTime; + + if(this._totalTimeRunning === this._renderTimestamp) return; + + if(time === -1) time = (this._renderTimestamp + 1); + + if(!this._container || !this._geometry) return; + + if((this._width !== this._renderedWidth) || (this._height !== this._renderedHeight)) update = true; + + if((this._display.x !== this._screenOffsetX) || (this._display.y !== this._screenOffsetY)) + { + this._display.position.set(this._screenOffsetX, this._screenOffsetY); + + update = true; + } + + if(this._display.scale.x !== this._scale) + { + this._display.scale.set(this._scale); + + update = true; + } + + this.doMagic(); + + const frame = Math.round(this._totalTimeRunning / (60 / this._animationFPS)); + + let updateVisuals = false; + + if(frame !== this._lastFrame) + { + this._lastFrame = frame; + + updateVisuals = true; + } + + let spriteCount = 0; + + const objects = this._container.objects; + + if(objects.size) + { + for(const object of objects.values()) + { + if(!object) continue; + + spriteCount = (spriteCount + this.renderObject(object, object.instanceId.toString(), time, update, updateVisuals, spriteCount)); + } + } + + this._sortableSprites.sort((a, b) => (b.z - a.z)); + + if(spriteCount < this._sortableSprites.length) this._sortableSprites.splice(spriteCount); + + let iterator = 0; + + while(iterator < spriteCount) + { + const sprite = this._sortableSprites[iterator]; + + if(sprite && sprite.sprite) this.renderSprite(iterator, sprite); + + iterator++; + } + + this.cleanSprites(spriteCount); + + if(update || updateVisuals) this._canvasUpdated = true; + + this._renderTimestamp = this._totalTimeRunning; + this._renderedWidth = this._width; + this._renderedHeight = this._height; + } + + public skipSpriteVisibilityChecking(): void + { + this._noSpriteVisibilityChecking = true; + + this.render(-1, true); + } + + public resumeSpriteVisibilityChecking(): void + { + this._noSpriteVisibilityChecking = false; + } + + public getSortableSpriteList(): RoomObjectSpriteData[] + { + return this._objectCache.getSortableSpriteList(); + } + + public getPlaneSortableSprites(): SortableSprite[] + { + return this._objectCache.getPlaneSortableSprites(); + } + + public removeFromCache(identifier: string): void + { + this._objectCache.removeObjectCache(identifier); + } + + private renderObject(object: IRoomObject, identifier: string, time: number, update: boolean, updateVisuals: boolean, count: number): number + { + if(!object) return 0; + + const visualization = object.visualization as IRoomObjectSpriteVisualization; + + if(!visualization) + { + this.removeFromCache(identifier); + + return 0; + } + + const cache = this.getCacheItem(identifier); + cache.objectId = object.instanceId; + + const locationCache = cache.location; + const sortableCache = cache.sprites; + + const vector = locationCache.updateLocation(object, this._geometry); + + if(!vector) + { + this.removeFromCache(identifier); + + return 0; + } + + if(updateVisuals) visualization.update(this._geometry, time, (!sortableCache.isEmpty || update), (this._skipObjectUpdate && this._runningSlow)); + + if(locationCache.locationChanged) update = true; + + if(!sortableCache.needsUpdate(visualization.instanceId, visualization.updateSpriteCounter) && !update) + { + return sortableCache.spriteCount; + } + + let x = vector.x; + let y = vector.y; + let z = vector.z; + + if(x > 0) z = (z + (x * 1.2E-7)); + else z = (z + (-(x) * 1.2E-7)); + + x = (x + Math.trunc(this._width / 2)); + y = (y + Math.trunc(this._height / 2)); + + let spriteCount = 0; + + for(const sprite of visualization.sprites.values()) + { + if(!sprite || !sprite.visible) continue; + + const texture = sprite.texture; + const baseTexture = texture && texture.baseTexture; + + if(!texture || !baseTexture) continue; + + const spriteX = ((x + sprite.offsetX) + this._screenOffsetX); + const spriteY = ((y + sprite.offsetY) + this._screenOffsetY); + + if(sprite.flipH) + { + const checkX = ((x + (-(texture.width + (-(sprite.offsetX))))) + this._screenOffsetX); + + if(!this.isSpriteVisible(checkX, spriteY, texture.width, texture.height)) continue; + } + + else if(sprite.flipV) + { + const checkY = ((y + (-(texture.height + (-(sprite.offsetY))))) + this._screenOffsetY); + + if(!this.isSpriteVisible(spriteX, checkY, texture.width, texture.height)) continue; + } + + else + { + if(!this.isSpriteVisible(spriteX, spriteY, texture.width, texture.height)) continue; + } + + let sortableSprite = sortableCache.getSprite(spriteCount); + + if(!sortableSprite) + { + sortableSprite = new SortableSprite(); + + sortableCache.addSprite(sortableSprite); + + this._sortableSprites.push(sortableSprite); + + sortableSprite.name = identifier; + } + + sortableSprite.sprite = sprite; + + if((sprite.spriteType === RoomObjectSpriteType.AVATAR) || (sprite.spriteType === RoomObjectSpriteType.AVATAR_OWN)) + { + sortableSprite.sprite.libraryAssetName = 'avatar_' + object.id; + } + + sortableSprite.x = (spriteX - this._screenOffsetX); + sortableSprite.y = (spriteY - this._screenOffsetY); + sortableSprite.z = ((z + sprite.relativeDepth) + (3.7E-11 * count)); + + spriteCount++; + count++; + } + + sortableCache.setSpriteCount(spriteCount); + + this._canvasUpdated = true; + + return spriteCount; + } + + private getExtendedSprite(index: number): ExtendedSprite + { + if((index < 0) || (index >= this._spriteCount)) return null; + + const sprite = (this._display.getChildAt(index) as ExtendedSprite); + + if(!sprite) return null; + + return sprite; + } + + protected getExtendedSpriteIdentifier(sprite: ExtendedSprite): string + { + if(!sprite) return ''; + + return sprite.name; + } + + private renderSprite(index: number, sprite: SortableSprite): boolean + { + if(index >= this._spriteCount) + { + this.createAndAddSprite(sprite); + + return true; + } + + if(!sprite) return false; + + const objectSprite = sprite.sprite; + const extendedSprite = this.getExtendedSprite(index); + + if(!objectSprite || !extendedSprite) return false; + + if(extendedSprite.varyingDepth !== objectSprite.varyingDepth) + { + if(extendedSprite.varyingDepth && !objectSprite.varyingDepth) + { + this._display.removeChildAt(index); + + this._spritePool.push(extendedSprite); + + return this.renderSprite(index, sprite); + } + + this.createAndAddSprite(sprite, index); + + return true; + } + + if(extendedSprite.needsUpdate(objectSprite.id, objectSprite.updateCounter) || RoomEnterEffect.isVisualizationOn()) + { + extendedSprite.tag = objectSprite.tag; + extendedSprite.alphaTolerance = objectSprite.alphaTolerance; + extendedSprite.name = sprite.name; + extendedSprite.varyingDepth = objectSprite.varyingDepth; + extendedSprite.clickHandling = objectSprite.clickHandling; + extendedSprite.filters = objectSprite.filters; + + const alpha = (objectSprite.alpha / 255); + + if(extendedSprite.alpha !== alpha) extendedSprite.alpha = alpha; + + if(extendedSprite.tint !== objectSprite.color) extendedSprite.tint = objectSprite.color; + + if(extendedSprite.blendMode !== objectSprite.blendMode) extendedSprite.blendMode = objectSprite.blendMode; + + if(extendedSprite.texture !== objectSprite.texture) extendedSprite.setTexture(objectSprite.texture); + + if(objectSprite.updateContainer) + { + const length = extendedSprite.children.length; + + if(length === 1) extendedSprite.removeChildAt(0); + + extendedSprite.addChild(objectSprite.container); + + objectSprite.updateContainer = false; + } + + if(objectSprite.flipH) + { + if(extendedSprite.scale.x !== -1) extendedSprite.scale.x = -1; + } + else + { + if(extendedSprite.scale.x !== 1) extendedSprite.scale.x = 1; + } + + if(objectSprite.flipV) + { + if(extendedSprite.scale.y !== -1) extendedSprite.scale.y = -1; + } + else + { + if(extendedSprite.scale.y !== 1) extendedSprite.scale.y = 1; + } + + this.updateEnterRoomEffect(extendedSprite, objectSprite); + } + + if(extendedSprite.x !== sprite.x) extendedSprite.x = sprite.x; + if(extendedSprite.y !== sprite.y) extendedSprite.y = sprite.y; + + extendedSprite.offsetX = objectSprite.offsetX; + extendedSprite.offsetY = objectSprite.offsetY; + + return true; + } + + private createAndAddSprite(sortableSprite: SortableSprite, index: number = -1): void + { + const sprite = sortableSprite.sprite; + + if(!sprite) return; + + let extendedSprite: ExtendedSprite = null; + + if(this._spritePool.length > 0) extendedSprite = this._spritePool.pop(); + + if(!extendedSprite) extendedSprite = new ExtendedSprite(); + + if(extendedSprite.children.length) extendedSprite.removeChildren(); + + extendedSprite.tag = sprite.tag; + extendedSprite.alphaTolerance = sprite.alphaTolerance; + extendedSprite.alpha = (sprite.alpha / 255); + extendedSprite.tint = sprite.color; + extendedSprite.x = sortableSprite.x; + extendedSprite.y = sortableSprite.y; + extendedSprite.offsetX = sprite.offsetX; + extendedSprite.offsetY = sprite.offsetY; + extendedSprite.name = sprite.name; + extendedSprite.varyingDepth = sprite.varyingDepth; + extendedSprite.clickHandling = sprite.clickHandling; + extendedSprite.blendMode = sprite.blendMode; + extendedSprite.filters = sprite.filters; + + extendedSprite.setTexture(sprite.texture); + + if(sprite.updateContainer) + { + extendedSprite.addChild(sprite.container); + + sprite.updateContainer = false; + } + + if(sprite.flipH) extendedSprite.scale.x = -1; + + if(sprite.flipV) extendedSprite.scale.y = -1; + + this.updateEnterRoomEffect(extendedSprite, sprite); + + if((index < 0) || (index >= this._spriteCount)) + { + this._display.addChild(extendedSprite); + + this._spriteCount++; + } + else + { + this._display.addChildAt(extendedSprite, index); + } + + this._activeSpriteCount++; + } + + private cleanSprites(spriteCount: number, _arg_2: boolean = false): void + { + if(!this._display) return; + + if(spriteCount < 0) spriteCount = 0; + + if((spriteCount < this._activeSpriteCount) || !this._activeSpriteCount) + { + let iterator = (this._spriteCount - 1); + + while(iterator >= spriteCount) + { + this.cleanSprite(this.getExtendedSprite(iterator), _arg_2); + + iterator--; + } + } + + this._activeSpriteCount = spriteCount; + } + + private updateEnterRoomEffect(sprite: ExtendedSprite, _arg_2: IRoomObjectSprite): void + { + if(!RoomEnterEffect.isVisualizationOn() || !_arg_2) return; + + switch(_arg_2.spriteType) + { + case RoomObjectSpriteType.AVATAR_OWN: + return; + case RoomObjectSpriteType.ROOM_PLANE: + sprite.alpha = RoomEnterEffect.getDelta(0.9); + return; + case RoomObjectSpriteType.AVATAR: + sprite.alpha = RoomEnterEffect.getDelta(0.5); + return; + default: + sprite.alpha = RoomEnterEffect.getDelta(0.1); + } + } + + private cleanSprite(sprite: ExtendedSprite, _arg_2: boolean): void + { + if(!sprite) return; + + if(!_arg_2) + { + sprite.setTexture(null); + } + else + { + if(sprite.parent) sprite.parent.removeChild(sprite); + + sprite.destroy({ + children: true + }); + } + } + + public update(): void + { + if(!this._mouseCheckCount) + { + //this.checkMouseHits(this._mouseLocation.x, this._mouseLocation.y, MouseEventType.MOUSE_MOVE); + } + + this._mouseCheckCount = 0; + + this._eventId++; + } + + public setMouseListener(listener: IRoomCanvasMouseListener): void + { + this._mouseListener = listener; + } + + private getCacheItem(id: string): RoomObjectCacheItem + { + return this._objectCache.getObjectCache(id); + } + + private isSpriteVisible(x: number, y: number, width: number, height: number): boolean + { + if(this._noSpriteVisibilityChecking) return true; + + x = (((x - this._screenOffsetX) * this._scale) + this._screenOffsetX); + y = (((y - this._screenOffsetY) * this._scale) + this._screenOffsetY); + width = (width * this._scale); + height = (height * this._scale); + + if(((x < this._width) && ((x + width) >= 0)) && ((y < this._height) && ((y + height) >= 0))) + { + if(!this._usesExclusionRectangles) return true; + } + + return false; + } + + public handleMouseEvent(x: number, y: number, type: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean, buttonDown: boolean): boolean + { + x = (x - this._screenOffsetX); + y = (y - this._screenOffsetY); + + this._mouseLocation.x = (x / this._scale); + this._mouseLocation.y = (y / this._scale); + + if((this._mouseCheckCount > 0) && (type == MouseEventType.MOUSE_MOVE)) return this._mouseSpriteWasHit; + + this._mouseSpriteWasHit = this.checkMouseHits(Math.trunc(x / this._scale), Math.trunc(y / this._scale), type, altKey, ctrlKey, shiftKey, buttonDown); + + this._mouseCheckCount++; + + return this._mouseSpriteWasHit; + } + + private checkMouseHits(x: number, y: number, type: string, altKey: boolean = false, ctrlKey: boolean = false, shiftKey: boolean = false, buttonDown: boolean = false): boolean + { + const checkedSprites: string[] = []; + + let didHitSprite = false; + let mouseEvent: IRoomSpriteMouseEvent = null; + let spriteId = (this._activeSpriteCount - 1); + + while(spriteId >= 0) + { + const extendedSprite = this.getExtendedSprite(spriteId); + + if(extendedSprite && extendedSprite.containsPoint(new Point((x - extendedSprite.x), (y - extendedSprite.y)))) + { + if(extendedSprite.clickHandling && ((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK))) + { + // + } + else + { + const identifier = this.getExtendedSpriteIdentifier(extendedSprite); + + if(checkedSprites.indexOf(identifier) === -1) + { + const tag = extendedSprite.tag; + + let mouseData = this._mouseActiveObjects.get(identifier); + + if(mouseData) + { + if(mouseData.spriteTag !== tag) + { + mouseEvent = this.createMouseEvent(0, 0, 0, 0, MouseEventType.ROLL_OUT, mouseData.spriteTag, altKey, ctrlKey, shiftKey, buttonDown); + + this.bufferMouseEvent(mouseEvent, identifier); + } + } + + if((type === MouseEventType.MOUSE_MOVE) && (!mouseData || (mouseData.spriteTag !== tag))) + { + mouseEvent = this.createMouseEvent(x, y, (x - extendedSprite.x), (y - extendedSprite.y), MouseEventType.ROLL_OVER, tag, altKey, ctrlKey, shiftKey, buttonDown); + } + else + { + mouseEvent = this.createMouseEvent(x, y, (x - extendedSprite.x), (y - extendedSprite.y), type, tag, altKey, ctrlKey, shiftKey, buttonDown); + + mouseEvent.spriteOffsetX = extendedSprite.offsetX; + mouseEvent.spriteOffsetY = extendedSprite.offsetY; + } + + if(!mouseData) + { + mouseData = new ObjectMouseData(); + + mouseData.objectId = identifier; + this._mouseActiveObjects.set(identifier, mouseData); + } + + mouseData.spriteTag = tag; + + if(((type !== MouseEventType.MOUSE_MOVE) || (x !== this._mouseOldX)) || (y !== this._mouseOldY)) + { + this.bufferMouseEvent(mouseEvent, identifier); + } + + checkedSprites.push(identifier); + } + + didHitSprite = true; + } + } + + spriteId--; + } + + const keys: string[] = []; + + for(const key of this._mouseActiveObjects.keys()) key && keys.push(key); + + let index = 0; + + while(index < keys.length) + { + const key = keys[index]; + + if(checkedSprites.indexOf(key) >= 0) keys[index] = null; + + index++; + } + + index = 0; + + while(index < keys.length) + { + const key = keys[index]; + + if(key !== null) + { + const existing = this._mouseActiveObjects.get(key); + + if(existing) this._mouseActiveObjects.delete(key); + + const mouseEvent = this.createMouseEvent(0, 0, 0, 0, MouseEventType.ROLL_OUT, existing.spriteTag, altKey, ctrlKey, shiftKey, buttonDown); + + this.bufferMouseEvent(mouseEvent, key); + } + + index++; + } + + this.processMouseEvents(); + this._mouseOldX = x; + this._mouseOldY = y; + + return didHitSprite; + } + + protected createMouseEvent(x: number, y: number, localX: number, localY: number, type: string, tag: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean, buttonDown: boolean): IRoomSpriteMouseEvent + { + const screenX: number = (x - (this._width / 2)); + const screenY: number = (y - (this._height / 2)); + const canvasName = `canvas_${this._id}`; + + return new RoomSpriteMouseEvent(type, ((canvasName + '_') + this._eventId), canvasName, tag, screenX, screenY, localX, localY, ctrlKey, altKey, shiftKey, buttonDown); + } + + protected bufferMouseEvent(k: IRoomSpriteMouseEvent, _arg_2: string): void + { + if(!k || !this._eventCache) return; + + this._eventCache.delete(_arg_2); + this._eventCache.set(_arg_2, k); + } + + protected processMouseEvents(): void + { + if(!this._container || !this._eventCache) return; + + for(const [key, event] of this._eventCache.entries()) + { + if(!this._eventCache) return; + + if(!event) continue; + + const roomObject = this._container.getRoomObject(parseInt(key)); + + if(!roomObject) continue; + + if(this._mouseListener) + { + this._mouseListener.processRoomCanvasMouseEvent(event, roomObject, this._geometry); + } + else + { + const logic = roomObject.mouseHandler; + + if(logic) + { + logic.mouseEvent(event, this._geometry); + } + } + } + + if(this._eventCache) this._eventCache.clear(); + } + + public getDisplayAsTexture(): RenderTexture + { + this._noSpriteVisibilityChecking = true; + const k = this._scale; + const _local_2 = this._screenOffsetX; + const _local_3 = this._screenOffsetY; + this.setScale(1, null, null, true); + this._screenOffsetX = 0; + this._screenOffsetY = 0; + this.render(-1, true); + + this._display.mask = null; + + const bounds = this._display.getBounds(); + + const renderTexture = RenderTexture.create({ + width: this._display.width, + height: this._display.height + }); + + PixiApplicationProxy.instance.renderer.render(this._display, { + renderTexture, + clear: true, + transform: new Matrix(1, 0, 0, 1, -(bounds.x), -(bounds.y)) + }); + + this._display.mask = this._mask; + + this._noSpriteVisibilityChecking = false; + this.setScale(k, null, null, true); + this._screenOffsetX = _local_2; + this._screenOffsetY = _local_3; + + return renderTexture; + } + + private doMagic(): void + { + const geometry = (this.geometry as RoomGeometry); + + if(this._rotation !== 0) + { + let direction = this._effectDirection; + + geometry.direction = new Vector3d((direction.x + this._rotation), direction.y, direction.z); + + direction = (geometry.direction as Vector3d); + + geometry.setDepthVector(new Vector3d(direction.x, direction.y, 5)); + + const location = new Vector3d(); + + location.assign(this._rotationOrigin); + + location.x = (location.x + ((this._rotationRodLength * Math.cos((((direction.x + 180) / 180) * 3.14159265358979))) * Math.cos(((direction.y / 180) * 3.14159265358979)))); + location.y = (location.y + ((this._rotationRodLength * Math.sin((((direction.x + 180) / 180) * 3.14159265358979))) * Math.cos(((direction.y / 180) * 3.14159265358979)))); + location.z = (location.z + (this._rotationRodLength * Math.sin(((direction.y / 180) * 3.14159265358979)))); + + geometry.location = location; + + this._effectLocation = new Vector3d(); + this._effectLocation.assign(location); + this._effectDirection = new Vector3d(); + this._effectDirection.assign(geometry.direction); + } + + if(RoomShakingEffect.isVisualizationOn() && !this._SafeStr_4507) + { + this.changeShaking(); + } + else + { + if(!RoomShakingEffect.isVisualizationOn() && this._SafeStr_4507) this.changeShaking(); + } + + if(RoomRotatingEffect.isVisualizationOn()) this.changeRotation(); + + if(this._SafeStr_4507) + { + this._SafeStr_795++; + + const _local_4 = this._effectDirection; + const _local_1 = Vector3d.sum(_local_4, new Vector3d((Math.sin((((this._SafeStr_795 * 5) / 180) * 3.14159265358979)) * 2), (Math.sin(((this._SafeStr_795 / 180) * 3.14159265358979)) * 5), (Math.sin((((this._SafeStr_795 * 10) / 180) * 3.14159265358979)) * 2))); + + geometry.direction = _local_1; + } + else + { + this._SafeStr_795 = 0; + + geometry.direction = this._effectDirection; + } + } + + private changeShaking(): void + { + this._SafeStr_4507 = !this._SafeStr_4507; + + if(this._SafeStr_4507) + { + const direction = this.geometry.direction; + + this._effectDirection = new Vector3d(direction.x, direction.y, direction.z); + } + } + + private changeRotation(): void + { + if(this._SafeStr_4507) return; + + const geometry = (this.geometry as RoomGeometry); + + if(!geometry) return; + + if(this._rotation === 0) + { + const location = geometry.location; + const directionAxis = geometry.directionAxis; + + this._effectLocation = new Vector3d(); + this._effectLocation.assign(location); + this._effectDirection = new Vector3d(); + this._effectDirection.assign(geometry.direction); + + const intersection = RoomGeometry.getIntersectionVector(location, directionAxis, new Vector3d(0, 0, 0), new Vector3d(0, 0, 1)); + + if(intersection !== null) + { + this._rotationOrigin = new Vector3d(intersection.x, intersection.y, intersection.z); + this._rotationRodLength = Vector3d.dif(intersection, location).length; + this._rotation = 1; + } + + return; + } + + this._rotation = 0; + + geometry.location = this._effectLocation; + geometry.direction = this._effectDirection; + geometry.setDepthVector(new Vector3d(this._effectDirection.x, this._effectDirection.y, 5)); + } + + public moveLeft(): void + { + if(this._rotation !== 0) + { + if(this._rotation === 1) + { + this._rotation = -1; + } + else + { + this._rotation = (this._rotation - 1); + } + + return; + } + + const geometry = (this.geometry as RoomGeometry); + const direction = (((geometry.direction.x - 90) / 180) * 3.14159265358979); + + geometry.location = Vector3d.sum(geometry.location, new Vector3d((Math.cos(direction) * Math.sqrt(2)), (Math.sin(direction) * Math.sqrt(2)))); + } + + public moveRight(): void + { + if(this._rotation !== 0) + { + if(this._rotation === -1) + { + this._rotation = 1; + } + else + { + this._rotation = (this._rotation + 1); + } + + return; + } + + const geometry = (this.geometry as RoomGeometry); + const direction = (((geometry.direction.x + 90) / 180) * 3.14159265358979); + + geometry.location = Vector3d.sum(geometry.location, new Vector3d((Math.cos(direction) * Math.sqrt(2)), (Math.sin(direction) * Math.sqrt(2)))); + } + + public moveUp(): void + { + if(this._rotation !== 0) return; + + const geometry = (this.geometry as RoomGeometry); + const direction = ((geometry.direction.x / 180) * 3.14159265358979); + + geometry.location = Vector3d.sum(geometry.location, new Vector3d((Math.cos(direction) * Math.sqrt(2)), (Math.sin(direction) * Math.sqrt(2)))); + } + + public moveDown(): void + { + if(this._rotation !== 0) return; + + const geometry = (this.geometry as RoomGeometry); + const direction = (((geometry.direction.x + 180) / 180) * 3.14159265358979); + + geometry.location = Vector3d.sum(geometry.location, new Vector3d((Math.cos(direction) * Math.sqrt(2)), (Math.sin(direction) * Math.sqrt(2)))); + } + + public get id(): number + { + return this._id; + } + + public get geometry(): IRoomGeometry + { + return this._geometry; + } + + public get master(): DisplayObject + { + return this._master; + } + + public get display(): DisplayObject + { + return this._display; + } + + public get screenOffsetX(): number + { + return this._screenOffsetX; + } + + public set screenOffsetX(x: number) + { + x = Math.trunc(x); + + this._mouseLocation.x = (this._mouseLocation.x - (x - this._screenOffsetX)); + this._screenOffsetX = x; + } + + public get screenOffsetY(): number + { + return this._screenOffsetY; + } + + public set screenOffsetY(y: number) + { + y = Math.trunc(y); + + this._mouseLocation.y = (this._mouseLocation.y - (y - this._screenOffsetY)); + this._screenOffsetY = y; + } + + public get scale(): number + { + return this._scale; + } + + public get width(): number + { + return (this._width * this._scale); + } + + public get height(): number + { + return (this._height * this._scale); + } + + public get restrictsScaling(): boolean + { + return this._restrictsScaling; + } + + public set restrictsScaling(flag: boolean) + { + this._restrictsScaling = flag; + } + + public get canvasUpdated(): boolean + { + return this._canvasUpdated; + } + + public set canvasUpdated(flag: boolean) + { + this._canvasUpdated = flag; + } +} diff --git a/submodules/renderer/src/room/renderer/cache/RoomObjectCache.ts b/submodules/renderer/src/room/renderer/cache/RoomObjectCache.ts new file mode 100644 index 0000000..fe2f377 --- /dev/null +++ b/submodules/renderer/src/room/renderer/cache/RoomObjectCache.ts @@ -0,0 +1,146 @@ +import { IRoomObjectSprite, RoomObjectSpriteData, RoomObjectSpriteType } from '../../../api'; +import { SortableSprite } from '../utils'; +import { RoomObjectCacheItem } from './RoomObjectCacheItem'; + +export class RoomObjectCache +{ + private static MAX_SIZE_FOR_AVG_COLOR: number = 200; + + private _data: Map; + private _roomObjectVariableAccurateZ: string; + + constructor(accurateZ: string) + { + this._data = new Map(); + this._roomObjectVariableAccurateZ = accurateZ; + } + + public dispose(): void + { + if(this._data) + { + for(const [key, item] of this._data.entries()) + { + if(!item) continue; + + this._data.delete(key); + + item.dispose(); + } + + this._data = null; + } + } + + public getObjectCache(k: string): RoomObjectCacheItem + { + let existing = this._data.get(k); + + if(!existing) + { + existing = new RoomObjectCacheItem(this._roomObjectVariableAccurateZ); + + this._data.set(k, existing); + } + + return existing; + } + + public removeObjectCache(k: string): void + { + const existing = this._data.get(k); + + if(!existing) return; + + this._data.delete(k); + + existing.dispose(); + } + + public getSortableSpriteList(): RoomObjectSpriteData[] + { + const spriteData: RoomObjectSpriteData[] = []; + + for(const item of this._data.values()) + { + if(!item) continue; + + const sprites = item.sprites && item.sprites.sprites; + + if(!sprites || !sprites.length) continue; + + for(const sprite of sprites) + { + if(!sprite) continue; + + if((sprite.sprite.spriteType !== RoomObjectSpriteType.ROOM_PLANE) && (sprite.sprite.name !== '')) + { + const data = new RoomObjectSpriteData(); + + data.objectId = item.objectId; + data.x = sprite.x; + data.y = sprite.y; + data.z = sprite.z; + data.name = sprite.sprite.name || ''; + data.flipH = sprite.sprite.flipH; + data.alpha = sprite.sprite.alpha; + data.color = sprite.sprite.color.toString(); + data.blendMode = sprite.sprite.blendMode.toString(); + data.width = sprite.sprite.width; + data.height = sprite.sprite.height; + data.type = sprite.sprite.type; + data.posture = sprite.sprite.posture; + + const isSkewed = this.isSkewedSprite(sprite.sprite); + + if(isSkewed) + { + data.skew = (((sprite.sprite.direction % 4) === 0) ? -0.5 : 0.5); + } + + if(((((isSkewed || (sprite.name.indexOf('%image.library.url%') >= 0)) || (sprite.name.indexOf('%group.badge.url%') >= 0)) && (data.width <= RoomObjectCache.MAX_SIZE_FOR_AVG_COLOR)) && (data.height <= RoomObjectCache.MAX_SIZE_FOR_AVG_COLOR))) + { + //data.color = Canvas._Str_23439(sprite.sprite.texture).toString(); + + if(sprite.sprite.name.indexOf('external_image_wallitem') === 0) + { + data.frame = true; + } + } + + spriteData.push(data); + } + } + } + + if(!spriteData || !spriteData.length) return null; + + return spriteData; + } + + private isSkewedSprite(k: IRoomObjectSprite): boolean + { + if(!k.type) return false; + + if((k.type.indexOf('external_image_wallitem') === 0) && (k.tag === 'THUMBNAIL')) return true; + + if((k.type.indexOf('guild_forum') === 0) && (k.tag === 'THUMBNAIL')) return true; + + return false; + } + + public getPlaneSortableSprites(): SortableSprite[] + { + const sprites: SortableSprite[] = []; + + for(const item of this._data.values()) + { + for(const sprite of item.sprites.sprites) + { + if(sprite.sprite.spriteType === RoomObjectSpriteType.ROOM_PLANE) sprites.push(sprite); + } + } + + return sprites; + } +} diff --git a/submodules/renderer/src/room/renderer/cache/RoomObjectCacheItem.ts b/submodules/renderer/src/room/renderer/cache/RoomObjectCacheItem.ts new file mode 100644 index 0000000..2fcbede --- /dev/null +++ b/submodules/renderer/src/room/renderer/cache/RoomObjectCacheItem.ts @@ -0,0 +1,52 @@ +import { RoomObjectLocationCacheItem } from './RoomObjectLocationCacheItem'; +import { RoomObjectSortableSpriteCacheItem } from './RoomObjectSortableSpriteCacheItem'; + +export class RoomObjectCacheItem +{ + private _objectId: number; + private _location: RoomObjectLocationCacheItem; + private _sprites: RoomObjectSortableSpriteCacheItem; + + constructor(accurateZ: string) + { + this._location = new RoomObjectLocationCacheItem(accurateZ); + this._sprites = new RoomObjectSortableSpriteCacheItem(); + } + + public get location(): RoomObjectLocationCacheItem + { + return this._location; + } + + public get sprites(): RoomObjectSortableSpriteCacheItem + { + return this._sprites; + } + + public dispose(): void + { + if(this._location) + { + this._location.dispose(); + + this._location = null; + } + + if(this._sprites) + { + this._sprites.dispose(); + + this._sprites = null; + } + } + + public get objectId(): number + { + return this._objectId; + } + + public set objectId(k: number) + { + this._objectId = k; + } +} diff --git a/submodules/renderer/src/room/renderer/cache/RoomObjectLocationCacheItem.ts b/submodules/renderer/src/room/renderer/cache/RoomObjectLocationCacheItem.ts new file mode 100644 index 0000000..1ebb46d --- /dev/null +++ b/submodules/renderer/src/room/renderer/cache/RoomObjectLocationCacheItem.ts @@ -0,0 +1,95 @@ +import { IRoomGeometry, IRoomObject, IVector3D, Vector3d } from '../../../api'; + +export class RoomObjectLocationCacheItem +{ + private _roomObjectVariableAccurateZ: string; + + private _location: Vector3d; + private _screenLocation: Vector3d; + private _locationChanged: boolean; + + private _geometryUpdateId: number; + private _objectUpdateId: number; + + constructor(accurateZ: string) + { + this._roomObjectVariableAccurateZ = accurateZ || ''; + + this._location = new Vector3d(); + this._screenLocation = new Vector3d(); + this._locationChanged = false; + + this._geometryUpdateId = -1; + this._objectUpdateId = -1; + } + + public dispose(): void + { + this._screenLocation = null; + } + + public updateLocation(object: IRoomObject, geometry: IRoomGeometry): IVector3D + { + if(!object || !geometry) return null; + + let locationChanged = false; + + const location = object.getLocation(); + + if((geometry.updateId !== this._geometryUpdateId) || (object.updateCounter !== this._objectUpdateId)) + { + this._objectUpdateId = object.updateCounter; + + if((geometry.updateId !== this._geometryUpdateId) || (location.x !== this._location.x) || (location.y !== this._location.y) || (location.z !== this._location.z)) + { + this._geometryUpdateId = geometry.updateId; + this._location.assign(location); + + locationChanged = true; + } + } + + this._locationChanged = locationChanged; + + if(this._locationChanged) + { + const screenLocation = geometry.getScreenPosition(location); + + if(!screenLocation) return null; + + const accurateZ = object.model.getValue(this._roomObjectVariableAccurateZ); + + if(isNaN(accurateZ) || (accurateZ === 0)) + { + const rounded = new Vector3d(Math.round(location.x), Math.round(location.y), location.z); + + if((rounded.x !== location.x) || (rounded.y !== location.y)) + { + const roundedScreen = geometry.getScreenPosition(rounded); + + this._screenLocation.assign(screenLocation); + + if(roundedScreen) this._screenLocation.z = roundedScreen.z; + } + else + { + this._screenLocation.assign(screenLocation); + } + } + else + { + this._screenLocation.assign(screenLocation); + } + + this._screenLocation.x = Math.round(this._screenLocation.x); + this._screenLocation.y = Math.round(this._screenLocation.y); + } + + return this._screenLocation; + } + + public get locationChanged(): boolean + { + return this._locationChanged; + } +} diff --git a/submodules/renderer/src/room/renderer/cache/RoomObjectSortableSpriteCacheItem.ts b/submodules/renderer/src/room/renderer/cache/RoomObjectSortableSpriteCacheItem.ts new file mode 100644 index 0000000..cef1b4e --- /dev/null +++ b/submodules/renderer/src/room/renderer/cache/RoomObjectSortableSpriteCacheItem.ts @@ -0,0 +1,78 @@ +import { SortableSprite } from '../utils'; + +export class RoomObjectSortableSpriteCacheItem +{ + private _sprites: SortableSprite[]; + private _updateId1: number; + private _updateId2: number; + private _isEmpty: boolean; + + constructor() + { + this._sprites = []; + this._updateId1 = -1; + this._updateId2 = -1; + this._isEmpty = false; + } + + public get spriteCount(): number + { + return this._sprites.length; + } + + public get isEmpty(): boolean + { + return this._isEmpty; + } + + public dispose(): void + { + this.setSpriteCount(0); + } + + public addSprite(sprite: SortableSprite): void + { + this._sprites.push(sprite); + } + + public getSprite(k: number): SortableSprite + { + return this._sprites[k]; + } + + public get sprites(): SortableSprite[] + { + return this._sprites; + } + + public needsUpdate(k: number, _arg_2: number): boolean + { + if((k === this._updateId1) && (_arg_2 === this._updateId2)) return false; + + this._updateId1 = k; + this._updateId2 = _arg_2; + + return true; + } + + public setSpriteCount(k: number): void + { + if(k < this._sprites.length) + { + let iterator = k; + + while(iterator < this._sprites.length) + { + const sprite = this._sprites[iterator]; + + if(sprite) sprite.dispose(); + + iterator++; + } + + this._sprites.splice(k, (this._sprites.length - k)); + } + + this._isEmpty = (this._sprites.length) ? false : true; + } +} diff --git a/submodules/renderer/src/room/renderer/cache/index.ts b/submodules/renderer/src/room/renderer/cache/index.ts new file mode 100644 index 0000000..361f724 --- /dev/null +++ b/submodules/renderer/src/room/renderer/cache/index.ts @@ -0,0 +1,4 @@ +export * from './RoomObjectCache'; +export * from './RoomObjectCacheItem'; +export * from './RoomObjectLocationCacheItem'; +export * from './RoomObjectSortableSpriteCacheItem'; diff --git a/submodules/renderer/src/room/renderer/index.ts b/submodules/renderer/src/room/renderer/index.ts new file mode 100644 index 0000000..2978ecd --- /dev/null +++ b/submodules/renderer/src/room/renderer/index.ts @@ -0,0 +1,5 @@ +export * from './cache'; +export * from './RoomRenderer'; +export * from './RoomRendererFactory'; +export * from './RoomSpriteCanvas'; +export * from './utils'; diff --git a/submodules/renderer/src/room/renderer/utils/ExtendedSprite.ts b/submodules/renderer/src/room/renderer/utils/ExtendedSprite.ts new file mode 100644 index 0000000..7cff5b0 --- /dev/null +++ b/submodules/renderer/src/room/renderer/utils/ExtendedSprite.ts @@ -0,0 +1,206 @@ +import { BLEND_MODES } from '@pixi/constants'; +import { BaseTexture, Resource, Texture } from '@pixi/core'; +import { Point } from '@pixi/math'; +import { Sprite } from '@pixi/sprite'; +import { AlphaTolerance } from '../../../api'; +import { TextureUtils } from '../../../pixi-proxy'; + +export class ExtendedSprite extends Sprite +{ + private _offsetX: number; + private _offsetY: number; + private _tag: string; + private _alphaTolerance: number; + private _varyingDepth: boolean; + private _clickHandling: boolean; + + private _pairedSpriteId: number; + private _pairedSpriteUpdateCounter: number; + + constructor(texture: Texture = null) + { + super(texture); + + this._offsetX = 0; + this._offsetY = 0; + this._tag = ''; + this._alphaTolerance = 128; + this._varyingDepth = false; + this._clickHandling = false; + + this._pairedSpriteId = -1; + this._pairedSpriteUpdateCounter = -1; + } + + public needsUpdate(pairedSpriteId: number, pairedSpriteUpdateCounter: number): boolean + { + if((this._pairedSpriteId === pairedSpriteId) && (this._pairedSpriteUpdateCounter === pairedSpriteUpdateCounter)) return false; + + this._pairedSpriteId = pairedSpriteId; + this._pairedSpriteUpdateCounter = pairedSpriteUpdateCounter; + + return true; + } + + public calculateVertices(): void + { + if(!this.texture.orig) return; + + super.calculateVertices(); + } + + public setTexture(texture: Texture): void + { + if(!texture) texture = Texture.EMPTY; + + if(texture === this.texture) return; + + if(texture === Texture.EMPTY) + { + this._pairedSpriteId = -1; + this._pairedSpriteUpdateCounter = -1; + } + + this.texture = texture; + } + + public containsPoint(point: Point): boolean + { + return ExtendedSprite.containsPoint(this, point); + } + + public static containsPoint(sprite: ExtendedSprite, point: Point): boolean + { + if(!sprite || !point || (sprite.alphaTolerance > 255)) return false; + + if(!(sprite instanceof Sprite)) return false; + + if((sprite.texture === Texture.EMPTY) || (sprite.blendMode !== BLEND_MODES.NORMAL)) return; + + const texture = sprite.texture; + const baseTexture = texture.baseTexture; + + if(!texture || !baseTexture || !baseTexture.valid) return false; + + const x = (point.x * sprite.scale.x); + const y = (point.y * sprite.scale.y); + + if(!sprite.getLocalBounds().contains(x, y)) return false; + + //@ts-ignore + if(!baseTexture.hitMap) + { + if(!ExtendedSprite.generateHitMap(baseTexture)) return false; + } + + //@ts-ignore + const hitMap = (baseTexture.hitMap as Uint32Array); + + let dx = (x + texture.frame.x); + let dy = (y + texture.frame.y); + + if(texture.trim) + { + dx -= texture.trim.x; + dy -= texture.trim.y; + } + + dx = (Math.round(dx) * baseTexture.resolution); + dy = (Math.round(dy) * baseTexture.resolution); + + const ind = (dx + dy * baseTexture.realWidth); + const ind1 = ind % 32; + const ind2 = ind / 32 | 0; + + return (hitMap[ind2] & (1 << ind1)) !== 0; + } + + private static generateHitMap(baseTexture: BaseTexture): boolean + { + if(!baseTexture) return false; + + const texture = new Texture(baseTexture); + const sprite = new Sprite(texture); + const pixels = TextureUtils.getPixels(sprite); + const width = baseTexture.width; + const height = baseTexture.height; + const hitmap = new Uint32Array(Math.ceil(width * height / 32)); + const threshold = AlphaTolerance.MATCH_OPAQUE_PIXELS; + + for(let i = 0; i < width * height; i++) + { + const ind1 = i % 32; + const ind2 = i / 32 | 0; + + if(pixels[i * 4 + 3] >= threshold) hitmap[ind2] = hitmap[ind2] | (1 << ind1); + } + + //@ts-ignore + baseTexture.hitMap = hitmap; + + sprite.destroy(); + texture.destroy(); + + return true; + } + + public get offsetX(): number + { + return this._offsetX; + } + + public set offsetX(offset: number) + { + this._offsetX = offset; + } + + public get offsetY(): number + { + return this._offsetY; + } + + public set offsetY(offset: number) + { + this._offsetY = offset; + } + + public get tag(): string + { + return this._tag; + } + + public set tag(tag: string) + { + this._tag = tag; + } + + public get alphaTolerance(): number + { + return this._alphaTolerance; + } + + public set alphaTolerance(tolerance: number) + { + this._alphaTolerance = tolerance; + } + + public get varyingDepth(): boolean + { + return this._varyingDepth; + } + + public set varyingDepth(flag: boolean) + { + this._varyingDepth = flag; + } + + public get clickHandling(): boolean + { + return this._clickHandling; + } + + public set clickHandling(flag: boolean) + { + this._clickHandling = flag; + } +} diff --git a/submodules/renderer/src/room/renderer/utils/ObjectMouseData.ts b/submodules/renderer/src/room/renderer/utils/ObjectMouseData.ts new file mode 100644 index 0000000..ed47437 --- /dev/null +++ b/submodules/renderer/src/room/renderer/utils/ObjectMouseData.ts @@ -0,0 +1,31 @@ +export class ObjectMouseData +{ + private _objectId: string; + private _spriteTag: string; + + constructor() + { + this._objectId = ''; + this._spriteTag = ''; + } + + public get objectId(): string + { + return this._objectId; + } + + public set objectId(k: string) + { + this._objectId = k; + } + + public get spriteTag(): string + { + return this._spriteTag; + } + + public set spriteTag(k: string) + { + this._spriteTag = k; + } +} \ No newline at end of file diff --git a/submodules/renderer/src/room/renderer/utils/SortableSprite.ts b/submodules/renderer/src/room/renderer/utils/SortableSprite.ts new file mode 100644 index 0000000..2475988 --- /dev/null +++ b/submodules/renderer/src/room/renderer/utils/SortableSprite.ts @@ -0,0 +1,79 @@ +import { IRoomObjectSprite, ISortableSprite } from '../../../api'; + +export class SortableSprite implements ISortableSprite +{ + public static Z_INFINITY: number = 100000000; + + private _name: string; + private _sprite: IRoomObjectSprite; + + private _x: number; + private _y: number; + private _z: number; + + constructor() + { + this._name = ''; + this._sprite = null; + + this._x = 0; + this._y = 0; + this._z = 0; + } + + public dispose(): void + { + this._z = -(SortableSprite.Z_INFINITY); + this._sprite = null; + } + + public get name(): string + { + return this._name; + } + + public set name(name: string) + { + this._name = name; + } + + public get sprite(): IRoomObjectSprite + { + return this._sprite; + } + + public set sprite(sprite: IRoomObjectSprite) + { + this._sprite = sprite; + } + + public get x(): number + { + return this._x; + } + + public set x(x: number) + { + this._x = x; + } + + public get y(): number + { + return this._y; + } + + public set y(y: number) + { + this._y = y; + } + + public get z(): number + { + return this._z; + } + + public set z(z: number) + { + this._z = z; + } +} diff --git a/submodules/renderer/src/room/renderer/utils/index.ts b/submodules/renderer/src/room/renderer/utils/index.ts new file mode 100644 index 0000000..65ca238 --- /dev/null +++ b/submodules/renderer/src/room/renderer/utils/index.ts @@ -0,0 +1,3 @@ +export * from './ExtendedSprite'; +export * from './ObjectMouseData'; +export * from './SortableSprite'; diff --git a/submodules/renderer/src/room/utils/ColorConverter.ts b/submodules/renderer/src/room/utils/ColorConverter.ts new file mode 100644 index 0000000..ab2c369 --- /dev/null +++ b/submodules/renderer/src/room/utils/ColorConverter.ts @@ -0,0 +1,353 @@ +import { IVector3D, Vector3d } from '../../api'; + +export class ColorConverter +{ + private static HEX_DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; + + public static hex2rgb(hex: number, out: Array | Float32Array = []): Array | Float32Array + { + out[0] = ((hex >> 16) & 0xFF) / 255; + out[1] = ((hex >> 8) & 0xFF) / 255; + out[2] = (hex & 0xFF) / 255; + + return out; + } + + public static hex2rgba(hex: number, out: Array | Float32Array = []): Array | Float32Array + { + out[0] = ((hex >> 16) & 0xFF) / 255; + out[1] = ((hex >> 8) & 0xFF) / 255; + out[2] = (hex & 0xFF) / 255; + out[3] = (hex & 0xFF); + + return out; + } + + public static rgb2hex(rgb: number[] | Float32Array): number + { + return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0)); + } + + public static rgba2hex(rgb: number[] | Float32Array): number + { + return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0) + (rgb[3] | 0)); + } + + public static rgbStringToHex(rgb: string): string + { + const extracted = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); + + return '#' + ColorConverter.getHex(extracted[1]) + ColorConverter.getHex(extracted[2]) + ColorConverter.getHex(extracted[3]); + } + + public static getHex(x: any) + { + return isNaN(x) ? '00' : ColorConverter.HEX_DIGITS[(x - x % 16) / 16] + ColorConverter.HEX_DIGITS[x % 16]; + } + + public static int2rgb(color: number): string + { + color >>>= 0; + const b = color & 0xFF; + const g = (color & 0xFF00) >>> 8; + const r = (color & 0xFF0000) >>> 16; + const a = ((color & 0xFF000000) >>> 24) / 255; + + return 'rgba(' + [r, g, b, 1].join(',') + ')'; + } + + public static rgbToHSL(k: number): number + { + const _local_2: number = (((k >> 16) & 0xFF) / 0xFF); + const _local_3: number = (((k >> 8) & 0xFF) / 0xFF); + const _local_4: number = ((k & 0xFF) / 0xFF); + const _local_5: number = Math.max(_local_2, _local_3, _local_4); + const _local_6: number = Math.min(_local_2, _local_3, _local_4); + const _local_7: number = (_local_5 - _local_6); + let _local_8 = 0; + let _local_9 = 0; + let _local_10 = 0; + if(_local_7 == 0) + { + _local_8 = 0; + } + else + { + if(_local_5 == _local_2) + { + if(_local_3 > _local_4) + { + _local_8 = ((60 * (_local_3 - _local_4)) / _local_7); + } + else + { + _local_8 = (((60 * (_local_3 - _local_4)) / _local_7) + 360); + } + } + else + { + if(_local_5 == _local_3) + { + _local_8 = (((60 * (_local_4 - _local_2)) / _local_7) + 120); + } + else + { + if(_local_5 == _local_4) + { + _local_8 = (((60 * (_local_2 - _local_3)) / _local_7) + 240); + } + } + } + } + _local_9 = (0.5 * (_local_5 + _local_6)); + if(_local_7 == 0) + { + _local_10 = 0; + } + else + { + if(_local_9 <= 0.5) + { + _local_10 = ((_local_7 / _local_9) * 0.5); + } + else + { + _local_10 = ((_local_7 / (1 - _local_9)) * 0.5); + } + } + const _local_11: number = Math.round(((_local_8 / 360) * 0xFF)); + const _local_12: number = Math.round((_local_10 * 0xFF)); + const _local_13: number = Math.round((_local_9 * 0xFF)); + const _local_14: number = (((_local_11 << 16) + (_local_12 << 8)) + _local_13); + return _local_14; + } + + public static hslToRGB(k: number): number + { + let _local_12: number; + let _local_13: number; + let _local_14: number; + let _local_15: number; + let _local_16: number; + const _local_2: number = (((k >> 16) & 0xFF) / 0xFF); + const _local_3: number = (((k >> 8) & 0xFF) / 0xFF); + const _local_4: number = ((k & 0xFF) / 0xFF); + let _local_5 = 0; + let _local_6 = 0; + let _local_7 = 0; + if(_local_3 > 0) + { + _local_12 = 0; + _local_13 = 0; + if(_local_4 < 0.5) + { + _local_12 = (_local_4 * (1 + _local_3)); + } + else + { + _local_12 = ((_local_4 + _local_3) - (_local_4 * _local_3)); + } + _local_13 = ((2 * _local_4) - _local_12); + _local_14 = (_local_2 + (1 / 3)); + _local_15 = _local_2; + _local_16 = (_local_2 - (1 / 3)); + if(_local_14 < 0) + { + _local_14 = (_local_14 + 1); + } + else + { + if(_local_14 > 1) + { + _local_14--; + } + } + if(_local_15 < 0) + { + _local_15 = (_local_15 + 1); + } + else + { + if(_local_15 > 1) + { + _local_15--; + } + } + if(_local_16 < 0) + { + _local_16 = (_local_16 + 1); + } + else + { + if(_local_16 > 1) + { + _local_16--; + } + } + if((_local_14 * 6) < 1) + { + _local_5 = (_local_13 + (((_local_12 - _local_13) * 6) * _local_14)); + } + else + { + if((_local_14 * 2) < 1) + { + _local_5 = _local_12; + } + else + { + if((_local_14 * 3) < 2) + { + _local_5 = (_local_13 + (((_local_12 - _local_13) * 6) * ((2 / 3) - _local_14))); + } + else + { + _local_5 = _local_13; + } + } + } + if((_local_15 * 6) < 1) + { + _local_6 = (_local_13 + (((_local_12 - _local_13) * 6) * _local_15)); + } + else + { + if((_local_15 * 2) < 1) + { + _local_6 = _local_12; + } + else + { + if((_local_15 * 3) < 2) + { + _local_6 = (_local_13 + (((_local_12 - _local_13) * 6) * ((2 / 3) - _local_15))); + } + else + { + _local_6 = _local_13; + } + } + } + if((_local_16 * 6) < 1) + { + _local_7 = (_local_13 + (((_local_12 - _local_13) * 6) * _local_16)); + } + else + { + if((_local_16 * 2) < 1) + { + _local_7 = _local_12; + } + else + { + if((_local_16 * 3) < 2) + { + _local_7 = (_local_13 + (((_local_12 - _local_13) * 6) * ((2 / 3) - _local_16))); + } + else + { + _local_7 = _local_13; + } + } + } + } + else + { + _local_5 = _local_4; + _local_6 = _local_4; + _local_7 = _local_4; + } + const _local_8: number = Math.round((_local_5 * 0xFF)); + const _local_9: number = Math.round((_local_6 * 0xFF)); + const _local_10: number = Math.round((_local_7 * 0xFF)); + const _local_11: number = (((_local_8 << 16) + (_local_9 << 8)) + _local_10); + return _local_11; + } + + public static rgb2xyz(k: number): IVector3D + { + let _local_2: number = (((k >> 16) & 0xFF) / 0xFF); + let _local_3: number = (((k >> 8) & 0xFF) / 0xFF); + let _local_4: number = (((k >> 0) & 0xFF) / 0xFF); + if(_local_2 > 0.04045) + { + _local_2 = Math.pow(((_local_2 + 0.055) / 1.055), 2.4); + } + else + { + _local_2 = (_local_2 / 12.92); + } + if(_local_3 > 0.04045) + { + _local_3 = Math.pow(((_local_3 + 0.055) / 1.055), 2.4); + } + else + { + _local_3 = (_local_3 / 12.92); + } + if(_local_4 > 0.04045) + { + _local_4 = Math.pow(((_local_4 + 0.055) / 1.055), 2.4); + } + else + { + _local_4 = (_local_4 / 12.92); + } + _local_2 = (_local_2 * 100); + _local_3 = (_local_3 * 100); + _local_4 = (_local_4 * 100); + return new Vector3d((((_local_2 * 0.4124) + (_local_3 * 0.3576)) + (_local_4 * 0.1805)), (((_local_2 * 0.2126) + (_local_3 * 0.7152)) + (_local_4 * 0.0722)), (((_local_2 * 0.0193) + (_local_3 * 0.1192)) + (_local_4 * 0.9505))); + } + + public static xyz2CieLab(k: IVector3D): IVector3D + { + let _local_2: number = (k.x / 95.047); + let _local_3: number = (k.y / 100); + let _local_4: number = (k.z / 108.883); + if(_local_2 > 0.008856) + { + _local_2 = Math.pow(_local_2, (1 / 3)); + } + else + { + _local_2 = ((7.787 * _local_2) + (16 / 116)); + } + if(_local_3 > 0.008856) + { + _local_3 = Math.pow(_local_3, (1 / 3)); + } + else + { + _local_3 = ((7.787 * _local_3) + (16 / 116)); + } + if(_local_4 > 0.008856) + { + _local_4 = Math.pow(_local_4, (1 / 3)); + } + else + { + _local_4 = ((7.787 * _local_4) + (16 / 116)); + } + return new Vector3d(((116 * _local_3) - 16), (500 * (_local_2 - _local_3)), (200 * (_local_3 - _local_4))); + } + + public static rgb2CieLab(k: number): IVector3D + { + return ColorConverter.xyz2CieLab(ColorConverter.rgb2xyz(k)); + } + + public static colorize(colorA: number, colorB: number): number + { + if(colorB === 0xFFFFFFFF) return colorA; + + let r = ((colorB >> 16) & 0xFF); + let g = ((colorB >> 8) & 0xFF); + let b = (colorB & 0xFF); + + r = ((((colorA >> 16) & 0xFF) * r) / 0xFF); + g = ((((colorA >> 8) & 0xFF) * g) / 0xFF); + b = (((colorA & 0xFF) * b) / 0xFF); + + return ((colorA && 0xFF000000) | (r << 16) | (g << 8) | b); + } +} diff --git a/submodules/renderer/src/room/utils/NumberBank.ts b/submodules/renderer/src/room/utils/NumberBank.ts new file mode 100644 index 0000000..271ab1f --- /dev/null +++ b/submodules/renderer/src/room/utils/NumberBank.ts @@ -0,0 +1,54 @@ +export class NumberBank +{ + private _reservedNumbers: number[]; + private _freeNumbers: number[]; + + constructor(k: number) + { + if(k < 0) k = 0; + + this._reservedNumbers = []; + this._freeNumbers = []; + + let i = 0; + + while(i < k) + { + this._freeNumbers.push(i); + + i++; + } + } + + public dispose(): void + { + this._reservedNumbers = null; + this._freeNumbers = null; + } + + public reserveNumber(): number + { + if(this._freeNumbers.length > 0) + { + const k = this._freeNumbers.pop(); + + this._reservedNumbers.push(k); + + return k; + } + + return -1; + } + + public freeNumber(k: number): void + { + const i = this._reservedNumbers.indexOf(k); + + if(i >= 0) + { + this._reservedNumbers.splice(i, 1); + + this._freeNumbers.push(k); + } + } +} diff --git a/submodules/renderer/src/room/utils/PointMath.ts b/submodules/renderer/src/room/utils/PointMath.ts new file mode 100644 index 0000000..d01f668 --- /dev/null +++ b/submodules/renderer/src/room/utils/PointMath.ts @@ -0,0 +1,19 @@ +import { Point } from '@pixi/math'; + +export class PointMath +{ + public static sum(k: Point, _arg_2: Point): Point + { + return new Point((k.x + _arg_2.x), (k.y + _arg_2.y)); + } + + public static sub(k: Point, _arg_2: Point): Point + { + return new Point((k.x - _arg_2.x), (k.y - _arg_2.y)); + } + + public static mul(k: Point, _arg_2: number): Point + { + return new Point((k.x * _arg_2), (k.y * _arg_2)); + } +} diff --git a/submodules/renderer/src/room/utils/Rasterizer.ts b/submodules/renderer/src/room/utils/Rasterizer.ts new file mode 100644 index 0000000..df75b6f --- /dev/null +++ b/submodules/renderer/src/room/utils/Rasterizer.ts @@ -0,0 +1,130 @@ +import { Resource, Texture } from '@pixi/core'; +import { Graphics } from '@pixi/graphics'; +import { Matrix } from '@pixi/math'; +import { Sprite } from '@pixi/sprite'; +import { PixiApplicationProxy, TextureUtils } from '../../pixi-proxy'; + +export class Rasterizer +{ + // public static line(k:BitmapData, _arg_2: Point, _arg_3: Point, _arg_4: number): void + // { + // var _local_5: number; + // var _local_6: number; + // var _local_7: number; + // var _local_8: number; + // var _local_9: number; + // var _local_10: number; + // var _local_11: number = _arg_2.x; + // var _local_12: number = _arg_2.y; + // _local_5 = (_arg_3.x - _arg_2.x); + // _local_6 = (_arg_3.y - _arg_2.y); + // _local_8 = ((_local_5 > 0) ? 1 : -1); + // _local_9 = ((_local_6 > 0) ? 1 : -1); + // _local_5 = Math.abs(_local_5); + // _local_6 = Math.abs(_local_6); + // k.lock(); + // k.setPixel32(_local_11, _local_12, _arg_4); + // if (((_local_5 == 0) && (_local_6 == 0))) + // { + // return; + // } + // if (_local_5 > _local_6) + // { + // _local_7 = (_local_5 - 1); + // while (_local_7 >= 0) + // { + // _local_10 = (_local_10 + _local_6); + // _local_11 = (_local_11 + _local_8); + // if (_local_10 >= (_local_5 / 2)) + // { + // _local_10 = (_local_10 - _local_5); + // _local_12 = (_local_12 + _local_9); + // } + // k.setPixel32(_local_11, _local_12, _arg_4); + // _local_7--; + // } + // } + // else + // { + // _local_7 = (_local_6 - 1); + // while (_local_7 >= 0) + // { + // _local_10 = (_local_10 + _local_5); + // _local_12 = (_local_12 + _local_9); + // if (_local_10 >= (_local_6 / 2)) + // { + // _local_10 = (_local_10 - _local_6); + // _local_11 = (_local_11 + _local_8); + // } + // k.setPixel32(_local_11, _local_12, _arg_4); + // _local_7--; + // } + // } + // k.setPixel32(_arg_3.x, _arg_3.y, _arg_4); + // k.unlock(); + // } + + public static getFlipHBitmapData(k: Texture): Texture + { + if(!k) return null; + + const renderTexture = TextureUtils.createRenderTexture(k.width, k.height); + + const matrix = new Matrix(); + + matrix.scale(-1, 1); + matrix.translate(k.width, 0); + + PixiApplicationProxy.instance.renderer.render(new Sprite(k), { + renderTexture, + clear: true, + transform: matrix + }); + + return renderTexture; + } + + public static getFlipVBitmapData(k: Texture): Texture + { + if(!k) return null; + + const matrix = new Matrix(); + + matrix.scale(1, -1); + matrix.translate(0, k.height); + + const graphic = new Graphics(); + + graphic + .beginTextureFill({ + texture: k, + matrix + }) + .drawRect(0, 0, k.width, k.height) + .endFill(); + + return TextureUtils.generateTexture(graphic); + } + + public static getFlipHVBitmapData(k: Texture): Texture + { + if(!k) return null; + + const matrix = new Matrix(); + + matrix.scale(-1, -1); + matrix.translate(k.width, k.height); + + const graphic = new Graphics(); + + graphic + .beginTextureFill({ + texture: k, + matrix + }) + .drawRect(0, 0, k.width, k.height) + .endFill(); + + return TextureUtils.generateTexture(graphic); + } +} diff --git a/submodules/renderer/src/room/utils/RoomEnterEffect.ts b/submodules/renderer/src/room/utils/RoomEnterEffect.ts new file mode 100644 index 0000000..407aaf5 --- /dev/null +++ b/submodules/renderer/src/room/utils/RoomEnterEffect.ts @@ -0,0 +1,78 @@ +import { GetTickerTime } from '../../pixi-proxy'; + +export class RoomEnterEffect +{ + public static STATE_NOT_INITIALIZED: number = 0; + public static STATE_START_DELAY: number = 1; + public static STATE_RUNNING: number = 2; + public static STATE_OVER: number = 3; + + private static _state: number = RoomEnterEffect.STATE_NOT_INITIALIZED; + private static _visualizationOn: boolean = false; + private static _currentDelta: number = 0; + private static _initializationTimeMs: number = 0; + private static _startDelayMs: number = (20 * 1000); + private static _effectDurationMs: number = 2000; + + public static init(delay: number, duration: number): void + { + RoomEnterEffect._currentDelta = 0; + RoomEnterEffect._startDelayMs = delay; + RoomEnterEffect._effectDurationMs = duration; + RoomEnterEffect._initializationTimeMs = GetTickerTime(); + RoomEnterEffect._state = RoomEnterEffect.STATE_START_DELAY; + } + + public static turnVisualizationOn(): void + { + if((RoomEnterEffect._state === RoomEnterEffect.STATE_NOT_INITIALIZED) || (RoomEnterEffect._state === RoomEnterEffect.STATE_OVER)) return; + + const k = (GetTickerTime() - RoomEnterEffect._initializationTimeMs); + + if(k > (RoomEnterEffect._startDelayMs + RoomEnterEffect._effectDurationMs)) + { + RoomEnterEffect._state = RoomEnterEffect.STATE_OVER; + + return; + } + + RoomEnterEffect._visualizationOn = true; + + if(k < RoomEnterEffect._startDelayMs) + { + RoomEnterEffect._state = RoomEnterEffect.STATE_START_DELAY; + + return; + } + + RoomEnterEffect._state = RoomEnterEffect.STATE_RUNNING; + RoomEnterEffect._currentDelta = ((k - RoomEnterEffect._startDelayMs) / RoomEnterEffect._effectDurationMs); + } + + public static turnVisualizationOff(): void + { + RoomEnterEffect._visualizationOn = false; + } + + public static isVisualizationOn(): boolean + { + return (RoomEnterEffect._visualizationOn) && (RoomEnterEffect.isRunning()); + } + + public static isRunning(): boolean + { + if((RoomEnterEffect._state === RoomEnterEffect.STATE_START_DELAY) || (RoomEnterEffect._state === RoomEnterEffect.STATE_RUNNING)) return true; + + return false; + } + + public static getDelta(k: number = 0, _arg_2: number = 1): number + { + return Math.min(Math.max(RoomEnterEffect._currentDelta, k), _arg_2); + } + + public static get totalRunningTime(): number + { + return RoomEnterEffect._startDelayMs + RoomEnterEffect._effectDurationMs; + } +} diff --git a/submodules/renderer/src/room/utils/RoomGeometry.ts b/submodules/renderer/src/room/utils/RoomGeometry.ts new file mode 100644 index 0000000..45885e1 --- /dev/null +++ b/submodules/renderer/src/room/utils/RoomGeometry.ts @@ -0,0 +1,431 @@ +import { Point } from '@pixi/math'; +import { IRoomGeometry, IVector3D, Vector3d } from '../../api'; + +export class RoomGeometry implements IRoomGeometry +{ + public static SCALE_ZOOMED_IN: number = 64; + public static SCALE_ZOOMED_OUT: number = 32; + + private _updateId: number = 0; + private _x: IVector3D; + private _y: IVector3D; + private _z: IVector3D; + private _directionAxis: IVector3D; + private _location: IVector3D; + private _direction: IVector3D; + private _depth: IVector3D; + private _scale: number = 1; + private _x_scale: number = 1; + private _y_scale: number = 1; + private _z_scale: number = 1; + private _x_scale_internal: number = 1; + private _y_scale_internal: number = 1; + private _z_scale_internal: number = 1; + private _loc: IVector3D; + private _dir: IVector3D; + private _clipNear: number = -500; + private _clipFar: number = 500; + private _displacements: Map = null; + + constructor(scale: number, direction: IVector3D, location: IVector3D, _arg_4: IVector3D = null) + { + this.scale = scale; + this._x = new Vector3d(); + this._y = new Vector3d(); + this._z = new Vector3d(); + this._directionAxis = new Vector3d(); + this._location = new Vector3d(); + this._direction = new Vector3d(); + this._depth = new Vector3d(); + this._x_scale_internal = 1; + this._y_scale_internal = 1; + this.x_scale = 1; + this.y_scale = 1; + this._z_scale_internal = (Math.sqrt((1 / 2)) / Math.sqrt((3 / 4))); + this.z_scale = 1; + this.location = new Vector3d(location.x, location.y, location.z); + this.direction = new Vector3d(direction.x, direction.y, direction.z); + if(_arg_4 != null) + { + this.setDepthVector(_arg_4); + } + else + { + this.setDepthVector(direction); + } + this._displacements = new Map(); + } + + public static getIntersectionVector(k: IVector3D, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D): IVector3D + { + const _local_5: number = Vector3d.dotProduct(_arg_2, _arg_4); + if(Math.abs(_local_5) < 1E-5) + { + return null; + } + const _local_6: IVector3D = Vector3d.dif(k, _arg_3); + const _local_7: number = (-(Vector3d.dotProduct(_arg_4, _local_6)) / _local_5); + const _local_8: IVector3D = Vector3d.sum(k, Vector3d.product(_arg_2, _local_7)); + return _local_8; + } + + + public get updateId(): number + { + return this._updateId; + } + + public get scale(): number + { + return this._scale / Math.sqrt(0.5); + } + + public set scale(scale: number) + { + if(scale <= 1) + { + scale = 1; + } + scale = (scale * Math.sqrt(0.5)); + if(scale != this._scale) + { + this._scale = scale; + this._updateId++; + } + } + + public get directionAxis(): IVector3D + { + return this._directionAxis; + } + + public get location(): IVector3D + { + this._location.assign(this._loc); + this._location.x = (this._location.x * this._x_scale); + this._location.y = (this._location.y * this._y_scale); + this._location.z = (this._location.z * this._z_scale); + return this._location; + } + + public set location(location: IVector3D) + { + if(location == null) + { + return; + } + if(this._loc == null) + { + this._loc = new Vector3d(); + } + const _local_2: number = this._loc.x; + const _local_3: number = this._loc.y; + const _local_4: number = this._loc.z; + this._loc.assign(location); + this._loc.x = (this._loc.x / this._x_scale); + this._loc.y = (this._loc.y / this._y_scale); + this._loc.z = (this._loc.z / this._z_scale); + if((((!(this._loc.x == _local_2)) || (!(this._loc.y == _local_3))) || (!(this._loc.z == _local_4)))) + { + this._updateId++; + } + } + + public get direction(): IVector3D + { + return this._direction; + } + + public set direction(direction: IVector3D) + { + let _local_21: number; + let _local_22: number; + let _local_23: IVector3D; + let _local_24: IVector3D; + let _local_25: IVector3D; + if(direction == null) + { + return; + } + if(this._dir == null) + { + this._dir = new Vector3d(); + } + const _local_2: number = this._dir.x; + const _local_3: number = this._dir.y; + const _local_4: number = this._dir.z; + this._dir.assign(direction); + this._direction.assign(direction); + if((((!(this._dir.x == _local_2)) || (!(this._dir.y == _local_3))) || (!(this._dir.z == _local_4)))) + { + this._updateId++; + } + const _local_5: IVector3D = new Vector3d(0, 1, 0); + const _local_6: IVector3D = new Vector3d(0, 0, 1); + const _local_7: IVector3D = new Vector3d(1, 0, 0); + const _local_8: number = ((direction.x / 180) * Math.PI); + const _local_9: number = ((direction.y / 180) * Math.PI); + const _local_10: number = ((direction.z / 180) * Math.PI); + const _local_11: number = Math.cos(_local_8); + const _local_12: number = Math.sin(_local_8); + const _local_13: IVector3D = Vector3d.sum(Vector3d.product(_local_5, _local_11), Vector3d.product(_local_7, -(_local_12))); + const _local_14: IVector3D = new Vector3d(_local_6.x, _local_6.y, _local_6.z); + const _local_15: IVector3D = Vector3d.sum(Vector3d.product(_local_5, _local_12), Vector3d.product(_local_7, _local_11)); + const _local_16: number = Math.cos(_local_9); + const _local_17: number = Math.sin(_local_9); + const _local_18: IVector3D = new Vector3d(_local_13.x, _local_13.y, _local_13.z); + const _local_19: IVector3D = Vector3d.sum(Vector3d.product(_local_14, _local_16), Vector3d.product(_local_15, _local_17)); + const _local_20: IVector3D = Vector3d.sum(Vector3d.product(_local_14, -(_local_17)), Vector3d.product(_local_15, _local_16)); + if(_local_10 != 0) + { + _local_21 = Math.cos(_local_10); + _local_22 = Math.sin(_local_10); + _local_23 = Vector3d.sum(Vector3d.product(_local_18, _local_21), Vector3d.product(_local_19, _local_22)); + _local_24 = Vector3d.sum(Vector3d.product(_local_18, -(_local_22)), Vector3d.product(_local_19, _local_21)); + _local_25 = new Vector3d(_local_20.x, _local_20.y, _local_20.z); + this._x.assign(_local_23); + this._y.assign(_local_24); + this._z.assign(_local_25); + this._directionAxis.assign(this._z); + } + else + { + this._x.assign(_local_18); + this._y.assign(_local_19); + this._z.assign(_local_20); + this._directionAxis.assign(this._z); + } + } + + public set x_scale(xScale: number) + { + if(this._x_scale != (xScale * this._x_scale_internal)) + { + this._x_scale = (xScale * this._x_scale_internal); + this._updateId++; + } + } + + public set y_scale(yScale: number) + { + if(this._y_scale != (yScale * this._y_scale_internal)) + { + this._y_scale = (yScale * this._y_scale_internal); + this._updateId++; + } + } + + public set z_scale(zScale: number) + { + if(this._z_scale != (zScale * this._z_scale_internal)) + { + this._z_scale = (zScale * this._z_scale_internal); + this._updateId++; + } + } + + public dispose(): void + { + this._x = null; + this._y = null; + this._z = null; + this._loc = null; + this._dir = null; + this._directionAxis = null; + this._location = null; + if(this._displacements != null) + { + this._displacements.clear(); + this._displacements = null; + } + } + + public setDisplacement(k: IVector3D, _arg_2: IVector3D): void + { + let _local_3: string; + let _local_4: IVector3D; + if(((k == null) || (_arg_2 == null))) + { + return; + } + if(this._displacements != null) + { + _local_3 = Math.trunc(Math.round(k.x)) + '_' + Math.trunc(Math.round(k.y)) + '_' + Math.trunc(Math.round(k.z)); + this._displacements.delete(_local_3); + _local_4 = new Vector3d(); + _local_4.assign(_arg_2); + this._displacements.set(_local_3, _local_4); + this._updateId++; + } + } + + private getDisplacenent(k: IVector3D): IVector3D + { + let _local_2: string; + if(this._displacements != null) + { + _local_2 = Math.trunc(Math.round(k.x)) + '_' + Math.trunc(Math.round(k.y)) + '_' + Math.trunc(Math.round(k.z)); + return this._displacements.get(_local_2); + } + return null; + } + + public setDepthVector(k: IVector3D): void + { + let _local_18: number; + let _local_19: number; + let _local_20: IVector3D; + let _local_21: IVector3D; + let _local_22: IVector3D; + const _local_2: IVector3D = new Vector3d(0, 1, 0); + const _local_3: IVector3D = new Vector3d(0, 0, 1); + const _local_4: IVector3D = new Vector3d(1, 0, 0); + const _local_5: number = ((k.x / 180) * Math.PI); + const _local_6: number = ((k.y / 180) * Math.PI); + const _local_7: number = ((k.z / 180) * Math.PI); + const _local_8: number = Math.cos(_local_5); + const _local_9: number = Math.sin(_local_5); + const _local_10: IVector3D = Vector3d.sum(Vector3d.product(_local_2, _local_8), Vector3d.product(_local_4, -(_local_9))); + const _local_11: IVector3D = new Vector3d(_local_3.x, _local_3.y, _local_3.z); + const _local_12: IVector3D = Vector3d.sum(Vector3d.product(_local_2, _local_9), Vector3d.product(_local_4, _local_8)); + const _local_13: number = Math.cos(_local_6); + const _local_14: number = Math.sin(_local_6); + const _local_15: IVector3D = new Vector3d(_local_10.x, _local_10.y, _local_10.z); + const _local_16: IVector3D = Vector3d.sum(Vector3d.product(_local_11, _local_13), Vector3d.product(_local_12, _local_14)); + const _local_17: IVector3D = Vector3d.sum(Vector3d.product(_local_11, -(_local_14)), Vector3d.product(_local_12, _local_13)); + if(_local_7 != 0) + { + _local_18 = Math.cos(_local_7); + _local_19 = Math.sin(_local_7); + _local_20 = Vector3d.sum(Vector3d.product(_local_15, _local_18), Vector3d.product(_local_16, _local_19)); + _local_21 = Vector3d.sum(Vector3d.product(_local_15, -(_local_19)), Vector3d.product(_local_16, _local_18)); + _local_22 = new Vector3d(_local_17.x, _local_17.y, _local_17.z); + this._depth.assign(_local_22); + } + else + { + this._depth.assign(_local_17); + } + this._updateId++; + } + + public adjustLocation(k: IVector3D, _arg_2: number): void + { + if(((k == null) || (this._z == null))) + { + return; + } + const _local_3: IVector3D = Vector3d.product(this._z, -(_arg_2)); + const _local_4: IVector3D = new Vector3d((k.x + _local_3.x), (k.y + _local_3.y), (k.z + _local_3.z)); + this.location = _local_4; + } + + public getCoordinatePosition(k: IVector3D): IVector3D + { + if(k == null) + { + return null; + } + const _local_2: number = Vector3d.scalarProjection(k, this._x); + const _local_3: number = Vector3d.scalarProjection(k, this._y); + const _local_4: number = Vector3d.scalarProjection(k, this._z); + const _local_5: IVector3D = new Vector3d(_local_2, _local_3, _local_4); + return _local_5; + } + + public getScreenPosition(k: IVector3D): IVector3D + { + let _local_2: IVector3D = Vector3d.dif(k, this._loc); + _local_2.x = (_local_2.x * this._x_scale); + _local_2.y = (_local_2.y * this._y_scale); + _local_2.z = (_local_2.z * this._z_scale); + let _local_3: number = Vector3d.scalarProjection(_local_2, this._depth); + if(((_local_3 < this._clipNear) || (_local_3 > this._clipFar))) + { + return null; + } + let _local_4: number = Vector3d.scalarProjection(_local_2, this._x); + let _local_5: number = -(Vector3d.scalarProjection(_local_2, this._y)); + _local_4 = (_local_4 * this._scale); + _local_5 = (_local_5 * this._scale); + const _local_6: IVector3D = this.getDisplacenent(k); + if(_local_6 != null) + { + _local_2 = Vector3d.dif(k, this._loc); + _local_2.add(_local_6); + _local_2.x = (_local_2.x * this._x_scale); + _local_2.y = (_local_2.y * this._y_scale); + _local_2.z = (_local_2.z * this._z_scale); + _local_3 = Vector3d.scalarProjection(_local_2, this._depth); + } + _local_2.x = _local_4; + _local_2.y = _local_5; + _local_2.z = _local_3; + return _local_2; + } + + public getScreenPoint(k: IVector3D): Point + { + const _local_2: IVector3D = this.getScreenPosition(k); + if(_local_2 == null) + { + return null; + } + const _local_3: Point = new Point(_local_2.x, _local_2.y); + return _local_3; + } + + public getPlanePosition(k: Point, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D): Point + { + let _local_15: number; + let _local_16: number; + const _local_5: number = (k.x / this._scale); + const _local_6: number = (-(k.y) / this._scale); + const _local_7: IVector3D = Vector3d.product(this._x, _local_5); + _local_7.add(Vector3d.product(this._y, _local_6)); + const _local_8: IVector3D = new Vector3d((this._loc.x * this._x_scale), (this._loc.y * this._y_scale), (this._loc.z * this._z_scale)); + _local_8.add(_local_7); + const _local_9: IVector3D = this._z; + const _local_10: IVector3D = new Vector3d((_arg_2.x * this._x_scale), (_arg_2.y * this._y_scale), (_arg_2.z * this._z_scale)); + const _local_11: IVector3D = new Vector3d((_arg_3.x * this._x_scale), (_arg_3.y * this._y_scale), (_arg_3.z * this._z_scale)); + const _local_12: IVector3D = new Vector3d((_arg_4.x * this._x_scale), (_arg_4.y * this._y_scale), (_arg_4.z * this._z_scale)); + const _local_13: IVector3D = Vector3d.crossProduct(_local_11, _local_12); + const _local_14: IVector3D = new Vector3d(); + _local_14.assign(RoomGeometry.getIntersectionVector(_local_8, _local_9, _local_10, _local_13)); + if(_local_14 != null) + { + _local_14.subtract(_local_10); + _local_15 = ((Vector3d.scalarProjection(_local_14, _arg_3) / _local_11.length) * _arg_3.length); + _local_16 = ((Vector3d.scalarProjection(_local_14, _arg_4) / _local_12.length) * _arg_4.length); + return new Point(_local_15, _local_16); + } + return null; + } + + public performZoom(): void + { + if(this.isZoomedIn()) + { + this.scale = RoomGeometry.SCALE_ZOOMED_OUT; + } + else + { + this.scale = RoomGeometry.SCALE_ZOOMED_IN; + } + } + + public isZoomedIn(): boolean + { + return this.scale == RoomGeometry.SCALE_ZOOMED_IN; + } + + public performZoomOut(): void + { + this.scale = RoomGeometry.SCALE_ZOOMED_OUT; + } + + public performZoomIn(): void + { + this.scale = RoomGeometry.SCALE_ZOOMED_IN; + } +} diff --git a/submodules/renderer/src/room/utils/RoomId.ts b/submodules/renderer/src/room/utils/RoomId.ts new file mode 100644 index 0000000..8df53a0 --- /dev/null +++ b/submodules/renderer/src/room/utils/RoomId.ts @@ -0,0 +1,14 @@ +export class RoomId +{ + private static PREVIEW_ROOM_ID_BASE: number = 0x7FFF0000; + + public static makeRoomPreviewerId(roomId: number): number + { + return (roomId & 0xFFFF) + RoomId.PREVIEW_ROOM_ID_BASE; + } + + public static isRoomPreviewerId(roomId: number): boolean + { + return (roomId >= RoomId.PREVIEW_ROOM_ID_BASE); + } +} diff --git a/submodules/renderer/src/room/utils/RoomRotatingEffect.ts b/submodules/renderer/src/room/utils/RoomRotatingEffect.ts new file mode 100644 index 0000000..8b2e313 --- /dev/null +++ b/submodules/renderer/src/room/utils/RoomRotatingEffect.ts @@ -0,0 +1,75 @@ +import { GetTickerTime } from '../../pixi-proxy'; + +export class RoomRotatingEffect +{ + public static STATE_NOT_INITIALIZED: number = 0; + public static STATE_START_DELAY: number = 1; + public static STATE_RUNNING: number = 2; + public static STATE_OVER: number = 3; + + private static _SafeStr_448: number = 0; + private static _SafeStr_4512: boolean = false; + private static _SafeStr_4513: number = 0; + private static _SafeStr_4514: number = 0; + private static _SafeStr_4515: number = 20000; + private static _SafeStr_4516: number = 5000; + private static _SafeStr_4524: ReturnType; + + public static init(_arg_1: number, _arg_2: number): void + { + this._SafeStr_4513 = 0; + this._SafeStr_4515 = _arg_1; + this._SafeStr_4516 = _arg_2; + this._SafeStr_4514 = GetTickerTime(); + this._SafeStr_448 = 1; + } + + public static turnVisualizationOn(): void + { + if((this._SafeStr_448 === 0) || (this._SafeStr_448 === 3)) return; + + if(!this._SafeStr_4524) this._SafeStr_4524 = setTimeout(() => this.turnVisualizationOff(), this._SafeStr_4516); + + const _local_1 = (GetTickerTime() - this._SafeStr_4514); + + if(_local_1 > (this._SafeStr_4515 + this._SafeStr_4516)) + { + this._SafeStr_448 = 3; + + return; + } + + this._SafeStr_4512 = true; + + if(_local_1 < this._SafeStr_4515) + { + this._SafeStr_448 = 1; + + return; + } + + this._SafeStr_448 = 2; + this._SafeStr_4513 = ((_local_1 - this._SafeStr_4515) / this._SafeStr_4516); + } + + public static turnVisualizationOff(): void + { + this._SafeStr_4512 = false; + + clearTimeout(this._SafeStr_4524); + + this._SafeStr_4524 = null; + } + + public static isVisualizationOn(): boolean + { + return (this._SafeStr_4512 && this.isRunning()); + } + + private static isRunning(): boolean + { + if((this._SafeStr_448 === 1) || (this._SafeStr_448 === 2)) return true; + + return false; + } +} diff --git a/submodules/renderer/src/room/utils/RoomShakingEffect.ts b/submodules/renderer/src/room/utils/RoomShakingEffect.ts new file mode 100644 index 0000000..5fd142e --- /dev/null +++ b/submodules/renderer/src/room/utils/RoomShakingEffect.ts @@ -0,0 +1,75 @@ +import { GetTickerTime } from '../../pixi-proxy'; + +export class RoomShakingEffect +{ + public static STATE_NOT_INITIALIZED: number = 0; + public static STATE_START_DELAY: number = 1; + public static STATE_RUNNING: number = 2; + public static STATE_OVER: number = 3; + + private static _SafeStr_448: number = 0; + private static _SafeStr_4512: boolean = false; + private static _SafeStr_4513: number; + private static _SafeStr_4514: number = 0; + private static _SafeStr_4515: number = 20000; + private static _SafeStr_4516: number = 5000; + private static _SafeStr_4524: ReturnType; + + public static init(_arg_1: number, _arg_2: number): void + { + this._SafeStr_4513 = 0; + this._SafeStr_4515 = _arg_1; + this._SafeStr_4516 = _arg_2; + this._SafeStr_4514 = GetTickerTime(); + this._SafeStr_448 = 1; + } + + public static turnVisualizationOn(): void + { + if((this._SafeStr_448 === 0) || (this._SafeStr_448 === 3)) return; + + if(!this._SafeStr_4524) this._SafeStr_4524 = setTimeout(() => this.turnVisualizationOff(), this._SafeStr_4516); + + const _local_1 = (GetTickerTime() - this._SafeStr_4514); + + if(_local_1 > (this._SafeStr_4515 + this._SafeStr_4516)) + { + this._SafeStr_448 = 3; + + return; + } + + this._SafeStr_4512 = true; + + if(_local_1 < this._SafeStr_4515) + { + this._SafeStr_448 = 1; + + return; + } + + this._SafeStr_448 = 2; + this._SafeStr_4513 = ((_local_1 - this._SafeStr_4515) / this._SafeStr_4516); + } + + public static turnVisualizationOff(): void + { + this._SafeStr_4512 = false; + + clearTimeout(this._SafeStr_4524); + + this._SafeStr_4524 = null; + } + + public static isVisualizationOn(): boolean + { + return (this._SafeStr_4512 && this.isRunning()); + } + + private static isRunning(): boolean + { + if((this._SafeStr_448 === 1) || (this._SafeStr_448 === 2)) return true; + + return false; + } +} diff --git a/submodules/renderer/src/room/utils/SpriteUtilities.ts b/submodules/renderer/src/room/utils/SpriteUtilities.ts new file mode 100644 index 0000000..4cd5f31 --- /dev/null +++ b/submodules/renderer/src/room/utils/SpriteUtilities.ts @@ -0,0 +1,20 @@ +import { BLEND_MODES } from '@pixi/constants'; + +export class SpriteUtilities +{ + public static hex2int(hex: string): number + { + return parseInt(hex, 16); + } + + public static inkToBlendMode(ink: string | number): number + { + if(ink == 'ADD' || ink == 33) return BLEND_MODES.ADD; + + if(ink == 'SUBTRACT') return BLEND_MODES.SUBTRACT; + + if(ink == 'DARKEN') return BLEND_MODES.DARKEN; + + return BLEND_MODES.NORMAL; + } +} diff --git a/submodules/renderer/src/room/utils/index.ts b/submodules/renderer/src/room/utils/index.ts new file mode 100644 index 0000000..3320cc3 --- /dev/null +++ b/submodules/renderer/src/room/utils/index.ts @@ -0,0 +1,10 @@ +export * from './ColorConverter'; +export * from './NumberBank'; +export * from './PointMath'; +export * from './Rasterizer'; +export * from './RoomEnterEffect'; +export * from './RoomGeometry'; +export * from './RoomId'; +export * from './RoomRotatingEffect'; +export * from './RoomShakingEffect'; +export * from './SpriteUtilities'; diff --git a/submodules/renderer/tsconfig.json b/submodules/renderer/tsconfig.json new file mode 100644 index 0000000..6b1f315 --- /dev/null +++ b/submodules/renderer/tsconfig.json @@ -0,0 +1,35 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "baseUrl": "./src", + "outDir": "./dist", + "sourceMap": false, + "declaration": true, + "experimentalDecorators": true, + "moduleResolution": "Node", + "esModuleInterop": true, + "importHelpers": true, + "isolatedModules": true, + "resolveJsonModule": true, + "downlevelIteration": true, + "allowSyntheticDefaultImports": true, + "allowJs": true, + "skipLibCheck": true, + "noEmit": true, + "target": "ES6", + "lib": [ + "DOM", + "DOM.Iterable", + "ESNext" + ], + "module": "ES6", + "paths": { + "mini-signals": [ + "node_modules/mini-signals/index.js" + ] + }, + }, + "include": [ + "src" + ] +} diff --git a/submodules/renderer/vite.config.js b/submodules/renderer/vite.config.js new file mode 100644 index 0000000..40ccd6b --- /dev/null +++ b/submodules/renderer/vite.config.js @@ -0,0 +1,36 @@ +// vite.config.js +import typescript from '@rollup/plugin-typescript'; +import { resolve } from 'path'; +import { defineConfig } from 'vite'; +import { ViteMinifyPlugin } from 'vite-plugin-minify'; + +const resolvePath = str => resolve(__dirname, str); + +export default defineConfig({ + plugins: [ + typescript({ + 'target': 'es6', + 'rootDir': resolvePath('./src'), + 'declaration': true, + exclude: resolvePath('./node_modules/**'), + allowSyntheticDefaultImports: true + }), + ViteMinifyPlugin() + ], + build: { + lib: { + entry: resolve(__dirname, 'src/index.ts'), + name: 'nitro-renderer', + fileName: 'nitro-renderer' + } + }, + resolve: { + alias: { + '@': resolve(__dirname, 'src'), + '~': resolve(__dirname, 'node_modules') + } + }, + server: { + host: '127.0.0.1' + } +}); diff --git a/submodules/renderer/yarn.lock b/submodules/renderer/yarn.lock new file mode 100644 index 0000000..885907f --- /dev/null +++ b/submodules/renderer/yarn.lock @@ -0,0 +1,1564 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@esbuild/android-arm64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.16.9.tgz#474da719599f99d820ec010c92846a4f685fa28a" + integrity sha512-ndIAZJUeLx4O+4AJbFQCurQW4VRUXjDsUvt1L+nP8bVELOWdmdCEOtlIweCUE6P+hU0uxYbEK2AEP0n5IVQvhg== + +"@esbuild/android-arm@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.16.9.tgz#b0747ec074bba3ca652bfa8de3f55acfbb2d259e" + integrity sha512-kW5ccqWHVOOTGUkkJbtfoImtqu3kA1PFkivM+9QPFSHphPfPBlBalX9eDRqPK+wHCqKhU48/78T791qPgC9e9A== + +"@esbuild/android-x64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.16.9.tgz#1cd75e8ed7d6d7eb5f9896f623df63882bd8e887" + integrity sha512-UbMcJB4EHrAVOnknQklREPgclNU2CPet2h+sCBCXmF2mfoYWopBn/CfTfeyOkb/JglOcdEADqAljFndMKnFtOw== + +"@esbuild/darwin-arm64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.16.9.tgz#820c88738cd97621737abcd5f05400ae5e0c66e6" + integrity sha512-d7D7/nrt4CxPul98lx4PXhyNZwTYtbdaHhOSdXlZuu5zZIznjqtMqLac8Bv+IuT6SVHiHUwrkL6ywD7mOgLW+A== + +"@esbuild/darwin-x64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.16.9.tgz#5a19c00781595e0dfeef1826b3512d04c37b98ff" + integrity sha512-LZc+Wlz06AkJYtwWsBM3x2rSqTG8lntDuftsUNQ3fCx9ZttYtvlDcVtgb+NQ6t9s6K5No5zutN3pcjZEC2a4iQ== + +"@esbuild/freebsd-arm64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.16.9.tgz#2b7c16f5d15c259ed279b293b97c28c4a4bb107f" + integrity sha512-gIj0UQZlQo93CHYouHKkpzP7AuruSaMIm1etcWIxccFEVqCN1xDr6BWlN9bM+ol/f0W9w3hx3HDuEwcJVtGneQ== + +"@esbuild/freebsd-x64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.16.9.tgz#2db48ffeeab149c2b970494a60b82bf3004b8630" + integrity sha512-GNors4vaMJ7lzGOuhzNc7jvgsQZqErGA8rsW+nck8N1nYu86CvsJW2seigVrQQWOV4QzEP8Zf3gm+QCjA2hnBQ== + +"@esbuild/linux-arm64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.16.9.tgz#4c63c9f8ddd690d140ac3e0f360226d3fcdd75d8" + integrity sha512-YPxQunReYp8RQ1FvexFrOEqqf+nLbS3bKVZF5FRT2uKM7Wio7BeATqAwO02AyrdSEntt3I5fhFsujUChIa8CZg== + +"@esbuild/linux-arm@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.16.9.tgz#7704de1c2a30bc68d8f615d3ecb1cf68f001256a" + integrity sha512-cNx1EF99c2t1Ztn0lk9N+MuwBijGF8mH6nx9GFsB3e0lpUpPkCE/yt5d+7NP9EwJf5uzqdjutgVYoH1SNqzudA== + +"@esbuild/linux-ia32@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.16.9.tgz#bf0fda9f046e6c8332d7c8350b8a94d63acb4ceb" + integrity sha512-zb12ixDIKNwFpIqR00J88FFitVwOEwO78EiUi8wi8FXlmSc3GtUuKV/BSO+730Kglt0B47+ZrJN1BhhOxZaVrw== + +"@esbuild/linux-loong64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.16.9.tgz#c16378b898fa38f5f788f76fbce16a45c49c8793" + integrity sha512-X8te4NLxtHiNT6H+4Pfm5RklzItA1Qy4nfyttihGGX+Koc53Ar20ViC+myY70QJ8PDEOehinXZj/F7QK3A+MKQ== + +"@esbuild/linux-mips64el@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.16.9.tgz#492605f13f19dc06c350d94e4048c21478b9dec4" + integrity sha512-ZqyMDLt02c5smoS3enlF54ndK5zK4IpClLTxF0hHfzHJlfm4y8IAkIF8LUW0W7zxcKy7oAwI7BRDqeVvC120SA== + +"@esbuild/linux-ppc64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.16.9.tgz#ccaf759fc4f7a5fe72bdac05b4f5bf18ef1fe01b" + integrity sha512-k+ca5W5LDBEF3lfDwMV6YNXwm4wEpw9krMnNvvlNz3MrKSD2Eb2c861O0MaKrZkG/buTQAP4vkavbLwgIe6xjg== + +"@esbuild/linux-riscv64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.16.9.tgz#542d0e68bc99fb658fe732b0917931c09775f1a3" + integrity sha512-GuInVdogjmg9DhgkEmNipHkC+3tzkanPJzgzTC2ihsvrruLyFoR1YrTGixblNSMPudQLpiqkcwGwwe0oqfrvfA== + +"@esbuild/linux-s390x@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.16.9.tgz#4398f9d9d64dba4cfa6eed267476eaa9c9b7f214" + integrity sha512-49wQ0aYkvwXonGsxc7LuuLNICMX8XtO92Iqmug5Qau0kpnV6SP34jk+jIeu4suHwAbSbRhVFtDv75yRmyfQcHw== + +"@esbuild/linux-x64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.16.9.tgz#67c6b418ef36addbca17af0d7a2274c37ddffba2" + integrity sha512-Nx4oKEAJ6EcQlt4dK7qJyuZUoXZG7CAeY22R7rqZijFzwFfMOD+gLP56uV7RrV86jGf8PeRY8TBsRmOcZoG42w== + +"@esbuild/netbsd-x64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.16.9.tgz#22ed58e404ebeb2475b821bc4e25f1027eb0c912" + integrity sha512-d0WnpgJ+FTiMZXEQ1NOv9+0gvEhttbgKEvVqWWAtl1u9AvlspKXbodKHzQ5MLP6YV1y52Xp+p8FMYqj8ykTahg== + +"@esbuild/openbsd-x64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.16.9.tgz#2b2597b4edd4d26946f7c56838680fbeb4d455eb" + integrity sha512-jccK11278dvEscHFfMk5EIPjF4wv1qGD0vps7mBV1a6TspdR36O28fgPem/SA/0pcsCPHjww5ouCLwP+JNAFlw== + +"@esbuild/sunos-x64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.16.9.tgz#c132603a19ef79c0d7bd95afb09f41618ea8dda2" + integrity sha512-OetwTSsv6mIDLqN7I7I2oX9MmHGwG+AP+wKIHvq+6sIHwcPPJqRx+DJB55jy9JG13CWcdcQno/7V5MTJ5a0xfQ== + +"@esbuild/win32-arm64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.16.9.tgz#bf74d007d7f0fe1fe32c4fff82d27b271b3e1d58" + integrity sha512-tKSSSK6unhxbGbHg+Cc+JhRzemkcsX0tPBvG0m5qsWbkShDK9c+/LSb13L18LWVdOQZwuA55Vbakxmt6OjBDOQ== + +"@esbuild/win32-ia32@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.16.9.tgz#e46478e77431bca1a8b80f6260fc6b0020aa8127" + integrity sha512-ZTQ5vhNS5gli0KK8I6/s6+LwXmNEfq1ftjnSVyyNm33dBw8zDpstqhGXYUbZSWWLvkqiRRjgxgmoncmi6Yy7Ng== + +"@esbuild/win32-x64@0.16.9": + version "0.16.9" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.16.9.tgz#4595a29c2930c5157aa1be0963abbbac989647c9" + integrity sha512-C4ZX+YFIp6+lPrru3tpH6Gaapy8IBRHw/e7l63fzGDhn/EaiGpQgbIlT5paByyy+oMvRFQoxxyvC4LE0AjJMqQ== + +"@eslint/eslintrc@^1.3.3": + version "1.3.3" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.3.tgz#2b044ab39fdfa75b4688184f9e573ce3c5b0ff95" + integrity sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^9.4.0" + globals "^13.15.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@humanwhocodes/config-array@^0.11.6": + version "0.11.8" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9" + integrity sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g== + dependencies: + "@humanwhocodes/object-schema" "^1.2.1" + debug "^4.1.1" + minimatch "^3.0.5" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== + +"@humanwhocodes/object-schema@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" + integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== + +"@jridgewell/gen-mapping@^0.3.0": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9" + integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A== + dependencies: + "@jridgewell/set-array" "^1.0.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/resolve-uri@3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" + integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== + +"@jridgewell/set-array@^1.0.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" + integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== + +"@jridgewell/source-map@^0.3.2": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.2.tgz#f45351aaed4527a298512ec72f81040c998580fb" + integrity sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw== + dependencies: + "@jridgewell/gen-mapping" "^0.3.0" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/sourcemap-codec@1.4.14", "@jridgewell/sourcemap-codec@^1.4.10": + version "1.4.14" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" + integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== + +"@jridgewell/trace-mapping@^0.3.9": + version "0.3.17" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz#793041277af9073b0951a7fe0f0d8c4c98c36985" + integrity sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g== + dependencies: + "@jridgewell/resolve-uri" "3.1.0" + "@jridgewell/sourcemap-codec" "1.4.14" + +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + +"@pixi/app@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/app/-/app-6.5.8.tgz#0a09bce23a222458e6a769d8ecbb0643ee165368" + integrity sha512-pDPkamtYDaPhscNxack+bHNqazCwrqw6cAotKyoz1mvLXeGhxqTntOcfgGLZR2fNbnY8EBmdduLvH7n2jI/LTg== + +"@pixi/basis@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/basis/-/basis-6.5.8.tgz#a9ded903fea5d0ba240c22839648868de2f64702" + integrity sha512-j4j08fZsdg8b3F1Cs1cE478m6aVk6ix53pTrv+kxq0Givl3ctO+wwWEU07BFAuvsGGySKrhAEt4vmz78cRK9KQ== + +"@pixi/canvas-display@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/canvas-display/-/canvas-display-6.5.8.tgz#9d280a2ee8b9ec0fbf2a9420b592152f91902997" + integrity sha512-7kgFmN2dCWBhgo+CEKpZDmgqRkYCQeHoVsyOSyxSvTqHDnMjFane1OwTBg6p4PlsE+Jn1BEx/3V2ja/XbR9XOg== + +"@pixi/canvas-extract@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/canvas-extract/-/canvas-extract-6.5.8.tgz#c4ae9f6c29aea26ac9cdc00ed89c84ba213aa2ec" + integrity sha512-9jRVlQpumyj0QWF9CQzsDqg7QkqYxLhX/Xu87o5bWfpwrocF6AlJJak0zc6WMLvDEJ1ZI3mNdV2P1AW9ba4+WA== + +"@pixi/canvas-renderer@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/canvas-renderer/-/canvas-renderer-6.5.8.tgz#88c816f9b0aa116ac25d322963f6a0f7bc3051c4" + integrity sha512-W+qp05VNtPIoE1/azAyAcYLYXONdql15ts72bsGssRvGJGmECzfhOKq389S4j9X5uVKm51CZhChE7yReWkbUEw== + +"@pixi/constants@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/constants/-/constants-6.5.8.tgz#034bf0f318546bf3c9346f4f3a7528f8cadcdb55" + integrity sha512-yYRCebBPqajm1kn5f8QQTTvl7oDRDk1nppfO+JpqbrFXg0W7oqIMurec3KeG9RdZW5foOiXDoz1Gw+VtolYIEw== + +"@pixi/core@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/core/-/core-6.5.8.tgz#6b4fb6d877723427c8b3b438d071c1d523a859f5" + integrity sha512-Gconik7/PpFPMpCpOddXVIPx5C2StWKw7lQ4YX19yQ+cRRmecCea2cV0xTBtpEjjx0ilX7nBfIEuZ4zIlMmlbA== + dependencies: + "@types/offscreencanvas" "^2019.6.4" + +"@pixi/display@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/display/-/display-6.5.8.tgz#f6e69aba09926affd610ad90b68b01cf6d5e3a64" + integrity sha512-2K8YOG8s0iF8x/k2Q0RTFmoMJ9biI6PXEh76nH3EqUFdpyrIIgrG5aOMnCkVDvOxlgVRrKG8Q3JBHlSievTmuw== + +"@pixi/events@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/events/-/events-6.5.8.tgz#739a2bf634484d4394acc55019fa6910a35cf925" + integrity sha512-9pnL1Z/YBynIEk2I5f3ZvcB+fnqxeZ0dP5m1OKZ8GpKnkZz6/2FZ9hbelyeZgW9iHUPNy98A+Nrfv4oE7lB5Dg== + +"@pixi/extensions@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/extensions/-/extensions-6.5.8.tgz#6976b8f582ce09dea9ba3baebd14c5958c39b222" + integrity sha512-6vEV801Vn/EkU/qjFiZ76OZWPq5KsBR2r+P5gfKv4YLnaDc3A+0IpUOJ7sLBAJqmr0iw68g6xV6MnuqVjNGjFg== + +"@pixi/extract@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/extract/-/extract-6.5.8.tgz#d2a07055a766b7269b3f3a0ad1fdb93762168f6f" + integrity sha512-qbuuD/iBA4J+TCBgrbMe8oDUFbCriyy9LTKEtQp+pghKD5MEMvJ3nO6Osumxqiqta2kYU6WldFLTldKyHEiQ7Q== + +"@pixi/filter-alpha@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/filter-alpha/-/filter-alpha-6.5.8.tgz#627ac683285754ebc94ad560bf99c015721d3314" + integrity sha512-W4IkFTLTP84H+DS9XIdBGunAEpaXLrasDc4CQBeyp4c4hBlGlzriUZp30vkmqm7GPmFhzPe7aiJtNYgUpxKQBQ== + +"@pixi/filter-color-matrix@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/filter-color-matrix/-/filter-color-matrix-6.5.8.tgz#4fa64977c87fcb5420aff439df1652a2048c47a6" + integrity sha512-iix+a/KEi6HAwZwkUH3nkIzyLu0ln3HBuHEFLUUhug7xrQgQgGrTQZ32iWlfpJD/BZuKphIGfzlxMFfvyQmkVw== + +"@pixi/graphics-extras@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/graphics-extras/-/graphics-extras-6.5.8.tgz#79c113ff285f5954df78b64becf58a05c162936f" + integrity sha512-RdrAucGr6etEzz64TiViPcxlEpUfwJTj62j8eMDU1BjCwSaNDs5TN3LerY/en7IRRsUsrVLMn/3z52B25P+rjQ== + +"@pixi/graphics@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/graphics/-/graphics-6.5.8.tgz#25db47335d8191c38ae39adc95bd9eb20672247b" + integrity sha512-DUuUXHO4t5fg+n+srMkHX38QEH3WtS1IMXtovBGFJkkopG0Z0xjxSp5XvsPPw1J//4fzkHZI5OBrlN613p9+sg== + +"@pixi/interaction@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/interaction/-/interaction-6.5.8.tgz#d4e83cb4d1f03f23633706ef9495406a2401dc26" + integrity sha512-uP247r0f47vo9WSpEnsUfeD1izxVGpjtg4iAyGT/02ezWse2vD1aEL8AbxFa65TL0IXOKsHEQudCVL+wjnbSKQ== + +"@pixi/loaders@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/loaders/-/loaders-6.5.8.tgz#5fe2e74c2c532b4bb900063ee2f33385e5446f7a" + integrity sha512-mj11UPKsqWaTEPMpCnFugr6heKkQeNFuVSddSwE8crg19l46zcMhk3ucpQX15RDpAdDJjtl3OraevQCHHbNENw== + +"@pixi/math-extras@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/math-extras/-/math-extras-6.5.8.tgz#5329bcaa827f96fbdfea5c0b90709861bc37686a" + integrity sha512-Vkc1OHPZKoVI89mHigAtpBma6bU3z6t4XJfXwG6RkHX/D955gtnZ80BBeu3wt482z1iMedYLgHv9eqW70ROtxg== + +"@pixi/math@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/math/-/math-6.5.8.tgz#7dc06425c6a53b6a2adf5e66e57a2f9db0907cc9" + integrity sha512-9493KEH5ITnjOZvQZbaU22lD0kcg/XhNh+309KYfwFX787zA1BN/7is06oHEgHBDb2NemqioYi6sw1WnECgQig== + +"@pixi/mixin-cache-as-bitmap@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/mixin-cache-as-bitmap/-/mixin-cache-as-bitmap-6.5.8.tgz#3e70ae36d3c63cb53f75ca74fec7814f3bfc01b4" + integrity sha512-5TTv4w8v7guI6z3gKz5ppUCbNMRw+8RRNru/aq65qUl6kcUaJiYwQdBFJ/vJwpI9ePEScWrCuLVEc8QtX6xjNw== + +"@pixi/mixin-get-child-by-name@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/mixin-get-child-by-name/-/mixin-get-child-by-name-6.5.8.tgz#414a8bbf8d80686e351bc8f9abb8f12be2d04ff8" + integrity sha512-b15HTdHpW4ErDBpf7wm1vvWHrTv5kQzElXrwAPBCnLgvronfSL9mL7npOUkZOybUorCoEBq/7oNVjkimsQc5gw== + +"@pixi/mixin-get-global-position@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/mixin-get-global-position/-/mixin-get-global-position-6.5.8.tgz#7fc71b89e13d37fdf39955a3de680511883ef5f2" + integrity sha512-Y5epEW5mRrgpDOHvfc92t0PaBgboBKXR4n/AzOOFt0h9GRNTmVKYBpUQPp/HO+r1Bxq+XbaGm1CyfkjUUxnORA== + +"@pixi/polyfill@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/polyfill/-/polyfill-6.5.8.tgz#98d753fc6ca95cf086077ee230d089595a32bbfb" + integrity sha512-z2klHelxTZExMyO4oiLdxJMGzzXnToEIDn7Dwfy3FY+98LbxSa2dVFCgzDsYeiiS8fSMsni2Ru7aZT/DFsRDcA== + dependencies: + object-assign "^4.1.1" + promise-polyfill "^8.2.0" + +"@pixi/runner@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/runner/-/runner-6.5.8.tgz#e86ed6fac1f243d17dfa5d5317cb0b98fdce3960" + integrity sha512-/9KVgQjTKiBa1qHdNmhP9I+AHgC/Eu9QiKcc+oakLCJtpYi79lx+nDFrpLUamIi2c7lP0hDWVe0XqlQeYmSwag== + +"@pixi/settings@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/settings/-/settings-6.5.8.tgz#574df7b10039903e4e158a067be8fd5d8531c653" + integrity sha512-gmnwHkg9+tlQRuFNOdimzl73Dup2fdEo/VYaF7spT+8womE4KWAvARCBMqY/10aAx1iYeYuo5av/RfqrePB5Hg== + +"@pixi/sprite-tiling@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/sprite-tiling/-/sprite-tiling-6.5.8.tgz#2fafe50268565ab7f03d4aba50b2c2a975056edc" + integrity sha512-PG3tiWI6uUest/d7HAz4/3I8NjpYyeMUL2WDy86nMXCJ6bLdTs/s9Nq3DLckaUsyIMTGsVbj/BXjE8LP1WDTog== + +"@pixi/sprite@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/sprite/-/sprite-6.5.8.tgz#94bcf4fe590f674e193e64b02365fa4582453c40" + integrity sha512-ywvbrNgjK+K93X9cvHtDCnsBtU7B9JD/3wg+1G6v1Ktrr2E1gwVIQK1NANBrjzt6cYGphz5EqGAW68d0rMBliw== + +"@pixi/spritesheet@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/spritesheet/-/spritesheet-6.5.8.tgz#d369372e0341a522e44d75e2c750534392a5f9e6" + integrity sha512-WiJd4fKpSitD3A+/u5q8IPoHXMFT8++bsluhuJvDwzo//s0PHb9qExlF2xos7zUmekmydEFMkDnrl4+lWn2cyg== + +"@pixi/text@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/text/-/text-6.5.8.tgz#ed23ea16812b0b5be2d0b964e707c5c407f1e758" + integrity sha512-7AZPj5+vWcUjK0QzQ3ehiEwEqywiWR8NhDmnnN5nRNHR9u5IOOnqCQtBTdDffYPN0uMgCi8MzUPwTJhGuyOeww== + +"@pixi/ticker@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/ticker/-/ticker-6.5.8.tgz#708120bcadce7c4446e2238df590c54debbaed78" + integrity sha512-7VKq5hfnRDSv6a16pATqZAmpQfEu4G171iUTloy3QZfbnPw0s3JervZSih1yJJD84GXEF4VzYB26pJ/x3arGjQ== + +"@pixi/tilemap@^3.2.2": + version "3.2.2" + resolved "https://registry.yarnpkg.com/@pixi/tilemap/-/tilemap-3.2.2.tgz#8327e5d7007a90be640a0b1eb9943a1e405b57e4" + integrity sha512-svdmMyJP63vdae3t66tCmE8IWeO/6lD1xXU+5gzfxqxJS5seTp2bm8mQok2c8PF0O6l/NYlLz6BRklOuEuHboQ== + +"@pixi/utils@~6.5.0": + version "6.5.8" + resolved "https://registry.yarnpkg.com/@pixi/utils/-/utils-6.5.8.tgz#5b7662c00951ac530bb0b72329bab922f4030930" + integrity sha512-zLnvmVQBWPDnwkfvrSpBBF2XpWSMt+kQAsX562eqjuME63ic9M6fK4u/IaA8csdlG2wtcjBvSYWrpWmPq0bWag== + dependencies: + "@types/earcut" "^2.1.0" + earcut "^2.2.4" + eventemitter3 "^3.1.0" + url "^0.11.0" + +"@rollup/plugin-typescript@^10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-10.0.1.tgz#270b515b116ea28320e6bb62451c4767d49072d6" + integrity sha512-wBykxRLlX7EzL8BmUqMqk5zpx2onnmRMSw/l9M1sVfkJvdwfxogZQVNUM9gVMJbjRLDR5H6U0OMOrlDGmIV45A== + dependencies: + "@rollup/pluginutils" "^5.0.1" + resolve "^1.22.1" + +"@rollup/pluginutils@^5.0.1": + version "5.0.2" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.0.2.tgz#012b8f53c71e4f6f9cb317e311df1404f56e7a33" + integrity sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA== + dependencies: + "@types/estree" "^1.0.0" + estree-walker "^2.0.2" + picomatch "^2.3.1" + +"@types/earcut@^2.1.0": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@types/earcut/-/earcut-2.1.1.tgz#573a0af609f17005c751f6f4ffec49cfe358ea51" + integrity sha512-w8oigUCDjElRHRRrMvn/spybSMyX8MTkKA5Dv+tS1IE/TgmNZPqUYtvYBXGY8cieSE66gm+szeK+bnbxC2xHTQ== + +"@types/estree@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.0.tgz#5fb2e536c1ae9bf35366eed879e827fa59ca41c2" + integrity sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ== + +"@types/howler@^2.2.7": + version "2.2.7" + resolved "https://registry.yarnpkg.com/@types/howler/-/howler-2.2.7.tgz#5acfbed57f9e1d99b8dabe1b824729e1c1ea1fae" + integrity sha512-PEZldwZqJJw1PWRTpupyC7ajVTZA8aHd8nB/Y0n6zRZi5u8ktYDntsHj13ltEiBRqWwF06pASxBEvCTxniG8eA== + +"@types/json-schema@^7.0.9": + version "7.0.11" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" + integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== + +"@types/offscreencanvas@^2019.6.4": + version "2019.7.0" + resolved "https://registry.yarnpkg.com/@types/offscreencanvas/-/offscreencanvas-2019.7.0.tgz#e4a932069db47bb3eabeb0b305502d01586fa90d" + integrity sha512-PGcyveRIpL1XIqK8eBsmRBt76eFgtzuPiSTyKHZxnGemp2yzGzWpjYKAfK3wIMiU7eH+851yEpiuP8JZerTmWg== + +"@types/pako@^1.0.3": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@types/pako/-/pako-1.0.4.tgz#b4262aef92680a9331fcdb8420c69cf3dd98d3f3" + integrity sha512-Z+5bJSm28EXBSUJEgx29ioWeEEHUh6TiMkZHDhLwjc9wVFH+ressbkmX6waUZc5R3Gobn4Qu5llGxaoflZ+yhA== + +"@types/semver@^7.3.12": + version "7.3.13" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91" + integrity sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw== + +"@typescript-eslint/eslint-plugin@^5.30.7": + version "5.46.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.46.1.tgz#098abb4c9354e19f460d57ab18bff1f676a6cff0" + integrity sha512-YpzNv3aayRBwjs4J3oz65eVLXc9xx0PDbIRisHj+dYhvBn02MjYOD96P8YGiWEIFBrojaUjxvkaUpakD82phsA== + dependencies: + "@typescript-eslint/scope-manager" "5.46.1" + "@typescript-eslint/type-utils" "5.46.1" + "@typescript-eslint/utils" "5.46.1" + debug "^4.3.4" + ignore "^5.2.0" + natural-compare-lite "^1.4.0" + regexpp "^3.2.0" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/parser@^5.30.7": + version "5.46.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.46.1.tgz#1fc8e7102c1141eb64276c3b89d70da8c0ba5699" + integrity sha512-RelQ5cGypPh4ySAtfIMBzBGyrNerQcmfA1oJvPj5f+H4jI59rl9xxpn4bonC0tQvUKOEN7eGBFWxFLK3Xepneg== + dependencies: + "@typescript-eslint/scope-manager" "5.46.1" + "@typescript-eslint/types" "5.46.1" + "@typescript-eslint/typescript-estree" "5.46.1" + debug "^4.3.4" + +"@typescript-eslint/scope-manager@5.46.1": + version "5.46.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.46.1.tgz#70af8425c79bbc1178b5a63fb51102ddf48e104a" + integrity sha512-iOChVivo4jpwUdrJZyXSMrEIM/PvsbbDOX1y3UCKjSgWn+W89skxWaYXACQfxmIGhPVpRWK/VWPYc+bad6smIA== + dependencies: + "@typescript-eslint/types" "5.46.1" + "@typescript-eslint/visitor-keys" "5.46.1" + +"@typescript-eslint/type-utils@5.46.1": + version "5.46.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.46.1.tgz#195033e4b30b51b870dfcf2828e88d57b04a11cc" + integrity sha512-V/zMyfI+jDmL1ADxfDxjZ0EMbtiVqj8LUGPAGyBkXXStWmCUErMpW873zEHsyguWCuq2iN4BrlWUkmuVj84yng== + dependencies: + "@typescript-eslint/typescript-estree" "5.46.1" + "@typescript-eslint/utils" "5.46.1" + debug "^4.3.4" + tsutils "^3.21.0" + +"@typescript-eslint/types@5.46.1": + version "5.46.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.46.1.tgz#4e9db2107b9a88441c4d5ecacde3bb7a5ebbd47e" + integrity sha512-Z5pvlCaZgU+93ryiYUwGwLl9AQVB/PQ1TsJ9NZ/gHzZjN7g9IAn6RSDkpCV8hqTwAiaj6fmCcKSQeBPlIpW28w== + +"@typescript-eslint/typescript-estree@5.46.1": + version "5.46.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.46.1.tgz#5358088f98a8f9939355e0996f9c8f41c25eced2" + integrity sha512-j9W4t67QiNp90kh5Nbr1w92wzt+toiIsaVPnEblB2Ih2U9fqBTyqV9T3pYWZBRt6QoMh/zVWP59EpuCjc4VRBg== + dependencies: + "@typescript-eslint/types" "5.46.1" + "@typescript-eslint/visitor-keys" "5.46.1" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/utils@5.46.1": + version "5.46.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.46.1.tgz#7da3c934d9fd0eb4002a6bb3429f33298b469b4a" + integrity sha512-RBdBAGv3oEpFojaCYT4Ghn4775pdjvwfDOfQ2P6qzNVgQOVrnSPe5/Pb88kv7xzYQjoio0eKHKB9GJ16ieSxvA== + dependencies: + "@types/json-schema" "^7.0.9" + "@types/semver" "^7.3.12" + "@typescript-eslint/scope-manager" "5.46.1" + "@typescript-eslint/types" "5.46.1" + "@typescript-eslint/typescript-estree" "5.46.1" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" + semver "^7.3.7" + +"@typescript-eslint/visitor-keys@5.46.1": + version "5.46.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.46.1.tgz#126cc6fe3c0f83608b2b125c5d9daced61394242" + integrity sha512-jczZ9noovXwy59KjRTk1OftT78pwygdcmCuBf8yMoWt/8O8l+6x2LSEze0E4TeepXK4MezW3zGSyoDRZK7Y9cg== + dependencies: + "@typescript-eslint/types" "5.46.1" + eslint-visitor-keys "^3.3.0" + +acorn-jsx@^5.3.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + +acorn@^8.5.0, acorn@^8.8.0: + version "8.8.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.1.tgz#0a3f9cbecc4ec3bea6f0a80b66ae8dd2da250b73" + integrity sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA== + +ajv@^6.10.0, ajv@^6.12.4: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +braces@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + +buffer-from@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" + integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +camel-case@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-4.1.2.tgz#9728072a954f805228225a6deea6b38461e1bd5a" + integrity sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw== + dependencies: + pascal-case "^3.1.2" + tslib "^2.0.3" + +chalk@^4.0.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +clean-css@^5.2.2: + version "5.3.1" + resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-5.3.1.tgz#d0610b0b90d125196a2894d35366f734e5d7aa32" + integrity sha512-lCr8OHhiWCTw4v8POJovCoh4T7I9U11yVsPjMWWnnMmp9ZowCxyad1Pathle/9HjaDp+fdQKjO9fQydE6RHTZg== + dependencies: + source-map "~0.6.0" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +commander@^2.20.0: + version "2.20.3" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" + integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== + +commander@^8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" + integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + +cross-spawn@^7.0.2: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: + version "4.3.4" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== + dependencies: + ms "2.1.2" + +deep-is@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" + integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== + +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + +dot-case@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/dot-case/-/dot-case-3.0.4.tgz#9b2b670d00a431667a8a75ba29cd1b98809ce751" + integrity sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w== + dependencies: + no-case "^3.0.4" + tslib "^2.0.3" + +earcut@^2.2.4: + version "2.2.4" + resolved "https://registry.yarnpkg.com/earcut/-/earcut-2.2.4.tgz#6d02fd4d68160c114825d06890a92ecaae60343a" + integrity sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ== + +esbuild@^0.16.3: + version "0.16.9" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.16.9.tgz#01b6c3a6cbc072108253ac160a0734229bf8c921" + integrity sha512-gkH83yHyijMSZcZFs1IWew342eMdFuWXmQo3zkDPTre25LIPBJsXryg02M3u8OpTwCJdBkdaQwqKkDLnAsAeLQ== + optionalDependencies: + "@esbuild/android-arm" "0.16.9" + "@esbuild/android-arm64" "0.16.9" + "@esbuild/android-x64" "0.16.9" + "@esbuild/darwin-arm64" "0.16.9" + "@esbuild/darwin-x64" "0.16.9" + "@esbuild/freebsd-arm64" "0.16.9" + "@esbuild/freebsd-x64" "0.16.9" + "@esbuild/linux-arm" "0.16.9" + "@esbuild/linux-arm64" "0.16.9" + "@esbuild/linux-ia32" "0.16.9" + "@esbuild/linux-loong64" "0.16.9" + "@esbuild/linux-mips64el" "0.16.9" + "@esbuild/linux-ppc64" "0.16.9" + "@esbuild/linux-riscv64" "0.16.9" + "@esbuild/linux-s390x" "0.16.9" + "@esbuild/linux-x64" "0.16.9" + "@esbuild/netbsd-x64" "0.16.9" + "@esbuild/openbsd-x64" "0.16.9" + "@esbuild/sunos-x64" "0.16.9" + "@esbuild/win32-arm64" "0.16.9" + "@esbuild/win32-ia32" "0.16.9" + "@esbuild/win32-x64" "0.16.9" + +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +eslint-scope@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" + integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== + dependencies: + esrecurse "^4.3.0" + estraverse "^4.1.1" + +eslint-scope@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" + integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + +eslint-utils@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" + integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== + dependencies: + eslint-visitor-keys "^2.0.0" + +eslint-visitor-keys@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" + integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== + +eslint-visitor-keys@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" + integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== + +eslint@^8.20.0: + version "8.29.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.29.0.tgz#d74a88a20fb44d59c51851625bc4ee8d0ec43f87" + integrity sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg== + dependencies: + "@eslint/eslintrc" "^1.3.3" + "@humanwhocodes/config-array" "^0.11.6" + "@humanwhocodes/module-importer" "^1.0.1" + "@nodelib/fs.walk" "^1.2.8" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + escape-string-regexp "^4.0.0" + eslint-scope "^7.1.1" + eslint-utils "^3.0.0" + eslint-visitor-keys "^3.3.0" + espree "^9.4.0" + esquery "^1.4.0" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + find-up "^5.0.0" + glob-parent "^6.0.2" + globals "^13.15.0" + grapheme-splitter "^1.0.4" + ignore "^5.2.0" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + is-path-inside "^3.0.3" + js-sdsl "^4.1.4" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.1" + regexpp "^3.2.0" + strip-ansi "^6.0.1" + strip-json-comments "^3.1.0" + text-table "^0.2.0" + +espree@^9.4.0: + version "9.4.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.4.1.tgz#51d6092615567a2c2cff7833445e37c28c0065bd" + integrity sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg== + dependencies: + acorn "^8.8.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.3.0" + +esquery@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" + integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + +estraverse@^5.1.0, estraverse@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + +estree-walker@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" + integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +eventemitter3@^3.1.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" + integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q== + +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-glob@^3.2.9: + version "3.2.12" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" + integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fast-levenshtein@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== + +fastq@^1.6.0: + version "1.14.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.14.0.tgz#107f69d7295b11e0fccc264e1fc6389f623731ce" + integrity sha512-eR2D+V9/ExcbF9ls441yIuN6TI2ED1Y2ZcA5BmMtJsOkWOFRJQ0Jt0g1UwqXJJVAb+V+umH5Dfr8oh4EVP7VVg== + dependencies: + reusify "^1.0.4" + +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + dependencies: + flat-cache "^3.0.4" + +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== + dependencies: + flatted "^3.1.0" + rimraf "^3.0.2" + +flatted@^3.1.0: + version "3.2.7" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" + integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== + +fsevents@~2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +gifuct-js@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/gifuct-js/-/gifuct-js-2.1.2.tgz#06152437ba30ec914db8398bd838bd0fbc8a6ecd" + integrity sha512-rI2asw77u0mGgwhV3qA+OEgYqaDn5UNqgs+Bx0FGwSpuqfYn+Ir6RQY5ENNQ8SbIiG/m5gVa7CD5RriO4f4Lsg== + dependencies: + js-binary-schema-parser "^2.0.3" + +glob-parent@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + +glob@^7.1.3: + version "7.2.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.1.1" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^13.15.0: + version "13.19.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.19.0.tgz#7a42de8e6ad4f7242fbcca27ea5b23aca367b5c8" + integrity sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ== + dependencies: + type-fest "^0.20.2" + +globby@^11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.2.9" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^3.0.0" + +grapheme-splitter@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" + integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + +he@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== + +howler@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/howler/-/howler-2.2.3.tgz#a2eff9b08b586798e7a2ee17a602a90df28715da" + integrity sha512-QM0FFkw0LRX1PR8pNzJVAY25JhIWvbKMBFM4gqk+QdV+kPXOhleWGCB6AiAF/goGjIHK2e/nIElplvjQwhr0jg== + +html-minifier-terser@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz#bfc818934cc07918f6b3669f5774ecdfd48f32ab" + integrity sha512-YXxSlJBZTP7RS3tWnQw74ooKa6L9b9i9QYXY21eUEvhZ3u9XLfv6OnFsQq6RxkhHygsaUMvYsZRV5rU/OVNZxw== + dependencies: + camel-case "^4.1.2" + clean-css "^5.2.2" + commander "^8.3.0" + he "^1.2.0" + param-case "^3.0.4" + relateurl "^0.2.7" + terser "^5.10.0" + +ignore@^5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.1.tgz#c2b1f76cb999ede1502f3a226a9310fdfe88d46c" + integrity sha512-d2qQLzTJ9WxQftPAuEQpSPmKqzxePjzVbpAVv62AQ64NTL+wR4JkrVqR/LqFsFEUsHDAiId52mJteHDFuDkElA== + +import-fresh@^3.0.0, import-fresh@^3.2.1: + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +is-core-module@^2.9.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144" + integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw== + dependencies: + has "^1.0.3" + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +is-path-inside@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + +js-binary-schema-parser@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/js-binary-schema-parser/-/js-binary-schema-parser-2.0.3.tgz#3d7848748e8586e63b34e8911b643f59cfb6396e" + integrity sha512-xezGJmOb4lk/M1ZZLTR/jaBHQ4gG/lqQnJqdIv4721DMggsa1bDVlHXNeHYogaIEHD9vCRv0fcL4hMA+Coarkg== + +js-sdsl@^4.1.4: + version "4.2.0" + resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.2.0.tgz#278e98b7bea589b8baaf048c20aeb19eb7ad09d0" + integrity sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ== + +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== + +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + +lower-case@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-2.0.2.tgz#6fa237c63dbdc4a82ca0fd882e4722dc5e634e28" + integrity sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg== + dependencies: + tslib "^2.0.3" + +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + +merge2@^1.3.0, merge2@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +micromatch@^4.0.4: + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + +minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +nanoid@^3.3.4: + version "3.3.4" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" + integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== + +natural-compare-lite@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" + integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g== + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== + +no-case@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/no-case/-/no-case-3.0.4.tgz#d361fd5c9800f558551a8369fc0dcd4662b6124d" + integrity sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg== + dependencies: + lower-case "^2.0.2" + tslib "^2.0.3" + +object-assign@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + +optionator@^0.9.1: + version "0.9.1" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" + integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== + dependencies: + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + word-wrap "^1.2.3" + +p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + +pako@^2.0.4: + version "2.1.0" + resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86" + integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug== + +param-case@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/param-case/-/param-case-3.0.4.tgz#7d17fe4aa12bde34d4a77d91acfb6219caad01c5" + integrity sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A== + dependencies: + dot-case "^3.0.4" + tslib "^2.0.3" + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +pascal-case@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/pascal-case/-/pascal-case-3.1.2.tgz#b48e0ef2b98e205e7c1dae747d0b1508237660eb" + integrity sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g== + dependencies: + no-case "^3.0.4" + tslib "^2.0.3" + +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== + +path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + +picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + +postcss@^8.4.20: + version "8.4.20" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.20.tgz#64c52f509644cecad8567e949f4081d98349dc56" + integrity sha512-6Q04AXR1212bXr5fh03u8aAwbLxAQNGQ/Q1LNa0VfOI06ZAlhPHtQvE4OIdpj4kLThXilalPnmDSOD65DcHt+g== + dependencies: + nanoid "^3.3.4" + picocolors "^1.0.0" + source-map-js "^1.0.2" + +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + +promise-polyfill@^8.2.0: + version "8.2.3" + resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-8.2.3.tgz#2edc7e4b81aff781c88a0d577e5fe9da822107c6" + integrity sha512-Og0+jCRQetV84U8wVjMNccfGCnMQ9mGs9Hv78QFe+pSDD3gWTpz0y+1QCuxy5d/vBFuZ3iwP2eycAkvqIMPmWg== + +punycode@1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" + integrity sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw== + +punycode@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== + +querystring@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" + integrity sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g== + +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + +regexpp@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" + integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== + +relateurl@^0.2.7: + version "0.2.7" + resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" + integrity sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog== + +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +resolve@^1.22.1: + version "1.22.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" + integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== + dependencies: + is-core-module "^2.9.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + +rollup@^3.7.0: + version "3.7.5" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.7.5.tgz#db580f8eda50237b0721ddea301fb981cd992933" + integrity sha512-z0ZbqHBtS/et2EEUKMrAl2CoSdwN7ZPzL17UMiKN9RjjqHShTlv7F9J6ZJZJNREYjBh3TvBrdfjkFDIXFNeuiQ== + optionalDependencies: + fsevents "~2.3.2" + +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + +semver@^7.3.7: + version "7.3.8" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" + integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== + dependencies: + lru-cache "^6.0.0" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + +source-map-js@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" + integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== + +source-map-support@~0.5.20: + version "0.5.21" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" + integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map@^0.6.0, source-map@~0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + +terser@^5.10.0: + version "5.16.1" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.16.1.tgz#5af3bc3d0f24241c7fb2024199d5c461a1075880" + integrity sha512-xvQfyfA1ayT0qdK47zskQgRZeWLoOQ8JQ6mIgRGVNwZKdQMU+5FkCBjmv4QjcrTzyZquRw2FVtlJSRUmMKQslw== + dependencies: + "@jridgewell/source-map" "^0.3.2" + acorn "^8.5.0" + commander "^2.20.0" + source-map-support "~0.5.20" + +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +tslib@^1.8.1: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== + +tslib@^2.0.3, tslib@^2.3.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e" + integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA== + +tsutils@^3.21.0: + version "3.21.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== + dependencies: + tslib "^1.8.1" + +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + +typescript@~4.4.4: + version "4.4.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c" + integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA== + +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + +url@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" + integrity sha512-kbailJa29QrtXnxgq+DdCEGlbTeYM2eJUxsz6vjZavrCYPMIFHMKQmSKYAIuUK2i7hgPm28a8piX5NTUtM/LKQ== + dependencies: + punycode "1.3.2" + querystring "0.2.0" + +vite-plugin-minify@^1.5.2: + version "1.5.2" + resolved "https://registry.yarnpkg.com/vite-plugin-minify/-/vite-plugin-minify-1.5.2.tgz#4a331686361cd71b54c28dc149c0a952f354e830" + integrity sha512-clf3THHlet1jD35y8+mbw/xgACbdUQ1Eyc9zZFiqaxVOZLSC3UbrkOYOG+Nf4cleRjWgb8czbXrnQiWZICVh3Q== + dependencies: + html-minifier-terser "^6.1.0" + +vite@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/vite/-/vite-4.0.2.tgz#909beb07995048fe5a83b35b5e827d79627457c4" + integrity sha512-QJaY3R+tFlTagH0exVqbgkkw45B+/bXVBzF2ZD1KB5Z8RiAoiKo60vSUf6/r4c2Vh9jfGBKM4oBI9b4/1ZJYng== + dependencies: + esbuild "^0.16.3" + postcss "^8.4.20" + resolve "^1.22.1" + rollup "^3.7.0" + optionalDependencies: + fsevents "~2.3.2" + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +word-wrap@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" + integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== + +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== diff --git a/tsconfig.json b/tsconfig.json index 9912440..2898fca 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,11 +2,7 @@ "compilerOptions": { "baseUrl": "./src", "target": "es6", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, @@ -22,8 +18,5 @@ "noEmit": true, "jsx": "react-jsx" }, - "include": [ - "src", - "node_modules/@nitrots/nitro-renderer/src/**/*.ts", - ] + "include": ["src", "submodules/pro-renderer/src/**/*.ts"] } diff --git a/vite.config.js b/vite.config.js deleted file mode 100644 index 1c4696c..0000000 --- a/vite.config.js +++ /dev/null @@ -1,31 +0,0 @@ -// vite.config.js -import react from '@vitejs/plugin-react'; -import { resolve } from 'path'; -import { defineConfig } from 'vite'; - -export default defineConfig({ - plugins: [ react() ], - resolve: { - alias: { - '@': resolve(__dirname, 'src'), - '~': resolve(__dirname, 'node_modules') - } - }, - build: { - assetsInlineLimit: 102400, - rollupOptions: { - output: { - assetFileNames: 'src/assets/[name].[ext]', - manualChunks: id => - { - if(id.includes('node_modules')) - { - if(id.includes('@nitrots/nitro-renderer')) return 'nitro-renderer'; - - return 'vendor'; - } - } - } - } - } -}) diff --git a/vite.config.mjs b/vite.config.mjs new file mode 100644 index 0000000..c247d76 --- /dev/null +++ b/vite.config.mjs @@ -0,0 +1,32 @@ +// vite.config.js +import react from "@vitejs/plugin-react"; +import { resolve } from "path"; +import { defineConfig } from "vite"; + +export default defineConfig({ + plugins: [react()], + resolve: { + alias: { + "@": resolve(__dirname, "src"), + "~": resolve(__dirname, "node_modules"), + submodules: resolve(__dirname, "submodules"), + }, + }, + build: { + assetsInlineLimit: 102400, + rollupOptions: { + output: { + assetFileNames: "src/assets/[name].[ext]", + manualChunks: (id) => { + if (id.includes("submodules")) { + return "nitro-renderer"; + } + + if (id.includes("node_modules")) { + return "vendor"; + } + }, + }, + }, + }, +}); diff --git a/yarn.lock b/yarn.lock index f6aa936..ba7aa86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -407,10 +407,8 @@ "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" -"@nitrots/nitro-renderer@^1.6.6": +"@nitrots/nitro-renderer@file:submodules/renderer": version "1.6.6" - resolved "https://registry.yarnpkg.com/@nitrots/nitro-renderer/-/nitro-renderer-1.6.6.tgz#c6e572720113e9bdd5b797795772c34761778a42" - integrity sha512-VMxn4gAV49G1nnOrtL6koLnJglHdp83zILcKe8DTZsZXX6GOGU2wST1sSnHvdcH28KpesqrCP5dyJGKC/0ylYQ== dependencies: "@pixi/app" "~6.5.0" "@pixi/basis" "~6.5.0"