Registration Code (Part 1): w%kQ6
Registration Code (Part 2): b<#$1[*(cw~
In order to register on this forum, you must use the codes above. Combine them into one code (copy paste).

[SOURCE] NostaleSDK - Structures / Functions / Misc Info

Topics regarding the online game Nostale.
Post Reply
User avatar
atom0s
Site Admin
Posts: 401
Joined: Sun Jan 04, 2015 11:23 pm
Location: 127.0.0.1
Contact:

[SOURCE] NostaleSDK - Structures / Functions / Misc Info

Post by atom0s » Sun Nov 13, 2016 11:53 pm

Here is my personal SDK I made for Nostale. I've since quit the game again since it is as boring as it was in 2007? the first time I hacked it and got banned after having fun and ruining a GM even and handing out tons of free gold from packet exploits.

These are the structures for the game I've personally mapped out. I have no idea if they will work 100% on the current client but for the most part should get people the info they need/want.

This kids, is a real SDK, not some nonsense that scans for two functions.
  1. /**
  2.  * NostaleSDK - Copyright (c) 2016 atom0s [atom0s@live.com]
  3.  *
  4.  * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
  5.  * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to
  6.  * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
  7.  *
  8.  * By using NostaleSDK, you agree to the above license and its terms.
  9.  *
  10.  *      Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were
  11.  *                    made. You must do so in any reasonable manner, but not in any way that suggests the licensor
  12.  *                    endorses you or your use.
  13.  *
  14.  *   Non-Commercial - You may not use the material (NostaleSDK) for commercial purposes.
  15.  *
  16.  *   No-Derivatives - If you remix, transform, or build upon the material (NostaleSDK), you may not distribute the
  17.  *                    modified material. You are, however, allowed to submit the modified works back to the original
  18.  *                    NostaleSDK project in attempt to have it added to the original project.
  19.  *
  20.  * You may not apply legal terms or technological measures that legally restrict others
  21.  * from doing anything the license permits.
  22.  *
  23.  * No warranties are given.
  24.  */
  25.  
  26. #ifndef __NOSTALESDK_H_INCLUDED__
  27. #define __NOSTALESDK_H_INCLUDED__
  28.  
  29. #if defined (_MSC_VER) && (_MSC_VER >= 1020)
  30. #pragma once
  31. #endif
  32.  
  33. #include <Windows.h>
  34. #include <algorithm>
  35. #include <functional>
  36. #include <map>
  37. #include <string>
  38.  
  39. /**
  40.  * TMapObjBase
  41.  *
  42.  * Structure definition of a base map object. All entities inherit from this.
  43.  */
  44. struct TMapObjBase
  45. {
  46.     uint32_t        VTablePointer;              // TMapObjBase VTable Pointer
  47.     uint8_t         ObjectType;                 // The object type id. [0x01 = Player, 0x02 = Monster, 0x03 = NPC, 0x04 = Item]
  48.     uint8_t         Unknown0000[3];             // Unknown (unused; padding)
  49.     uint32_t        Id;                         // The objects id.
  50.     uint16_t        MapX;                       // The objects map x coord.
  51.     uint16_t        MapY;                       // The objects map y coord.
  52.     uint32_t        SyncCount;                  // Must stay in sync with another pointer or you get kicked from game. (Movement syncing?)
  53.     uint32_t        Unknown0001;                // Unknown (Seems like a string based on what reads from it.)
  54.     uint32_t        Unknown0002;                // Unknown (Seems like a string based on what reads from it.)
  55.     uint32_t        Unknown0003;                // Unknown (Usually -1 0xFFFFFFFF)
  56.     uint32_t        Unknown0004;                // Unknown (Usually -1 0xFFFFFFFF)
  57.     uint32_t        Unknown0005;                // Pointer to TSmallIntList object. (Used with the last two unknowns.)
  58.     uint32_t        Unknown0006;                // Pointer to TSmallIntList object. (Used with the last two unknowns.)
  59.     uint32_t        ColorMask;                  // BGRA color of the object. Typically 0xFFFFFFFF to allow normal color of the object.
  60.     uint8_t         ColorMaskOpacity;           // 0-255 opacity that is used for the above color mask. Setting this will set the alpha channel in the above color.
  61.     uint8_t         Unknown0007;                // Unknown (unused; padding)
  62.     uint8_t         Unknown0008;                // Unknown (unused; padding)
  63.     uint8_t         Unknown0009;                // Unknown (unused; padding)
  64.     float           Unknown0010;                // Unknown (Changes rapidly while moving.)
  65.     float           Unknown0011;                // Unknown (Usually 1, if changed it is the max value of the above unknown.)
  66.     uint8_t         Unknown0012;                // Unknown (Usually 1, seems to be some sort of 'loaded' flag.)
  67.     uint8_t         Unknown0013;                // Unknown (unused; padding)
  68.     uint8_t         Unknown0014;                // Unknown (unused; padding)
  69.     uint8_t         Unknown0015;                // Unknown (unused; padding)
  70.     uint32_t        Unknown0016;                // Pointer to TMapObjTextureCache (Affects the objects model if edited.)
  71.     float           ModelSize;                  // The size of the objects model.
  72.     float           HitboxRadius;               // The radius of the objects hitbox from its center. (0 = max radius, higher number makes radius smaller and smaller.)
  73.     float           Unknown0018;                // Unknown (Usually 1, only set when spawning/zoning.)
  74.     float           Unknown0019;                // Unknown (Usually 1, only set when spawning/zoning.)
  75.     float           X;                          // The objects X coord. (Where the model is rendered at.)
  76.     float           Z;                          // The objects Z coord. (Where the model is rendered at.)
  77.     float           Y;                          // The objects Y coord. (Where the model is rendered at.)
  78.     float           X2;                         // The objects X coord. (Where the game assumes you are doing things from.)
  79.     float           Z2;                         // The objects Z coord. (Where the game assumes you are doing things from.)
  80.     float           Y2;                         // The objects Y coord. (Where the game assumes you are doing things from.)
  81.     float           XAxisOffset;                // The objects offset on the X coord from 'center' screen. (Visual only, if you move it will reset to normal.)
  82.     float           ZAxisOffset;                // The objects offset on the Z coord from 'center' screen. (Visual only, if you move it will reset to normal.)
  83.     float           YAxisOffset;                // The objects offset on the Y coord from 'center' screen. (Visual only, if you move it will reset to normal.)
  84.     float           XAxisOffset2;               // The objects offset on the X coord from 'center' screen. (If set this will be used constantly.)
  85.     float           ZAxisOffset2;               // The objects offset on the Z coord from 'center' screen. (If set this will be used constantly.)
  86.     float           YAxisOffset2;               // The objects offset on the Y coord from 'center' screen. (If set this will be used constantly.)
  87.     uint32_t        Unknown0020;                // Relates to sync count. Set when you load/zone. Used to calculate your frame.
  88.     float           Unknown0021;                // Relates to the models size/pitch?
  89.     uint8_t         Unknown0022;                // Unknown (Used in the walk packet, 'walk x y ? speed', flips between 0 and 1.)
  90.     uint8_t         Unknown0023;                // Unknown (unused; padding)
  91.     uint8_t         Unknown0024;                // Unknown (unused; padding)
  92.     uint8_t         Unknown0025;                // Unknown (unused; padding)
  93.     uint32_t        Unknown0028;                // Unknown (set while zoning, usually -1)
  94.     uint8_t         Unknown0029;                // Flag the enables reading of the Unknown0033 value.
  95.     uint8_t         Unknown0030;                // Unknown (unused; padding)
  96.     uint8_t         Unknown0031;                // Unknown (unused; padding)
  97.     uint8_t         Unknown0032;                // Unknown (unused; padding)
  98.     uint32_t        Unknown0033;                // Offset 0x98
  99. };
  100.  
  101. /**
  102.  * TMapMoveObjBase
  103.  *
  104.  * Structure definition of a base movable map object.
  105.  */
  106. struct TMapMoveObjBase : TMapObjBase
  107. {
  108.     uint8_t         Direction;                  // The objects current facing direction. (0 = North, 1 = East, 2 = South, 3 = West, etc.)
  109.     uint8_t         Status;                     // The objects current status. (0 = Normal, 1 = Resting, 8 = Running, 9 = Yawning (Animation))
  110.     uint8_t         Speed;                      // The objects current speed. (Editing randomly causes disconnects.)
  111.     uint8_t         BoundsCheck;                // The objects bounds checking status. (Normally 1, if set otherwise will let you attempt to walk through walls.)
  112.     uint8_t         AttackedFlag;               // Toggles between 0 and 1 while being hit by something.
  113.     uint8_t         Unknown0031;                // Unknown (unused; padding)
  114.     uint8_t         Unknown0032;                // Unknown (unused; padding)
  115.     uint8_t         Unknown0033;                // Unknown (unused; padding)
  116.     uint32_t        AnimationCounter;           // The objects animation counter. (Set to 1 and you force-yawn.)
  117.     float           AnimationStepCounter1;      // The objects animation step counter. (If frozen, you will teleport around instead of walking.)
  118.     float           AnimationStepCounter2;      // The objects animation step counter. (If frozen and set to a high value, you will teleport instead of walk.)
  119.     uint32_t        MovementDirectionList;      // Pointer to TByteList object holding the movement directions of the players current movement.
  120.     uint32_t        MovementFrequency;          // The objects movement frequency limiter. (Freeze to 0 to speed hack in a 'legit' manner. You send valid walk walk packets but much faster.)
  121.     uint32_t        Unknown0035;                // Pointer to TMapObjFxList object. (Holds a TNTFairy entry.)
  122.     uint8_t         HealthPercent;              // The objects health percent. (Shown on the bar above their head.)
  123.     uint8_t         ManaPercent;                // The objects mana percent. (Shown on the bar above their head.)
  124.     uint8_t         Unknown0036;                // Unknown (unused; padding)
  125.     uint8_t         Unknown0037;                // Unknown (unused; padding)
  126.     uint32_t        Unknown0038;                // Unknown (unused)
  127.     uint8_t         FamilyNameColor;            // The objects family name color.
  128.     uint8_t         Unknown0039[3];             // Unknown (unused; padding)
  129.     uint32_t        Unknown0040;                // Pointer to TSmallIntList object.
  130.     uint32_t        Unknown0041;                // Pointer to TSmallIntList object.
  131.     uint32_t        LastWaitAnimationTick;      // The last tick the object did a wait animation. (Stretch/yawn, foot tap etc.)
  132.     uint16_t        Unknown0042;                // Unknown (Setting to 1 makes the scene half-disappear.)
  133.     uint16_t        Unknown0043;                // Unknown (Used with the above unknown in some manner.)
  134.     uint32_t        Unknown0044;                // Unknown (unused)
  135.     uint32_t        Unknown0045;                // Unknown (Seems to always be -1)
  136.     uint32_t        Unknown0046;                // Unknown (Seems to only be set when zoning.)
  137.     uint32_t        Unknown0047;                // Unknown (Seems to only be set when zoning.)
  138.     uint32_t        Unknown0048;                // Unknown (Seems to only be set when zoning.)
  139.     uint32_t        Unknown0049;                // Unknown (Seems to only be set when zoning.)
  140.     uint32_t        Unknown0050;                // Unknown (Seems to only be set when zoning.)
  141.     uint32_t        Unknown0051;                // Unknown (Seems to only be set when zoning.)
  142.     uint32_t        Unknown0052;                // Unknown (Compared against 0, if not 0 will lock you from moving.)
  143.     uint8_t         Unknown0053;                // Unknown (unused)
  144.     uint8_t         Unknown0054;                // The objects locked animation. (Sitting, knockback, death, etc.)
  145.     uint8_t         Unknown0055;                // An offset used for a float lookup.
  146.     uint8_t         Unknown0056;                // Unknown (unused)
  147.     float           Unknown0057;                // Unknown (Timer that increments while locked animation is active.)
  148.     float           Unknown0058;                // Unknown (Timer that increments while locked animation is active.)
  149.     uint32_t        Unknown0059;                // Unknown (Seems to only be set when zoning.)
  150.     uint32_t        Unknown0060;                // Unknown (Seems to only be set when zoning.)
  151.     uint32_t        Unknown0061;                // Unknown (Seems to only be set when zoning.)
  152.     uint8_t         Unknown0062;                // Unknown (Sets between 0 and 1 based on the objects status. If Status != 4, set to 1, otherwise 0.)
  153.     uint8_t         Unknown0063;                // Unknown (unused; padding)
  154.     uint8_t         Unknown0064;                // Unknown (unused; padding)
  155.     uint8_t         Unknown0065;                // Unknown (unused; padding)
  156.     uint32_t        Unknown0066;                // Unknown (Seems to only be set when zoning.)
  157.     float           Unknown0067;                // Unknown (Seems to only be set when zoning.)
  158.     uint8_t         Unknown0068;                // Flag used while object is animated.
  159.     uint8_t         Unknown0069;                // Flag used while object is animated.
  160.     uint8_t         Unknown0070;                // Unknown (unused; padding)
  161.     uint8_t         Unknown0071;                // Unknown (unused; padding)
  162.     uint32_t        Unknown0072;                // Unknown (Indexed array of pointers.)
  163.     uint32_t        Unknown0073;                // Unknown (Indexed array of pointers.)
  164.     uint32_t        Unknown0074;                // Unknown (Indexed array of pointers.)
  165.     uint32_t        Unknown0075;                // Unknown (Indexed array of pointers.)
  166.     uint32_t        Unknown0076;                // Unknown (Indexed array of pointers.)
  167.     uint32_t        Unknown0077;                // Unknown (Indexed array of pointers.)
  168.     uint32_t        Unknown0078;                // Unknown (Indexed array of pointers.)
  169.     uint32_t        Unknown0079;                // Unknown (Indexed array of pointers.)
  170.     uint16_t        Level;                      // The objects level.
  171.     uint16_t        WingType;                   // The objects wing type shown when targeting them. (Based on their good/evil status?)
  172.     uint16_t        Unknown0081;                // Unknown (Seems to always be 0 for players. Has a value for objects players spawn like mailboxes, mini-house telepots, etc.)
  173.     uint8_t         ShadowVisible;              // -1 if hidden, anything else is visible.
  174.     uint8_t         XSelectionVisible;          // Determines if the objects 'X' selection mark under it is visible.
  175.     uint8_t         SelectionRingColor;         // The ring around the objects feet on the ground. (0 = Orange, 1 = Green)
  176.     uint8_t         Unknown0083;                // Unknown (Seems to always be 0.)
  177.     uint8_t         Unknown0084;                // Unknown (Seems to always be -1.)
  178.     uint8_t         Unknown0085;                // Unknown (Seems to always be 0.)
  179.     uint32_t        OwnerId;                    // The object id that owns this object. (Used for pets.)
  180.     uint8_t         AboveHeadShopBackground;    // -1 if disabled, otherwise displays the shop background over the objects head.
  181.     uint8_t         OpenWindowId;               // The window id to open when the objects shop is used (or dialog is opened). (This does not match normal window ids. It has some sort of offset.)
  182.     uint16_t        Unknown0087;                // Unknown (unused; padding)
  183.     uint32_t        AboveHeadShopText;          // Pointer to the shops text.
  184.     float           Unknown0088;                // Unknown
  185.     uint32_t        IsInPartyFlag;              // Set to -1 if not in party, 14 if in party.
  186.     uint32_t        FamilyId;                   // The id of the objects family.
  187.     uint32_t        Unknown0091;                // Unknown (Seems to always be -1.)
  188.     uint32_t        Unknown0092;                // Unknown (Seems to always be -1.)
  189.     uint32_t        Unknown0093;                // Unknown (Seems to always be -1.)
  190.     uint32_t        Unknown0094;                // Unknown (Seems to always be -1.)
  191.     uint8_t         Unknown0095;                // Setting this and moving alters the players animation.
  192.     uint8_t         NameVisibleFlag;            // 0x02 when name is hidden. (Can be used to tell if something is invisible.)
  193.     uint8_t         AboveHeadIcon;              // The icon displayed over the players head. (Checkmark, Exclamation, etc.)
  194.     uint8_t         Unknown0096;                // Unknown (unused; padding)
  195.     uint8_t         AutorunHitboxRange;         // The amount of space before the player will stop running to this object when auto-running. (0 means to run right up to the object.)
  196.     uint8_t         Unknown0097;                // Unknown (unused; padding)
  197.     uint8_t         Unknown0098;                // Unknown (unused; padding)
  198.     uint8_t         Unknown0099;                // Unknown (unused; padding)
  199. };
  200.  
  201. /**
  202.  * TMapPlayerObj
  203.  *
  204.  * Structure definition of a player object.
  205.  */
  206. struct TMapPlayerObj : TMapMoveObjBase
  207. {
  208.  
  209.     uint16_t        Visuals0000;                // Contains the players current costume id. (Lower end bits hold the sex of the outfit.)
  210.     uint16_t        Unknown0000;                // Unknown (unused)
  211.     uint8_t         IsMounted;                  // Flag that determines if the player is in a mounted costume / state.
  212.     uint8_t         Unknown0001;                // Unknown (unused)
  213.     uint8_t         Unknown0002;                // Unknown (unused)
  214.     uint8_t         Unknown0003;                // Unknown (unused)
  215.     uint32_t        HairColorPointer;           // Pointer to the players hair color. (0xAARRGGBB format.)
  216.     uint32_t        HairColor;                  // The players hair color. (0xAARRGGBB format.) (Updates from the pointer value above.)
  217.     uint32_t        HatColor;                   // The players hat color. (0xAARRGGBB format.)
  218.     uint32_t        FaceMaskColor;              // The players face mask color. (0xAARRGGBB format.)
  219.     uint8_t         Unknown0005;                // Unknown (Flag that is checked against 0.)
  220.     uint8_t         Unknown0006;                // Unknown (unused)
  221.     uint8_t         Unknown0007;                // Unknown (unused)
  222.     uint8_t         Unknown0008;                // Unknown (unused)
  223.     float           GlowEffectDistance;         // The distance a glowing effect pulses from the player. (Such as a weapon on their back.)
  224.     uint8_t         WeaponGlowEffect;           // The players weapon glow effect.
  225.     uint32_t        WeaponGlowColor;            // The players weapon glow color. (0xAARRGGBB format.)
  226.     float           WeaponGlowSize;             // The players weapon glow size.
  227.     uint8_t         WeaponGlowInnerEffect;      // The players weapon glow inner effect.
  228.     uint32_t        Unknown0009;                // Unknown function pointer.
  229.     uint8_t         Unknown0010;                // Unknown (Passed as a parameter to the above unknown function.)
  230.     uint8_t         Unknown0011;                // Unknown (Passed as a parameter to the above unknown function.)
  231.     uint32_t        LastSparkleTick;            // The players last time they sparkled.
  232.     uint16_t        Unknown0012;                // Unknown (Affects the players sparkle effect.)
  233.     uint16_t        Unknown0013;                // Unknown (unused)
  234.     uint8_t         ClassId;                    // The players class id. (0x80 = Adventurer, 0x81 = Swordsman, 0x82 = Archer, 0x83 = Mage)
  235.     uint8_t         JobId;                      // The players job id.
  236.     uint8_t         ShirtStyle;                 // The players shirt style.
  237.     uint8_t         HairStyle;                  // The players hair style.
  238.     uint8_t         HatId;                      // The players hat id.
  239.     uint8_t         FaceMask;                   // The players face mask id.
  240.     uint8_t         Unknown0014;                // Unknown;
  241.     uint8_t         ClassWeapon;                // The players weapon id. (Based on their class.)
  242.     char*           Name;                       // Pointer to the players name.
  243.     uint32_t        Family;                     // Pointer to the players family name and information.
  244.     uint32_t        Fairy;                      // Pointer to the players TNTFairy object.
  245.     uint16_t        NameFlag;                   // Bit array that handles the players name tags. (GM = 0x02)
  246.     uint16_t        Unknown0015;                // Unknown
  247.     uint32_t        NameIcon;                   // Bit array that handles the icon shown next to the players name.
  248. };
  249.  
  250. /**
  251.  * TMonsterName
  252.  *
  253.  * Structure definition of a monsters name information.
  254.  */
  255. struct TMonsterName
  256. {
  257.     uint32_t        Length;                     // The length of the monsters name.
  258.     char*           MonsterName;                // Pointer to the monsters name.
  259. };
  260.  
  261. /**
  262.  * TMapMonsterObj
  263.  *
  264.  * Structure definition of a monster object.
  265.  */
  266. struct TMapMonsterObj : TMapMoveObjBase
  267. {
  268.     uint8_t         Unknown0000;                // Deals with the outlining of the monster when moused over.
  269.     uint8_t         Unknown0001;                // Unknown (unused; padding)
  270.     uint8_t         Unknown0002;                // Unknown (unused; padding)
  271.     uint8_t         Unknown0003;                // Unknown (unused; padding)
  272.     uint32_t        Unknown0004;                // Unknown (If not 0, all entities are hidden on screen.)
  273.     uint16_t        ModelId;                    // The monster model id to load for the entity.
  274.     uint16_t        Unknown0006;                // Alters the shadow of the entity. Not sure what exactly it is for though.
  275.     TMonsterName*   NamePointer;                // Pointer to a TMonsterName structure holding the monsters name info.
  276.     uint8_t         SpecialEffect;              // Additional effect placed on the entity.
  277.     uint8_t         Unknown0008;                // Unknown (unused; padding)
  278.     uint8_t         Unknown0009;                // Unknown (unused; padding)
  279.     uint8_t         Unknown0010;                // Unknown (unused; padding)
  280.     float           SpecialEffectMultiplier;    // Multiplies the amount of the special effect that is activated.
  281.     uint8_t         EffectColorB;               // The blue color of the effect. (SpecialEffect 1 for this to work.)
  282.     uint8_t         EffectColorG;               // The green color of the effect. (SpecialEffect 1 for this to work.)
  283.     uint8_t         EffectColorR;               // The red color of the effect. (SpecialEffect 1 for this to work.)
  284.     uint8_t         Unknown0011;                // Unknown (unused; padding)
  285.     uint8_t         EffectPulseType;            // The special effect pulse type when the effect is set to 2.
  286. };
  287.  
  288. /**
  289.  * TMapNpcObj
  290.  *
  291.  * Structure definition of an npc object.
  292.  */
  293. struct TMapNpcObj : TMapMonsterObj
  294. {
  295.     char*           NpcName;
  296. };
  297.  
  298. /**
  299.  * TMapItemInfo
  300.  *
  301.  * Structure definition of an items information.
  302.  */
  303. struct TMapItemInfo
  304. {
  305.     uint8_t         Unknown0000[0x38];
  306.     uint32_t        ItemName;
  307.     uint8_t         Unknown0001[0x0E];
  308.     uint16_t        ItemId;
  309. };
  310.  
  311. /**
  312.  * TMapItemObj
  313.  *
  314.  * Structure definition of an item object.
  315.  */
  316. struct TMapItemObj : TMapObjBase
  317. {
  318.     uint32_t        Unknown0000;                // Unknown (set to 0 when item is spawned)
  319.     uint32_t        Unknown0001;                // Unknown (set to 0 when item is spawned)
  320.     uint32_t        Unknown0002;                // Unknown (set to 0 when item is spawned)
  321.     uint32_t        Unknown0003;                // Unknown (set to 0 when item is spawned)
  322.     uint8_t         Unknown0004;                // If set to 1 the item will disappear on screen like someone picked it up.
  323.     uint8_t         Unknown0005;                // Unknown (set to 0 when item is spawned)
  324.     uint8_t         Unknown0006;                // Unknown (set to 0 when item is spawned)
  325.     uint8_t         Unknown0007;                // Unknown (set to 0 when item is spawned)
  326.     uint32_t        Unknown0008;                // Unknown (set to 0 when item is spawned)
  327.     uint32_t        Unknown0009;                // Unknown (set to 0 when item is spawned)
  328.     uint32_t        Unknown0010;                // Unknown (set to 0 when item is spawned)
  329.     uint16_t        ItemId;                     // The items id.
  330.     uint16_t        ItemId2;                    // The items id. (Copied from [ItemInfoPointer]+0x4A's value.)
  331.     TMapItemInfo*   ItemInfoPointer;            // Pointer to information about this item. (+0x4A from this holds the item id.)
  332.     uint32_t        ItemCount;                  // The amount of items in the single stack.
  333.     uint32_t        ItemOwnerId;                // The server id of the owner of the item. (-1 if its free for all.)
  334.     uint8_t         ItemFlags;                  // Bit array holding information about the item. (Such as if it is a quest item etc.)
  335.     uint8_t         Unknown0011;                // Unknown (unused; padding)
  336.     uint8_t         Unknown0012;                // Unknown (unused; padding)
  337.     uint8_t         Unknown0013;                // Unknown (unused; padding)
  338. };
  339.  
  340. /**
  341.  * TPlayerObjManager
  342.  *
  343.  * Structure definition of the games internal TPlayerObjManager object.
  344.  */
  345. struct TPlayerObjManager
  346. {
  347.     uint32_t        VTablePointer;              // TPlayerObjManager VTable Pointer
  348.     uint16_t        CurrentMapX;                // The players current map x position.
  349.     uint16_t        CurrentMapY;                // The players curremt map y position.
  350.     uint16_t        DestinationMapX;            // The players destination map x position.
  351.     uint16_t        DestinationMapY;            // The players destination map y position.
  352.     uint32_t        Unknown0002;                // Incrementing timer used while auto-attacking.
  353.     uint32_t        Unknown0003;                // Unknown (unused)
  354.     uint8_t         CombatStatus;               // The players combat status. 0 = None, 2 = Attacking / Casting, 3 = Using Slingshot, etc.
  355.     uint8_t         Unknown0004;                // Unknown (0 is written to this each time you exit combat.)
  356.     uint16_t        Unknown0005;                // Unknown (unused)
  357.     uint32_t        Unknown0006;                // Pointer to a TByteList object.
  358.     uint8_t         Unknown0007;                // Unknown (set to 0 usually, deals with the list object before this if set to 1.)
  359.     uint8_t         Unknown0008;                // Unknown (unused)
  360.     uint8_t         Unknown0009;                // Unknown (unused)
  361.     uint8_t         Unknown0010;                // Unknown (unused)
  362.     TMapPlayerObj*  PlayerObject;               // Pointer to the current players object.
  363.     uint32_t        PlayerId;                   // The current players server id.
  364.     uint8_t         CanUseEmotes;               // Determines if the player is able to emote. (Possibly a flag to determine if the player is loaded.)
  365.     uint8_t         Unknown0011;                // Unknown (unused)
  366.     uint8_t         Unknown0012;                // Unknown (unused)
  367.     uint8_t         Unknown0013;                // Unknown (unused)
  368.     TMapObjBase*    AutoAttackingMobPointer;    // Pointer to an entity object that the player has double-clicked to auto-follow / auto-attack.
  369.     uint32_t        Unknown0014;                // Pointer to a TList object.
  370.     uint32_t        Unknown0015;                // Pointer to a wide string. Unsure what uses it currently.
  371.     uint32_t        Unknown0016;                // Unknown (set to 0 when logging out.)
  372.     uint32_t        Unknown0017;                // Unknown (set to 0 when logging out.)
  373.     uint32_t        Unknown0018;                // Unknown (set to 1800000 when the manager is created.)
  374.     TMapObjBase*    LastClickedObject;          // Pointer to the last clicked object. (0 if floor was clicked.)
  375. };
  376.  
  377. /**
  378.  * TSceneManager
  379.  *
  380.  * Structure definition of the games internal TSceneManager object.
  381.  */
  382. struct TSceneManager
  383. {
  384.     uint32_t        VTablePointer;              // TSceneManager VTable Pointer
  385.     uint32_t        TEventCtrlPointer;          // Pointer to a TEventCtrl object.
  386.     uint32_t        UnknownTMapMoveObjBaseList; // Pointer to a TMapMoveObjBase object.
  387.     uint32_t        PlayerListPointer;          // Pointer to a TMapObjBaseList -> TMapPlayerObj object holding the current maps players.
  388.     uint32_t        MonsterListPointer;         // Pointer to a TMapObjBaseList -> TMapMonsterObj object holding the curremt maps monsters.
  389.     uint32_t        NpcListPointer;             // Pointer to a TMapObjBaseList -> TMapNpcObj object holding the curremt maps npcs.
  390.     uint32_t        ItemListPointer;            // Pointer to a TMapObjBaseList -> TMapItemObj object holding the curremt maps items.
  391.     uint32_t        UnknownTLBSBkFxListPointer; // Pointer to a TLBSBkFxList object.
  392.     uint32_t        Unknown0000;                // Pointer to structure holding information about the mouse movement.
  393.     uint32_t        TotalFrameCounter;          // Incrementing timer that signifies the total frame count. (Value is copied from another location. This copy is used for movement.)
  394.     uint8_t         IsPlayerLoaded;             // Flag to determine if the player is loaded and the camera is snapped onto the player. (Set to zero while loading, reset to 1 after c_info and mapout packets are handled.)
  395.     uint8_t         Unknown0002;                // Unknown (unused)
  396.     uint8_t         Unknown0003;                // Unknown (unused)
  397.     uint8_t         Unknown0004;                // Unknown (unused)
  398.     uint32_t        PlayerId;                   // The local players current server id. (Referred to as session id by others.)
  399.     uint32_t        PlayerObjectPointer;        // Pointer to the local players TMapPlayerObj object.
  400.     uint32_t        MouseOverObjectPointer1;    // Pointer to the TMapObjBase object that the mouse is currently hovering over. (Valid when the mouse is over an object and the name is visible.)
  401.     uint32_t        MouseOverObjectPointer2;    // Pointer to the TMapObjBase object that the mouse is currently hovering over. (Valid when the mouse is within an objects hitbox.)
  402.     float           Unknown0005;                // Unknown (Deals with the mouse while its within the maps clickable area. Adjusts differently when mouse is held down.)
  403.     float           Unknown0006;                // Unknown (Deals with the mouse while its within the maps clickable area. Adjusts differently when mouse is held down.)
  404.     uint32_t        Unknown0007;                // Unknown (Deals with the mouse.)
  405.     uint32_t        AutoAttackObjectPointer;    // Pointer to a TMapObjBase object that the player is targeting to attack. (When you double-click an enemy this is set to the enemies pointer.)
  406.     uint16_t        MousePositionX;             // The mouses current x axis position, relative to the top-left corner of the game window.
  407.     uint16_t        MousePositionY;             // The mouses current y axis position, relative to the top-left corner of the game window.
  408.     uint16_t        WindowWidth;                // The window width that the mouse is usable within.
  409.     uint16_t        WindowHeight;               // The window height that the mouse is usable within.
  410.     uint32_t        Unknown0008;                // Unknown (usused, always 0)
  411.     uint8_t         Unknown0009;                // Unknown (seems to always be 1, compared against 0 in several instructions. Deals with the mouse.)
  412.     uint8_t         Unknown0010;                // Unknown (unused)
  413.     uint8_t         Unknown0011;                // Unknown (unused)
  414.     uint8_t         Unknown0012;                // Unknown (unused)
  415.     float           MouseMapX;                  // The mouses current x axis position as a float. Can be used to edit where the mouse will click.
  416.     float           MouseMapZ;                  // The mouses current z axis position as a float. Can be used to edit where the mouse will click. (Depth.)
  417.     float           MouseMapY;                  // The mouses current y axis position as a float. Can be used to edit where the mouse will click.
  418.     uint32_t        Unknown0013;                // Pointer to a TCellBlockTexture object.
  419.     uint32_t        CameraPointer;              // Pointer to a TLBSCamera object that handles the game camera.
  420.     uint32_t        Unknown0014;                // Pointer to a TList object. (List holds TLBSBaseGmItem objects.)
  421.     uint32_t        Unknown0015;                // Pointer to a TList object. (List holds TLBSFixtGmItem objects.)
  422.     uint32_t        Unknown0016;                // Pointer to a TList object. (List holds TLBSFixtGmItem objects.)
  423.     uint32_t        Unknown0017;                // Pointer to a TList object. (List holds TLBSEffectGmItem objects.)
  424.     uint32_t        Unknown0018;                // Pointer to a TList object. (List holds various objects, TMapMonsterObj, TMapPlayerObj etc. Changes sizes and objects rapidly while moving around.)
  425.     uint32_t        Unknown0019;                // Pointer to a TList object. (List holds TLBSMapFxItem objects.)
  426.     uint32_t        ZoneTimeSnapshot;           // The timer count set when zoning. (Pulls the timer from TotalFrameCounter's value at the time of zoning.)
  427.     uint8_t         Unknown0020;                // Unknown (set when logging in, always 0)
  428.     uint8_t         Unknown0021;                // Unknown (set when zoning, always 0)
  429.     uint8_t         Unknown0022;                // Unknown (unused)
  430.     uint8_t         Unknown0023;                // Unknown (unused)
  431.     uint32_t        Unknown0024;                // Unknown (set when zoning, always 0)
  432.     uint32_t        Unknown0025;                // Unknown (set when getting attacked,  changes each time you are attacked) TObjAtkTimeArr object.
  433.     uint8_t         Unknown0026;                // Unknown (set to 255 (-1) by force if changed, used within the pulse packet handler somewhere)
  434.     uint8_t         Unknown0027;                // Unknown (unused)
  435.     uint8_t         Unknown0028;                // Unknown (unused)
  436.     uint8_t         Unknown0029;                // Unknown (unused)
  437.     uint32_t        Unknown0030;                // Unknown (read when zoning) /* End of TSceneManager based on decompiler output. */
  438. };
  439.  
  440. #endif // __NOSTALESDK_H_INCLUDED__
Derp~
Need a great web host? Check out: AnHonestHost.com


Donations can be made via Paypal:
https://www.paypal.me/atom0s
User avatar
atom0s
Site Admin
Posts: 401
Joined: Sun Jan 04, 2015 11:23 pm
Location: 127.0.0.1
Contact:

Re: [SOURCE] Various Nostale Structures / Data

Post by atom0s » Sun Nov 13, 2016 11:56 pm

PlayerObjManager

Code: Select all

Pattern: 8B83????????8B15????????3B42??74??33C0
Offset: +0x08
PlayerMoveTo

Code: Select all

Pattern: 558BEC83C4E853565766894DFA8955FC8BF833DB8BC7
Offset: +0x00
  1.  
  2. /**
  3.  * Moves the player to the given location via mouse clicking.
  4.  *
  5.  * @param {uint32_t} mapPos                         The position on the map to move to.
  6.  */
  7. void PlayerObjManager::MoveTo(uint32_t mapPos)
  8. {
  9.     // Ensure the base pointer has been found..
  10.     if (this->m_PlayerObjManagerPointer == 0)
  11.         return;
  12.  
  13.     // Read the pointer..
  14.     auto pointer = *(uintptr_t*)this->m_PlayerObjManagerPointer;
  15.     if (pointer == 0) return;
  16.     pointer = *(uintptr_t*)pointer;
  17.     if (pointer == 0) return;
  18.  
  19.     auto func = this->m_MoveToPositionFunction;
  20.  
  21.     __asm
  22.     {
  23.         push 1
  24.         xor ecx, ecx
  25.         mov edx, mapPos
  26.         mov eax, pointer
  27.         call[func];
  28.     }
  29. }
Here is the full code to my PlayerObjManager:
  1. /**
  2.  * NosHook - Copyright (c) 2016 atom0s [atom0s@live.com]
  3.  *
  4.  * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
  5.  * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to
  6.  * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
  7.  *
  8.  * By using NosHook, you agree to the above license and its terms.
  9.  *
  10.  *      Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were
  11.  *                    made. You must do so in any reasonable manner, but not in any way that suggests the licensor
  12.  *                    endorses you or your use.
  13.  *
  14.  *   Non-Commercial - You may not use the material (NosHook) for commercial purposes.
  15.  *
  16.  *   No-Derivatives - If you remix, transform, or build upon the material (NosHook), you may not distribute the
  17.  *                    modified material. You are, however, allowed to submit the modified works back to the original
  18.  *                    NosHook project in attempt to have it added to the original project.
  19.  *
  20.  * You may not apply legal terms or technological measures that legally restrict others
  21.  * from doing anything the license permits.
  22.  *
  23.  * No warranties are given.
  24.  */
  25.  
  26. #include "PlayerObjManager.h"
  27.  
  28. /**
  29.  * Constructor / Deconstructor
  30.  */
  31. PlayerObjManager::PlayerObjManager(void)
  32.     : m_HookCore(nullptr)
  33.     , m_PlayerObjManagerPointer(0)
  34. { }
  35. PlayerObjManager::~PlayerObjManager(void)
  36. { }
  37.  
  38. /**
  39.  * Gets the singleton instance of the PlayerObjManager class.
  40.  *
  41.  * @return {PlayerObjManager&}                      The singleton instance of the PlayerObjManager class.
  42.  */
  43. PlayerObjManager& PlayerObjManager::instance(void)
  44. {
  45.     static PlayerObjManager playerObjManager;
  46.     return playerObjManager;
  47. }
  48.  
  49. /**
  50.  * Initializes the PlayerObjManager class.
  51.  *
  52.  * @param {IHookCore*} hookCore                     The NosHook core object.
  53.  * @return {bool}                                   True on success, false otherwise.
  54.  */
  55. bool PlayerObjManager::Initialize(IHookCore* hookCore)
  56. {
  57.     this->m_HookCore = hookCore;
  58.  
  59.     // Dump the games memory to scan for pointers..
  60.     MODULEINFO mod = { 0 };
  61.     if (!::GetModuleInformation(::GetCurrentProcess(), ::GetModuleHandleA("NosTaleX.dat"), &mod, sizeof(MODULEINFO)))
  62.         return false;
  63.     std::vector<BYTE> rawdata((unsigned char*)mod.lpBaseOfDll, (unsigned char*)mod.lpBaseOfDll + mod.SizeOfImage);
  64.  
  65.     // Locate the TPlayerObjManager pointer..
  66.     this->m_PlayerObjManagerPointer = Atomic::Memory::FindPattern(std::ref(rawdata), mod.SizeOfImage, (uintptr_t)mod.lpBaseOfDll, "8B83????????8B15????????3B42??74??33C0", 0x08, 0x00);
  67.     if (this->m_PlayerObjManagerPointer == 0)
  68.     {
  69.         hookCore->GetConsole()->Write(D3DCOLOR_ARGB(255, 255, 0, 0), "[Error] Failed to locate TPlayerObjManager pointer!");
  70.         return false;
  71.     }
  72.  
  73.     // Locate the movement function pointer..
  74.     this->m_MoveToPositionFunction = Atomic::Memory::FindPattern(std::ref(rawdata), mod.SizeOfImage, (uintptr_t)mod.lpBaseOfDll, "558BEC83C4E853565766894DFA8955FC8BF833DB8BC7", 0x00, 0x00);
  75.     if (this->m_MoveToPositionFunction == 0)
  76.     {
  77.         hookCore->GetConsole()->Write(D3DCOLOR_ARGB(255, 255, 0, 0), "[Error] Failed to locate movement function pointer!");
  78.         return false;
  79.     }
  80.  
  81.     return true;
  82. }
  83.  
  84. /**
  85.  * Releases the PlayerObjManager class.
  86.  */
  87. void PlayerObjManager::Release(void)
  88. {
  89.     this->m_HookCore = nullptr;
  90.     this->m_PlayerObjManagerPointer = 0;
  91. }
  92.  
  93. /**
  94.  * Gets the Nostale TPlayerObjManager object.
  95.  *
  96.  * @return {TPlayerObjManager*}                     The Nostale player object manager.
  97.  */
  98. TPlayerObjManager* PlayerObjManager::GetPlayerObjManager(void)
  99. {
  100.     // Ensure the base pointer has been found..
  101.     if (this->m_PlayerObjManagerPointer == 0)
  102.         return nullptr;
  103.  
  104.     // Read the pointer..
  105.     auto pointer = *(uintptr_t*)this->m_PlayerObjManagerPointer;
  106.     if (pointer == 0)
  107.         return nullptr;
  108.  
  109.     // Read the object..
  110.     return ((TPlayerObjManager*)*(uintptr_t*)pointer);
  111. }
  112.  
  113. /**
  114.  * Moves the player to the given location via mouse clicking.
  115.  *
  116.  * @param {uint32_t} mapPos                         The position on the map to move to.
  117.  */
  118. void PlayerObjManager::MoveTo(uint32_t mapPos)
  119. {
  120.     // Ensure the base pointer has been found..
  121.     if (this->m_PlayerObjManagerPointer == 0)
  122.         return;
  123.  
  124.     // Read the pointer..
  125.     auto pointer = *(uintptr_t*)this->m_PlayerObjManagerPointer;
  126.     if (pointer == 0) return;
  127.     pointer = *(uintptr_t*)pointer;
  128.     if (pointer == 0) return;
  129.  
  130.     auto func = this->m_MoveToPositionFunction;
  131.  
  132.     __asm
  133.     {
  134.         push 1
  135.         xor ecx, ecx
  136.         mov edx, mapPos
  137.         mov eax, pointer
  138.         call[func];
  139.     }
  140. }
  141.  
  142. /**
  143.  * Gets the local player id.
  144.  *
  145.  * @return {uint32_t}                               The local player id.
  146.  */
  147. uint32_t PlayerObjManager::GetPlayerId(void) const
  148. {
  149.     // Ensure the base pointer has been found..
  150.     if (this->m_PlayerObjManagerPointer == 0)
  151.         return 0;
  152.  
  153.     // Read the pointer..
  154.     auto pointer = *(uintptr_t*)this->m_PlayerObjManagerPointer;
  155.     if (pointer == 0)
  156.         return 0;
  157.  
  158.     // Read the object..
  159.     return ((TPlayerObjManager*)*(uintptr_t*)pointer)->PlayerId;
  160. }
  161.  
  162. /**
  163.  * Gets the local player object.
  164.  *
  165.  * @return {TMapPlayerObj*}                         The local player object.
  166.  */
  167. TMapPlayerObj* PlayerObjManager::GetPlayer(void)
  168. {
  169.     // Ensure the base pointer has been found..
  170.     if (this->m_PlayerObjManagerPointer == 0)
  171.         return nullptr;
  172.  
  173.     // Read the pointer..
  174.     auto pointer = *(uintptr_t*)this->m_PlayerObjManagerPointer;
  175.     if (pointer == 0)
  176.         return nullptr;
  177.  
  178.     // Read the object..
  179.     return ((TPlayerObjManager*)*(uintptr_t*)pointer)->PlayerObject;
  180. }
Attachments
NostaleSDK.rar
(8.4 KiB) Downloaded 83 times
Derp~
Need a great web host? Check out: AnHonestHost.com


Donations can be made via Paypal:
https://www.paypal.me/atom0s
User avatar
atom0s
Site Admin
Posts: 401
Joined: Sun Jan 04, 2015 11:23 pm
Location: 127.0.0.1
Contact:

Re: [SOURCE] Various Nostale Structures / Data

Post by atom0s » Sun Nov 13, 2016 11:58 pm

SceneManager

Code: Select all

Pattern: 8B15????????8B123B4230??????C3
Offset: +0x02
Here is the full code to my SceneManager:
  1. /**
  2.  * NosHook - Copyright (c) 2016 atom0s [atom0s@live.com]
  3.  *
  4.  * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
  5.  * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to
  6.  * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
  7.  *
  8.  * By using NosHook, you agree to the above license and its terms.
  9.  *
  10.  *      Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were
  11.  *                    made. You must do so in any reasonable manner, but not in any way that suggests the licensor
  12.  *                    endorses you or your use.
  13.  *
  14.  *   Non-Commercial - You may not use the material (NosHook) for commercial purposes.
  15.  *
  16.  *   No-Derivatives - If you remix, transform, or build upon the material (NosHook), you may not distribute the
  17.  *                    modified material. You are, however, allowed to submit the modified works back to the original
  18.  *                    NosHook project in attempt to have it added to the original project.
  19.  *
  20.  * You may not apply legal terms or technological measures that legally restrict others
  21.  * from doing anything the license permits.
  22.  *
  23.  * No warranties are given.
  24.  */
  25.  
  26. #include "SceneManager.h"
  27.  
  28. /**
  29.  * Constructor / Deconstructor
  30.  */
  31. SceneManager::SceneManager(void)
  32.     : m_HookCore(nullptr)
  33.     , m_SceneManagerPointer(0)
  34. { }
  35. SceneManager::~SceneManager(void)
  36. { }
  37.  
  38. /**
  39.  * Gets the singleton instance of the SceneManager class.
  40.  *
  41.  * @return {SceneManager&}                      The singleton instance of the SceneManager class.
  42.  */
  43. SceneManager& SceneManager::instance(void)
  44. {
  45.     static SceneManager SceneManager;
  46.     return SceneManager;
  47. }
  48.  
  49. /**
  50.  * Initializes the SceneManager class.
  51.  *
  52.  * @param {IHookCore*} hookCore                     The NosHook core object.
  53.  * @return {bool}                                   True on success, false otherwise.
  54.  */
  55. bool SceneManager::Initialize(IHookCore* hookCore)
  56. {
  57.     this->m_HookCore = hookCore;
  58.  
  59.     // Dump the games memory to scan for pointers..
  60.     MODULEINFO mod = { 0 };
  61.     if (!::GetModuleInformation(::GetCurrentProcess(), ::GetModuleHandleA("NosTaleX.dat"), &mod, sizeof(MODULEINFO)))
  62.         return false;
  63.     std::vector<BYTE> rawdata((unsigned char*)mod.lpBaseOfDll, (unsigned char*)mod.lpBaseOfDll + mod.SizeOfImage);
  64.  
  65.     // Locate the TSceneManager pointer..
  66.     this->m_SceneManagerPointer = Atomic::Memory::FindPattern(std::ref(rawdata), mod.SizeOfImage, (uintptr_t)mod.lpBaseOfDll, "8B15????????8B123B4230??????C3", 0x02, 0x00);
  67.     if (this->m_SceneManagerPointer == 0)
  68.     {
  69.         hookCore->GetConsole()->Write(D3DCOLOR_ARGB(255, 255, 0, 0), "[Error] Failed to locate TSceneManager pointer!");
  70.         return false;
  71.     }
  72.  
  73.     return true;
  74. }
  75.  
  76. /**
  77.  * Releases the SceneManager class.
  78.  */
  79. void SceneManager::Release(void)
  80. {
  81.     this->m_HookCore = nullptr;
  82.     this->m_SceneManagerPointer = 0;
  83. }
  84.  
  85. /**
  86.  * Gets the total player count within the scene manager list.
  87.  *
  88.  * @return {uint32_t}                               The total player count.
  89.  */
  90. uint32_t SceneManager::GetPlayerCount(void) const
  91. {
  92.     // Ensure the base pointer has been found..
  93.     if (this->m_SceneManagerPointer == 0)
  94.         return 0;
  95.  
  96.     // Read the pointer..
  97.     auto pointer = READ_PTR(this->m_SceneManagerPointer, 0x00);
  98.     pointer = READ_PTR(pointer, 0x00);
  99.     pointer = READ_PTR(pointer, 0x00);
  100.     pointer = READ_PTR(pointer, 0x0C);
  101.     return *(uint32_t*)(pointer + 0x08);
  102. }
  103.  
  104. /**
  105.  * Gets the total monster count within the scene manager list.
  106.  *
  107.  * @return {uint32_t}                               The total monster count.
  108.  */
  109. uint32_t SceneManager::GetMonsterCount(void) const
  110. {
  111.     // Ensure the base pointer has been found..
  112.     if (this->m_SceneManagerPointer == 0)
  113.         return 0;
  114.  
  115.     // Read the pointer..
  116.     auto pointer = READ_PTR(this->m_SceneManagerPointer, 0x00);
  117.     pointer = READ_PTR(pointer, 0x00);
  118.     pointer = READ_PTR(pointer, 0x00);
  119.     pointer = READ_PTR(pointer, 0x10);
  120.     return *(uint32_t*)(pointer + 0x08);
  121. }
  122.  
  123. /**
  124.  * Gets the total npc count within the scene manager list.
  125.  *
  126.  * @return {uint32_t}                               The total npc count.
  127.  */
  128. uint32_t SceneManager::GetNpcCount(void) const
  129. {
  130.     // Ensure the base pointer has been found..
  131.     if (this->m_SceneManagerPointer == 0)
  132.         return 0;
  133.  
  134.     // Read the pointer..
  135.     auto pointer = READ_PTR(this->m_SceneManagerPointer, 0x00);
  136.     pointer = READ_PTR(pointer, 0x00);
  137.     pointer = READ_PTR(pointer, 0x00);
  138.     pointer = READ_PTR(pointer, 0x14);
  139.     return *(uint32_t*)(pointer + 0x08);
  140. }
  141.  
  142. /**
  143.  * Gets the total item count within the scene manager list.
  144.  *
  145.  * @return {uint32_t}                               The total item count.
  146.  */
  147. uint32_t SceneManager::GetItemCount(void) const
  148. {
  149.     // Ensure the base pointer has been found..
  150.     if (this->m_SceneManagerPointer == 0)
  151.         return 0;
  152.  
  153.     // Read the pointer..
  154.     auto pointer = READ_PTR(this->m_SceneManagerPointer, 0x00);
  155.     pointer = READ_PTR(pointer, 0x00);
  156.     pointer = READ_PTR(pointer, 0x00);
  157.     pointer = READ_PTR(pointer, 0x18);
  158.     return *(uint32_t*)(pointer + 0x08);
  159. }
  160.  
  161. /**
  162.  * Gets a player from the scene manager.
  163.  *
  164.  * @param {uint32_t} index                          The index of the player to obtain.
  165.  * @return {TMapPlayerObj*}                         The player object.
  166.  */
  167. TMapPlayerObj* SceneManager::GetPlayer(uint32_t index)
  168. {
  169.     // Ensure the base pointer has been found..
  170.     if (this->m_SceneManagerPointer == 0)
  171.         return nullptr;
  172.  
  173.     // Read the pointer..
  174.     auto pointer = READ_PTR(this->m_SceneManagerPointer, 0x00);
  175.     pointer = READ_PTR(pointer, 0x00);
  176.     pointer = READ_PTR(pointer, 0x00);
  177.     pointer = READ_PTR(pointer, 0x0C);
  178.     pointer = READ_PTR(pointer, 0x04);
  179.     pointer = READ_PTR(pointer, 0x04 * index);
  180.  
  181.     // Return the object..
  182.     return (TMapPlayerObj*)pointer;
  183. }
  184.  
  185. /**
  186.  * Gets a monster from the scene manager.
  187.  *
  188.  * @param {uint32_t} index                          The index of the monster to obtain.
  189.  * @return {TMapMonsterObj*}                        The monster object.
  190.  */
  191. TMapMonsterObj* SceneManager::GetMonster(uint32_t index)
  192. {
  193.     // Ensure the base pointer has been found..
  194.     if (this->m_SceneManagerPointer == 0)
  195.         return nullptr;
  196.  
  197.     // Read the pointer..
  198.     auto pointer = READ_PTR(this->m_SceneManagerPointer, 0x00);
  199.     pointer = READ_PTR(pointer, 0x00);
  200.     pointer = READ_PTR(pointer, 0x00);
  201.     pointer = READ_PTR(pointer, 0x10);
  202.     pointer = READ_PTR(pointer, 0x04);
  203.     pointer = READ_PTR(pointer, 0x04 * index);
  204.  
  205.     // Return the object..
  206.     return (TMapMonsterObj*)pointer;
  207. }
  208.  
  209. /**
  210.  * Gets a npc from the scene manager.
  211.  *
  212.  * @param {uint32_t} index                          The index of the npc to obtain.
  213.  * @return {TMapNpcObj*}                            The npc object.
  214.  */
  215. TMapNpcObj* SceneManager::GetNpc(uint32_t index)
  216. {
  217.     // Ensure the base pointer has been found..
  218.     if (this->m_SceneManagerPointer == 0)
  219.         return nullptr;
  220.  
  221.     // Read the pointer..
  222.     auto pointer = READ_PTR(this->m_SceneManagerPointer, 0x00);
  223.     pointer = READ_PTR(pointer, 0x00);
  224.     pointer = READ_PTR(pointer, 0x00);
  225.     pointer = READ_PTR(pointer, 0x14);
  226.     pointer = READ_PTR(pointer, 0x04);
  227.     pointer = READ_PTR(pointer, 0x04 * index);
  228.  
  229.     // Return the object..
  230.     return (TMapNpcObj*)pointer;
  231. }
  232.  
  233. /**
  234.  * Gets an item from the scene manager.
  235.  *
  236.  * @param {uint32_t} index                          The index of the item to obtain.
  237.  * @return {TMapItemObj*}                           The item object.
  238.  */
  239. TMapItemObj* SceneManager::GetItem(uint32_t index)
  240. {
  241.     // Ensure the base pointer has been found..
  242.     if (this->m_SceneManagerPointer == 0)
  243.         return nullptr;
  244.  
  245.     // Read the pointer..
  246.     auto pointer = READ_PTR(this->m_SceneManagerPointer, 0x00);
  247.     pointer = READ_PTR(pointer, 0x00);
  248.     pointer = READ_PTR(pointer, 0x00);
  249.     pointer = READ_PTR(pointer, 0x18);
  250.     pointer = READ_PTR(pointer, 0x04);
  251.     pointer = READ_PTR(pointer, 0x04 * index);
  252.  
  253.     // Return the object..
  254.     return (TMapItemObj*)pointer;
  255. }
Derp~
Need a great web host? Check out: AnHonestHost.com


Donations can be made via Paypal:
https://www.paypal.me/atom0s
User avatar
atom0s
Site Admin
Posts: 401
Joined: Sun Jan 04, 2015 11:23 pm
Location: 127.0.0.1
Contact:

Re: [SOURCE] Various Nostale Structures / Data

Post by atom0s » Mon Nov 14, 2016 10:43 am

TMiniMap
  1. Pattern: 8B128942??8BCBB201A1????????E8????????A3????????8BCBB201
  2. Offset: +0x14
  3.  
  4. Data Offsets (booleans):
  5.  + 0xC4 = Show local player.
  6.  + 0xC5 = Show party members.
  7.  + 0xC6 = Show current target.
  8.  + 0xC8 = Show npcs (1).
  9.  + 0xC9 = Show portals.
  10.  + 0xCA = Show timespaces.
  11.  + 0xCC = Show players.
  12.  + 0xCD = Show npcs (2).
  13.  + 0xCE = Show monsters.
  14.  + 0xCF = Show items.
  15.  
  16. void NosHacks::ApplyMinimapHack(uint32_t offset, bool value)
  17. {
  18.     // Ensure the minimap pointer is valid..
  19.     if (this->m_PtrMinimap == 0)
  20.         return;
  21.  
  22.     // Read into the pointer..
  23.     auto pointer = *(uintptr_t*)this->m_PtrMinimap;
  24.     if (pointer == 0) return;
  25.     pointer = *(uintptr_t*)(pointer + 0x00);
  26.     if (pointer == 0) return;
  27.     pointer = *(uintptr_t*)(pointer + 0xA8);
  28.     if (pointer == 0) return;
  29.  
  30.     // Write the value..
  31.     *(bool*)(pointer + offset) = value;
  32. }
Camera Zoom
  1. Pattern: ????8B43??A3????????EB??D905????????D85B
  2. Offset: +0x00
  3.  
  4.     if (this->m_MiscCameraZoom)
  5.     {
  6.         DWORD oldProtect = 0;
  7.         ::VirtualProtect((LPVOID)this->m_PtrCameraZoom, 0xFF, PAGE_EXECUTE_READWRITE, &oldProtect);
  8.         *(uint8_t*)(this->m_PtrCameraZoom + 0x00) = 0xEB;
  9.         *(uint8_t*)(this->m_PtrCameraZoom + 0x18) = 0xEB;
  10.     }
  11.     else
  12.     {
  13.         DWORD oldProtect = 0;
  14.         ::VirtualProtect((LPVOID)this->m_PtrCameraZoom, 0xFF, PAGE_EXECUTE_READWRITE, &oldProtect);
  15.         *(uint8_t*)(this->m_PtrCameraZoom + 0x00) = 0x73;
  16.         *(uint8_t*)(this->m_PtrCameraZoom + 0x18) = 0x76;
  17.     }
Ghost Camera
  1. Pattern: C683C000000000A1????????8B0089583C
  2. Offset: +0x08
  3.  
  4.     if (this->m_MiscGhostCamera)
  5.     {
  6.         auto pointer = *(uintptr_t*)this->m_PtrGhostCamera;
  7.         pointer = *(uintptr_t*)pointer;
  8.         pointer = *(uintptr_t*)pointer;
  9.         *(uint8_t*)(pointer + 0x18) = 1;
  10.     }
  11.     else
  12.     {
  13.         auto pointer = *(uintptr_t*)this->m_PtrGhostCamera;
  14.         pointer = *(uintptr_t*)pointer;
  15.         pointer = *(uintptr_t*)pointer;
  16.         *(uint8_t*)(pointer + 0x18) = 0;
  17.     }
Hide Entities
  1. Pattern: 803D????????00????????????837F3000????????????8B476C
  2. Offset: +0x02
  3.  
  4.     if (this->m_MiscHideEntities)
  5.     {
  6.         auto pointer = *(uintptr_t*)this->m_PtrHideEntities;
  7.         *(uint8_t*)pointer = 0x00;
  8.     }
  9.     else
  10.     {
  11.         auto pointer = *(uintptr_t*)this->m_PtrHideEntities;
  12.         *(uint8_t*)pointer = 0x01;
  13.     }
Send Packets via Chat
  1. Pattern: 833D????????00????????????8D45AC508B45F4
  2. Offset: +0x02
  3.  
  4.     if (this->m_MiscSendPacketsChat)
  5.     {
  6.         auto pointer = *(uintptr_t*)this->m_PtrSendPacketsChat;
  7.         *(uint8_t*)pointer = 1;
  8.     }
  9.     else
  10.     {
  11.         auto pointer = *(uintptr_t*)this->m_PtrSendPacketsChat;
  12.         *(uint8_t*)pointer = 0;
  13.     }
Target Info Spy
  1. Pattern: A3????????A1????????33D28950608BCBB201A1
  2. Offset: +0x01
  3.  
  4.     if (this->m_MiscTargetInfoSpy)
  5.     {
  6.         {
  7.             auto hppointer = *(uintptr_t*)this->m_PtrTargetInfoSpy;
  8.             hppointer = *(uintptr_t*)(hppointer + 0x00);
  9.             hppointer = *(uintptr_t*)(hppointer + 0x20);
  10.             hppointer = *(uintptr_t*)(hppointer + 0x04);
  11.             hppointer = *(uintptr_t*)(hppointer + 0x0C);
  12.             hppointer = *(uintptr_t*)(hppointer + 0x20);
  13.             hppointer = *(uintptr_t*)(hppointer + 0x04);
  14.             hppointer = *(uintptr_t*)(hppointer + 0x14);
  15.             *(uint8_t*)(hppointer + 0x84) = 1;
  16.         }
  17.         {
  18.             auto mppointer = *(uintptr_t*)this->m_PtrTargetInfoSpy;
  19.             mppointer = *(uintptr_t*)(mppointer + 0x00);
  20.             mppointer = *(uintptr_t*)(mppointer + 0x20);
  21.             mppointer = *(uintptr_t*)(mppointer + 0x04);
  22.             mppointer = *(uintptr_t*)(mppointer + 0x10);
  23.             mppointer = *(uintptr_t*)(mppointer + 0x20);
  24.             mppointer = *(uintptr_t*)(mppointer + 0x04);
  25.             mppointer = *(uintptr_t*)(mppointer + 0x14);
  26.             *(uint8_t*)(mppointer + 0x84) = 1;
  27.         }
  28.     }
  29.     else
  30.     {
  31.         {
  32.             auto hppointer = *(uintptr_t*)this->m_PtrTargetInfoSpy;
  33.             hppointer = *(uintptr_t*)(hppointer + 0x00);
  34.             hppointer = *(uintptr_t*)(hppointer + 0x20);
  35.             hppointer = *(uintptr_t*)(hppointer + 0x04);
  36.             hppointer = *(uintptr_t*)(hppointer + 0x0C);
  37.             hppointer = *(uintptr_t*)(hppointer + 0x20);
  38.             hppointer = *(uintptr_t*)(hppointer + 0x04);
  39.             hppointer = *(uintptr_t*)(hppointer + 0x14);
  40.             *(uint8_t*)(hppointer + 0x84) = 0;
  41.         }
  42.         {
  43.             auto mppointer = *(uintptr_t*)this->m_PtrTargetInfoSpy;
  44.             mppointer = *(uintptr_t*)(mppointer + 0x00);
  45.             mppointer = *(uintptr_t*)(mppointer + 0x20);
  46.             mppointer = *(uintptr_t*)(mppointer + 0x04);
  47.             mppointer = *(uintptr_t*)(mppointer + 0x10);
  48.             mppointer = *(uintptr_t*)(mppointer + 0x20);
  49.             mppointer = *(uintptr_t*)(mppointer + 0x04);
  50.             mppointer = *(uintptr_t*)(mppointer + 0x14);
  51.             *(uint8_t*)(mppointer + 0x84) = 0;
  52.         }
  53.     }
NPC Talk Anywhere (Longchat)
  1. Pattern: 8B57??668B4D??8B460CE8????????84C0????8BC5
  2. Offset: +0x11
  3.  
  4.     if (this->m_MiscNpcTalkAnywhere)
  5.     {
  6.         DWORD oldProtect = 0;
  7.         ::VirtualProtect((LPVOID)this->m_PtrNpcTalkAnywhere, 0xFF, PAGE_EXECUTE_READWRITE, &oldProtect);
  8.         *(uint8_t*)(this->m_PtrNpcTalkAnywhere + 0x00) = 0x90;
  9.         *(uint8_t*)(this->m_PtrNpcTalkAnywhere + 0x01) = 0x90;
  10.     }
  11.     else
  12.     {
  13.         DWORD oldProtect = 0;
  14.         ::VirtualProtect((LPVOID)this->m_PtrNpcTalkAnywhere, 0xFF, PAGE_EXECUTE_READWRITE, &oldProtect);
  15.         *(uint8_t*)(this->m_PtrNpcTalkAnywhere + 0x00) = 0x74;
  16.         *(uint8_t*)(this->m_PtrNpcTalkAnywhere + 0x01) = 0x27;
  17.     }
No Stun / No Delay
  1. Pattern: 83BF9A00000000????B3018BC7
  2. Offset: +0x07
  3. Pattern: 53????????8B45F4508D4DE8
  4. Offset: +0x01
  5.  
  6.     // No Stun
  7.     if (this->m_MiscNoStun)
  8.     {
  9.         DWORD oldProtect = 0;
  10.         ::VirtualProtect((LPVOID)this->m_PtrNoStun, 0xFF, PAGE_EXECUTE_READWRITE, &oldProtect);
  11.         *(uint8_t*)(this->m_PtrNoStun + 0x00) = 0xEB;
  12.     }
  13.     else
  14.     {
  15.         DWORD oldProtect = 0;
  16.         ::VirtualProtect((LPVOID)this->m_PtrNoStun, 0xFF, PAGE_EXECUTE_READWRITE, &oldProtect);
  17.         *(uint8_t*)(this->m_PtrNoStun + 0x00) = 0x76;
  18.     }
  19.  
  20.     // No Delay
  21.     if (this->m_MiscNoDelay)
  22.     {
  23.         DWORD oldProtect = 0;
  24.         ::VirtualProtect((LPVOID)this->m_PtrNoDelay, 0xFF, PAGE_EXECUTE_READWRITE, &oldProtect);
  25.         unsigned char patch[] = { 0x6A, 0x00, 0x90, 0x90 };
  26.         memcpy((LPVOID)this->m_PtrNoDelay, &patch, 4);
  27.     }
  28.     else
  29.     {
  30.         DWORD oldProtect = 0;
  31.         ::VirtualProtect((LPVOID)this->m_PtrNoDelay, 0xFF, PAGE_EXECUTE_READWRITE, &oldProtect);
  32.         unsigned char patch[] = { 0x8B, 0x45, 0xFC, 0x50 };
  33.         memcpy((LPVOID)this->m_PtrNoDelay, &patch, 4);
  34.     }
Open Game Windows
  1. Pattern: 558BEC83C4D8535633C9894D??894D??894D??8BF28BD833C055
  2. Offset: +0x00
  3.  
  4.         auto func = this->m_PtrOpenWindow;
  5.         __asm
  6.         {
  7.             xor ecx, ecx;
  8.             xor edx, edx;
  9.             xor eax, eax;
  10.             mov al, windowId;
  11.             call[func];
  12.         }
  13.  
  14. Common Window Ids:
  15.   - +Resistence: 0x0F
  16.   - Bet Rare: 0x0E
  17.   - Card Upgrade (SP): 0x13
  18.   - Examine Relics: 0x1D
  19.   - Item Upgrade: 0x05
  20.   - NosBazaar: 0x20
Speed Hack
  1. Pattern: 33C0????????????8B0485????????890424E8????????8944240833C08944240CDF6C2408D8A3
  2. Offset: +0x02
  3.  
  4.         if (this->m_MiscUseSpeedHack)
  5.         {
  6.             unsigned char buffer[] = { 0xB0, 0x0B, 0x90, 0x90, 0x90, 0x90 };
  7.             DWORD oldProtect = 0;
  8.             VirtualProtect((LPVOID)this->m_PtrSpeedHack, 0x06, PAGE_EXECUTE_READWRITE, &oldProtect);
  9.             memcpy((LPVOID)this->m_PtrSpeedHack, &buffer, 0x06);
  10.         }
  11.         else
  12.         {
  13.             unsigned char buffer[] = { 0x8A, 0x83, 0x9E, 0x00, 0x00, 0x00 };
  14.             DWORD oldProtect = 0;
  15.             VirtualProtect((LPVOID)this->m_PtrSpeedHack, 0x06, PAGE_EXECUTE_READWRITE, &oldProtect);
  16.             memcpy((LPVOID)this->m_PtrSpeedHack, &buffer, 0x06);
  17.         }
  18.  
  19.         // Writes the speed amount to the new modded instructions..
  20.         *(uint8_t*)(this->m_PtrSpeedHack + 0x01) = (uint8_t)this->m_MiscSpeedHackAmount;
Teleporting
Doing these requires sending packets.
  1. Act I
  2.     NosVille - n_run 0 0 1
  3.     NosCamp Cave - script 1 204
  4.     Fernon Outpost - script 1 203
  5.  
  6. Act II
  7.     Mount Krem - n_run 16 1 1
  8.     Land of Death - n_run 150 0 1
  9.  
  10. Act IV
  11.     Port Alveus - n_run 16 2 1
  12.     Glacernon - n_run 5005 0 1
  13.     Act IV Ship - n_run 5001 0 1
  14.  
  15. Act V
  16.     Mortaz Desert Port - n_run 26 0 1
  17.     Act V City 1 - n_run 26 2 1
  18.     Act V City 2 - n_run 26 1 1
  19.     Act V Shop - n_run 5011 0 1
  20.  
  21. Misc Teleports
  22.     Secret Chicken Farm - n_run 2002 2110 1
  23.     Pajama Stone (Yellow) - n_run 2002 2107 1
  24.     SP 1 (Red) - n_run 2002 2108 1
  25.     SP 2 (Blue) - n_run 2002 2109 1
  26.     SP 3 (Golden) - n_run 2002 2111 1
  27.     SP 4 (Grey) - n_run 2002 2112 1
Some of these require appending your current player id to the end of the packet info. (script commands do not require this, only the n_run ones do.)

Packet Functions
  1. Packet 'this' class pointer:
  2.     Pattern: 6A64A1????????8B008B4DF8BA????????E8????????33C05A5959
  3.     Offset: +0x03
  4.  
  5. Packet Send Function:
  6.     Pattern: 53568BF28BD8EB??EB??3919
  7.     Offset: +0x00
  8.  
  9. Packet Receive Function:
  10.     Pattern: 558BEC83C4F453565733C9894DF48955FC8BD88B45FC
  11.     Offset: +0x00
Here are the hooks to invoke these from my project NosHook. This uses Detours (3.0.1) to hook and use the functions:
  1. void PacketManager::SendPacket(const char* packet)
  2. {
  3.     if (Real_SendPacket == nullptr)
  4.         return;
  5.  
  6.     // Convert the packet to a Nostale valid string..
  7.     NostaleStringA nstr(packet);
  8.  
  9.     // Send the packet..
  10.     auto pointer = this->m_PacketThis;
  11.     auto pstr = nstr.get();
  12.  
  13.     __asm
  14.     {
  15.         mov eax, dword ptr ds : [pointer];  // Read the pointer for SendPacket..
  16.         mov eax, dword ptr ds : [eax];      // Read the pointer for SendPacket..
  17.         mov eax, dword ptr ds : [eax];      // Read the pointer for SendPacket..
  18.         mov eax, dword ptr ds : [eax];      // Read the pointer for SendPacket..
  19.         mov edx, pstr;                      // Set the packet string..
  20.         call[Real_SendPacket];              // Send the packet..
  21.     }
  22. }
  23.  
  24. void PacketManager::RecvPacket(const char* packet)
  25. {
  26.     if (Real_RecvPacket == nullptr)
  27.         return;
  28.  
  29.     // Convert the packet to a Nostale valid string..
  30.     NostaleStringA nstr(packet);
  31.  
  32.     // Send the packet..
  33.     auto pointer = this->m_PacketThis;
  34.     auto pstr = nstr.get();
  35.  
  36.     __asm
  37.     {
  38.         mov eax, dword ptr ds : [pointer];  // Read the pointer for RecvPacket..
  39.         mov eax, dword ptr ds : [eax];      // Read the pointer for RecvPacket..
  40.         mov eax, dword ptr ds : [eax];      // Read the pointer for RecvPacket..
  41.         mov eax, dword ptr ds : [eax];      // Read the pointer for RecvPacket..
  42.         mov eax, dword ptr ds : [eax + 34h];// Read the pointer for RecvPacket..
  43.         mov edx, pstr;                      // Set the packet string..
  44.         call[Real_RecvPacket];              // Send the packet..
  45.     }
  46. }
NostaleString Classes (Ascii and Unicode)
Nostale uses Delphi which handles strings in a specific manner, these are two simple wrappers to use strings in that similar manner:
  1. struct NostaleStringA
  2. {
  3.     char*   m_Buffer;
  4.     size_t  m_Length;
  5.  
  6.     NostaleStringA(void)
  7.         : m_Buffer(nullptr)
  8.         , m_Length(0)
  9.     { }
  10.     NostaleStringA(const char* str)
  11.         : m_Buffer(nullptr)
  12.         , m_Length(0)
  13.     {
  14.         this->set(str);
  15.     }
  16.     ~NostaleStringA(void)
  17.     {
  18.         if (this->m_Buffer != nullptr)
  19.             delete[] this->m_Buffer;
  20.         this->m_Buffer = nullptr;
  21.     }
  22.  
  23.     // Returns the size of the string.
  24.     size_t len(void)
  25.     {
  26.         return (this->m_Buffer != nullptr) ? this->m_Length : 0;
  27.     }
  28.  
  29.     // Returns the string within the buffer.
  30.     char* get(void)
  31.     {
  32.         return (this->m_Buffer != nullptr) ? (char*)(this->m_Buffer + 0x08) : nullptr;
  33.     }
  34.  
  35.     // Sets the string buffer.
  36.     void set(const char* str)
  37.     {
  38.         if (this->m_Buffer != nullptr)
  39.             delete[] this->m_Buffer;
  40.  
  41.         this->m_Length = strlen(str);
  42.         this->m_Buffer = new char[this->m_Length + 8 + 1];
  43.  
  44.         *(unsigned int*)(this->m_Buffer + 0x00) = 1; // Reference Count
  45.         *(unsigned int*)(this->m_Buffer + 0x04) = this->m_Length; // Length
  46.         memcpy(this->m_Buffer + 0x08, str, this->m_Length);
  47.         this->m_Buffer[this->m_Length + 0x08] = '\0';
  48.     }
  49. };
  50.  
  51. struct NostaleStringW
  52. {
  53.     wchar_t*    m_Buffer;
  54.     size_t      m_Length;
  55.  
  56.     NostaleStringW(void)
  57.         : m_Buffer(nullptr)
  58.         , m_Length(0)
  59.     { }
  60.     NostaleStringW(const wchar_t* str)
  61.         : m_Buffer(nullptr)
  62.         , m_Length(0)
  63.     {
  64.         this->set(str);
  65.     }
  66.     ~NostaleStringW(void)
  67.     {
  68.         if (this->m_Buffer != nullptr)
  69.             delete[] this->m_Buffer;
  70.         this->m_Buffer = nullptr;
  71.     }
  72.  
  73.     // Returns the size of the string.
  74.     size_t len(void)
  75.     {
  76.         return (this->m_Buffer != nullptr) ? this->m_Length : 0;
  77.     }
  78.  
  79.     // Returns the string within the buffer.
  80.     wchar_t* get(void)
  81.     {
  82.         return (this->m_Buffer != nullptr) ? (wchar_t*)((char*)this->m_Buffer + 0x08) : nullptr;
  83.     }
  84.  
  85.     // Sets the string buffer.
  86.     void set(const wchar_t* str)
  87.     {
  88.         if (this->m_Buffer != nullptr)
  89.             delete[] this->m_Buffer;
  90.  
  91.         this->m_Length = wcslen(str) * 2;
  92.         this->m_Buffer = new wchar_t[this->m_Length + 8 + 1];
  93.  
  94.         *(unsigned int*)((char*)this->m_Buffer + 0x00) = 1; // Reference Count
  95.         *(unsigned int*)((char*)this->m_Buffer + 0x04) = this->m_Length; // Length
  96.         memcpy((char*)this->m_Buffer + 0x08, str, this->m_Length);
  97.         *(wchar_t*)((char*)this->m_Buffer + this->m_Length + 0x08) = L'\0';
  98.     }
  99. };
Chat Related Functions
  1. Chat 'this' class pointer:
  2.     Pattern: 8B4DFCA1????????8B80B8000000
  3.     Offset +0x04
  4.  
  5. Add To Chat Function:
  6.     Pattern: 8BF98BF28BD88BCC33C08A83????????8B8483????????8D50??8BC6
  7.     Offset: -0x06
Using the 'add to chat' function, this lets you write things to the chat log directly.
  1. void ChatManager::Write(int chatMode, const char* msg)
  2. {
  3.     if (this->m_ChatThis == 0 || this->m_AddToChat == 0)
  4.     {
  5.         if (!this->Update())
  6.             return;
  7.     }
  8.  
  9.     // Convert to widechar..
  10.     std::string str(msg);
  11.     std::wstring wstr(str.begin(), str.end());
  12.  
  13.     NostaleStringW m(wstr.c_str());
  14.     auto msgPtr = m.get();
  15.  
  16.     auto thisPointer = this->m_ChatThis;
  17.     auto callPointer = this->m_AddToChat;
  18.  
  19.     __asm
  20.     {
  21.         mov eax, dword ptr ds : [thisPointer];
  22.         mov eax, dword ptr ds : [eax];
  23.         mov eax, dword ptr ds : [eax + 0xB8];
  24.         mov edx, chatMode;
  25.         mov ecx, msgPtr;
  26.         call[callPointer];
  27.     }
  28. }
Derp~
Need a great web host? Check out: AnHonestHost.com


Donations can be made via Paypal:
https://www.paypal.me/atom0s
User avatar
atom0s
Site Admin
Posts: 401
Joined: Sun Jan 04, 2015 11:23 pm
Location: 127.0.0.1
Contact:

Re: [SOURCE] NostaleSDK - Structures / Functions / Misc Info

Post by atom0s » Mon Nov 14, 2016 10:52 am

Here are some helper functions for using the NostaleSDK I have made and posted here:

Check if a mob is close to the player for attacking.
  1.     static bool IsMobClose()
  2.     {
  3.         auto player = PlayerObjManager::instance().GetPlayer();
  4.  
  5.         for (auto x = 0; x < (int)SceneManager::instance().GetMonsterCount(); x++)
  6.         {
  7.             auto monster = SceneManager::instance().GetMonster(x);
  8.             if (monster != nullptr)
  9.             {
  10.                 if (GetDistance(player->X2, player->Y2, monster->X2, monster->Y2) <= StateMachine::instance().MaxAttackScanDistance)
  11.                     return true;
  12.             }
  13.         }
  14.  
  15.         return false;
  16.     }

Gets a monster instance by its monster id.
  1.     static TMapMonsterObj* GetMonster(uint32_t mobId)
  2.     {
  3.         for (auto x = 0; x < (int)SceneManager::instance().GetMonsterCount(); x++)
  4.         {
  5.             auto monster = SceneManager::instance().GetMonster(x);
  6.             if (monster != nullptr && monster->Id == mobId)
  7.                 return monster;
  8.         }
  9.  
  10.         return nullptr;
  11.     }

Check if there are lootable items around the player that the player can pick up.
  1.     static bool HasLootableItems(void)
  2.     {
  3.         // Get the player object..
  4.         auto player = PlayerObjManager::instance().GetPlayer();
  5.  
  6.         // Find any items that we can loot..
  7.         for (auto x = 0; x < (int)SceneManager::instance().GetItemCount(); x++)
  8.         {
  9.             auto item = SceneManager::instance().GetItem(x);
  10.             if (item != nullptr && item->ItemOwnerId == player->Id)
  11.                 return true;
  12.         }
  13.  
  14.         return false;
  15.     }
Gets an item instance by its id.
  1.     static TMapItemObj* GetItem(uint32_t itemId)
  2.     {
  3.         for (auto x = 0; x < (int)SceneManager::instance().GetItemCount(); x++)
  4.         {
  5.             auto item = SceneManager::instance().GetItem(x);
  6.             if (item->Id == itemId)
  7.                 return item;
  8.         }
  9.  
  10.         return nullptr;
  11.     }
Derp~
Need a great web host? Check out: AnHonestHost.com


Donations can be made via Paypal:
https://www.paypal.me/atom0s
Wulung
Posts: 1
Joined: Sat Jun 09, 2018 12:16 am

Re: [SOURCE] NostaleSDK - Structures / Functions / Misc Info

Post by Wulung » Sat Jun 09, 2018 12:18 am

Can you help me to make SDK for SF2 SEA?
Elyclea
Posts: 8
Joined: Wed Sep 13, 2017 2:27 am
Location: Spain

Re: [SOURCE] NostaleSDK - Structures / Functions / Misc Info

Post by Elyclea » Tue Jun 12, 2018 5:19 am

Code: Select all

    uint8_t         Unknown0022;                // Unknown (Used in the walk packet, 'walk x y ? speed', flips between 0 and 1.)
It follows a pattern depending of the coord. At (0, 0) it will be 1, at (3,0) it will be 1, etc...

This is the pattern (looking to north in NosTale you can see this) (every square is a coord) (black squares send the value of 1) (white squares send the value of 0):
Image
I really don't know why NosTale Server need it xD. If anyone have an idea, it would be awesome to know.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest