ScriptzMoDz

BO2 Set Waypoint/Objective

Aug 25th, 2014
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.55 KB | None | 0 0
  1. More Information @ http://www.nextgenupdate.com/forums/showthread.php?t=732031&p=5795129
  2.  
  3.     class Offsets
  4.     {
  5.         public static uint
  6.         G_HudElems = 0x15DDB00,
  7.         G_MaterialIndex = 0x276020,  
  8.     }
  9.  
  10.         public class ObjStruct
  11.         {
  12.             public static uint
  13.             ObjectiveIndex = 0x1608194,
  14.             ObjectiveIndexLength = 0x30,
  15.             Origin = 0x04,
  16.             X = 0x04,
  17.             Y = 0x08,
  18.             Z = 0x0C,
  19.             targetEntNum = 0x10,
  20.             MaterialIndex = 0x1C,
  21.             State = 0x28,
  22.             Team = 0x2D;
  23.         }
  24.  
  25.         public class HudStruct
  26.         {
  27.             public static uint
  28.             ElemIndex = Offsets.G_HudElems,
  29.             HudsLength = 0x88,
  30.             X = 0x00,
  31.             Y = 0x04,
  32.             Z = 0x08,
  33.             FontSize = 0xC,
  34.             fromFontScale = 0x10,
  35.             fontScaleStartTime = 0x14,
  36.             color = 0x18,
  37.             fromColor = 0x1C,
  38.             fadeStartTime = 0x20,
  39.             scaleStartTime = 0x24,
  40.             fromX = 0x28,
  41.             fromY = 0x2C,
  42.             moveStartTime = 0x30,
  43.             time = 0x34,
  44.             duration = 0x38,
  45.             value = 0x3C,
  46.             sort = 0x40,
  47.             glowColor = 0x44,
  48.             fxBirthTime = 0x48,
  49.             flags = 0x4C,
  50.             targetEntNum = 0x50,
  51.             fontScaleTime = 0x52,
  52.             fadeTime = 0x54,
  53.             label = 0x56,
  54.             Width = 0x58,
  55.             Height = 0x5A,
  56.             fromWidth = 0x5C,
  57.             fromHeight = 0x5E,
  58.             scaleTime = 0x60,
  59.             moveTime = 0x62,
  60.             text = 0x64,
  61.             fxLetterTime = 0x66,
  62.             fxDecayStartTime = 0x68,
  63.             fxDecayDuration = 0x6A,
  64.             fxRedactDecayStartTime = 0x6C,
  65.             fxRedactDecayDuration = 0x6E,
  66.             type = 0x70,
  67.             Font = 0x71,
  68.             alignOrg = 0x72,
  69.             alignScreen = 0x73,
  70.             materialIndex = 0x74,
  71.             offscreenMaterialIndex = 0x75,
  72.             fromAlignOrg = 0x76,
  73.             fromAlignScreen = 0x77,
  74.             soundID = 0x78,
  75.             ui3dWindow = 0x79,
  76.             flag2 = 0x7A,
  77.             clientOffset = 0x7C,
  78.             team = 0x80,
  79.             abilityFlag = 0x84;
  80.         }
  81.  
  82.         private static uint HudElem_Alloc()
  83.         {
  84.             for (uint i = 120; i < 1024; i++)
  85.             {
  86.                 uint Index = Offsets.G_HudElems + (i * HudStruct.HudsLength);
  87.                 if (Lib.ReadByte(Index + HudStruct.type) == 0)
  88.                 {
  89.                     Lib.WriteBytes(Index, new byte[0x88]);
  90.                     return Index;
  91.                 }
  92.             }
  93.             return 0;
  94.         }
  95.  
  96.         private static uint Objective_Alloc()
  97.         {
  98.             for (uint i = 3; i <= 31; i++)
  99.             {
  100.                 uint Index = ObjStruct.ObjectiveIndex + (i * ObjStruct.ObjectiveIndexLength);
  101.                 if (Lib.ReadInt32(Index) == 0)
  102.                 {
  103.                     Lib.WriteBytes(Index, new byte[0x30]);
  104.                     return Index;
  105.                 }
  106.             }
  107.             return 0;
  108.         }
  109.  
  110.  
  111.         public static void Huds_DestroyAll()
  112.         {
  113.             for (uint i = 60; i < 0x400; i++)
  114.             {
  115.                 PS3.SetMemory(Offsets.G_HudElems + (i * HudStruct.HudsLength), new byte[HudStruct.HudsLength]);
  116.             }
  117.         }
  118.  
  119.  
  120.         public static void Objective_DestroyAll()
  121.         {
  122.             for (uint i = 3; i <= 31; i++)
  123.             {
  124.                 uint Index = ObjStruct.ObjectiveIndex + (i * ObjStruct.ObjectiveIndexLength);
  125.                 Lib.WriteBytes(Index, new byte[ObjStruct.ObjectiveIndexLength]);
  126.             }
  127.         }
  128.  
  129.         public static int getMaterialIndex(string Material)
  130.         {
  131.             return (int)RPC.Call(Offsets.G_MaterialIndex, Material);
  132.         }
  133.  
  134.         public static void SetObjective(Int16 onEntity = 0x3FF, Object Material = null, Single[] Position = null)
  135.         {
  136.             UInt32 Objective = Objective_Alloc();
  137.             Lib.WriteInt32(Objective, 1);
  138.             Lib.WriteSingle(Objective + ObjStruct.Origin, Position);
  139.             Lib.WriteInt16(Objective + ObjStruct.targetEntNum, onEntity);
  140.             if (Material is String)
  141.             { Lib.WriteInt32(Objective + ObjStruct.MaterialIndex, (Int16)getMaterialIndex((String)Material)); }
  142.             if (Material is Int32)
  143.             { Lib.WriteInt32(Objective + ObjStruct.MaterialIndex, (Int32)Material); }
  144.         }
  145.  
  146.         public static uint SetWaypoint(Int32 clientIndex = 0x3FF, Int16 onEntity = 0x3FF, Object Material = null, Single[] Position = null, Int32 R = 255, Int32 G = 255, Int32 B = 255, Int32 A = 255)
  147.         {
  148.             uint Waypoint = HudElem_Alloc();
  149.             Lib.WriteByte(Waypoint + HudStruct.type, 0xF);//0xF = Waypoint
  150.             if (Material is String)
  151.             { Lib.WriteByte(Waypoint + HudStruct.offscreenMaterialIndex, Convert.ToByte(getMaterialIndex((String)Material))); }
  152.             if (Material is Int32)
  153.             { Lib.WriteByte(Waypoint + HudStruct.offscreenMaterialIndex, Convert.ToByte(Material)); }
  154.             Lib.WriteSingle(Waypoint, Position);
  155.             Lib.WriteInt32(Waypoint + HudStruct.clientOffset, clientIndex);
  156.             Lib.WriteInt16(Waypoint + HudStruct.targetEntNum, onEntity);
  157.             Lib.WriteByte(Waypoint + HudStruct.ui3dWindow, 0xFF);
  158.             Lib.WriteBytes(Waypoint + HudStruct.color, new Byte[] { (Byte)R, (Byte)G, (Byte)B, (Byte)A });
  159.             return Waypoint;
  160.         }
Add Comment
Please, Sign In to add comment