Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String centerString(string[] StringArray)
- {
- Int32 num3;
- Int32 length = 0;
- Int32 num2 = 0;
- String str = "";
- for (num3 = 0; num3 < StringArray.Length; num3++)
- {
- if (StringArray[num3].Length > length)
- {
- length = StringArray[num3].Length;
- }
- }
- for (num3 = 0; num3 < StringArray.Length; num3++)
- {
- str = "";
- if (StringArray[num3].Length < length)
- {
- num2 = length - StringArray[num3].Length;
- if (StringArray[num3].Contains("[{+"))
- {
- num2 += 13;
- }
- for (Int32 i = 0; i < num2; i++)
- {
- str = str + " ";
- }
- }
- StringArray[num3] = str + StringArray[num3];
- }
- String str2 = "";
- for (num3 = 0; num3 < StringArray.Length; num3++)
- {
- str2 = str2 + StringArray[num3] + "\n";
- }
- return ("^7" + str2);
- }
- public static void ChangeAlpha(UInt32 elemIndex, Byte Alpha)
- {
- Lib.WriteByte((elemIndex + HudStruct.color) + 3, Alpha);
- }
- public static void ChangeText(UInt32 elemIndex, String Text)
- {
- Lib.WriteInt16(elemIndex + HudStruct.text, G_LocalizedStringIndex(Text));
- }
- public static void DestroyElement(UInt32 Element)
- {
- PS3.SetMemory(Element, new Byte[HudStruct.IndexSize]);
- }
- public static void FadeOverTime(UInt32 elemIndex, Int16 Time, Byte R = 0, Byte G = 0, Byte B = 0, Byte A = 0)
- {
- Lib.WriteBytes(elemIndex + HudStruct.fromColor, Lib.ReadBytes(elemIndex + HudStruct.color, 4));
- Lib.WriteInt16(elemIndex + HudStruct.fadeTime, Time);
- Lib.WriteUInt32(elemIndex + HudStruct.fadeStartTime, GetLevelTime());
- Lib.WriteBytes(elemIndex + HudStruct.color, new Byte[] { R, G, B, A });
- }
- public static void FadeAlphaOverTime(UInt32 elemIndex, Int16 Time, Byte A = 0)
- {
- Byte[] RGB = Lib.ReadBytes(elemIndex + HudStruct.color, 3);
- Lib.WriteBytes(elemIndex + HudStruct.fromColor, Lib.ReadBytes(elemIndex + HudStruct.color, 4));
- Lib.WriteInt16(elemIndex + HudStruct.fadeTime, Time);
- Lib.WriteUInt32(elemIndex + HudStruct.fadeStartTime, GetLevelTime());
- Lib.WriteBytes(elemIndex + HudStruct.color, new Byte[] { RGB[0], RGB[1], RGB[2], A });
- }
- public static void FontScaleOverTime(UInt32 elemIndex, Double FontSize, Int16 time)
- {
- Lib.WriteSingle(elemIndex + HudStruct.fromFontScale, Lib.ReadSingle(elemIndex + HudStruct.FontSize));
- Lib.WriteUInt32(elemIndex + HudStruct.fontScaleStartTime, GetLevelTime());
- Lib.WriteInt16(elemIndex + HudStruct.fontScaleTime, time);
- Lib.WriteSingle(elemIndex + HudStruct.FontSize, (Single) FontSize);
- }
- public static Int16 G_LocalizedStringIndex(String Text)
- {
- return (Int16)RPC.Call(0x275D24, Text);
- }
- public static UInt32 GetLevelTime()
- {
- return Lib.ReadUInt32(0x1608100 + 0x798);
- }
- private static UInt32 HudElem_Alloc()
- {
- for (UInt32 i = 120; i < 1024; i++)
- {
- UInt32 Index = HudStruct.G_Hudelems + (i * HudStruct.IndexSize);
- if (Lib.ReadByte(Index + HudStruct.type) == 0)
- {
- Lib.WriteBytes(Index, new Byte[0x88]);
- return Index;
- }
- }
- return 0;
- }
- private static UInt32 Objective_Alloc()
- {
- for (UInt32 i = 3; i <= 31; i++)
- {
- UInt32 Index = ObjStruct.ObjectiveIndex + (i * ObjStruct.ObjectiveIndexLength);
- if (Lib.ReadInt32(Index) == 0)
- {
- Lib.WriteBytes(Index, new Byte[0x30]);
- return Index;
- }
- }
- return 0;
- }
- public static void Huds_DestroyAll()
- {
- PS3.SetMemory(HudStruct.G_Hudelems + (60 * HudStruct.IndexSize), new Byte[HudStruct.IndexSize * 0x400]);
- }
- public static void Objective_DestroyAll()
- {
- Lib.WriteBytes(ObjStruct.ObjectiveIndex + (3 * ObjStruct.ObjectiveIndexLength), new Byte[ObjStruct.ObjectiveIndexLength * 31]);
- }
- public static Int32 getMaterialIndex(String Material)
- {
- return (Int32)RPC.Call(0x276020, Material);
- }
- public static void MoveOverTime(UInt32 elemIndex, Int16 time, Single x, Single y)
- {
- Lib.WriteSingle(elemIndex + HudStruct.fromX, Lib.ReadSingle(elemIndex));
- Lib.WriteSingle(elemIndex + HudStruct.fromY, Lib.ReadSingle(elemIndex + HudStruct.Y));
- Lib.WriteInt32(elemIndex + HudStruct.moveStartTime, (Int32)GetLevelTime());
- Lib.WriteInt16(elemIndex + HudStruct.moveTime, time);
- Lib.WriteSingle(elemIndex, x);
- Lib.WriteSingle(elemIndex + HudStruct.Y, y);
- }
- public static Int32[] RandomizeRGB()
- {
- Int32[] numArray = new Int32[4];
- Random random = new Random();
- numArray[0] = random.Next(0, 255);
- numArray[1] = random.Next(0, 255);
- numArray[2] = random.Next(0, 255);
- numArray[3] = 255;
- return numArray;
- }
- public static Byte[] ReverseArray(Byte[] Arry)
- {
- Array.Reverse(Arry);
- return Arry;
- }
- public static void ScaleOverTime(UInt32 elemIndex, Int16 time, Int16 width, Int16 height)
- {
- Lib.WriteUInt32(elemIndex + HudStruct.scaleStartTime, GetLevelTime());
- Lib.WriteInt32(elemIndex + HudStruct.fromHeight, Lib.ReadInt16(elemIndex + HudStruct.Width));
- Lib.WriteInt32(elemIndex + HudStruct.fromWidth, Lib.ReadInt16(elemIndex + HudStruct.Height));
- Lib.WriteInt16(elemIndex + HudStruct.Width, width);
- Lib.WriteInt16(elemIndex + HudStruct.Height, height);
- Lib.WriteInt16(elemIndex + HudStruct.scaleTime, time);
- }
- public static UInt32 SetShader(Int32 clientIndex, Object Material, Int16 Width, Int16 Height, Single X, Single Y, UInt32 align = 0, Int32 r = 255, Int32 g = 255, Int32 b = 255, Int32 a = 255)
- {
- UInt32 Shader = HudElem_Alloc();
- Lib.WriteByte(Shader + HudStruct.type, 8);//8 = Icon
- if (Material is String)
- { Functions.precacheShader((string)Material); Lib.WriteByte(Shader + HudStruct.materialIndex, Convert.ToByte(getMaterialIndex((String)Material))); }
- if (Material is Int32)
- { Lib.WriteByte(Shader + HudStruct.materialIndex, Convert.ToByte(Material)); }
- Lib.WriteInt16(Shader + HudStruct.Height, Height);
- Lib.WriteInt16(Shader + HudStruct.Width, Width);
- if (align != 0)
- { Lib.WriteByte(Shader + HudStruct.alignOrg, 5); Lib.WriteByte(Shader + HudStruct.alignScreen, Convert.ToByte(align)); }
- else
- { Lib.WriteSingle(Shader + HudStruct.X, X); Lib.WriteSingle(Shader + HudStruct.Y, Y); }
- Lib.WriteInt32(Shader + HudStruct.clientOffset, clientIndex);
- PS3.SetMemory(Shader + HudStruct.ui3dWindow, new Byte[] { 0xFF });
- Lib.WriteBytes(Shader + HudStruct.color, new Byte[] { (Byte)r, (Byte)g, (Byte)b, (Byte)a });
- return Shader;
- }
- public static Int32 SetTimer(UInt32 elemIndex, Int32 Time = 60, String Direction = "Up", Boolean Tenths = true)
- {
- if (Lib.ReadByte(elemIndex + HudStruct.type) != 0x8 && Direction == "Up" && !Tenths)
- { Lib.WriteByte(elemIndex + HudStruct.type, 0xA); }
- if (Lib.ReadByte(elemIndex + HudStruct.type) != 0x8 && Direction == "Up" && Tenths)
- { Lib.WriteByte(elemIndex + HudStruct.type, 0xC); }
- if (Lib.ReadByte(elemIndex + HudStruct.type) != 0x8 && Direction == "Down" && !Tenths)
- { Lib.WriteByte(elemIndex + HudStruct.type, 0x9); }
- if (Lib.ReadByte(elemIndex + HudStruct.type) != 0x8 && Direction == "Down" && Tenths)
- { Lib.WriteByte(elemIndex + HudStruct.type, 0xB); }
- if (Direction == "Up")
- { Lib.WriteInt32(elemIndex + HudStruct.time, (Int32)GetLevelTime() - (Time * 1000)); return (Int32)GetLevelTime() - (Time * 1000); }
- if (Direction == "Down")
- { Lib.WriteInt32(elemIndex + HudStruct.time, (Int32)GetLevelTime() + (Time * 1000)); return (Int32)GetLevelTime() + (Time * 1000); }
- return (Int32)GetLevelTime() + (Time * 1000);
- }
- public static Int32 SetClock(UInt32 elemIndex, Int32 Duration = 60, Int32 Time = 60, String Direction = "Up")
- {
- if (Lib.ReadByte(elemIndex + HudStruct.type) != 0x1 && Direction == "Up")
- { Lib.WriteByte(elemIndex + HudStruct.type, 0xE); }
- if (Lib.ReadByte(elemIndex + HudStruct.type) != 0x1 && Direction == "Down")
- { Lib.WriteByte(elemIndex + HudStruct.type, 0xD); }
- if (Direction == "Up")
- {
- Lib.WriteInt32(elemIndex + HudStruct.duration, Duration * 1000);
- Lib.WriteInt32(elemIndex + HudStruct.time, (Int32)GetLevelTime() - (Time * 1000));
- return (Int32)GetLevelTime() - (Time * 1000);
- }
- if (Direction == "Down")
- {
- Lib.WriteInt32(elemIndex + HudStruct.duration, Duration * 1000);
- Lib.WriteInt32(elemIndex + HudStruct.time, (Int32)GetLevelTime() + (Time * 1000));
- return (Int32)GetLevelTime() + (Time * 1000);
- }
- return 0;
- }
- public static UInt32 SetValue(UInt32 elemIndex, Single Value)
- {
- Lib.WriteByte(elemIndex + HudStruct.type, 7);
- Lib.WriteSingle(elemIndex + HudStruct.value, Value);
- return (UInt32)Value;
- }
- public static UInt32 SetObjective(Int16 onEntity = 0x3FF, Object Material = null, Single[] Position = null)
- {
- UInt32 Objective = Objective_Alloc();
- Lib.WriteInt32(Objective, 1);
- Lib.WriteSingle(Objective + ObjStruct.Origin, Position);
- Lib.WriteInt16(Objective + ObjStruct.targetEntNum, onEntity);
- if (Material is String)
- { Functions.precacheShader((string)Material); Lib.WriteInt32(Objective + ObjStruct.MaterialIndex, (Int16)getMaterialIndex((String)Material)); }
- if (Material is Int32)
- { Lib.WriteInt32(Objective + ObjStruct.MaterialIndex, (Int32)Material); }
- return Objective;
- }
- public static UInt32 SetWaypoint(Int32 clientIndex = 0x3FF, Int16 onEntity = 0x3FF, Object Material = null, Single[] Position = null, Boolean DirectionalArrows = true, Int32 R = 255, Int32 G = 255, Int32 B = 255, Int32 A = 255)
- {
- UInt32 Waypoint = HudElem_Alloc();
- Lib.WriteByte(Waypoint + HudStruct.type, 0xF);//0xF = Waypoint
- if (Material is String && DirectionalArrows)
- { Functions.precacheShader((string)Material); Lib.WriteByte(Waypoint + HudStruct.offscreenMaterialIndex, Convert.ToByte(getMaterialIndex((String)Material))); }
- if (Material is Int32 && DirectionalArrows)
- { Lib.WriteByte(Waypoint + HudStruct.offscreenMaterialIndex, Convert.ToByte(Material)); }
- if (!DirectionalArrows)
- { SetWaypointNoArrows(Waypoint, Material); }
- Lib.WriteSingle(Waypoint, Position);
- Lib.WriteInt32(Waypoint + HudStruct.clientOffset, clientIndex);
- Lib.WriteInt16(Waypoint + HudStruct.targetEntNum, onEntity);
- Lib.WriteByte(Waypoint + HudStruct.ui3dWindow, 0xFF);
- Lib.WriteBytes(Waypoint + HudStruct.color, new Byte[] { (Byte)R, (Byte)G, (Byte)B, (Byte)A });
- return Waypoint;
- }
- public static void SetWaypointNoArrows(UInt32 Waypoint, Object Material = null)
- {
- Lib.WriteByte(Waypoint + HudStruct.offscreenMaterialIndex, 0);
- Lib.WriteSingle(Waypoint + HudStruct.Height, 2.3f);
- if (Material is String)
- { Functions.precacheShader((string)Material); Lib.WriteByte(Waypoint + HudStruct.materialIndex, Convert.ToByte(getMaterialIndex((String)Material))); }
- if (Material is Int32)
- { Lib.WriteByte(Waypoint + HudStruct.materialIndex, Convert.ToByte(Material)); }
- }
- public static UInt32 SetWaypointText(UInt32 Waypoint, String TextString, Int32 Font, Single FontSize)
- {
- Lib.WriteSingle(Waypoint + HudStruct.FontSize, FontSize);
- Lib.WriteByte(Waypoint + HudStruct.Font, Convert.ToByte(Font));
- Lib.WriteInt16(Waypoint + HudStruct.label, G_LocalizedStringIndex(TextString));
- return 0;
- }
- public static UInt32 SetText(Int32 clientIndex, String TextString, Int32 Font, Single FontSize, Single X, Single Y, UInt32 align = 0, Int32 r = 255, Int32 g = 255, Int32 b = 255, Int32 a = 255, Int32 glowr = 255, Int32 glowg = 255, Int32 glowb = 255, Int32 glowa = 0)
- {
- UInt32 Text = HudElem_Alloc();
- Lib.WriteByte(Text + HudStruct.type, 1);//1 = Text
- Lib.WriteSingle(Text + HudStruct.FontSize, FontSize);
- Lib.WriteByte(Text + HudStruct.Font, Convert.ToByte(Font));
- if (align != 0)
- { Lib.WriteByte(Text + HudStruct.alignOrg, 5); Lib.WriteByte(Text + HudStruct.alignScreen, Convert.ToByte(align)); }
- else
- { Lib.WriteSingle(Text + HudStruct.X, X); Lib.WriteSingle(Text + HudStruct.Y, Y); }
- Lib.WriteInt32(Text + HudStruct.clientOffset, clientIndex);
- Lib.WriteInt16(Text + HudStruct.text, G_LocalizedStringIndex(TextString));
- Lib.WriteBytes(Text + HudStruct.color, new Byte[] { (Byte)r, (Byte)g, (Byte)b, (Byte)a });
- Lib.WriteBytes(Text + HudStruct.glowColor, new Byte[] { (Byte)glowr, (Byte)glowg, (Byte)glowb, (Byte)glowa });
- Lib.WriteByte(Text + HudStruct.ui3dWindow, 0xFF);
- return Text;
- }
- public static UInt32 SetTypewriter(Int32 clientIndex, String Text, Int32 Font, Single FontSize, Single X, Single Y, UInt32 align, UInt32 Type = 0, UInt16 Lettertime = 200, UInt16 fxDecayStartTime = 7000, UInt16 fxDecayDuration = 1000, Int32 r = 255, Int32 g = 255, Int32 b = 255, Int32 a = 255, Int32 glowr = 255, Int32 glowg = 255, Int32 glowb = 255, Int32 glowa = 0)
- {
- UInt32 elemIndex = SetText(clientIndex, Text, Font, FontSize, X, Y, align, r, g, b, a, glowr, glowg, glowb, glowa);
- Lib.WriteUInt32(elemIndex + HudStruct.flags, Type);
- Lib.WriteUInt32(elemIndex + HudStruct.fxBirthTime, GetLevelTime());
- Lib.WriteUInt16(elemIndex + HudStruct.fxLetterTime, Lettertime);
- Lib.WriteUInt16(elemIndex + HudStruct.fxDecayStartTime, fxDecayStartTime);
- Lib.WriteUInt16(elemIndex + HudStruct.fxDecayDuration, fxDecayDuration);
- return elemIndex;
- }
- public class ObjStruct
- {
- public static UInt32
- ObjectiveIndex = 0x1608194,
- ObjectiveIndexLength = 0x30,
- Origin = 0x04,
- X = 0x04,
- Y = 0x08,
- Z = 0x0C,
- targetEntNum = 0x10,
- MaterialIndex = 0x1C,
- State = 0x28,
- Team = 0x2D;
- }
- public class HudStruct
- {
- public static UInt32
- G_Hudelems = 0x15DDB00,
- IndexSize = 0x88,
- X = 0x00,
- Y = 0x04,
- Z = 0x08,
- FontSize = 0xC,
- fromFontScale = 0x10,
- fontScaleStartTime = 0x14,
- color = 0x18,
- fromColor = 0x1C,
- fadeStartTime = 0x20,
- scaleStartTime = 0x24,
- fromX = 0x28,
- fromY = 0x2C,
- moveStartTime = 0x30,
- time = 0x34,
- duration = 0x38,
- value = 0x3C,
- sort = 0x40,
- glowColor = 0x44,
- fxBirthTime = 0x48,
- flags = 0x4C,
- targetEntNum = 0x50,
- fontScaleTime = 0x52,
- fadeTime = 0x54,
- label = 0x56,
- Width = 0x58,
- Height = 0x5A,
- fromWidth = 0x5C,
- fromHeight = 0x5E,
- scaleTime = 0x60,
- moveTime = 0x62,
- text = 0x64,
- fxLetterTime = 0x66,
- fxDecayStartTime = 0x68,
- fxDecayDuration = 0x6A,
- fxRedactDecayStartTime = 0x6C,
- fxRedactDecayDuration = 0x6E,
- type = 0x70,
- Font = 0x71,
- alignOrg = 0x72,
- alignScreen = 0x73,
- materialIndex = 0x74,
- offscreenMaterialIndex = 0x75,
- fromAlignOrg = 0x76,
- fromAlignScreen = 0x77,
- soundID = 0x78,
- ui3dWindow = 0x79,
- flag2 = 0x7A,
- clientOffset = 0x7C,
- team = 0x80,
- abilityFlag = 0x84;
- public class Align
- {
- public static UInt32
- TOP_RIGHT = 0xA8,
- TOP_LEFT = 0x88,
- TOP_CENTERED = 0x78,
- BOTTOM_RIGHT = 0xAA,
- BOTTOM_LEFT = 0x8A,
- BOTTOM_CENTER = 0x9A,
- CENTER_MIDDLE = 0x92,
- CENTER_LEFT = 0x82,
- CENTER_RIGHT = 0xA2;
- }
- public class Typewriter
- {
- public static UInt32
- Normal = 0x800,
- Classic = 0x4000;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement