├── .gitignore ├── LICENSE ├── README.md ├── WYD2Bot.sln └── WYD2Bot ├── Basedef.cpp ├── Basedef.h ├── CClient.cpp ├── CClient.h ├── CSocket.h ├── Command.cpp ├── GetFunc.cpp ├── GetFunc.h ├── ItemEffect.h ├── Lua.cpp ├── Lua.h ├── Main.cpp ├── Main.h ├── PacketControl.cpp ├── PathFinding.h ├── Pathfinding.cpp ├── ProcessTimer.cpp ├── SendFunc.cpp ├── SendFunc.h ├── Socket.cpp ├── Struct.h ├── WYD2Bot.vcxproj ├── WYD2Bot.vcxproj.filters ├── WndProc.cpp ├── interface.rc └── resource.h /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | [Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | [Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # MSTest test Results 33 | [Tt]est[Rr]esult*/ 34 | [Bb]uild[Ll]og.* 35 | 36 | # NUNIT 37 | *.VisualState.xml 38 | TestResult.xml 39 | 40 | # Build Results of an ATL Project 41 | [Dd]ebugPS/ 42 | [Rr]eleasePS/ 43 | dlldata.c 44 | 45 | # .NET Core 46 | project.lock.json 47 | project.fragment.lock.json 48 | artifacts/ 49 | **/Properties/launchSettings.json 50 | 51 | *_i.c 52 | *_p.c 53 | *_i.h 54 | *.ilk 55 | *.meta 56 | *.obj 57 | *.pch 58 | *.pdb 59 | *.pgc 60 | *.pgd 61 | *.rsp 62 | *.sbr 63 | *.tlb 64 | *.tli 65 | *.tlh 66 | *.tmp 67 | *.tmp_proj 68 | *.log 69 | *.vspscc 70 | *.vssscc 71 | .builds 72 | *.pidb 73 | *.svclog 74 | *.scc 75 | 76 | # Chutzpah Test files 77 | _Chutzpah* 78 | 79 | # Visual C++ cache files 80 | ipch/ 81 | *.aps 82 | *.ncb 83 | *.opendb 84 | *.opensdf 85 | *.sdf 86 | *.cachefile 87 | *.VC.db 88 | *.VC.VC.opendb 89 | 90 | # Visual Studio profiler 91 | *.psess 92 | *.vsp 93 | *.vspx 94 | *.sap 95 | 96 | # TFS 2012 Local Workspace 97 | $tf/ 98 | 99 | # Guidance Automation Toolkit 100 | *.gpState 101 | 102 | # ReSharper is a .NET coding add-in 103 | _ReSharper*/ 104 | *.[Rr]e[Ss]harper 105 | *.DotSettings.user 106 | 107 | # JustCode is a .NET coding add-in 108 | .JustCode 109 | 110 | # TeamCity is a build add-in 111 | _TeamCity* 112 | 113 | # DotCover is a Code Coverage Tool 114 | *.dotCover 115 | 116 | # Visual Studio code coverage results 117 | *.coverage 118 | *.coveragexml 119 | 120 | # NCrunch 121 | _NCrunch_* 122 | .*crunch*.local.xml 123 | nCrunchTemp_* 124 | 125 | # MightyMoose 126 | *.mm.* 127 | AutoTest.Net/ 128 | 129 | # Web workbench (sass) 130 | .sass-cache/ 131 | 132 | # Installshield output folder 133 | [Ee]xpress/ 134 | 135 | # DocProject is a documentation generator add-in 136 | DocProject/buildhelp/ 137 | DocProject/Help/*.HxT 138 | DocProject/Help/*.HxC 139 | DocProject/Help/*.hhc 140 | DocProject/Help/*.hhk 141 | DocProject/Help/*.hhp 142 | DocProject/Help/Html2 143 | DocProject/Help/html 144 | 145 | # Click-Once directory 146 | publish/ 147 | 148 | # Publish Web Output 149 | *.[Pp]ublish.xml 150 | *.azurePubxml 151 | # TODO: Comment the next line if you want to checkin your web deploy settings 152 | # but database connection strings (with potential passwords) will be unencrypted 153 | *.pubxml 154 | *.publishproj 155 | 156 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 157 | # checkin your Azure Web App publish settings, but sensitive information contained 158 | # in these scripts will be unencrypted 159 | PublishScripts/ 160 | 161 | # NuGet Packages 162 | *.nupkg 163 | # The packages folder can be ignored because of Package Restore 164 | **/packages/* 165 | # except build/, which is used as an MSBuild target. 166 | !**/packages/build/ 167 | # Uncomment if necessary however generally it will be regenerated when needed 168 | #!**/packages/repositories.config 169 | # NuGet v3's project.json files produces more ignorable files 170 | *.nuget.props 171 | *.nuget.targets 172 | 173 | # Microsoft Azure Build Output 174 | csx/ 175 | *.build.csdef 176 | 177 | # Microsoft Azure Emulator 178 | ecf/ 179 | rcf/ 180 | 181 | # Windows Store app package directories and files 182 | AppPackages/ 183 | BundleArtifacts/ 184 | Package.StoreAssociation.xml 185 | _pkginfo.txt 186 | 187 | # Visual Studio cache files 188 | # files ending in .cache can be ignored 189 | *.[Cc]ache 190 | # but keep track of directories ending in .cache 191 | !*.[Cc]ache/ 192 | 193 | # Others 194 | ClientBin/ 195 | ~$* 196 | *~ 197 | *.dbmdl 198 | *.dbproj.schemaview 199 | *.jfm 200 | *.pfx 201 | *.publishsettings 202 | orleans.codegen.cs 203 | 204 | # Since there are multiple workflows, uncomment next line to ignore bower_components 205 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 206 | #bower_components/ 207 | 208 | # RIA/Silverlight projects 209 | Generated_Code/ 210 | 211 | # Backup & report files from converting an old project file 212 | # to a newer Visual Studio version. Backup files are not needed, 213 | # because we have git ;-) 214 | _UpgradeReport_Files/ 215 | Backup*/ 216 | UpgradeLog*.XML 217 | UpgradeLog*.htm 218 | 219 | # SQL Server files 220 | *.mdf 221 | *.ldf 222 | *.ndf 223 | 224 | # Business Intelligence projects 225 | *.rdl.data 226 | *.bim.layout 227 | *.bim_*.settings 228 | 229 | # Microsoft Fakes 230 | FakesAssemblies/ 231 | 232 | # GhostDoc plugin setting file 233 | *.GhostDoc.xml 234 | 235 | # Node.js Tools for Visual Studio 236 | .ntvs_analysis.dat 237 | node_modules/ 238 | 239 | # Typescript v1 declaration files 240 | typings/ 241 | 242 | # Visual Studio 6 build log 243 | *.plg 244 | 245 | # Visual Studio 6 workspace options file 246 | *.opt 247 | 248 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 249 | *.vbw 250 | 251 | # Visual Studio LightSwitch build output 252 | **/*.HTMLClient/GeneratedArtifacts 253 | **/*.DesktopClient/GeneratedArtifacts 254 | **/*.DesktopClient/ModelManifest.xml 255 | **/*.Server/GeneratedArtifacts 256 | **/*.Server/ModelManifest.xml 257 | _Pvt_Extensions 258 | 259 | # Paket dependency manager 260 | .paket/paket.exe 261 | paket-files/ 262 | 263 | # FAKE - F# Make 264 | .fake/ 265 | 266 | # JetBrains Rider 267 | .idea/ 268 | *.sln.iml 269 | 270 | # CodeRush 271 | .cr/ 272 | 273 | # Python Tools for Visual Studio (PTVS) 274 | __pycache__/ 275 | *.pyc 276 | 277 | # Cake - Uncomment if you are using it 278 | # tools/** 279 | # !tools/packages.config 280 | 281 | # Telerik's JustMock configuration file 282 | *.jmconfig 283 | 284 | # BizTalk build output 285 | *.btp.cs 286 | *.btm.cs 287 | *.odx.cs 288 | *.xsd.cs 289 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WYD2Bot 2 | ## About Project 3 | The WYD2Bot is a project to simulate a WYD client without interface. This project is constructed only with C/C++ and works with Client version 759 or greater. 4 | This code was made by any which way. 5 | 6 | If you want lower version you need to update all structs. 7 | 8 | ## Contents 9 | - Read configuration files like: heightmap (movement), attributemap (movement), quiz (auto answer), itemlist, skilldata, itemeffect, autotrade (create autotrade). 10 | - Login system with optional Encrypt Version found in some clients. 11 | - CharList complete. 12 | - Numeric system. 13 | - Login in any character of account. 14 | - Recognizes mobs and players around and gets movement or attack. 15 | - Refresh selected mob in list of mobs with current hp or position. 16 | - Macro system with magical and physical attack. System search the most near enemy. 17 | - Magical macro: can set to heal your group, just set skillbar with heal id. 18 | - Auto buff with transform select (beastmaster) respecting skill delay. 19 | - Use some item of your inventory. 20 | - Auto feed your pet. 21 | - Auto pot. 22 | - Water Macro. 23 | - Patchfinding. 24 | 25 | ## Prerequisites 26 | You will need just four files: `AttributeMap.dat`, `HeightMap.dat`, `ItemList.csv`, `SkillData.csv`. 27 | The files are found on any release of WYD (see http://www.webcheats.com.br/). 28 | 29 | To compile, you will need Visual Studio 2017 or greater. 30 | 31 | ## Before compile 32 | 1. Set in `Socket.cpp` function `Server::Connect` IP and PORT you want to connect. 33 | 2. Set in `SendFunc.cpp` function `SendRequestLogin` the client version. 34 | 35 | ## Use it 36 | After you compile, just open the program and set your login / password / numeric password and click Enter. 37 | 38 | In the updated list on right, select character you want to enter and click Enter, below of list. All of info around you will be on program. 39 | 40 | ## Avaible commands 41 | 42 | `move ` 43 | Move your character to position using Pathfinding. 44 | Disclaimer: use with positions you can move normally. This bot don't use any illegal movement or teleport. 45 | When you stop on a teleport, you will be notified and you can use another command (see below). 46 | 47 | `use ` 48 | Use item of your inventory. If you don't have, you will be notified. 49 | 50 | `party exit` 51 | Exit current party. 52 | 53 | `party invt ` 54 | Invite player with to your group. You can enter on any group with this command (use leader id). 55 | 56 | `party kick ` 57 | Kick player with from your group (only if you're leader). 58 | 59 | `party ` 60 | Accept group from player. Needs to write right nickname and ID. 61 | 62 | `water <||0|1||> <||0|1|2||>` 63 | Active/Desactive water macro. Use status 1 to active. Type means Normal, Mistical or Arcane. 64 | 65 | `tele` 66 | If you are above a teleport (notified if you stop on one) use this command to access. 67 | 68 | `transform <||0|1|2|3|4||>` 69 | Tell to Bot what transform you want to use. In order: werewolf, bear, astaroth, titan and eden. 70 | 71 | ## How to use Water Macro 72 | First, you need to login normally on server to save Stellar Gem on Water Zone and buy some Scroll Teleport. 73 | After that login with WYD2Bot and write on Command area: #use 699 to teleport. 74 | 75 | Just set what water you want to use with: `water 1 `. 76 | `1 => means active status 77 | => 0 = Normal, M = Mystical, A = Arcane` 78 | 79 | You will be teleported using item and will automatically go to the next room in order. 80 | 81 | ## Macro 82 | - Macro will be refresh all time. If you need to change any configuration on skillbar for example, deactivate macro for safety. 83 | - You can't active physical attack and magical at same time. 84 | - Group Macro Mob show current attacked mob. 85 | - EXP checkbox show current earned experience. 86 | 87 | ## Important thing to do 88 | You need to update with hash system used on 756 version or above to encrypt packet correctly. 89 | This system needs to be on `cServer::AddMessage(char *pMsg, int Size)`. 90 | -------------------------------------------------------------------------------- /WYD2Bot.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WYD2Bot", "WYD2Bot\WYD2Bot.vcxproj", "{AD0E28DB-05E7-440F-AEB6-99F3531A2342}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {AD0E28DB-05E7-440F-AEB6-99F3531A2342}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {AD0E28DB-05E7-440F-AEB6-99F3531A2342}.Debug|Win32.Build.0 = Debug|Win32 14 | {AD0E28DB-05E7-440F-AEB6-99F3531A2342}.Release|Win32.ActiveCfg = Release|Win32 15 | {AD0E28DB-05E7-440F-AEB6-99F3531A2342}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /WYD2Bot/Basedef.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevinkouketsu/WYD2Bot/355fc70cdf30964c580050bd7b8c648f6ed8c2bd/WYD2Bot/Basedef.cpp -------------------------------------------------------------------------------- /WYD2Bot/Basedef.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "ItemEffect.h" 3 | 4 | #ifndef __BASEDEF__ 5 | #define __BASEDEF__ 6 | 7 | 8 | #pragma region EXP 9 | static INT64 g_pNextLevel[5][400] = { 10 | { 11 | 500, 12 | 1124, 13 | 1826, 14 | 2610, 15 | 3480, 16 | 4440, 17 | 5494, 18 | 6646, 19 | 7900, 20 | 9260, 21 | 10893, 22 | 12817, 23 | 15050, 24 | 17610, 25 | 20515, 26 | 23783, 27 | 27432, 28 | 31480, 29 | 35945, 30 | 40845, 31 | 46251, 32 | 52187, 33 | 58677, 34 | 65745, 35 | 73415, 36 | 81711, 37 | 90657, 38 | 100277, 39 | 110595, 40 | 121635, 41 | 133647, 42 | 146671, 43 | 160747, 44 | 175915, 45 | 192215, 46 | 209687, 47 | 228371, 48 | 248307, 49 | 269535, 50 | 292095, 51 | 316151, 52 | 341751, 53 | 368943, 54 | 397775, 55 | 428295, 56 | 460551, 57 | 494591, 58 | 530463, 59 | 568215, 60 | 607895, 61 | 649715, 62 | 693731, 63 | 739999, 64 | 788575, 65 | 839515, 66 | 892875, 67 | 948711, 68 | 1007079, 69 | 1068035, 70 | 1131635, 71 | 1198670, 72 | 1269230, 73 | 1343405, 74 | 1421285, 75 | 1502960, 76 | 1588520, 77 | 1678055, 78 | 1771655, 79 | 1869410, 80 | 1971410, 81 | 2078255, 82 | 2190055, 83 | 2306920, 84 | 2428960, 85 | 2556285, 86 | 2689005, 87 | 2827230, 88 | 2971070, 89 | 3120635, 90 | 3276035, 91 | 3438521, 92 | 3608249, 93 | 3785375, 94 | 3970055, 95 | 4162445, 96 | 4362701, 97 | 4570979, 98 | 4787435, 99 | 5012225, 100 | 5245505, 101 | 5488163, 102 | 5740379, 103 | 6002333, 104 | 6274205, 105 | 6556175, 106 | 6848423, 107 | 7151129, 108 | 7464473, 109 | 7788635, 110 | 8123795, 111 | 8460174, 112 | 8797774, 113 | 9136597, 114 | 9476645, 115 | 9817920, 116 | 10160424, 117 | 10504159, 118 | 10849127, 119 | 11195330, 120 | 11542770, 121 | 11892311, 122 | 12243959, 123 | 12597720, 124 | 12953600, 125 | 13311605, 126 | 13671741, 127 | 14034014, 128 | 14398430, 129 | 14764995, 130 | 15133715, 131 | 15508850, 132 | 15890450, 133 | 16278565, 134 | 16673245, 135 | 17074540, 136 | 17482500, 137 | 17897175, 138 | 18318615, 139 | 18746870, 140 | 19181990, 141 | 19625811, 142 | 20078403, 143 | 20539836, 144 | 21010180, 145 | 21489505, 146 | 21977881, 147 | 22475378, 148 | 22982066, 149 | 23498015, 150 | 24023295, 151 | 24559110, 152 | 25105558, 153 | 25662737, 154 | 26230745, 155 | 26809680, 156 | 27399640, 157 | 28000723, 158 | 28613027, 159 | 29236650, 160 | 29871690, 161 | 30517485, 162 | 31174125, 163 | 31841700, 164 | 32520300, 165 | 33210015, 166 | 33910935, 167 | 34623150, 168 | 35346750, 169 | 36081825, 170 | 36828465, 171 | 37587867, 172 | 38360139, 173 | 39145389, 174 | 39943725, 175 | 40755255, 176 | 41580087, 177 | 42418329, 178 | 43270089, 179 | 44135475, 180 | 45014595, 181 | 45904870, 182 | 46806370, 183 | 47719165, 184 | 48643325, 185 | 49578920, 186 | 50526020, 187 | 51484695, 188 | 52455015, 189 | 53437050, 190 | 54430870, 191 | 55439542, 192 | 56463162, 193 | 57501826, 194 | 58555630, 195 | 59624670, 196 | 60709042, 197 | 61808842, 198 | 62924166, 199 | 64055110, 200 | 65201770, 201 | 66366010, 202 | 67547930, 203 | 68747630, 204 | 69965210, 205 | 71200770, 206 | 72454410, 207 | 73726230, 208 | 75016330, 209 | 76324810, 210 | 77651770, 211 | 78985354, 212 | 80325578, 213 | 81672458, 214 | 83026010, 215 | 84386250, 216 | 85753194, 217 | 87126858, 218 | 88507258, 219 | 89894410, 220 | 91288330, 221 | 92693002, 222 | 94108458, 223 | 95534730, 224 | 96971850, 225 | 98419850, 226 | 99878762, 227 | 101348618, 228 | 102829450, 229 | 104321290, 230 | 105824170, 231 | 107352234, 232 | 108905674, 233 | 110484682, 234 | 112089450, 235 | 113720170, 236 | 115377034, 237 | 117060234, 238 | 118769962, 239 | 120506410, 240 | 122269770, 241 | 124065890, 242 | 125895058, 243 | 127757562, 244 | 129653690, 245 | 131583730, 246 | 133547970, 247 | 135546698, 248 | 137580202, 249 | 139648770, 250 | 141752690, 251 | 143928178, 252 | 146176386, 253 | 148498466, 254 | 150895570, 255 | 153368850, 256 | 155919458, 257 | 158548546, 258 | 161257266, 259 | 164046770, 260 | 166918210, 261 | 169956978, 262 | 173167682, 263 | 176554930, 264 | 180123330, 265 | 205345890, 266 | 209100050, 267 | 212902550, 268 | 216753470, 269 | 220652890, 270 | 224600890, 271 | 228597550, 272 | 232642950, 273 | 236737170, 274 | 240880290, 275 | 245072390, 276 | 249313550, 277 | 253603850, 278 | 257943370, 279 | 262332190, 280 | 266770390, 281 | 271258050, 282 | 275795250, 283 | 280382070, 284 | 285018590, 285 | 289904810, 286 | 295042730, 287 | 300434350, 288 | 306081670, 289 | 311986690, 290 | 318151410, 291 | 324577830, 292 | 331267950, 293 | 338223770, 294 | 345447290, 295 | 354039310, 296 | 364049830, 297 | 375528850, 298 | 388526370, 299 | 403092390, 300 | 419276910, 301 | 437129930, 302 | 456701450, 303 | 476272970, 304 | 495844490, 305 | 515416010, 306 | 534987530, 307 | 554559050, 308 | 574130570, 309 | 593702090, 310 | 613273610, 311 | 632845130, 312 | 652416650, 313 | 671988170, 314 | 691559690, 315 | 711131210, 316 | 730702730, 317 | 750274250, 318 | 769845770, 319 | 789417290, 320 | 808988810, 321 | 828560330, 322 | 848131850, 323 | 867703370, 324 | 887274890, 325 | 906846410, 326 | 926417930, 327 | 945989450, 328 | 965560970, 329 | 985132490, 330 | 1004704010, 331 | 1024275530, 332 | 1043847050, 333 | 1063418570, 334 | 1082990090, 335 | 1102561610, 336 | 1122133130, 337 | 1141704650, 338 | 1161276170, 339 | 1180847690, 340 | 1200419210, 341 | 1222705731, 342 | 1244995262, 343 | 1267288477, 344 | 1289622601, 345 | 1311966887, 346 | 1334333102, 347 | 1356724650, 348 | 1379151914, 349 | 1401651370, 350 | 1424151231, 351 | 1448674779, 352 | 1473220997, 353 | 1497782544, 354 | 1522364697, 355 | 1546957043, 356 | 1571581919, 357 | 1596243411, 358 | 1620925875, 359 | 1645647464, 360 | 1670373305, 361 | 2000000000, 362 | 2000000000, 363 | 2000000000, 364 | 2000000000, 365 | 2039000000, 366 | 2078000000, 367 | 2117000000, 368 | 2156000000, 369 | 2195000000, 370 | 2234000000, 371 | 2273000000, 372 | 2312000000, 373 | 2351000000, 374 | 2390000000, 375 | 2429000000, 376 | 2468000000, 377 | 2507000000, 378 | 2546000000, 379 | 2585000000, 380 | 2624000000, 381 | 2663000000, 382 | 2702000000, 383 | 2741000000, 384 | 2780000000, 385 | 2819000000, 386 | 2858000000, 387 | 2897000000, 388 | 2936000000, 389 | 3000000000, 390 | 3043000000, 391 | 3086000000, 392 | 3129000000, 393 | 3172000000, 394 | 3215000000, 395 | 3258000000, 396 | 3301000000, 397 | 3344000000, 398 | 3387000000, 399 | 3430000000, 400 | 3473000000, 401 | 3516000000, 402 | 3559000000, 403 | 3602000000, 404 | 3645000000, 405 | 3688000000, 406 | 3731000000, 407 | 3774000000, 408 | 3817000000, 409 | 4000000000 410 | }, 411 | { 412 | 500, 413 | 1124, 414 | 1826, 415 | 2610, 416 | 3480, 417 | 4440, 418 | 5494, 419 | 6646, 420 | 7900, 421 | 9260, 422 | 10893, 423 | 12817, 424 | 15050, 425 | 17610, 426 | 20515, 427 | 23783, 428 | 27432, 429 | 31480, 430 | 35945, 431 | 40845, 432 | 46251, 433 | 52187, 434 | 58677, 435 | 65745, 436 | 73415, 437 | 81711, 438 | 90657, 439 | 100277, 440 | 110595, 441 | 121635, 442 | 133647, 443 | 146671, 444 | 160747, 445 | 175915, 446 | 192215, 447 | 209687, 448 | 228371, 449 | 248307, 450 | 269535, 451 | 292095, 452 | 316151, 453 | 341751, 454 | 368943, 455 | 397775, 456 | 428295, 457 | 460551, 458 | 494591, 459 | 530463, 460 | 568215, 461 | 607895, 462 | 649715, 463 | 693731, 464 | 739999, 465 | 788575, 466 | 839515, 467 | 892875, 468 | 948711, 469 | 1007079, 470 | 1068035, 471 | 1131635, 472 | 1198670, 473 | 1269230, 474 | 1343405, 475 | 1421285, 476 | 1502960, 477 | 1588520, 478 | 1678055, 479 | 1771655, 480 | 1869410, 481 | 1971410, 482 | 2078255, 483 | 2190055, 484 | 2306920, 485 | 2428960, 486 | 2556285, 487 | 2689005, 488 | 2827230, 489 | 2971070, 490 | 3120635, 491 | 3276035, 492 | 3438521, 493 | 3608249, 494 | 3785375, 495 | 3970055, 496 | 4162445, 497 | 4362701, 498 | 4570979, 499 | 4787435, 500 | 5012225, 501 | 5245505, 502 | 5488163, 503 | 5740379, 504 | 6002333, 505 | 6274205, 506 | 6556175, 507 | 6848423, 508 | 7151129, 509 | 7464473, 510 | 7788635, 511 | 8123795, 512 | 8460174, 513 | 8797774, 514 | 9136597, 515 | 9476645, 516 | 9817920, 517 | 10160424, 518 | 10504159, 519 | 10849127, 520 | 11195330, 521 | 11542770, 522 | 11892311, 523 | 12243959, 524 | 12597720, 525 | 12953600, 526 | 13311605, 527 | 13671741, 528 | 14034014, 529 | 14398430, 530 | 14764995, 531 | 15133715, 532 | 15508850, 533 | 15890450, 534 | 16278565, 535 | 16673245, 536 | 17074540, 537 | 17482500, 538 | 17897175, 539 | 18318615, 540 | 18746870, 541 | 19181990, 542 | 19625811, 543 | 20078403, 544 | 20539836, 545 | 21010180, 546 | 21489505, 547 | 21977881, 548 | 22475378, 549 | 22982066, 550 | 23498015, 551 | 24023295, 552 | 24559110, 553 | 25105558, 554 | 25662737, 555 | 26230745, 556 | 26809680, 557 | 27399640, 558 | 28000723, 559 | 28613027, 560 | 29236650, 561 | 29871690, 562 | 30517485, 563 | 31174125, 564 | 31841700, 565 | 32520300, 566 | 33210015, 567 | 33910935, 568 | 34623150, 569 | 35346750, 570 | 36081825, 571 | 36828465, 572 | 37587867, 573 | 38360139, 574 | 39145389, 575 | 39943725, 576 | 40755255, 577 | 41580087, 578 | 42418329, 579 | 43270089, 580 | 44135475, 581 | 45014595, 582 | 45904870, 583 | 46806370, 584 | 47719165, 585 | 48643325, 586 | 49578920, 587 | 50526020, 588 | 51484695, 589 | 52455015, 590 | 53437050, 591 | 54430870, 592 | 55439542, 593 | 56463162, 594 | 57501826, 595 | 58555630, 596 | 59624670, 597 | 60709042, 598 | 61808842, 599 | 62924166, 600 | 64055110, 601 | 65201770, 602 | 66366010, 603 | 67547930, 604 | 68747630, 605 | 69965210, 606 | 71200770, 607 | 72454410, 608 | 73726230, 609 | 75016330, 610 | 76324810, 611 | 77651770, 612 | 78985354, 613 | 80325578, 614 | 81672458, 615 | 83026010, 616 | 84386250, 617 | 85753194, 618 | 87126858, 619 | 88507258, 620 | 89894410, 621 | 91288330, 622 | 92693002, 623 | 94108458, 624 | 95534730, 625 | 96971850, 626 | 98419850, 627 | 99878762, 628 | 101348618, 629 | 102829450, 630 | 104321290, 631 | 105824170, 632 | 107352234, 633 | 108905674, 634 | 110484682, 635 | 112089450, 636 | 113720170, 637 | 115377034, 638 | 117060234, 639 | 118769962, 640 | 120506410, 641 | 122269770, 642 | 124065890, 643 | 125895058, 644 | 127757562, 645 | 129653690, 646 | 131583730, 647 | 133547970, 648 | 135546698, 649 | 137580202, 650 | 139648770, 651 | 141752690, 652 | 143928178, 653 | 146176386, 654 | 148498466, 655 | 150895570, 656 | 153368850, 657 | 155919458, 658 | 158548546, 659 | 161257266, 660 | 164046770, 661 | 166918210, 662 | 169956978, 663 | 173167682, 664 | 176554930, 665 | 180123330, 666 | 205345890, 667 | 209100050, 668 | 212902550, 669 | 216753470, 670 | 220652890, 671 | 224600890, 672 | 228597550, 673 | 232642950, 674 | 236737170, 675 | 240880290, 676 | 245072390, 677 | 249313550, 678 | 253603850, 679 | 257943370, 680 | 262332190, 681 | 266770390, 682 | 271258050, 683 | 275795250, 684 | 280382070, 685 | 285018590, 686 | 289904810, 687 | 295042730, 688 | 300434350, 689 | 306081670, 690 | 311986690, 691 | 318151410, 692 | 324577830, 693 | 331267950, 694 | 338223770, 695 | 345447290, 696 | 354039310, 697 | 364049830, 698 | 375528850, 699 | 388526370, 700 | 403092390, 701 | 419276910, 702 | 437129930, 703 | 456701450, 704 | 476272970, 705 | 495844490, 706 | 515416010, 707 | 534987530, 708 | 554559050, 709 | 574130570, 710 | 593702090, 711 | 613273610, 712 | 632845130, 713 | 652416650, 714 | 671988170, 715 | 691559690, 716 | 711131210, 717 | 730702730, 718 | 750274250, 719 | 769845770, 720 | 789417290, 721 | 808988810, 722 | 828560330, 723 | 848131850, 724 | 867703370, 725 | 887274890, 726 | 906846410, 727 | 926417930, 728 | 945989450, 729 | 965560970, 730 | 985132490, 731 | 1004704010, 732 | 1024275530, 733 | 1043847050, 734 | 1063418570, 735 | 1082990090, 736 | 1102561610, 737 | 1122133130, 738 | 1141704650, 739 | 1161276170, 740 | 1180847690, 741 | 1200419210, 742 | 1222705731, 743 | 1244995262, 744 | 1267288477, 745 | 1289622601, 746 | 1311966887, 747 | 1334333102, 748 | 1356724650, 749 | 1379151914, 750 | 1401651370, 751 | 1424151231, 752 | 1448674779, 753 | 1473220997, 754 | 1497782544, 755 | 1522364697, 756 | 1546957043, 757 | 1571581919, 758 | 1596243411, 759 | 1620925875, 760 | 1645647464, 761 | 1670373305, 762 | 2000000000, 763 | 2000000000, 764 | 2000000000, 765 | 2000000000, 766 | 2039000000, 767 | 2078000000, 768 | 2117000000, 769 | 2156000000, 770 | 2195000000, 771 | 2234000000, 772 | 2273000000, 773 | 2312000000, 774 | 2351000000, 775 | 2390000000, 776 | 2429000000, 777 | 2468000000, 778 | 2507000000, 779 | 2546000000, 780 | 2585000000, 781 | 2624000000, 782 | 2663000000, 783 | 2702000000, 784 | 2741000000, 785 | 2780000000, 786 | 2819000000, 787 | 2858000000, 788 | 2897000000, 789 | 2936000000, 790 | 3000000000, 791 | 3043000000, 792 | 3086000000, 793 | 3129000000, 794 | 3172000000, 795 | 3215000000, 796 | 3258000000, 797 | 3301000000, 798 | 3344000000, 799 | 3387000000, 800 | 3430000000, 801 | 3473000000, 802 | 3516000000, 803 | 3559000000, 804 | 3602000000, 805 | 3645000000, 806 | 3688000000, 807 | 3731000000, 808 | 3774000000, 809 | 3817000000, 810 | 4000000000 811 | }, 812 | { 813 | 500, 814 | 1124, 815 | 1826, 816 | 2610, 817 | 3480, 818 | 4440, 819 | 5494, 820 | 6646, 821 | 7900, 822 | 9260, 823 | 10893, 824 | 12817, 825 | 15050, 826 | 17610, 827 | 20515, 828 | 23783, 829 | 27432, 830 | 31480, 831 | 35945, 832 | 40845, 833 | 46251, 834 | 52187, 835 | 58677, 836 | 65745, 837 | 73415, 838 | 81711, 839 | 90657, 840 | 100277, 841 | 110595, 842 | 121635, 843 | 133647, 844 | 146671, 845 | 160747, 846 | 175915, 847 | 192215, 848 | 209687, 849 | 228371, 850 | 248307, 851 | 269535, 852 | 292095, 853 | 316151, 854 | 341751, 855 | 368943, 856 | 397775, 857 | 428295, 858 | 460551, 859 | 494591, 860 | 530463, 861 | 568215, 862 | 607895, 863 | 649715, 864 | 693731, 865 | 739999, 866 | 788575, 867 | 839515, 868 | 892875, 869 | 948711, 870 | 1007079, 871 | 1068035, 872 | 1131635, 873 | 1198670, 874 | 1269230, 875 | 1343405, 876 | 1421285, 877 | 1502960, 878 | 1588520, 879 | 1678055, 880 | 1771655, 881 | 1869410, 882 | 1971410, 883 | 2078255, 884 | 2190055, 885 | 2306920, 886 | 2428960, 887 | 2556285, 888 | 2689005, 889 | 2827230, 890 | 2971070, 891 | 3120635, 892 | 3276035, 893 | 3438521, 894 | 3608249, 895 | 3785375, 896 | 3970055, 897 | 4162445, 898 | 4362701, 899 | 4570979, 900 | 4787435, 901 | 5012225, 902 | 5245505, 903 | 5488163, 904 | 5740379, 905 | 6002333, 906 | 6274205, 907 | 6556175, 908 | 6848423, 909 | 7151129, 910 | 7464473, 911 | 7788635, 912 | 8123795, 913 | 8460174, 914 | 8797774, 915 | 9136597, 916 | 9476645, 917 | 9817920, 918 | 10160424, 919 | 10504159, 920 | 10849127, 921 | 11195330, 922 | 11542770, 923 | 11892311, 924 | 12243959, 925 | 12597720, 926 | 12953600, 927 | 13311605, 928 | 13671741, 929 | 14034014, 930 | 14398430, 931 | 14764995, 932 | 15133715, 933 | 15508850, 934 | 15890450, 935 | 16278565, 936 | 16673245, 937 | 17074540, 938 | 17482500, 939 | 17897175, 940 | 18318615, 941 | 18746870, 942 | 19181990, 943 | 19625811, 944 | 20078403, 945 | 20539836, 946 | 21010180, 947 | 21489505, 948 | 21977881, 949 | 22475378, 950 | 22982066, 951 | 23498015, 952 | 24023295, 953 | 24559110, 954 | 25105558, 955 | 25662737, 956 | 26230745, 957 | 26809680, 958 | 27399640, 959 | 28000723, 960 | 28613027, 961 | 29236650, 962 | 29871690, 963 | 30517485, 964 | 31174125, 965 | 31841700, 966 | 32520300, 967 | 33210015, 968 | 33910935, 969 | 34623150, 970 | 35346750, 971 | 36081825, 972 | 36828465, 973 | 37587867, 974 | 38360139, 975 | 39145389, 976 | 39943725, 977 | 40755255, 978 | 41580087, 979 | 42418329, 980 | 43270089, 981 | 44135475, 982 | 45014595, 983 | 45904870, 984 | 46806370, 985 | 47719165, 986 | 48643325, 987 | 49578920, 988 | 50526020, 989 | 51484695, 990 | 52455015, 991 | 53437050, 992 | 54430870, 993 | 55439542, 994 | 56463162, 995 | 57501826, 996 | 58555630, 997 | 59624670, 998 | 60709042, 999 | 61808842, 1000 | 62924166, 1001 | 64055110, 1002 | 65201770, 1003 | 66366010, 1004 | 67547930, 1005 | 68747630, 1006 | 69965210, 1007 | 71200770, 1008 | 72454410, 1009 | 73726230, 1010 | 75016330, 1011 | 76324810, 1012 | 77651770, 1013 | 78985354, 1014 | 80325578, 1015 | 81672458, 1016 | 83026010, 1017 | 84386250, 1018 | 85753194, 1019 | 87126858, 1020 | 88507258, 1021 | 89894410, 1022 | 91288330, 1023 | 92693002, 1024 | 94108458, 1025 | 95534730, 1026 | 96971850, 1027 | 98419850, 1028 | 99878762, 1029 | 101348618, 1030 | 102829450, 1031 | 104321290, 1032 | 105824170, 1033 | 107352234, 1034 | 108905674, 1035 | 110484682, 1036 | 112089450, 1037 | 113720170, 1038 | 115377034, 1039 | 117060234, 1040 | 118769962, 1041 | 120506410, 1042 | 122269770, 1043 | 124065890, 1044 | 125895058, 1045 | 127757562, 1046 | 129653690, 1047 | 131583730, 1048 | 133547970, 1049 | 135546698, 1050 | 137580202, 1051 | 139648770, 1052 | 141752690, 1053 | 143928178, 1054 | 146176386, 1055 | 148498466, 1056 | 150895570, 1057 | 153368850, 1058 | 155919458, 1059 | 158548546, 1060 | 161257266, 1061 | 164046770, 1062 | 166918210, 1063 | 169956978, 1064 | 173167682, 1065 | 176554930, 1066 | 180123330, 1067 | 205345890, 1068 | 209100050, 1069 | 212902550, 1070 | 216753470, 1071 | 220652890, 1072 | 224600890, 1073 | 228597550, 1074 | 232642950, 1075 | 236737170, 1076 | 240880290, 1077 | 245072390, 1078 | 249313550, 1079 | 253603850, 1080 | 257943370, 1081 | 262332190, 1082 | 266770390, 1083 | 271258050, 1084 | 275795250, 1085 | 280382070, 1086 | 285018590, 1087 | 289904810, 1088 | 295042730, 1089 | 300434350, 1090 | 306081670, 1091 | 311986690, 1092 | 318151410, 1093 | 324577830, 1094 | 331267950, 1095 | 338223770, 1096 | 345447290, 1097 | 354039310, 1098 | 364049830, 1099 | 375528850, 1100 | 388526370, 1101 | 403092390, 1102 | 419276910, 1103 | 437129930, 1104 | 456701450, 1105 | 476272970, 1106 | 495844490, 1107 | 515416010, 1108 | 534987530, 1109 | 554559050, 1110 | 574130570, 1111 | 593702090, 1112 | 613273610, 1113 | 632845130, 1114 | 652416650, 1115 | 671988170, 1116 | 691559690, 1117 | 711131210, 1118 | 730702730, 1119 | 750274250, 1120 | 769845770, 1121 | 789417290, 1122 | 808988810, 1123 | 828560330, 1124 | 848131850, 1125 | 867703370, 1126 | 887274890, 1127 | 906846410, 1128 | 926417930, 1129 | 945989450, 1130 | 965560970, 1131 | 985132490, 1132 | 1004704010, 1133 | 1024275530, 1134 | 1043847050, 1135 | 1063418570, 1136 | 1082990090, 1137 | 1102561610, 1138 | 1122133130, 1139 | 1141704650, 1140 | 1161276170, 1141 | 1180847690, 1142 | 1200419210, 1143 | 1222705731, 1144 | 1244995262, 1145 | 1267288477, 1146 | 1289622601, 1147 | 1311966887, 1148 | 1334333102, 1149 | 1356724650, 1150 | 1379151914, 1151 | 1401651370, 1152 | 1424151231, 1153 | 1448674779, 1154 | 1473220997, 1155 | 1497782544, 1156 | 1522364697, 1157 | 1546957043, 1158 | 1571581919, 1159 | 1596243411, 1160 | 1620925875, 1161 | 1645647464, 1162 | 1670373305, 1163 | 2000000000, 1164 | 2000000000, 1165 | 2000000000, 1166 | 2000000000, 1167 | 2039000000, 1168 | 2078000000, 1169 | 2117000000, 1170 | 2156000000, 1171 | 2195000000, 1172 | 2234000000, 1173 | 2273000000, 1174 | 2312000000, 1175 | 2351000000, 1176 | 2390000000, 1177 | 2429000000, 1178 | 2468000000, 1179 | 2507000000, 1180 | 2546000000, 1181 | 2585000000, 1182 | 2624000000, 1183 | 2663000000, 1184 | 2702000000, 1185 | 2741000000, 1186 | 2780000000, 1187 | 2819000000, 1188 | 2858000000, 1189 | 2897000000, 1190 | 2936000000, 1191 | 3000000000, 1192 | 3043000000, 1193 | 3086000000, 1194 | 3129000000, 1195 | 3172000000, 1196 | 3215000000, 1197 | 3258000000, 1198 | 3301000000, 1199 | 3344000000, 1200 | 3387000000, 1201 | 3430000000, 1202 | 3473000000, 1203 | 3516000000, 1204 | 3559000000, 1205 | 3602000000, 1206 | 3645000000, 1207 | 3688000000, 1208 | 3731000000, 1209 | 3774000000, 1210 | 3817000000, 1211 | 4000000000 1212 | }, 1213 | { 1214 | 20000000, 1215 | 40000000, 1216 | 60000000, 1217 | 80000000, 1218 | 100000000, 1219 | 120000000, 1220 | 140000000, 1221 | 160000000, 1222 | 180000000, 1223 | 200000000, 1224 | 220000000, 1225 | 240000000, 1226 | 260000000, 1227 | 280000000, 1228 | 300000000, 1229 | 320000000, 1230 | 340000000, 1231 | 360000000, 1232 | 380000000, 1233 | 400000000, 1234 | 420000000, 1235 | 440000000, 1236 | 460000000, 1237 | 480000000, 1238 | 500000000, 1239 | 520000000, 1240 | 540000000, 1241 | 560000000, 1242 | 580000000, 1243 | 600000000, 1244 | 620000000, 1245 | 640000000, 1246 | 660000000, 1247 | 680000000, 1248 | 700000000, 1249 | 720000000, 1250 | 740000000, 1251 | 760000000, 1252 | 780000000, 1253 | 800000000, 1254 | 820000000, 1255 | 840000000, 1256 | 860000000, 1257 | 880000000, 1258 | 900000000, 1259 | 920000000, 1260 | 940000000, 1261 | 960000000, 1262 | 980000000, 1263 | 1000000000, 1264 | 1020000000, 1265 | 1040000000, 1266 | 1060000000, 1267 | 1080000000, 1268 | 1100000000, 1269 | 1120000000, 1270 | 1140000000, 1271 | 1160000000, 1272 | 1180000000, 1273 | 1200000000, 1274 | 1220000000, 1275 | 1240000000, 1276 | 1260000000, 1277 | 1280000000, 1278 | 1300000000, 1279 | 1320000000, 1280 | 1340000000, 1281 | 1360000000, 1282 | 1380000000, 1283 | 1400000000, 1284 | 1420000000, 1285 | 1440000000, 1286 | 1460000000, 1287 | 1480000000, 1288 | 1500000000, 1289 | 1520000000, 1290 | 1540000000, 1291 | 1560000000, 1292 | 1580000000, 1293 | 1600000000, 1294 | 1620000000, 1295 | 1640000000, 1296 | 1660000000, 1297 | 1680000000, 1298 | 1700000000, 1299 | 1720000000, 1300 | 1740000000, 1301 | 1760000000, 1302 | 1780000000, 1303 | 1800000000, 1304 | 1820000000, 1305 | 1840000000, 1306 | 1860000000, 1307 | 1880000000, 1308 | 1900000000, 1309 | 1920000000, 1310 | 1940000000, 1311 | 1960000000, 1312 | 1980000000, 1313 | 2000000000, 1314 | 2020000000, 1315 | 2040000000, 1316 | 2060000000, 1317 | 2080000000, 1318 | 2100000000, 1319 | 2120000000, 1320 | 2140000000, 1321 | 2160000000, 1322 | 2180000000, 1323 | 2200000000, 1324 | 2220000000, 1325 | 2240000000, 1326 | 2260000000, 1327 | 2280000000, 1328 | 2300000000, 1329 | 2320000000, 1330 | 2340000000, 1331 | 2360000000, 1332 | 2380000000, 1333 | 2400000000, 1334 | 2420000000, 1335 | 2440000000, 1336 | 2460000000, 1337 | 2480000000, 1338 | 2500000000, 1339 | 2520000000, 1340 | 2540000000, 1341 | 2560000000, 1342 | 2580000000, 1343 | 2600000000, 1344 | 2620000000, 1345 | 2640000000, 1346 | 2660000000, 1347 | 2680000000, 1348 | 2700000000, 1349 | 2720000000, 1350 | 2740000000, 1351 | 2760000000, 1352 | 2780000000, 1353 | 2800000000, 1354 | 2820000000, 1355 | 2840000000, 1356 | 2860000000, 1357 | 2880000000, 1358 | 2900000000, 1359 | 2920000000, 1360 | 2940000000, 1361 | 2960000000, 1362 | 2980000000, 1363 | 3000000000, 1364 | 3020000000, 1365 | 3040000000, 1366 | 3060000000, 1367 | 3080000000, 1368 | 3100000000, 1369 | 3120000000, 1370 | 3140000000, 1371 | 3160000000, 1372 | 3180000000, 1373 | 3200000000, 1374 | 3220000000, 1375 | 3240000000, 1376 | 3260000000, 1377 | 3280000000, 1378 | 3300000000, 1379 | 3320000000, 1380 | 3340000000, 1381 | 3360000000, 1382 | 3380000000, 1383 | 3400000000, 1384 | 3420000000, 1385 | 3440000000, 1386 | 3460000000, 1387 | 3480000000, 1388 | 3500000000, 1389 | 3520000000, 1390 | 3540000000, 1391 | 3560000000, 1392 | 3580000000, 1393 | 3600000000, 1394 | 3620000000, 1395 | 3640000000, 1396 | 3660000000, 1397 | 3680000000, 1398 | 3700000000, 1399 | 3720000000, 1400 | 3740000000, 1401 | 3760000000, 1402 | 3780000000, 1403 | 3800000000, 1404 | 3820000000, 1405 | 3840000000, 1406 | 3860000000, 1407 | 3880000000, 1408 | 3900000000, 1409 | 3920000000, 1410 | 3940000000, 1411 | 3960000000, 1412 | 4000000000, 1413 | 4200000000 1414 | }, 1415 | { 1416 | 20000000, 1417 | 40000000, 1418 | 60000000, 1419 | 80000000, 1420 | 100000000, 1421 | 120000000, 1422 | 140000000, 1423 | 160000000, 1424 | 180000000, 1425 | 200000000, 1426 | 220000000, 1427 | 240000000, 1428 | 260000000, 1429 | 280000000, 1430 | 300000000, 1431 | 320000000, 1432 | 340000000, 1433 | 360000000, 1434 | 380000000, 1435 | 400000000, 1436 | 420000000, 1437 | 440000000, 1438 | 460000000, 1439 | 480000000, 1440 | 500000000, 1441 | 520000000, 1442 | 540000000, 1443 | 560000000, 1444 | 580000000, 1445 | 600000000, 1446 | 620000000, 1447 | 640000000, 1448 | 660000000, 1449 | 680000000, 1450 | 700000000, 1451 | 720000000, 1452 | 740000000, 1453 | 760000000, 1454 | 780000000, 1455 | 800000000, 1456 | 820000000, 1457 | 840000000, 1458 | 860000000, 1459 | 880000000, 1460 | 900000000, 1461 | 920000000, 1462 | 940000000, 1463 | 960000000, 1464 | 980000000, 1465 | 1000000000, 1466 | 1020000000, 1467 | 1040000000, 1468 | 1060000000, 1469 | 1080000000, 1470 | 1100000000, 1471 | 1120000000, 1472 | 1140000000, 1473 | 1160000000, 1474 | 1180000000, 1475 | 1200000000, 1476 | 1220000000, 1477 | 1240000000, 1478 | 1260000000, 1479 | 1280000000, 1480 | 1300000000, 1481 | 1320000000, 1482 | 1340000000, 1483 | 1360000000, 1484 | 1380000000, 1485 | 1400000000, 1486 | 1420000000, 1487 | 1440000000, 1488 | 1460000000, 1489 | 1480000000, 1490 | 1500000000, 1491 | 1520000000, 1492 | 1540000000, 1493 | 1560000000, 1494 | 1580000000, 1495 | 1600000000, 1496 | 1620000000, 1497 | 1640000000, 1498 | 1660000000, 1499 | 1680000000, 1500 | 1700000000, 1501 | 1720000000, 1502 | 1740000000, 1503 | 1760000000, 1504 | 1780000000, 1505 | 1800000000, 1506 | 1820000000, 1507 | 1840000000, 1508 | 1860000000, 1509 | 1880000000, 1510 | 1900000000, 1511 | 1920000000, 1512 | 1940000000, 1513 | 1960000000, 1514 | 1980000000, 1515 | 2000000000, 1516 | 2020000000, 1517 | 2040000000, 1518 | 2060000000, 1519 | 2080000000, 1520 | 2100000000, 1521 | 2120000000, 1522 | 2140000000, 1523 | 2160000000, 1524 | 2180000000, 1525 | 2200000000, 1526 | 2220000000, 1527 | 2240000000, 1528 | 2260000000, 1529 | 2280000000, 1530 | 2300000000, 1531 | 2320000000, 1532 | 2340000000, 1533 | 2360000000, 1534 | 2380000000, 1535 | 2400000000, 1536 | 2420000000, 1537 | 2440000000, 1538 | 2460000000, 1539 | 2480000000, 1540 | 2500000000, 1541 | 2520000000, 1542 | 2540000000, 1543 | 2560000000, 1544 | 2580000000, 1545 | 2600000000, 1546 | 2620000000, 1547 | 2640000000, 1548 | 2660000000, 1549 | 2680000000, 1550 | 2700000000, 1551 | 2720000000, 1552 | 2740000000, 1553 | 2760000000, 1554 | 2780000000, 1555 | 2800000000, 1556 | 2820000000, 1557 | 2840000000, 1558 | 2860000000, 1559 | 2880000000, 1560 | 2900000000, 1561 | 2920000000, 1562 | 2940000000, 1563 | 2960000000, 1564 | 2980000000, 1565 | 3000000000, 1566 | 3020000000, 1567 | 3040000000, 1568 | 3060000000, 1569 | 3080000000, 1570 | 3100000000, 1571 | 3120000000, 1572 | 3140000000, 1573 | 3160000000, 1574 | 3180000000, 1575 | 3200000000, 1576 | 3220000000, 1577 | 3240000000, 1578 | 3260000000, 1579 | 3280000000, 1580 | 3300000000, 1581 | 3320000000, 1582 | 3340000000, 1583 | 3360000000, 1584 | 3380000000, 1585 | 3400000000, 1586 | 3420000000, 1587 | 3440000000, 1588 | 3460000000, 1589 | 3480000000, 1590 | 3500000000, 1591 | 3520000000, 1592 | 3540000000, 1593 | 3560000000, 1594 | 3580000000, 1595 | 3600000000, 1596 | 3620000000, 1597 | 3640000000, 1598 | 3660000000, 1599 | 3680000000, 1600 | 3700000000, 1601 | 3720000000, 1602 | 3740000000, 1603 | 3760000000, 1604 | 3780000000, 1605 | 3800000000, 1606 | 3820000000, 1607 | 3840000000, 1608 | 3860000000, 1609 | 3880000000, 1610 | 3900000000, 1611 | 3920000000, 1612 | 3940000000, 1613 | 3960000000, 1614 | 4000000000, 1615 | 4200000000 1616 | } 1617 | }; 1618 | #pragma endregion 1619 | 1620 | #define MAX_ITEMLIST 6500 1621 | #define MAX_EFFECT_NAME 256 1622 | 1623 | #define MAX_MESH_BUFFER 16 1624 | #define MAX_SCORE_BUFFER 32 1625 | #define MAX_EFFECT 12 1626 | 1627 | #define MAX_PLAYER 750 1628 | #define INIT_SPAWN_MOB 1000 1629 | #define MAX_SPAWN_MOB 30000 1630 | 1631 | #define MAX_SKILLDATA 128 1632 | 1633 | #define MAX_ENEMY 10 1634 | 1635 | #define EQUIP_TYPE 0 1636 | #define INV_TYPE 1 1637 | #define STORAGE_TYPE 2 1638 | 1639 | void EncryptVersion(UINT32 *pVersion); 1640 | void ServerMessage(char *msg, ...); 1641 | void AddChat(char *msg, ...); 1642 | void AddGroup(char *msg, ...); 1643 | void SetLabel(INT32 id, char *msg, ...); 1644 | void CharLogOut(); 1645 | void RefreshStatus(); 1646 | void RefreshGroup(); 1647 | void RefreshMacroStatus(); 1648 | void RefreshMobStatus(); 1649 | int Rand(); 1650 | 1651 | short get_effect_index(const char *s); 1652 | bool ReadItemEffect(); 1653 | bool ReadItemList(); 1654 | bool ReadSkillData(); 1655 | BOOL ReadQuiz(); 1656 | BOOL ReadAutoTrade(); 1657 | 1658 | void ApplyAttribute(char *pHeight, int size); 1659 | bool ReadAttributeMap(); 1660 | bool ReadHeightMap(); 1661 | 1662 | extern char g_pHeightGrid[4096][4096]; 1663 | extern unsigned char g_pAttributeMap[1024][1024]; 1664 | extern WORD g_pMobGrid[4096][4096]; 1665 | 1666 | static int g_HeightWidth = 4096; // 4C7B98 - 4CBB98 1667 | static int g_HeightHeight = 4096; // 4C7B9C - 4CBB9C 1668 | static int g_HeightPosX = 0; // 758FAA8 - 8BF17F8 1669 | static int g_HeightPosY = 0; // 758FAAC - 8BF17FC 1670 | 1671 | extern sItemData ItemList[MAX_ITEMLIST]; 1672 | extern sSpellData SkillData[MAX_SKILLDATA]; 1673 | extern char EffectName[MAX_EFFECT_NAME][16]; 1674 | 1675 | const int waterMaxMin[3][9][4] = { 1676 | { 1677 | {1040, 3545, 1055, 3560}, 1678 | {1040, 3510, 1055, 3525}, 1679 | {1040, 3475, 1055, 3490}, 1680 | {1080, 3475, 1095, 3490}, 1681 | {1115, 3475, 1130, 3490}, 1682 | {1115, 3510, 1130, 3525}, 1683 | {1115, 3545, 1130, 3560}, 1684 | {1075, 3545, 1096, 3560}, 1685 | {1075, 3505, 1095, 3530} 1686 | }, 1687 | { 1688 | {1170, 3675, 1185, 3690}, 1689 | {1170, 3635, 1185, 3655}, 1690 | {1170, 3600, 1185, 3620}, 1691 | {1205, 3600, 1220, 3620}, 1692 | {1240, 3600, 1255, 3620}, 1693 | {1240, 3640, 1255, 3655}, 1694 | {1240, 3675, 1255, 3690}, 1695 | {1205, 3675, 1220, 3690}, 1696 | {1205, 3630, 1225, 3655} 1697 | }, 1698 | { 1699 | {1295, 3545, 1315, 3565}, // OK 1700 | {1295, 3510, 1315, 3525}, // OK 1701 | {1300, 3470, 1315, 3490}, // OK 1702 | {1335, 3475, 1350, 3490}, // OK 1703 | {1370, 3475, 1385, 3490}, // OK 1704 | {1370, 3510, 1385, 3525}, // OK 1705 | {1365, 3545, 1385, 3565}, // OK 1706 | {1330, 3545, 1350, 3565}, // OK 1707 | {1330, 3505, 1355, 3530} // OK 1708 | } 1709 | }; 1710 | #endif -------------------------------------------------------------------------------- /WYD2Bot/CClient.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevinkouketsu/WYD2Bot/355fc70cdf30964c580050bd7b8c648f6ed8c2bd/WYD2Bot/CClient.cpp -------------------------------------------------------------------------------- /WYD2Bot/CClient.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevinkouketsu/WYD2Bot/355fc70cdf30964c580050bd7b8c648f6ed8c2bd/WYD2Bot/CClient.h -------------------------------------------------------------------------------- /WYD2Bot/CSocket.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifndef __SOCKET_H__ 5 | #define __SOCKET_H__ 6 | 7 | #define ACCEPT_USER WM_USER + 1 8 | #define RECV_USER WM_USER + 2 9 | #define WM_SOCKET WM_USER 10 | #define WM_SERVER 0x600 11 | 12 | #define INITCODE 0x1F11F311 13 | 14 | #define RECV_BUFFER_SIZE (32*1024) 15 | #define SEND_BUFFER_SIZE (32*1024) 16 | 17 | #define MAX_MESSAGE_SIZE 16384 18 | 19 | 20 | #pragma comment (lib, "WS2_32.lib") 21 | 22 | class Server 23 | { 24 | private: 25 | INT32 CurrentTime; 26 | INT32 HashIncrement; 27 | 28 | public: 29 | Server(); 30 | ~Server(); 31 | 32 | SOCKADDR_IN Service; 33 | BOOL Connect(); 34 | BOOL Receive(); 35 | BOOL AddMessage(char *pMsg, int Size); 36 | 37 | void RefreshRecvBuffer(); 38 | void RefreshSendBuffer(); 39 | 40 | INT32 LastPacket; 41 | INT32 TimePacket; 42 | public: 43 | INT32 hServer; 44 | WSADATA wSaData; 45 | unsigned int Sock; 46 | char *pSendBuffer; 47 | char *pRecvBuffer; 48 | int nSendPosition; 49 | int nRecvPosition; 50 | int nProcPosition; 51 | int nSentPosition; 52 | int Init; 53 | 54 | char *ReadMessage(int *ErrorCode, int* ErrorType); 55 | BOOL SendMessageA(); 56 | 57 | 58 | void SethServer(UINT32 value); 59 | void SetHashIncrement(INT32 value); 60 | 61 | INT32 GethServer(); 62 | SOCKADDR_IN *GetService(); 63 | WSADATA *GetwSaData(); 64 | INT32 GetCurrenttime(); 65 | INT32 GetHashIncrement(); 66 | 67 | }; 68 | 69 | 70 | static BYTE KeyTable[512] = { 71 | 0xBD, 0x7A, 0xB5, 0x6A, 0xD5, 0x70, 0xAA, 0x72, 0xE5, 0xCA, 0xBF, 0xFD, 0xF6, 0x3B, 0xA4, 0x62, 72 | 0xC5, 0x4A, 0xBF, 0xFE, 0x5A, 0xF1, 0x57, 0x29, 0xFC, 0x22, 0x85, 0x9F, 0x7F, 0xFE, 0xB9, 0x42, 73 | 0x85, 0x0A, 0x3F, 0xFC, 0x50, 0xFE, 0xFB, 0xEF, 0x7F, 0x80, 0x7C, 0xF7, 0xDD, 0xF7, 0xDF, 0x7C, 74 | 0xF3, 0x2D, 0xE4, 0xEB, 0xAF, 0xBF, 0xF9, 0xF2, 0xCB, 0xAF, 0x98, 0x7C, 0xFE, 0xF9, 0x17, 0x90, 75 | 0xCF, 0x3E, 0xFB, 0xBC, 0x6C, 0xD9, 0x72, 0x90, 0x32, 0x65, 0xCA, 0x96, 0x2E, 0x5D, 0xE6, 0xD3, 76 | 0x4F, 0x4B, 0x41, 0x3E, 0xF9, 0xE4, 0xD3, 0x8F, 0x3F, 0xFE, 0x04, 0x52, 0xB2, 0xE4, 0xC7, 0x1F, 77 | 0x7D, 0x54, 0xF2, 0xC3, 0x0F, 0x3F, 0x82, 0x7C, 0xF0, 0xC1, 0x87, 0x90, 0x12, 0x25, 0x3E, 0x78, 78 | 0xFF, 0xFD, 0x12, 0x90, 0xF7, 0xDE, 0x7B, 0x9F, 0x97, 0xE2, 0xC5, 0xDF, 0x2B, 0x56, 0xAC, 0xB8, 79 | 0x56, 0x8A, 0x16, 0x2D, 0x26, 0x0B, 0x7F, 0x16, 0xE9, 0x99, 0xA8, 0xF2, 0x41, 0xCE, 0xB8, 0x05, 80 | 0x13, 0xF9, 0x8E, 0xAA, 0x63, 0x39, 0x01, 0x7F, 0xC0, 0x12, 0xF3, 0x97, 0xC8, 0x57, 0xC9, 0xF1, 81 | 0xAC, 0x22, 0x10, 0x16, 0x4A, 0x4A, 0x81, 0x1D, 0x4B, 0x91, 0x38, 0x56, 0x0B, 0x10, 0x80, 0x48, 82 | 0x41, 0x04, 0x44, 0x57, 0x58, 0x1A, 0x86, 0x15, 0x84, 0x07, 0x8A, 0xD5, 0x8E, 0x81, 0x53, 0xA4, 83 | 0x48, 0xD1, 0xC2, 0x85, 0x8B, 0x14, 0x2A, 0x54, 0xB8, 0x60, 0xC1, 0x42, 0x90, 0x02, 0x05, 0x0A, 84 | 0xE6, 0xCF, 0x5F, 0x20, 0x5F, 0xBE, 0xFC, 0x79, 0xF3, 0xE6, 0x63, 0x92, 0x27, 0x4F, 0x5E, 0x26, 85 | 0xB9, 0x73, 0xE7, 0xD1, 0x4A, 0xAE, 0x5C, 0xB9, 0x21, 0xBA, 0xA7, 0x5C, 0x8A, 0x94, 0xEF, 0xA2, 86 | 0x3A, 0x90, 0x8B, 0xC1, 0x1F, 0xA0, 0x78, 0xF9, 0xF0, 0x9F, 0x0B, 0xF8, 0x29, 0x45, 0xBA, 0x26, 87 | 0x72, 0xED, 0xE4, 0xA2, 0xB2, 0xEA, 0x40, 0x72, 0xE4, 0xC8, 0x99, 0x89, 0x24, 0x47, 0x4E, 0x2E, 88 | 0xE4, 0x10, 0x83, 0x7E, 0xED, 0x72, 0xE6, 0xCC, 0x05, 0x91, 0xCF, 0xE2, 0x58, 0x6E, 0x5F, 0xB4, 89 | 0x8B, 0x04, 0x79, 0x01, 0x28, 0x09, 0xB4, 0x05, 0x3A, 0x03, 0xCD, 0x61, 0x9D, 0x08, 0x5A, 0x24, 90 | 0x77, 0x19, 0xD6, 0x0D, 0x75, 0xFB, 0x42, 0xBA, 0x46, 0xB2, 0xFB, 0xA6, 0x4C, 0xF8, 0xCE, 0xFE, 91 | 0xBE, 0x14, 0x50, 0x01, 0x04, 0x76, 0xAC, 0x1A, 0x0A, 0x52, 0xFC, 0x93, 0x8D, 0x33, 0x0C, 0x31, 92 | 0xD6, 0xE9, 0x20, 0x5C, 0x8F, 0x2B, 0xC0, 0xB4, 0x11, 0xAA, 0x28, 0xB7, 0x42, 0xF6, 0xEC, 0x39, 93 | 0xDE, 0x7D, 0x37, 0x5B, 0xD6, 0xAC, 0x90, 0x77, 0xB3, 0x64, 0x79, 0xF7, 0x9D, 0x2C, 0x59, 0xDF, 94 | 0x79, 0x07, 0x92, 0xE5, 0x6D, 0xC8, 0xDB, 0x2F, 0x43, 0xD8, 0xAD, 0xED, 0xF2, 0x4E, 0x96, 0x2C, 95 | 0x2A, 0xE1, 0xCF, 0xA6, 0xE0, 0x18, 0x55, 0x73, 0x2A, 0x59, 0xB2, 0x64, 0xD5, 0x88, 0x08, 0x4E, 96 | 0x46, 0x14, 0xB4, 0x9A, 0x5D, 0xB2, 0xBE, 0xFB, 0xAE, 0x4A, 0xE4, 0x53, 0x2E, 0x1D, 0x40, 0x13, 97 | 0x5E, 0xAC, 0x30, 0xF5, 0x93, 0xC5, 0x85, 0xBB, 0x43, 0x75, 0xED, 0xDA, 0x2B, 0x5E, 0xFE, 0xEE, 98 | 0xBB, 0xD9, 0x99, 0x64, 0xCB, 0x96, 0x03, 0x92, 0x3D, 0x7B, 0x4E, 0x26, 0x39, 0x30, 0xE6, 0xE4, 99 | 0xCA, 0x0D, 0xC9, 0x25, 0xCD, 0x2F, 0xD2, 0xF8, 0x9F, 0x27, 0x2F, 0x3A, 0x83, 0x62, 0x48, 0xC7, 100 | 0x94, 0xA4, 0x90, 0xFC, 0xF9, 0x31, 0x4F, 0x29, 0xA4, 0x40, 0x01, 0x4C, 0x5E, 0x96, 0xA4, 0x60, 101 | 0x41, 0x4C, 0x76, 0x6A, 0x29, 0x54, 0x08, 0x93, 0xA0, 0x05, 0xC1, 0x5C, 0x89, 0x9E, 0x8B, 0xFE, 102 | 0xAB, 0x91, 0x22, 0xE8, 0xD7, 0x96, 0xA5, 0x28, 0x86, 0x02, 0x4E, 0xE4, 0x45, 0x88, 0xBC, 0x02 103 | }; 104 | extern Server cServer; 105 | 106 | #endif -------------------------------------------------------------------------------- /WYD2Bot/Command.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevinkouketsu/WYD2Bot/355fc70cdf30964c580050bd7b8c648f6ed8c2bd/WYD2Bot/Command.cpp -------------------------------------------------------------------------------- /WYD2Bot/GetFunc.cpp: -------------------------------------------------------------------------------- 1 | #include "Main.h" 2 | #include "GetFunc.h" 3 | #include "Basedef.h" 4 | #include "CClient.h" 5 | #include 6 | 7 | double GetDistance(int x1,int y1,int x2,int y2) 8 | { 9 | return sqrt(float(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)))); 10 | } 11 | 12 | 13 | short GetItemAbility(st_Item *itemPtr, int eff) 14 | { 15 | int result = 0; 16 | 17 | int itemID = itemPtr->Index; 18 | 19 | int unique = ItemList[itemID].Unique; 20 | int pos = ItemList[itemID].Pos; 21 | 22 | if(eff == EF_DAMAGEADD || eff == EF_MAGICADD) 23 | if(unique < 41 || unique > 50) 24 | return 0; 25 | 26 | if(eff == EF_CRITICAL) 27 | if(itemPtr->Effect[1].Index == EF_CRITICAL2 || itemPtr->Effect[2].Index == EF_CRITICAL2) 28 | eff = EF_CRITICAL2; 29 | 30 | if(eff == EF_DAMAGE && pos == 32) 31 | if(itemPtr->Effect[1].Index == EF_DAMAGE2 || itemPtr->Effect[2].Index == EF_DAMAGE2) 32 | eff = EF_DAMAGE2; 33 | 34 | if(eff == EF_MPADD) 35 | if(itemPtr->Effect[1].Index == EF_MPADD2 || itemPtr->Effect[2].Index == EF_MPADD2) 36 | eff = EF_MPADD2; 37 | 38 | if(eff == EF_ACADD) 39 | if(itemPtr->Effect[1].Index == EF_ACADD2 || itemPtr->Effect[2].Index == EF_ACADD2) 40 | eff = EF_ACADD2; 41 | 42 | if(eff == EF_LEVEL && itemID >= 2330 && itemID < 2360) 43 | result = (itemPtr->Effect[1].Index - 1); 44 | else if(eff == EF_LEVEL) 45 | result += ItemList[itemID].Level; 46 | 47 | if(eff == EF_REQ_STR) 48 | result += ItemList[itemID].Str; 49 | if(eff == EF_REQ_INT) 50 | result += ItemList[itemID].Int; 51 | if(eff == EF_REQ_DEX) 52 | result += ItemList[itemID].Dex; 53 | if(eff == EF_REQ_CON) 54 | result += ItemList[itemID].Con; 55 | 56 | if(eff == EF_POS) 57 | result += ItemList[itemID].Pos; 58 | 59 | if(eff != EF_INCUBATE) 60 | { 61 | for(int i = 0; i < 12; i++) 62 | { 63 | if(ItemList[itemID].Effect[i].Index != eff) 64 | continue; 65 | 66 | int val = ItemList[itemID].Effect[i].Value; 67 | if(eff == EF_ATTSPEED && val == 1) 68 | val = 10; 69 | 70 | result += val; 71 | break; 72 | } 73 | } 74 | 75 | if(itemPtr->Index >= 2330 && itemPtr->Index < 2390) 76 | { 77 | if(eff == EF_MOUNTHP) 78 | return *(WORD*)&itemPtr->Effect[0].Index; 79 | 80 | if(eff == EF_MOUNTSANC) 81 | return itemPtr->Effect[1].Index; 82 | 83 | if(eff == EF_MOUNTLIFE) 84 | return itemPtr->Effect[1].Value; 85 | 86 | if(eff == EF_MOUNTFEED) 87 | return itemPtr->Effect[2].Index; 88 | 89 | if(eff == EF_MOUNTKILL) 90 | return itemPtr->Effect[2].Value; 91 | 92 | if(itemPtr->Index >= 2360 && itemPtr->Index < 2390 && *(WORD*)&itemPtr->Effect[0].Index > 0) 93 | { 94 | int mountIndex = itemPtr->Index - 2360; 95 | if(mountIndex < 0 || mountIndex > 29) 96 | return 0; 97 | 98 | } 99 | 100 | return result; 101 | } 102 | 103 | if(itemPtr->Index >= 3980 && itemPtr->Index <= 3994 && eff == EF_RUNSPEED) 104 | return 6; 105 | 106 | for(int i = 0; i < 3; i++) 107 | { 108 | if(itemPtr->Effect[i].Index != eff) 109 | continue; 110 | 111 | int val = itemPtr->Effect[i].Value; 112 | if(eff == EF_ATTSPEED && val == 1) 113 | val = 10; 114 | 115 | result += val; 116 | } 117 | 118 | if(eff == EF_RESIST1 || eff == EF_RESIST2 || 119 | eff == EF_RESIST3 || eff == EF_RESIST4) 120 | { 121 | for(int i = 0; i < 12; i++) 122 | { 123 | if(ItemList[itemID].Effect[i].Index != EF_RESISTALL) 124 | continue; 125 | 126 | result += ItemList[itemID].Effect[i].Value; 127 | break; 128 | } 129 | 130 | for(int i = 0; i < 3; i++) 131 | { 132 | if(itemPtr->Effect[i].Index != EF_RESISTALL) 133 | continue; 134 | 135 | result += itemPtr->Effect[i].Value; 136 | break; 137 | } 138 | } 139 | 140 | int sanc = GetItemSanc(itemPtr); 141 | if(itemPtr->Index <= 40) 142 | sanc = 0; 143 | 144 | if(sanc == 9 && (pos & 0xF00) != 0) 145 | sanc = 10; 146 | 147 | if(sanc > 15) 148 | sanc = 15; 149 | 150 | if(sanc != 0 && eff != EF_GRID && eff != EF_CLASS && 151 | eff != EF_POS && eff != EF_WTYPE && eff != EF_RANGE && 152 | eff != EF_LEVEL && eff != EF_REQ_STR && eff != EF_REQ_INT && 153 | eff != EF_REQ_DEX && eff != EF_REQ_CON && eff != EF_VOLATILE && 154 | eff != EF_INCUBATE && eff != EF_INCUDELAY && eff != EF_UNKNOW1) 155 | { 156 | INT32 value = sanc; 157 | 158 | if(value == 10) 159 | value = 10; 160 | else if(value == 11) 161 | value = 12; 162 | else if(value == 12) 163 | value = 15; 164 | else if(value == 13) 165 | value = 18; 166 | else if(value == 14) 167 | value = 23; 168 | else if(value == 15) 169 | value = 28; 170 | 171 | result = result * (value + 10) / 10; 172 | } 173 | 174 | if(eff == EF_RUNSPEED) 175 | { 176 | if(result >= 3) 177 | result = 2; 178 | 179 | if(result > 0 && sanc >= 9) 180 | result++; 181 | } 182 | 183 | if(eff == EF_HWORDGUILD || eff == EF_LWORDGUILD) 184 | { 185 | int x = result; 186 | result = x; 187 | } 188 | 189 | if(eff == EF_GRID) 190 | if(result < 0 || result > 7) 191 | result = 0; 192 | 193 | return result; 194 | } 195 | 196 | int GetItemSanc(st_Item *item) 197 | { 198 | int value = 0; 199 | 200 | if(item->Index >= 2360 && item->Index <= 2389) 201 | { 202 | //Montarias. 203 | value = (item->Effect[2].Index / 10); 204 | 205 | if(value > 9) 206 | value = 9; 207 | 208 | return value; 209 | } 210 | 211 | if(item->Index >= 2330 && item->Index <= 2359) 212 | { 213 | //Crias. 214 | return 0; 215 | } 216 | 217 | if(item->Effect[0].Index == 43) 218 | value = item->Effect[0].Value; 219 | else if(item->Effect[1].Index == 43) 220 | value = item->Effect[1].Value; 221 | else if(item->Effect[2].Index == 43) 222 | value = item->Effect[2].Value; 223 | else 224 | { 225 | for(INT32 i = 0; i < 3; i++) 226 | { 227 | if(item->Effect[i].Index >= 116 && item->Effect[i].Index <= 125) 228 | { 229 | value = item->Effect[i].Value; 230 | 231 | break; 232 | } 233 | } 234 | } 235 | 236 | if(value >= 230) 237 | { 238 | value = 10 + ((value - 230) / 4); 239 | if(value > 15) 240 | value = 15; 241 | } 242 | else 243 | value %= 10; 244 | 245 | return value; 246 | } 247 | 248 | int GetMaxAbility(st_Mob *usr, int eff) 249 | { 250 | int MaxAbility = 0; 251 | 252 | for(int i = 0; i < 16; i++) 253 | { 254 | if(usr->Equip[i].Index == 0) 255 | continue; 256 | 257 | short ItemAbility = GetItemAbility(&usr->Equip[i], eff); 258 | if(MaxAbility < ItemAbility) 259 | MaxAbility = ItemAbility; 260 | } 261 | 262 | return MaxAbility; 263 | } 264 | 265 | int GetMobAbility(st_Mob *usr, int eff) 266 | { 267 | int LOCAL_1 = 0; 268 | 269 | if(eff == EF_RANGE) 270 | { 271 | LOCAL_1 = GetMaxAbility(usr, eff); 272 | 273 | int LOCAL_2 = (usr->Equip[0].Index / 10); 274 | if(LOCAL_1 < 2 && LOCAL_2 == 3) 275 | if((usr->Learn & 0x40) != 0) 276 | LOCAL_1 = 2; 277 | 278 | return LOCAL_1; 279 | } 280 | 281 | int LOCAL_18[16]; 282 | for(int LOCAL_19 = 0; LOCAL_19 < 16; LOCAL_19++) 283 | { 284 | LOCAL_18[LOCAL_19] = 0; 285 | 286 | int LOCAL_20 = usr->Equip[LOCAL_19].Index; 287 | if(LOCAL_20 == 0 && LOCAL_19 != 7) 288 | continue; 289 | 290 | if(LOCAL_19 >= 1 && LOCAL_19 <= 5) 291 | LOCAL_18[LOCAL_19] = ItemList[LOCAL_20].Unique; 292 | 293 | if(eff == EF_DAMAGE && LOCAL_19 == 6) 294 | continue; 295 | 296 | if(eff == EF_MAGIC && LOCAL_19 == 7) 297 | continue; 298 | 299 | if(LOCAL_19 == 7 && eff == EF_DAMAGE) 300 | { 301 | int dam1 = (GetItemAbility(&usr->Equip[6], EF_DAMAGE) + 302 | GetItemAbility(&usr->Equip[6], EF_DAMAGE2)); 303 | int dam2 = (GetItemAbility(&usr->Equip[7], EF_DAMAGE) + 304 | GetItemAbility(&usr->Equip[7], EF_DAMAGE2)); 305 | 306 | int arm1 = usr->Equip[6].Index; 307 | int arm2 = usr->Equip[7].Index; 308 | 309 | int unique1 = 0; 310 | if(arm1 > 0 && arm1 < MAX_ITEMLIST) 311 | unique1 = ItemList[arm1].Unique; 312 | 313 | int unique2 = 0; 314 | if(arm2 > 0 && arm2 < MAX_ITEMLIST) 315 | unique2 = ItemList[arm2].Unique; 316 | 317 | if(unique1 != 0 && unique2 != 0) 318 | { 319 | int porc = 0; 320 | if(unique1 == unique2) 321 | porc = 70; 322 | else 323 | porc = 50; 324 | 325 | if(dam1 > dam2) 326 | LOCAL_1 = ((LOCAL_1 + dam1) + ((dam2 * porc) / 100)); 327 | else 328 | LOCAL_1 = ((LOCAL_1 + dam2) + ((dam1 * porc) / 100)); 329 | 330 | continue; 331 | } 332 | 333 | if(dam1 > dam2) 334 | LOCAL_1 += dam1; 335 | else 336 | LOCAL_1 += dam2; 337 | 338 | continue; 339 | } 340 | 341 | int LOCAL_28 = GetItemAbility(&usr->Equip[LOCAL_19], eff); 342 | if(eff == EF_ATTSPEED && LOCAL_28 == 1) 343 | LOCAL_28 = 10; 344 | 345 | LOCAL_1 += LOCAL_28; 346 | } 347 | 348 | if(eff == EF_AC && LOCAL_18[1] != 0) 349 | if(LOCAL_18[1] == LOCAL_18[2] && LOCAL_18[2] == LOCAL_18[3] && 350 | LOCAL_18[3] == LOCAL_18[4] && LOCAL_18[4] == LOCAL_18[5]) 351 | LOCAL_1 = ((LOCAL_1 * 105) / 100); 352 | 353 | return LOCAL_1; 354 | } 355 | 356 | INT32 GetManaSpent(INT32 skillId, INT32 saveMana, INT32 mastery) 357 | { 358 | INT32 manaSpent = SkillData[skillId].Mana; // -4 359 | 360 | manaSpent = (((mastery >> 1) + 100) * manaSpent) / 100; 361 | manaSpent = ((100 - saveMana) * manaSpent) / 100; 362 | 363 | return manaSpent; 364 | } 365 | 366 | st_Item *GetItemPointer(INT32 invType, INT32 invSlot) 367 | { 368 | if(invType < 0 || invType >= 3 || invSlot < 0 || invSlot >= 128) 369 | return NULL; 370 | 371 | if(invType == EQUIP_TYPE) // equip 372 | { 373 | if(invSlot >= 16) 374 | return NULL; 375 | 376 | return &Client.Mob.Equip[invSlot]; 377 | } 378 | else if(invType == INV_TYPE) // inv 379 | { 380 | if(invSlot >= 64) 381 | return NULL; 382 | 383 | return &Client.Mob.Inventory[invSlot]; 384 | } 385 | else if(invType == STORAGE_TYPE) 386 | { 387 | if(invSlot >= 128) 388 | return NULL; 389 | 390 | return &Client.Storage[invSlot]; 391 | } 392 | 393 | return NULL; 394 | } 395 | 396 | INT32 GetAffectSlot(st_Affect *affect, INT32 buffId) 397 | { 398 | for(INT32 i = 0; i < MAX_AFFECT; i++) 399 | { 400 | if(affect[i].Index == buffId) 401 | return i; 402 | } 403 | 404 | return -1; 405 | } 406 | 407 | unsigned char GetAttribute(int posX, int posY) 408 | { 409 | if (posX < 0 || posX > 4096 || posY < 0 || posY > 4096) 410 | return g_pAttributeMap[0][0]; 411 | 412 | int gridX = (posX >> 2) & 0x3FF; 413 | int gridY = (posY >> 2) & 0x3FF; 414 | 415 | return g_pAttributeMap[gridY][gridX]; 416 | } 417 | 418 | double GetPercentLevelExp(INT32 level, INT32 ev, INT64 exp) 419 | { 420 | if(level < 0 || level >= 400 || ev < 0 || ev >= 5) 421 | return 100.0f; 422 | 423 | INT64 exp1 = g_pNextLevel[ev][level - 1]; 424 | INT64 exp2 = g_pNextLevel[ev][level]; 425 | 426 | double dif = exp2 - exp1; 427 | if(dif <= 0) 428 | return 100.0f; 429 | 430 | double dif_exp = exp - exp1; 431 | 432 | double result = (dif_exp / dif) * 100; 433 | return result; 434 | } -------------------------------------------------------------------------------- /WYD2Bot/GetFunc.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifndef __GETFUNC__ 4 | #define __GETFUNC__ 5 | 6 | double GetDistance(int x1,int y1,int x2,int y2); 7 | int GetItemSanc(st_Item *item); 8 | short GetItemAbility(st_Item *itemPtr, int eff); 9 | int GetMobAbility(st_Mob *usr, int eff); 10 | int GetMaxAbility(st_Mob *usr, int eff); 11 | INT32 GetManaSpent(INT32 skillId, INT32 saveMana, INT32 mastery); 12 | st_Item *GetItemPointer(INT32 invType, INT32 invSlot); 13 | INT32 GetAffectSlot(st_Affect *affect, INT32 buffId); 14 | unsigned char GetAttribute(int posX, int posY); 15 | double GetPercentLevelExp(INT32 level, INT32 ev, INT64 exp); 16 | #endif -------------------------------------------------------------------------------- /WYD2Bot/ItemEffect.h: -------------------------------------------------------------------------------- 1 | //#define EF_NONE 0 // * EFFECT Type? 0 ?? ???? ??. ITEM?? Score[0]? ?? ??? ??. 2 | // Score ?? 3 | #define EF_LEVEL 1 // ?? * Score[1] - Score[15] Bonus Score?? ??? ?? ???. 4 | #define EF_DAMAGE 2 // ?? 5 | #define EF_AC 3 // ?? 6 | #define EF_HP 4 // ?? HP,MP,????,????,?? MAX?? 7 | #define EF_MP 5 // ?? 8 | #define EF_EXP 6 // ?? 9 | #define EF_STR 7 // ? 10 | #define EF_INT 8 // ?? 11 | #define EF_DEX 9 // ?? 12 | #define EF_CON 10 // ?? 13 | #define EF_SPECIAL1 11 // ?? 14 | #define EF_SPECIAL2 12 // ?1 15 | #define EF_SPECIAL3 13 // ?2 16 | #define EF_SPECIAL4 14 // ?3 17 | // Score ?. 18 | #define EF_SCORE14 15 // 19 | #define EF_SCORE15 16 // 20 | //////////////// REQUIREMENT ////////////////////////////////////////// 21 | #define EF_POS 17 // ?? ??? ?? ?? bit? - ??? NOWHERE (0?? ? EQUIP 0) 22 | #define EF_CLASS 18 // ?? ??? ?? (??)??? bit? - ??? YES 23 | #define EF_R1SIDC 19 // ?? 1?? ?? ??? ??? ?? STR INT DEC CON - ??? 0 24 | #define EF_R2SIDC 20 // ?? 2?? ? ??? ?? STR INT DEC CON - ??? ?? 25 | //////////////// BONUS //////////////////////////////// 26 | #define EF_WTYPE 21 // ?? ???? (?????) 27 | // 1:??(??) 28 | // 2:??(???) 29 | // 3:?? 30 | 31 | // 11:??? 32 | // 12:??? 33 | // 13:??? 34 | 35 | // 21:?? 36 | // 22:?? 37 | // 23:?? 38 | 39 | // 31:???? 40 | // 32:???? 41 | // 33:???? 42 | 43 | // 41:??? 44 | 45 | // 51:??? 46 | 47 | // 61:??? 48 | // 62:??? 49 | // 63:??? 50 | 51 | // 101:? 52 | // 102:?? 53 | // 103:???? 54 | // 104:??? 55 | //////////////////////////////////////////////////////////////////////////// 56 | #define EF_REQ_STR 22 // ?? 57 | #define EF_REQ_INT 23 // ?? 58 | #define EF_REQ_DEX 24 // ?? 59 | #define EF_REQ_CON 25 // ?? 60 | ///////////////////////////////////////////////////////////////////////// 61 | // * ? ?????, ???? ?? SIDC? ???? ???. 62 | ///////////////////////////////////////////////////////////////////////// 63 | 64 | 65 | #define EF_ATTSPEED 26 // ?? ???? 66 | #define EF_RANGE 27 // ?? ????. ??? ???? ???. 67 | ////#define EF_PRICE 28 // ?? 68 | #define EF_RUNSPEED 29 // ?? ?????. 69 | #define EF_SPELL 30 // ?? Item? ??? ???? ??? ?? 70 | #define EF_DURATION 31 // ?? Item ????1 - ??? ??? ???? ??, ?????? ?? 71 | #define EF_PARM2 32 // ?? Item ????2 72 | #define EF_GRID 33 // ?? Carry? ???? ?????? 73 | #define EF_GROUND 34 // ?? ????? ?? ???? ?? 74 | #define EF_CLAN 35 // ?? 75 | #define EF_HWORDCOIN 36 // ?? 76 | #define EF_LWORDCOIN 37 // ?? 77 | #define EF_VOLATILE 38 // ?? ??? ?? ???? ???. 0:???? 1:???? 2:??? 3:?? 4:?1 5:?2 6:?3 78 | // 6:??+15 7:??+1 79 | #define EF_KEYID 39 // ?? 80 | #define EF_PARRY 40 // ?? ??? ??? 81 | #define EF_HITRATE 41 // ?? ??? ??? 82 | #define EF_CRITICAL 42 // ?? ???? 83 | #define EF_SANC 43 // ?? Sanctuary ?? ??? ???? ???? 84 | #define EF_SAVEMANA 44 // ?? 1 -> 99% 85 | #define EF_HPADD 45 // ?? 1 -> 101% MAX_MP 86 | #define EF_MPADD 46 // ?? 1 -> 101% MAX_MP 87 | #define EF_REGENHP 47 // ?? 88 | #define EF_REGENMP 48 // ?? 89 | #define EF_RESIST1 49 // ?? 90 | #define EF_RESIST2 50 // ?? 91 | #define EF_RESIST3 51 // ?? 92 | #define EF_RESIST4 52 // ?? 93 | #define EF_ACADD 53 // ?? 94 | #define EF_RESISTALL 54 // ?? 95 | #define EF_BONUS 55 // ?? 96 | #define EF_HWORDGUILD 56 // ?? 97 | #define EF_LWORDGUILD 57 // ?? 98 | #define EF_QUEST 58 // ?? ??? 1?? ??, ??? Volatile? ?? ??? ? ?. 99 | #define EF_UNIQUE 59 // ?? 100 | #define EF_MAGIC 60 // ?? 1 -> 1% ?? 101 | #define EF_AMOUNT 61 // ?? 102 | #define EF_HWORDINDEX 62 // ?? 103 | #define EF_LWORDINDEX 63 // ?? 104 | #define EF_INIT1 64 // ?? 105 | #define EF_INIT2 65 // ?? 106 | #define EF_INIT3 66 // ?? 107 | #define EF_DAMAGEADD 67 // ?? 108 | #define EF_MAGICADD 68 // ?? 109 | // ?? 2?? ??? ??? ??? ?? ???? ??? ??? ?? ??? ?? ???? ??. 110 | // ????? ???? ??? ?? ??? ??? ??? ???? ??? ???. 111 | #define EF_HPADD2 69 // ?2 ??? ??? ?? ?? ???? ????. 112 | #define EF_MPADD2 70 // ?2 ??? ??? ?? ?? ???? ????. 113 | #define EF_CRITICAL2 71 // ?? ???? 114 | #define EF_ACADD2 72 // ?? 115 | #define EF_DAMAGE2 73 // 116 | #define EF_SPECIALALL 74 // ???? ???? ?? 117 | 118 | #define EF_CURKILL 75 // not used 119 | #define EF_LTOTKILL 76 // not used 120 | #define EF_HTOTKILL 77 // not used 121 | #define EF_INCUBATE 78 // ????? 122 | 123 | 124 | #define EF_MOUNTLIFE 79 // ? ? ?? 125 | #define EF_MOUNTHP 80 // ? ? ? 126 | #define EF_MOUNTSANC 81 // ? ??? 127 | #define EF_MOUNTFEED 82 // ? ??? ?? 128 | #define EF_MOUNTKILL 83 // ?? ?? ??? ??? 129 | 130 | #define EF_INCUDELAY 84 131 | #define EF_SUBGUILD 85 // SUB??, 0?? ???? 1,2,3?? ?? 132 | 133 | #define EF_MOBFACE 86 134 | 135 | #define EF_GRADE0 100 // 0? 136 | #define EF_GRADE1 101 // 1? 137 | #define EF_GRADE2 102 // 2? 138 | #define EF_GRADE3 103 // 3? 139 | #define EF_GRADE4 104 // 4? 140 | #define EF_GRADE5 105 // 5? 141 | 142 | #define EF_MOBTYPE 112 143 | #define EF_SELADO 115 144 | #define EF_ITEMTYPE 116 145 | #define EF_NOREFINE 117 146 | #define EF_UNKNOW1 118 147 | #define EF_NOTRADE 119 148 | //00488D32 eip 149 | //009ffbcc 150 | //44d65000767 -------------------------------------------------------------------------------- /WYD2Bot/Lua.cpp: -------------------------------------------------------------------------------- 1 | #include "Lua.h" 2 | /* 3 | LuaScript::LuaScript(const std::string& filename) { 4 | L = luaL_newstate(); 5 | if (luaL_loadfile(L, filename.c_str()) || lua_pcall(L, 0, 0, 0)) { 6 | std::cout << "Error: failed to load (" << filename << ")" << std::endl; 7 | L = 0; 8 | } 9 | 10 | if (L) luaL_openlibs(L); 11 | } 12 | 13 | LuaScript::~LuaScript() { 14 | if (L) lua_close(L); 15 | } 16 | 17 | void LuaScript::printError(const std::string& variableName, const std::string& reason) { 18 | std::cout << "Error: can't get [" << variableName << "]. " << reason << std::endl; 19 | }*/ -------------------------------------------------------------------------------- /WYD2Bot/Lua.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef LUASCRIPT_H 3 | #define LUASCRIPT_H 4 | /* 5 | #include 6 | #include 7 | #include 8 | 9 | // Lua is written in C, so compiler needs to know how to link its libraries 10 | extern "C" { 11 | # include "lua.h" 12 | # include "lauxlib.h" 13 | # include "lualib.h" 14 | } 15 | 16 | class LuaScript { 17 | public: 18 | LuaScript(const std::string& filename); 19 | ~LuaScript(); 20 | void printError(const std::string& variableName, const std::string& reason); 21 | 22 | template 23 | T get(const std::string& variableName) { 24 | // will be implemented later in tutorial 25 | } 26 | bool lua_gettostack(const std::string& variableName) { 27 | // will be explained later too 28 | } 29 | 30 | // Generic get 31 | template 32 | T lua_get(const std::string& variableName) { 33 | return 0; 34 | } 35 | 36 | // Generic default get 37 | template 38 | T lua_getdefault(const std::string& variableName) { 39 | return 0; 40 | } 41 | private: 42 | lua_State * L; 43 | }; 44 | 45 | template <> 46 | inline bool LuaScript::lua_get(const std::string& variableName) { 47 | return (bool)lua_toboolean(L, -1); 48 | } 49 | 50 | template <> 51 | inline float LuaScript::lua_get(const std::string& variableName) { 52 | if (!lua_isnumber(L, -1)) { 53 | printError(variableName, "Not a number"); 54 | } 55 | return (float)lua_tonumber(L, -1); 56 | } 57 | 58 | template <> 59 | inline int LuaScript::lua_get(const std::string& variableName) { 60 | if (!lua_isnumber(L, -1)) { 61 | printError(variableName, "Not a number"); 62 | } 63 | return (int)lua_tonumber(L, -1); 64 | } 65 | 66 | template <> 67 | inline std::string LuaScript::lua_get(const std::string& variableName) { 68 | std::string s = "null"; 69 | if (lua_isstring(L, -1)) { 70 | s = std::string(lua_tostring(L, -1)); 71 | } 72 | else { 73 | printError(variableName, "Not a string"); 74 | } 75 | return s; 76 | } 77 | */ 78 | #endif -------------------------------------------------------------------------------- /WYD2Bot/Main.cpp: -------------------------------------------------------------------------------- 1 | #include "Main.h" 2 | #include "CClient.h" 3 | #include "CSocket.h" 4 | #include "Basedef.h" 5 | #include "PathFinding.h" 6 | 7 | Server cServer; 8 | stWindow g_pWindow; 9 | CClient Client; 10 | Node *node; 11 | 12 | void CreateConsole() 13 | { 14 | AllocConsole(); 15 | 16 | // Output fix 17 | int outParam = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT); 18 | FILE *stdout_stream = _fdopen(outParam, "w"); 19 | 20 | *stdout = *stdout_stream; 21 | 22 | // Input fix 23 | int inParam = _open_osfhandle((long)GetStdHandle(STD_INPUT_HANDLE), _O_TEXT); 24 | FILE *stdin_stream = _fdopen(inParam, "r"); 25 | 26 | *stdin = *stdin_stream; 27 | } 28 | 29 | BOOL WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 30 | { 31 | BOOL ret; 32 | MSG msg; 33 | 34 | node = new Node(); 35 | 36 | g_pWindow.hWndMain = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_MainDlg), 0, MainDlgProc, 0); 37 | 38 | SetTimer(g_pWindow.hWndMain, TIMER_SEC, 500, NULL); 39 | 40 | ShowWindow(g_pWindow.hWndMain, nCmdShow); 41 | 42 | if(!ReadHeightMap()) 43 | MessageBoxA(NULL, "Falha ao ler Heightmap.dat", "Erro ao ler", MB_OK); 44 | if(!ReadAttributeMap()) 45 | MessageBoxA(NULL, "Falha ao ler Attributemap.dat", "Erro ao ler", MB_OK); 46 | 47 | ApplyAttribute((char*)g_pHeightGrid, 4096); 48 | 49 | ReadItemEffect(); 50 | ReadItemList(); 51 | ReadSkillData(); 52 | ReadQuiz(); 53 | 54 | memset(&g_pMobGrid, 0, sizeof g_pMobGrid); 55 | 56 | while((ret = GetMessage(&msg, 0, 0, 0)) != 0) 57 | { 58 | if(ret == -1) /* error found */ 59 | return -1; 60 | 61 | if(!IsDialogMessage(g_pWindow.hWndMain, &msg)) 62 | { 63 | TranslateMessage(&msg); /* translate virtual-key messages */ 64 | DispatchMessage(&msg); /* send it to dialog procedure */ 65 | } 66 | } 67 | return TRUE; 68 | } -------------------------------------------------------------------------------- /WYD2Bot/Main.h: -------------------------------------------------------------------------------- 1 | #pragma region __N_MAIN_H__ 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "PathFinding.h" 16 | #include "resource.h" 17 | #include "Struct.h" 18 | 19 | #define TIMER_SEC 0 20 | 21 | typedef struct 22 | { 23 | HWND hWndMain; 24 | } stWindow; 25 | 26 | extern Node *node; 27 | 28 | // functions 29 | INT_PTR CALLBACK MainDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 30 | void ProcessSecTimer(); 31 | 32 | void SendCommand(char *command); 33 | extern stWindow g_pWindow; 34 | 35 | #pragma endregion -------------------------------------------------------------------------------- /WYD2Bot/PacketControl.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevinkouketsu/WYD2Bot/355fc70cdf30964c580050bd7b8c648f6ed8c2bd/WYD2Bot/PacketControl.cpp -------------------------------------------------------------------------------- /WYD2Bot/PathFinding.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifndef __PATHFINDING__ 4 | #define __PATHFINDING__ 5 | 6 | #include "Struct.h" 7 | 8 | typedef struct 9 | { 10 | INT32 ParentX; 11 | INT32 ParentY; 12 | INT32 Closed; 13 | INT32 Open ; 14 | INT32 Walkable; 15 | 16 | INT32 F; 17 | INT32 G; 18 | INT32 H; 19 | } stNode; 20 | 21 | #define MAX_ROUTE 256 22 | 23 | class Node 24 | { 25 | public: 26 | Node(); 27 | ~Node(); 28 | 29 | INT32 Queue; 30 | 31 | st_Position Route[MAX_ROUTE]; 32 | stNode List[4096][4096]; 33 | 34 | INT32 RouteCount; 35 | INT32 RouteActual; 36 | INT32 G; 37 | INT32 H; 38 | INT32 F; 39 | 40 | INT32 Path(INT32 startX, INT32 startY, INT32 endX, INT32 endY); 41 | }; 42 | 43 | #endif -------------------------------------------------------------------------------- /WYD2Bot/Pathfinding.cpp: -------------------------------------------------------------------------------- 1 | #include "Main.h" 2 | #include "CClient.h" 3 | #include "Basedef.h" 4 | #include "GetFunc.h" 5 | #include "PathFinding.h" 6 | 7 | Node::Node() 8 | { 9 | RouteCount = 0; 10 | RouteActual = 0; 11 | Queue = 0; 12 | } 13 | 14 | Node::~Node() 15 | { 16 | 17 | } 18 | 19 | INT32 Node::Path(INT32 startX, INT32 startY, INT32 endX, INT32 endY) 20 | { 21 | INT32 x = 0, 22 | y = 0; 23 | 24 | INT32 dx = 0, 25 | dy = 0; 26 | 27 | INT32 lowestf = 100000; 28 | 29 | RouteCount = 0; 30 | RouteActual = 0; 31 | memset(Route, 0, sizeof Route); 32 | 33 | // lista de possibilidades 34 | memset(&List, 0, sizeof List); 35 | 36 | INT32 currentX = startX, 37 | currentY = startY; 38 | 39 | List[startY][startX].Open = 1; 40 | 41 | if(startX == endX && startY == endY) 42 | return 0; 43 | 44 | while((currentX != endX || currentY != endY)) 45 | { 46 | INT32 countF = 0; 47 | if(lowestf == 1000000 && currentX != startX && currentY != startY) 48 | break; 49 | 50 | List[currentY][currentX].Closed = true; 51 | List[currentY][currentX].Open = false; 52 | 53 | lowestf = 1000000; 54 | Route[RouteCount].X = currentX; 55 | Route[RouteCount].Y = currentY; 56 | 57 | RouteCount++; 58 | 59 | INT32 tmpX = currentX, 60 | tmpY = currentY; 61 | 62 | for(dy = -1; dy<=1;dy++) 63 | { 64 | for(dx = -1; dx <= 1; dx++) 65 | { 66 | if(g_pHeightGrid[currentY + dy][currentX + dx] == 127) 67 | continue; 68 | 69 | if(!List[currentY + dy][currentX + dx].Closed) 70 | { 71 | if(!List[currentY + dy][currentX + dx].Open) 72 | { 73 | List[currentY + dy][currentX + dx].Open = true; 74 | List[currentY + dy][currentX + dx].Closed = false; 75 | List[currentY + dy][currentX + dx].ParentX = currentX; 76 | List[currentY + dy][currentX + dx].ParentY = currentY; 77 | 78 | if(dx != 0 && dy != 0) 79 | List[currentY + dy][currentX + dx].G = 14; 80 | else 81 | List[currentY + dy][currentX + dx].G = 10; 82 | 83 | List[currentY + dy][currentX + dx].H = (abs(endX - (currentX + dx)) + abs(endY - (currentY + dy))) * 10; 84 | List[currentY + dy][currentX + dx].F = List[currentY + dy][currentX + dx].G + List[currentY + dy][currentX + dx].H; 85 | 86 | if(List[currentY + dy][currentX + dx].F < lowestf) 87 | { 88 | List[tmpY][tmpX].Open = false; 89 | 90 | tmpX = currentX + dx; 91 | tmpY = currentY + dy; 92 | lowestf = List[currentY + dy][currentX + dx].F ; 93 | List[tmpY][tmpX].Open = true; 94 | } 95 | 96 | // printf("Adicionado %dx %dy na lista aberta com F %d. H: %d.\n", currentX + dx, currentY + dy,List[currentY + dy][currentX + dx].F, List[currentY + dy][currentX + dx].H); 97 | } 98 | else 99 | { 100 | if(dx == 0 || dy == 0) 101 | { 102 | if(List[currentY + dy][currentX + dx].G != 10) 103 | { 104 | List[currentY + dy][currentX + dx].G = 10; 105 | List[currentY + dy][currentX + dx].ParentX = currentX; 106 | List[currentY + dy][currentX + dx].ParentY = currentY; 107 | List[currentY + dy][currentX + dx].H = (abs(endX - (currentX + dx)) + abs(endY - (currentY + dy))) * 10; 108 | List[currentY + dy][currentX + dx].F = List[currentY + dy][currentX + dx].G + List[currentY + dy][currentX + dx].H; 109 | 110 | if(List[currentY + dy][currentX + dx].F < lowestf) 111 | { 112 | List[tmpY][tmpX].Open = false; 113 | 114 | tmpX = currentX + dx; 115 | tmpY = currentY + dy; 116 | lowestf = List[currentY + dy][currentX + dx].F ; 117 | List[tmpY][tmpX].Open = true; 118 | } 119 | // printf("Encontrado melhor caminho\n"); 120 | } 121 | } 122 | } 123 | } 124 | } 125 | } 126 | 127 | currentX = tmpX; 128 | currentY = tmpY; 129 | } 130 | 131 | return true; 132 | } 133 | /* 134 | INT32 Node::Path(st_Position *current, st_Position *target) 135 | { 136 | // position temporary 137 | st_Position tmpCur; 138 | tmpCur.X = current->X; 139 | tmpCur.Y = current->Y; 140 | 141 | INT32 step = 0; 142 | while(true) 143 | { 144 | INT32 posX = tmpCur.X, 145 | posY = tmpCur.Y; 146 | 147 | if(posX == target->X && posY == target->Y) 148 | break; 149 | 150 | // N = y + 1 151 | // S = y - 1 152 | // L = x + 1 153 | // O = x - 1 154 | 155 | double northD = GetDistance(tmpCur.X, tmpCur.Y, posX, posY + 1); 156 | double southD = GetDistance(tmpCur.X, tmpCur.Y, posX, posY - 1); 157 | double eastD = GetDistance(tmpCur.X, tmpCur.Y, posX + 1, posY); 158 | double westD = GetDistance(tmpCur.X, tmpCur.Y, posX - 1, posY); 159 | 160 | char north = g_pHeightGrid[posY + 1][posX]; 161 | char south = g_pHeightGrid[posY - 1][posX]; 162 | char east = g_pHeightGrid[posY][posX + 1]; 163 | char west = g_pHeightGrid[posY][posX - 1]; 164 | 165 | INT32 mobNorth = g_pMobGrid[posY + 1][posX]; 166 | INT32 mobSouth = g_pMobGrid[posY - 1][posX]; 167 | INT32 mobEast = g_pMobGrid[posY][posX + 1]; 168 | INT32 mobWest = g_pMobGrid[posY][posX - 1]; 169 | 170 | if(mobNorth != 0) 171 | north = 127; 172 | 173 | if(mobSouth != 0) 174 | south = 127; 175 | 176 | if(mobEast != 0) 177 | east = 127; 178 | 179 | if(mobWest != 0) 180 | west = 127; 181 | 182 | } 183 | }*/ -------------------------------------------------------------------------------- /WYD2Bot/ProcessTimer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevinkouketsu/WYD2Bot/355fc70cdf30964c580050bd7b8c648f6ed8c2bd/WYD2Bot/ProcessTimer.cpp -------------------------------------------------------------------------------- /WYD2Bot/SendFunc.cpp: -------------------------------------------------------------------------------- 1 | #include "Main.h" 2 | #include "CClient.h" 3 | #include "CSocket.h" 4 | #include "Basedef.h" 5 | #include "GetFunc.h" 6 | 7 | void SendRequestLogin(char *login, char *password) 8 | { 9 | p20D packet; 10 | memset(&packet, 0, sizeof packet); 11 | 12 | packet.Header.PacketId = 0x20D; 13 | packet.Header.Size = sizeof packet; 14 | packet.Header.ClientId = 0; 15 | 16 | strncpy(packet.Username, login, 12); 17 | strncpy(packet.Password, password, 12); 18 | 19 | packet.CliVer = 9999;//7000;//8146; 20 | EncryptVersion(&packet.CliVer); 21 | 22 | UUID uuid; 23 | UuidCreateSequential(&uuid); // Ask OS to create UUID 24 | 25 | for(INT32 i = 2; i < 8; i++) 26 | packet.AdapterInfos[i - 2] = uuid.Data4[i]; 27 | 28 | cServer.AddMessage((char*)&packet, sizeof packet); 29 | 30 | ServerMessage("Tentativa de logar na conta %s", login); 31 | } 32 | 33 | void SendToken(char *number) 34 | { 35 | pFDE packet; 36 | memset(&packet, 0, sizeof packet); 37 | 38 | packet.Header.PacketId = 0xFDE; 39 | packet.Header.Size = sizeof packet; 40 | packet.Header.ClientId = Client.clientId; 41 | 42 | strncpy(packet.num, number, 6); 43 | 44 | cServer.AddMessage((char*)&packet, sizeof packet); 45 | } 46 | 47 | void SendRequestEnterWorld(INT32 charId) 48 | { 49 | p213 packet; 50 | memset(&packet, 0, sizeof packet); 51 | 52 | packet.Header.PacketId = 0x213; 53 | packet.Header.Size = sizeof p213; 54 | packet.Header.CheckSum = Client.clientId; 55 | 56 | packet.CharIndex = charId; 57 | cServer.AddMessage((char*)&packet, sizeof packet); 58 | } 59 | 60 | void SendArroba(char *msg) 61 | { 62 | p334 packet; 63 | memset(&packet, 0, sizeof packet); 64 | 65 | packet.Header.PacketId = 0x334; 66 | packet.Header.Size = sizeof packet; 67 | packet.Header.ClientId = Client.clientId; 68 | 69 | strncpy(packet.eValue, msg, 96); 70 | 71 | cServer.AddMessage((char*)&packet, sizeof packet); 72 | } 73 | 74 | void SendChat(char* msg) 75 | { 76 | p333 packet; 77 | memset(&packet, 0, sizeof packet); 78 | 79 | packet.Header.PacketId = 0x333; 80 | packet.Header.Size = sizeof packet; 81 | packet.Header.ClientId = Client.clientId; 82 | 83 | strncpy(packet.eChat, msg, 96); 84 | 85 | cServer.AddMessage((char*)&packet, sizeof packet); 86 | 87 | AddChat("[%s]> %s", Client.Mob.Name ,msg); 88 | } 89 | 90 | void SendWhisper(char *nick, char *msg) 91 | { 92 | p334 packet; 93 | memset(&packet, 0, sizeof packet); 94 | 95 | packet.Header.PacketId = 0x334; 96 | packet.Header.Size = sizeof packet; 97 | packet.Header.ClientId = Client.clientId; 98 | 99 | strncpy(packet.eCommand, nick, 16); 100 | strncpy(packet.eValue, msg, 96); 101 | 102 | cServer.AddMessage((char*)&packet, sizeof packet); 103 | } 104 | 105 | void SendSignal(INT32 packetId) 106 | { 107 | PacketHeader Header; 108 | 109 | Header.ClientId = Client.clientId; 110 | Header.PacketId = packetId; 111 | 112 | cServer.AddMessage((char*)&Header, sizeof Header); 113 | } 114 | 115 | void SendAction(INT32 posX, INT32 posY, INT32 targetX, INT32 targetY, INT32 speed, INT32 type) 116 | { 117 | p36C packet; 118 | memset(&packet, 0, sizeof packet); 119 | 120 | packet.Header.PacketId = 0x36C; 121 | packet.Header.Size = sizeof packet; 122 | packet.Header.CheckSum = Client.clientId; 123 | 124 | packet.Destiny.X = targetX; 125 | packet.Destiny.Y = targetY; 126 | 127 | packet.LastPos.X = posX; 128 | packet.LastPos.Y = posY; 129 | 130 | packet.MoveSpeed = speed; 131 | packet.MoveType = type; 132 | 133 | cServer.AddMessage((char*)&packet, sizeof packet); 134 | } 135 | 136 | void SendAttack(st_Target *target, INT32 skillId) 137 | { 138 | INT32 mp = Client.Mob.Status.curMP; 139 | 140 | if(skillId >= 0 && skillId <= 110) 141 | { 142 | INT32 skillKind = ((skillId % 24) >> 3) + 1; // mastery 143 | INT32 saveMana = GetMobAbility(&Client.Mob, EF_SAVEMANA); 144 | INT32 mpCost = GetManaSpent(skillId, saveMana, skillKind); 145 | 146 | if(mpCost > mp) 147 | { 148 | ServerMessage("Mana insuficiente. Mana atual: %d de %d", mp, mpCost); 149 | 150 | return; 151 | } 152 | 153 | mp -= mpCost; 154 | 155 | Client.Macro.Delay[skillId] = clock(); 156 | } 157 | 158 | p367 packet; 159 | memset(&packet, 0, sizeof packet); 160 | 161 | packet.Header.PacketId = 0x367; 162 | packet.Header.Size = sizeof packet; 163 | packet.Header.ClientId = Client.clientId; 164 | 165 | packet.skillId = skillId; 166 | packet.attackerId = Client.clientId; 167 | 168 | packet.attackerPos.X = Client.Position.X; 169 | packet.attackerPos.Y = Client.Position.Y; 170 | 171 | packet.currentMp = Client.Mob.Status.curMP; 172 | 173 | if(skillId == -1) 174 | { 175 | INT32 wType = GetItemAbility(&Client.Mob.Equip[6], EF_WTYPE); 176 | if(wType == 101) 177 | skillId = 151; 178 | } 179 | 180 | packet.FlagLocal = 1; 181 | packet.Motion = 4; 182 | packet.skillId = skillId; 183 | 184 | memcpy(&packet.Target, target, sizeof st_Target * 13); 185 | 186 | for(INT32 i = 0; i < 13; i++) 187 | { 188 | if(packet.Target[i].Index <= 0) 189 | continue; 190 | 191 | if(skillId == -1 || skillId == 151) 192 | packet.Target[i].Damage = -2; 193 | else 194 | packet.Target[i].Damage = -1; 195 | } 196 | 197 | cServer.AddMessage((char*)&packet, sizeof packet); 198 | } 199 | 200 | void SendAttack(INT32 mobId, INT32 skillId) 201 | { 202 | INT32 mp = Client.Mob.Status.curMP; 203 | 204 | if(skillId >= 0 && skillId <= 110) 205 | { 206 | INT32 skillKind = ((skillId % 24) >> 3) + 1; // mastery 207 | INT32 saveMana = GetMobAbility(&Client.Mob, EF_SAVEMANA); 208 | INT32 mpCost = GetManaSpent(skillId, saveMana, skillKind); 209 | 210 | if(mpCost > mp) 211 | { 212 | ServerMessage("Mana insuficiente. Mana atual: %d de %d", mp, mpCost); 213 | 214 | return; 215 | } 216 | 217 | mp -= mpCost; 218 | 219 | Client.Macro.Delay[skillId] = clock(); 220 | } 221 | 222 | p367 packet; 223 | memset(&packet, 0, sizeof packet); 224 | 225 | packet.Header.PacketId = 0x367; 226 | packet.Header.Size = sizeof packet; 227 | packet.Header.ClientId = Client.clientId; 228 | 229 | packet.skillId = skillId; 230 | packet.attackerId = Client.clientId; 231 | 232 | packet.attackerPos.X = Client.Position.X; 233 | packet.attackerPos.Y = Client.Position.Y; 234 | 235 | packet.currentMp = Client.Mob.Status.curMP; 236 | 237 | if(skillId == -1) 238 | { 239 | INT32 wType = GetItemAbility(&Client.Mob.Equip[6], EF_WTYPE); 240 | if(wType == 101) 241 | skillId = 151; 242 | } 243 | 244 | packet.FlagLocal = 1; 245 | packet.Motion = 4; 246 | packet.skillId = skillId; 247 | 248 | packet.Target[0].Index = mobId; 249 | 250 | if(skillId == -1 || skillId == 151) 251 | packet.Target[0].Damage = -2; 252 | else 253 | packet.Target[0].Damage = -1; 254 | 255 | cServer.AddMessage((char*)&packet, sizeof packet); 256 | } 257 | 258 | void SendRequestCreateAutoTrade() 259 | { 260 | p397 packet; 261 | memset(&packet, 0, sizeof packet); 262 | 263 | memcpy(&packet, &Client.AutoTrade, sizeof p397); 264 | 265 | packet.Header.PacketId = 0x397; 266 | packet.Header.Size = sizeof packet; 267 | packet.Header.ClientId = Client.clientId; 268 | 269 | for(INT32 i = 0; i < 12; i++) 270 | { 271 | if(packet.Gold[i] == 0) 272 | { 273 | packet.Slot[i] = -1; 274 | 275 | continue; 276 | } 277 | 278 | memcpy(&packet.Item[i], &Client.Storage[packet.Slot[i]], sizeof st_Item); 279 | } 280 | 281 | cServer.AddMessage((char*)&packet, sizeof p397); 282 | } 283 | 284 | void SendRequestUseItem(INT32 invType, INT32 slotId, INT32 dstType, INT32 dstSlot) 285 | { 286 | p373 packet; 287 | memset(&packet, 0, sizeof packet); 288 | 289 | packet.Header.PacketId = 0x373; 290 | packet.Header.Size = sizeof packet; 291 | packet.Header.ClientId = Client.clientId; 292 | 293 | packet.DstSlot = dstSlot; 294 | packet.DstType = dstType; 295 | 296 | packet.SrcSlot = slotId; 297 | packet.SrcType = invType; 298 | 299 | packet.PosX = Client.Position.X; 300 | packet.PosY = Client.Position.Y; 301 | 302 | cServer.AddMessage((char*)&packet, sizeof packet); 303 | } -------------------------------------------------------------------------------- /WYD2Bot/SendFunc.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Struct.h" 3 | 4 | #ifndef __SENDFUNC__ 5 | #define __SENDFUNC__ 6 | 7 | void SendRequestLogin(char *login, char *password); 8 | void SendToken(char *number); 9 | void SendRequestEnterWorld(INT32 charId); 10 | void SendChat(char *); 11 | void SendWhisper(char *nick, char *msg); 12 | void SendSignal(INT32 packetId); 13 | void SendAction(INT32 posX, INT32 posY, INT32 targetX, INT32 targetY, INT32 speed, INT32 type); 14 | void SendAttack(INT32 mobId, INT32 skillId); 15 | void SendAttack(st_Target *target, INT32 skillId); 16 | void SendRequestCreateAutoTrade(); 17 | void SendRequestUseItem(INT32 invType, INT32 slotId, INT32 dstType, INT32 dstSlot); 18 | void SendArroba(char *msg); 19 | 20 | #endif -------------------------------------------------------------------------------- /WYD2Bot/Socket.cpp: -------------------------------------------------------------------------------- 1 | #include "Main.h" 2 | #include "CSocket.h" 3 | 4 | Server::Server() 5 | { 6 | SethServer(SOCKET_ERROR); 7 | } 8 | 9 | Server::~Server() 10 | { 11 | } 12 | 13 | INT32 Server::GethServer() 14 | { 15 | return hServer; 16 | } 17 | 18 | WSADATA *Server::GetwSaData() 19 | { 20 | return &wSaData; 21 | } 22 | 23 | SOCKADDR_IN *Server::GetService() 24 | { 25 | return &Service; 26 | } 27 | 28 | void Server::SethServer(UINT32 value) 29 | { 30 | hServer = value; 31 | } 32 | 33 | BOOL Server::Connect() 34 | { 35 | bool Sucessful = true; 36 | SOCKADDR_IN *service = GetService(); 37 | 38 | ZeroMemory(service, sizeof SOCKADDR_IN); 39 | 40 | service->sin_family = AF_INET; 41 | service->sin_addr.s_addr = inet_addr(9999); 42 | service->sin_port = htons(999); 43 | 44 | WSADATA *wsa = GetwSaData(); 45 | if(WSAStartup(MAKEWORD(1, 1), wsa) != NO_ERROR) 46 | { 47 | MessageBoxA(0, "WSAStartup error", "Server::WSAStartup", 4096); 48 | 49 | return false; 50 | } 51 | 52 | UINT32 hServer = -1; 53 | if((hServer = socket(AF_INET, SOCK_STREAM, IPPROTO_IP)) == INVALID_SOCKET) 54 | { 55 | MessageBoxA(0, "socket error", "Server::socket", 4096); 56 | 57 | return false; 58 | } 59 | 60 | if(connect(hServer, (SOCKADDR*)service, sizeof SOCKADDR_IN) == SOCKET_ERROR) 61 | { 62 | MessageBoxA(0, "connect error", "Server::connect", 4096); 63 | 64 | closesocket(hServer); 65 | return false; 66 | } 67 | 68 | if(WSAAsyncSelect(hServer, g_pWindow.hWndMain, WM_SERVER, FD_READ|FD_CLOSE) == SOCKET_ERROR) 69 | { 70 | MessageBoxA(0, "WSAAsyncSelect error", "Server::WSAAsyncSelect", 4096); 71 | 72 | closesocket(hServer); 73 | return false; 74 | } 75 | 76 | unsigned int InitCode = INITCODE; 77 | send(hServer, (char*)&InitCode, 4, 0); 78 | 79 | SethServer(hServer); 80 | return true; 81 | } 82 | 83 | BOOL Server::Receive() 84 | { 85 | int Rest = RECV_BUFFER_SIZE - nRecvPosition; 86 | int tReceiveSize = recv(GethServer(), (char*)(pRecvBuffer + nRecvPosition), Rest, 0); 87 | 88 | if(tReceiveSize == SOCKET_ERROR || tReceiveSize == Rest) 89 | return FALSE; 90 | 91 | nRecvPosition = nRecvPosition + tReceiveSize; 92 | 93 | return TRUE; 94 | } 95 | 96 | BOOL Server::AddMessage(char *pMsg, int Size) 97 | { 98 | char temp[256]; 99 | PacketHeader *pSMsg = (PacketHeader *)pMsg; 100 | 101 | if(nSendPosition + Size >= SEND_BUFFER_SIZE) 102 | return FALSE; 103 | 104 | if(KeyTable[0]) 105 | { // 004251CA 106 | INT32 hashIncrement = GetHashIncrement(); 107 | if(hashIncrement > 15) 108 | { 109 | // checagem desnecessária 110 | // 0042524C 111 | 112 | } 113 | } 114 | 115 | // check socket valid 116 | 117 | unsigned char iKeyWord = rand()%256; 118 | unsigned char KeyWord = KeyTable[iKeyWord * 2]; 119 | unsigned char CheckSum = 0; 120 | 121 | pSMsg->Size = Size; 122 | pSMsg->Key = iKeyWord; 123 | pSMsg->CheckSum = CheckSum; 124 | pSMsg->TimeStamp = GetCurrenttime(); 125 | 126 | TimePacket = GetCurrentTime(); 127 | 128 | unsigned char Sum1 = 0; 129 | unsigned char Sum2 = 0; 130 | int pos = KeyWord; 131 | 132 | for (int i = 4; i < Size; i++, pos++) 133 | { 134 | Sum1 += pMsg[i]; 135 | 136 | int rst = pos % 256; 137 | unsigned char Trans = KeyTable[(rst & 255) * 2 + 1]; 138 | 139 | int mod = i & 0x3; 140 | if (mod == 0) 141 | pSendBuffer[nSendPosition + i] = pMsg[i] + (Trans << 1); 142 | if (mod == 1) 143 | pSendBuffer[nSendPosition + i] = pMsg[i] - (Trans >> 3); 144 | if (mod == 2) 145 | pSendBuffer[nSendPosition + i] = pMsg[i] + (Trans << 2); 146 | if (mod == 3) 147 | pSendBuffer[nSendPosition + i] = pMsg[i] - (Trans >> 5); 148 | 149 | Sum2 += pSendBuffer[nSendPosition + i]; 150 | } 151 | 152 | CheckSum = Sum2 - Sum1; 153 | pSMsg->CheckSum = CheckSum; 154 | 155 | memcpy(pSendBuffer + nSendPosition, pMsg, 4); 156 | 157 | nSendPosition = nSendPosition + Size; 158 | 159 | return SendMessageA(); 160 | } 161 | 162 | char* Server::ReadMessage(int *ErrorCode, int* ErrorType) 163 | { 164 | *ErrorCode = 0; 165 | 166 | if(nProcPosition >= nRecvPosition) 167 | { 168 | nRecvPosition = 0; 169 | nProcPosition = 0; 170 | 171 | return NULL; 172 | } 173 | 174 | if((nRecvPosition - nProcPosition) < 12) 175 | return NULL; 176 | 177 | unsigned short Size = *((unsigned short*)(pRecvBuffer + nProcPosition)); 178 | unsigned short CheckSum = *((unsigned char*)(pRecvBuffer + nProcPosition + 2)); 179 | 180 | if(Size > MAX_MESSAGE_SIZE || Size < sizeof(PacketHeader)) 181 | { 182 | nRecvPosition = 0; 183 | nProcPosition = 0; 184 | 185 | *ErrorCode = 2; 186 | *ErrorType = Size; 187 | return NULL; 188 | } 189 | 190 | unsigned short Rest = nRecvPosition - nProcPosition; 191 | if(Size > Rest) 192 | return NULL; 193 | 194 | char*pMsg = (char*)&(pRecvBuffer[nProcPosition]); 195 | nProcPosition = nProcPosition + Size; 196 | if(nRecvPosition <= nProcPosition) 197 | { 198 | nRecvPosition = 0; 199 | nProcPosition = 0; 200 | } 201 | 202 | unsigned int i; 203 | int pos, Key; 204 | int sum1 = 0, sum2 = 0; 205 | 206 | pos = KeyTable[CheckSum * 2]; 207 | for(i = 4; i < Size; i++, pos++) 208 | { 209 | sum1 += pMsg[i]; 210 | Key = KeyTable[((pos & 0xFF) * 2) + 1]; 211 | switch(i & 3) 212 | { 213 | case 0: 214 | Key <<= 1; 215 | Key &= 255; 216 | pMsg[i] -= Key; 217 | break; 218 | case 1: 219 | Key >>= 3; 220 | Key &= 255; 221 | pMsg[i] += Key; 222 | break; 223 | case 2: 224 | Key <<= 2; 225 | Key &= 255; 226 | pMsg[i] -= Key; 227 | break; 228 | case 3: default: 229 | Key >>= 5; 230 | Key &= 255; 231 | pMsg[i] += Key; 232 | break; 233 | } 234 | sum2 += pMsg[i]; 235 | } 236 | 237 | sum2 &= 255; 238 | sum1 &= 255; 239 | 240 | if(sum2 != sum1) 241 | { 242 | *ErrorCode = 1; 243 | *ErrorType = Size; 244 | } 245 | 246 | return pMsg; 247 | } 248 | 249 | BOOL Server::SendMessageA() 250 | { 251 | INT32 socket = GethServer(); 252 | if(socket <= 0) 253 | return false; 254 | 255 | if(nSentPosition > 0) 256 | RefreshSendBuffer(); 257 | 258 | if(nSendPosition > SEND_BUFFER_SIZE || nSendPosition < 0 || socket < 0) 259 | return false; 260 | 261 | if(nSentPosition > nSendPosition || nSentPosition > SEND_BUFFER_SIZE || nSentPosition < 0) 262 | return false; 263 | 264 | 265 | INT32 err = 0; 266 | INT32 LOCAL_68 = nSendPosition - nSentPosition; 267 | 268 | INT32 LOCAL_69 = send(socket, (char*)pSendBuffer + nSentPosition, LOCAL_68, 0); 269 | if(LOCAL_69 != -1) 270 | nSentPosition += LOCAL_69; 271 | else 272 | err = WSAGetLastError(); 273 | 274 | if(err != 0) 275 | printf("ERROR IN SEND\n"); 276 | 277 | if(nSendPosition >= nSendPosition || err != 0) 278 | { 279 | nSendPosition = 0; 280 | nSentPosition = 0; 281 | 282 | return true; 283 | } 284 | 285 | if(nSendPosition > SEND_BUFFER_SIZE) 286 | return false; 287 | 288 | return true; 289 | } 290 | 291 | void Server::RefreshSendBuffer() 292 | { 293 | INT32 LOCAL_2 = nSendPosition - nSentPosition; 294 | if(LOCAL_2 <= 0) 295 | return; 296 | 297 | memcpy(pSendBuffer, pSendBuffer + nSentPosition, LOCAL_2); 298 | 299 | nSentPosition = 0; 300 | nSendPosition -= LOCAL_2; 301 | } 302 | 303 | void Server::RefreshRecvBuffer() 304 | { 305 | int left = nRecvPosition - nProcPosition; 306 | if(left <= 0) 307 | return; 308 | 309 | memcpy(pRecvBuffer, pRecvBuffer + nProcPosition, left); 310 | 311 | nProcPosition = 0; 312 | nRecvPosition -= left; 313 | } 314 | 315 | void Server::SetHashIncrement(INT32 value) 316 | { 317 | if(value < 0 || value >= 16) 318 | return; 319 | 320 | HashIncrement = value; 321 | } 322 | 323 | INT32 Server::GetCurrenttime() 324 | { 325 | return (TimePacket + (GetCurrentTime() - LastPacket)); 326 | } 327 | 328 | INT32 Server::GetHashIncrement() 329 | { 330 | return HashIncrement; 331 | } 332 | -------------------------------------------------------------------------------- /WYD2Bot/Struct.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifndef __STRUCT_H__ 4 | #define __STRUCT_H__ 5 | 6 | struct st_Item 7 | { 8 | WORD Index; 9 | struct 10 | { 11 | BYTE Index; 12 | BYTE Value; 13 | } Effect[3]; 14 | }; 15 | 16 | #define EF1 Effect[0].Index 17 | #define EFV1 Effect[0].Value 18 | #define EF2 Effect[1].Index 19 | #define EFV2 Effect[1].Value 20 | #define EF3 Effect[2].Index 21 | #define EFV3 Effect[2].Value 22 | 23 | struct st_Position { 24 | WORD X, Y; 25 | }; 26 | 27 | typedef struct 28 | { 29 | BYTE Index; 30 | BYTE Master; 31 | 32 | WORD Value; 33 | DWORD Time; 34 | } st_Affect; 35 | 36 | struct sItemData 37 | { 38 | char Name[64]; 39 | 40 | short Mesh1; 41 | int Mesh2; 42 | 43 | short Level; 44 | short Str; 45 | short Int; 46 | short Dex; 47 | short Con; 48 | 49 | struct 50 | { 51 | short Index; 52 | short Value; 53 | } Effect[12]; 54 | 55 | int Price; 56 | short Unique; 57 | unsigned short Pos; 58 | short Extreme; 59 | short Grade; 60 | }; 61 | 62 | typedef struct 63 | { 64 | int Points; 65 | int Target; 66 | int Mana; 67 | int Delay; 68 | int Range; 69 | int InstanceType; // Affect[0].Index 70 | int InstanceValue; // Affect[0].Value 71 | int TickType; // Affect[1].Index 72 | int TickValue; // Affect[1].Value 73 | int AffectType; // Affect[2].Index 74 | int AffectValue; // Affect[2].Value 75 | int Time; 76 | char Act[16]; 77 | int InstanceAttribute; 78 | int TickAttribute; 79 | int Aggressive; 80 | int Maxtarget; 81 | int PartyCheck; 82 | int AffectResist; 83 | int Passive_Check; 84 | int ForceDamage; 85 | } sSpellData; 86 | 87 | typedef struct 88 | { 89 | DWORD Level; 90 | DWORD Defense; 91 | DWORD Attack; 92 | 93 | union 94 | { 95 | struct { 96 | BYTE Merchant : 4; 97 | BYTE Direction : 4; 98 | }; 99 | BYTE Value; 100 | } Merchant; 101 | 102 | union { 103 | struct { 104 | BYTE Speed : 4; 105 | BYTE ChaosRate : 4; 106 | }; 107 | BYTE Value; 108 | } Move; 109 | 110 | INT32 maxHP, maxMP; 111 | INT32 curHP, curMP; 112 | 113 | WORD STR, INT; 114 | WORD DEX, CON; 115 | 116 | WORD Mastery[4]; 117 | } st_Status; 118 | 119 | typedef struct 120 | { 121 | char Name[16]; // 0 - 15 122 | char CapeInfo; // 16 123 | 124 | union 125 | { 126 | struct 127 | { 128 | BYTE Merchant : 6; 129 | BYTE CityID : 2; 130 | }; 131 | BYTE Value; 132 | } Info; // 17 133 | 134 | WORD GuildIndex; // 18 19 135 | BYTE ClassInfo; // 20 136 | 137 | union 138 | { 139 | struct 140 | { 141 | BYTE SlowMov : 1; 142 | BYTE DrainHP : 1; 143 | BYTE VisionDrop : 1; 144 | BYTE Evasion : 1; 145 | BYTE Snoop : 1; 146 | BYTE SpeedMov : 1; 147 | BYTE SkillDelay : 1; 148 | BYTE Resist : 1; 149 | }; 150 | 151 | BYTE Value; 152 | } AffectInfo; // 21 153 | 154 | union 155 | { 156 | struct 157 | { 158 | WORD Mystical_GetQuest : 1; // 1 159 | WORD Mystical_CanGetAmuleto : 1; // 2 160 | WORD Mystical_GetAmuleto : 1; // 4 161 | WORD Reset50 : 1; // 8 162 | WORD Reset100 : 1; // 16 163 | WORD MestreHab : 1; // primeiro reset free? 32 164 | WORD Treinadores : 4; // 64 128 256 512 165 | WORD All : 6; 166 | }; 167 | 168 | WORD Value; 169 | } QuestInfo; 170 | 171 | int Gold; // 24 - 27 172 | 173 | int Unkw1; // 28 - 31 174 | INT64 Exp; // 32 - 39 175 | 176 | st_Position Last; // 40 - 43 177 | st_Status bStatus; // 44 - 91 178 | st_Status Status; // 92 - 139 179 | 180 | st_Item Equip[16]; // 140 - 267 181 | st_Item Inventory[64]; // 268 - 779 182 | 183 | DWORD Learn; // 780 - 783 184 | DWORD Mimimimimimi; // 774 - 787 185 | WORD StatusPoint; // 788 - 789 186 | WORD MasterPoint; // 790 - 791 187 | WORD SkillPoint; //792 - 793 188 | 189 | BYTE Critical; // 794 190 | BYTE SaveMana; // 795 191 | 192 | char SkillBar1[4]; // 796 - 799 193 | char GuildMemberType; // 800 194 | 195 | BYTE MagicIncrement; // 801 196 | BYTE RegenHP; // 802 197 | BYTE RegenMP; // 803 198 | 199 | struct 200 | { 201 | BYTE Fogo; 202 | BYTE Gelo; 203 | BYTE Sagrado; 204 | BYTE Trovao; 205 | } Resist; // 804 - 807 206 | } st_Mob; 207 | 208 | typedef struct 209 | { 210 | WORD Size; 211 | BYTE Key; 212 | BYTE CheckSum; 213 | WORD PacketId; 214 | WORD ClientId; 215 | DWORD TimeStamp; 216 | } PacketHeader; 217 | 218 | typedef struct { 219 | PacketHeader Header; 220 | char Password[12]; 221 | char Username[16]; 222 | 223 | char Unknow[52]; 224 | UINT32 CliVer; 225 | UINT32 Unknow_84; 226 | 227 | char AdapterInfos[16]; 228 | } p20D; 229 | 230 | typedef struct 231 | { 232 | PacketHeader Header; 233 | 234 | char Message[96]; 235 | } p101; 236 | 237 | typedef struct 238 | { 239 | PacketHeader Header; 240 | INT32 npcId; 241 | INT32 click; 242 | } p28B; 243 | 244 | typedef struct 245 | { 246 | PacketHeader Header; 247 | char Title[96]; 248 | char Ans[4][32]; 249 | } p1C6; 250 | 251 | typedef struct 252 | { 253 | PacketHeader Header; 254 | BYTE Keys[16]; 255 | 256 | INT32 Unkw; 257 | 258 | struct 259 | { 260 | INT16 PositionX[4]; 261 | INT16 PositionY[4]; 262 | 263 | char Name[4][16]; 264 | 265 | st_Status Status[4]; 266 | st_Item Equip[4][16]; 267 | 268 | UINT16 GuildIndex[4]; 269 | 270 | int Gold[4]; 271 | INT64 Exp[4]; 272 | } CharList; 273 | 274 | st_Item Storage[128]; 275 | UINT32 GoldStorage; 276 | 277 | char UserName[16]; 278 | BYTE Unknow[12]; 279 | } p10A; 280 | 281 | typedef struct 282 | { 283 | PacketHeader Header; 284 | char num[6]; 285 | char unk[10]; 286 | INT32 RequestChange; 287 | } pFDE; 288 | 289 | typedef struct 290 | { 291 | PacketHeader Header; 292 | int CharIndex; 293 | char Zero[18]; 294 | } p213; 295 | 296 | typedef struct 297 | { 298 | PacketHeader Header; // 0 - 11 299 | st_Position WorldPos; // 12 - 15 300 | st_Mob Mob; // 16 - 823 301 | 302 | st_Status SubClass; 303 | char Tab[26]; 304 | char GuildName[30]; 305 | int NextMovement; 306 | 307 | BYTE unknow[108]; 308 | 309 | struct 310 | { 311 | short SlotIndex; // 1040 - 1041 312 | short ClientIndex; // 1042 - 1043 313 | short evasao; // 1044 - 1045 314 | 315 | char SkillBar2[16]; // 1046 - 1061 316 | WORD Unknow; // 1062 - 1063 317 | int Hold; // 1064 - 1065 318 | } Other; 319 | int HPDRAIN; 320 | int AtkSpeed; 321 | int Absorcao; 322 | int TimeStamp; 323 | 324 | int BonusXP; 325 | int BonusPerf; 326 | int BonusDrop; 327 | 328 | int ControlMP; 329 | st_Position Old_Pos; 330 | st_Affect Affect[32]; 331 | int ClassMaster; 332 | 333 | INT64 Unknow22; 334 | INT8 Unknoww[22]; 335 | char SkillBar[2][10]; 336 | 337 | BYTE Unknow[286]; 338 | } p114; 339 | 340 | typedef struct 341 | { 342 | PacketHeader Header; 343 | char SkillBar1[4]; 344 | char SkillBar2[16]; 345 | } p378; 346 | 347 | typedef struct 348 | { 349 | PacketHeader Header; 350 | char eChat[96]; 351 | }p333; 352 | 353 | typedef struct 354 | { 355 | PacketHeader Header; // 0 - 11 356 | 357 | st_Status Status; // 12 - 59 358 | 359 | BYTE Critical; // 60 360 | BYTE SaveMana; // 61 361 | 362 | struct 363 | { 364 | BYTE Time; 365 | BYTE Index; 366 | } Affect[32]; //62 - 125 367 | 368 | WORD GuildIndex; // 126 - 127 369 | 370 | BYTE RegenHP, // 128 371 | RegenMP; // 129 372 | 373 | BYTE Resist1; // 130 374 | BYTE Resist2; // 131 375 | BYTE Resist3; // 132 376 | BYTE Resist4; // 133 377 | 378 | WORD Unknow; // 134 - 135 379 | WORD CurrHP; // 136 - 137 380 | DWORD CurrMP; // 138 - 142 381 | BYTE Unknow_2; // 143 382 | BYTE MagicIncrement; // 144 - 147 383 | DWORD Unknow_148; // 148 - 151 384 | } p336; 385 | 386 | // Spawn Info 387 | typedef struct 388 | { 389 | PacketHeader Header; // 0 - 11 390 | 391 | // Spawn Info 392 | struct 393 | { 394 | short X, Y; 395 | } Current; // 12 - 15 396 | 397 | short Index; // 16 - 17 398 | 399 | char Name[12]; // 18 - 29 400 | 401 | // Killer Points 402 | unsigned char ChaosPoints; // 30 403 | unsigned char CurrentKill; // 31 404 | unsigned short TotalKill; // 32 - 33 405 | 406 | // Item Info 407 | WORD Item_Refine[16]; // 34 - 65 408 | 409 | 410 | // Skill Info 411 | struct 412 | { 413 | BYTE Time; 414 | BYTE Index; 415 | } Affect[32]; // 66 - 129 416 | 417 | // Guild Info 418 | WORD GuildIndex; // 130 - 131 419 | 420 | // Unknow byte 757 421 | char GuildMemberType; // 132 - 133 422 | 423 | WORD Unknow; 424 | 425 | // Score Info 426 | st_Status Status; // 134 - 181 427 | 428 | // Spawn Type 429 | struct 430 | { 431 | WORD Type; 432 | } Spawn; // 182 - 185 433 | 434 | char pAnctCode[16]; 435 | char pTab[26]; 436 | 437 | BYTE Unknow_02[4]; 438 | } p3644; 439 | 440 | typedef struct 441 | { 442 | PacketHeader Header; 443 | 444 | INT32 Value; 445 | } pMsgSignal; 446 | 447 | typedef struct 448 | { 449 | PacketHeader Header; 450 | char eCommand[16]; 451 | char eValue[100]; 452 | }p334; 453 | 454 | typedef struct 455 | { 456 | PacketHeader Header; 457 | 458 | INT32 curHP; 459 | INT32 curMP; 460 | INT32 maxHP; 461 | INT32 maxMP; 462 | } p181; 463 | 464 | typedef struct 465 | { 466 | PacketHeader Header; // 0 - 11 467 | st_Position LastPos; // 12 - 15 468 | 469 | UINT32 MoveType; // 16 - 19 470 | UINT32 MoveSpeed; // 20 - 23 471 | 472 | char Command[24]; // 23 - 47 473 | 474 | st_Position Destiny; // 48 - 50 475 | } p36C; 476 | 477 | typedef struct 478 | { 479 | PacketHeader Header; // 0 - 11 480 | 481 | st_Status Status; // 12 - 59 482 | 483 | BYTE Critical; // 60 484 | BYTE SaveMana; // 61 485 | 486 | struct 487 | { 488 | BYTE Time; 489 | BYTE Index; 490 | } Affect[32]; //62 - 125 491 | 492 | WORD GuildIndex; // 126 - 127 493 | 494 | BYTE RegenHP, // 128 495 | RegenMP; // 129 496 | 497 | BYTE Resist1; // 130 498 | BYTE Resist2; // 131 499 | BYTE Resist3; // 132 500 | BYTE Resist4; // 133 501 | 502 | WORD Unknow; // 134 - 135 503 | WORD CurrHP; // 136 - 137 504 | DWORD CurrMP; // 138 - 142 505 | BYTE Unknow_2; // 143 506 | BYTE MagicIncrement; // 144 - 147 507 | DWORD Unknow_148; // 148 - 151 508 | } p366; 509 | 510 | typedef struct 511 | { 512 | INT32 Index; 513 | INT32 Damage; 514 | }st_Target; 515 | 516 | typedef struct 517 | { 518 | PacketHeader Header; // 0 - 11 519 | INT32 Hold; // 12 - 15 520 | INT32 reqMP; // 16 - 19 521 | INT32 Unk; // 20 - 23 522 | INT64 currentExp; // 24 - 27 523 | short unknow; // 28 - 31 524 | st_Position attackerPos; // 32 - 35 525 | st_Position targetPos; // 36 - 39 526 | short attackerId; // 40 - 41 527 | short attackCount; // 42 - 43 528 | unsigned char Motion; // 44 529 | unsigned char skillParm; // 45 530 | unsigned char doubleCritical; // 46 531 | unsigned char FlagLocal; 532 | short Rsv; 533 | 534 | int currentMp; 535 | short skillId; // 48 - 51 536 | short reqMp; 537 | st_Target Target[13]; // 56 - 538 | } p367; 539 | 540 | typedef struct 541 | { 542 | PacketHeader Header; 543 | short invType; 544 | short invSlot; 545 | st_Item itemData; 546 | } p182; 547 | 548 | typedef struct 549 | { 550 | PacketHeader Header; // 0 - 11 551 | INT32 Hold; // 12 - 15 552 | INT32 reqMP; // 16 - 19 553 | INT32 Unk; // 20 - 23 554 | INT64 currentExp; // 24 - 27 555 | short unknow; // 28 - 31 556 | st_Position attackerPos; // 32 - 35 557 | st_Position targetPos; // 36 - 39 558 | short attackerId; // 40 - 41 559 | short attackCount; // 42 - 43 560 | unsigned char Motion; // 44 561 | unsigned char skillParm; // 45 562 | unsigned char doubleCritical; // 46 563 | unsigned char FlagLocal; 564 | //char flagLocal; // 47 565 | short Rsv; 566 | 567 | int currentMp; 568 | short skillId; // 48 - 51 569 | short reqMp; 570 | st_Target Target; //44 - 47 571 | //int Padding; 572 | } p39D; 573 | 574 | typedef struct 575 | { 576 | PacketHeader Header; 577 | 578 | st_Affect Affect[32]; 579 | } p3B9; 580 | 581 | typedef struct 582 | { 583 | PacketHeader Header; // 0 - 11 584 | 585 | char Name[24]; // 12 - 35 586 | st_Item Item[12]; // 36 - 131 587 | 588 | BYTE Slot[12]; // 132 - 143 589 | 590 | int Gold[12]; // 144 - 191 591 | short Unknown; // 192 - 193 592 | short Index; // 194 - 195 593 | } p397; 594 | 595 | // Spawn Info 596 | typedef struct 597 | { 598 | PacketHeader Header; 599 | 600 | // Spawn Info 601 | struct 602 | { 603 | short X, Y; 604 | } Current; 605 | 606 | short Index; 607 | 608 | char Name[12]; 609 | 610 | // Killer Points 611 | unsigned char ChaosPoints; 612 | unsigned char CurrentKill; 613 | unsigned short TotalKill; 614 | 615 | // Item Info 616 | WORD Item_Refine[16]; 617 | 618 | // Skill Info 619 | struct 620 | { 621 | BYTE Time; 622 | BYTE Index; 623 | } Affect[32]; 624 | 625 | // Guild Info 626 | WORD GuildIndex; 627 | 628 | // Unknow byte 757 629 | char Unknow; 630 | 631 | // Score Info 632 | st_Status Status; 633 | 634 | // Spawn Type 635 | struct 636 | { 637 | unsigned short Type : 8; 638 | unsigned short MemberType : 8; 639 | } Spawn; 640 | 641 | char pAnctCode[16]; 642 | char pTab[26]; 643 | 644 | char StoreName[27]; 645 | } p363; 646 | 647 | typedef struct 648 | { 649 | PacketHeader Header; 650 | 651 | DWORD Hold; 652 | UINT64 Exp; 653 | DWORD Learn; 654 | DWORD Learn2; 655 | 656 | WORD pStatus; 657 | WORD pMaster; 658 | WORD pSkills; 659 | BYTE Magic; // Unknow 660 | BYTE Unk; 661 | 662 | DWORD Gold; 663 | } p337; 664 | 665 | typedef struct 666 | { 667 | PacketHeader Header; 668 | int Hold; 669 | short killed; 670 | short killer; 671 | INT32 Unknow; 672 | INT64 Exp; 673 | }p338; 674 | 675 | 676 | typedef struct 677 | { 678 | PacketHeader Header; 679 | WORD partyId; 680 | WORD Level; 681 | WORD maxHP; 682 | WORD curHP; 683 | WORD leaderId; 684 | char nickName[16]; 685 | BYTE unk; 686 | WORD targetId; 687 | } p37F; 688 | 689 | typedef struct { 690 | PacketHeader Header; 691 | DWORD SrcType; 692 | DWORD SrcSlot; 693 | DWORD DstType; 694 | DWORD DstSlot; 695 | WORD PosX; 696 | WORD PosY; 697 | int warp; 698 | }p373; 699 | 700 | typedef struct 701 | { 702 | PacketHeader Header; 703 | WORD liderID; 704 | char nickName[16]; 705 | } p3AB; 706 | 707 | typedef struct 708 | { 709 | PacketHeader Header; 710 | INT16 mobId; 711 | } p37E; 712 | 713 | typedef struct 714 | { 715 | PacketHeader Header; 716 | WORD LiderID; 717 | WORD Level; 718 | WORD maxHP; 719 | WORD curHP; 720 | WORD PartyID; 721 | char nickName[16]; 722 | WORD ID; 723 | } p37D; 724 | 725 | typedef struct 726 | { 727 | PacketHeader Header; 728 | 729 | INT32 Requested; 730 | BYTE Mac[6]; 731 | } p655; 732 | 733 | typedef struct 734 | { 735 | PacketHeader Header; 736 | 737 | INT32 Requested; 738 | char nick[16]; 739 | } p656; 740 | #endif 741 | -------------------------------------------------------------------------------- /WYD2Bot/WYD2Bot.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {AD0E28DB-05E7-440F-AEB6-99F3531A2342} 15 | AsgardBot 16 | 10.0.16299.0 17 | 18 | 19 | 20 | Application 21 | true 22 | v141 23 | MultiByte 24 | 25 | 26 | Application 27 | false 28 | v141 29 | true 30 | MultiByte 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | $(SolutionDir)include\lua;$(IncludePath) 44 | 45 | 46 | 47 | Level3 48 | Disabled 49 | MultiThreaded 50 | 51 | 52 | true 53 | 54 | 55 | 56 | 57 | Level3 58 | MaxSpeed 59 | true 60 | true 61 | MultiThreaded 62 | 63 | 64 | 65 | 66 | true 67 | true 68 | true 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /WYD2Bot/WYD2Bot.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | Header Files 35 | 36 | 37 | Header Files 38 | 39 | 40 | Header Files 41 | 42 | 43 | Header Files 44 | 45 | 46 | Header Files 47 | 48 | 49 | Header Files 50 | 51 | 52 | 53 | 54 | Resource Files 55 | 56 | 57 | 58 | 59 | Source Files 60 | 61 | 62 | Source Files 63 | 64 | 65 | Source Files 66 | 67 | 68 | Source Files 69 | 70 | 71 | Source Files 72 | 73 | 74 | Source Files 75 | 76 | 77 | Source Files 78 | 79 | 80 | Source Files 81 | 82 | 83 | Source Files 84 | 85 | 86 | Source Files 87 | 88 | 89 | Source Files 90 | 91 | 92 | Source Files 93 | 94 | 95 | -------------------------------------------------------------------------------- /WYD2Bot/WndProc.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevinkouketsu/WYD2Bot/355fc70cdf30964c580050bd7b8c648f6ed8c2bd/WYD2Bot/WndProc.cpp -------------------------------------------------------------------------------- /WYD2Bot/interface.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevinkouketsu/WYD2Bot/355fc70cdf30964c580050bd7b8c648f6ed8c2bd/WYD2Bot/interface.rc -------------------------------------------------------------------------------- /WYD2Bot/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevinkouketsu/WYD2Bot/355fc70cdf30964c580050bd7b8c648f6ed8c2bd/WYD2Bot/resource.h --------------------------------------------------------------------------------