Skip to content

Commit

Permalink
1.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Pro-Tweaker committed Feb 13, 2021
1 parent a058e55 commit a5acbeb
Show file tree
Hide file tree
Showing 20 changed files with 737 additions and 346 deletions.
11 changes: 6 additions & 5 deletions Cloudpunk-Trainer/Cloudpunk-Trainer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@
<StartupObject>Cloudpunk_Trainer.Program</StartupObject>
</PropertyGroup>
<ItemGroup>
<Reference Include="Process Memory, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Process Memory\Process Memory\bin\x64\Debug\netstandard2.0\Process Memory.dll</HintPath>
<Reference Include="Memory">
<HintPath>..\..\Memory\Memory\bin\x64\Release\netstandard2.0\Memory.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -79,8 +78,10 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Cloudpunk\Global.cs" />
<Compile Include="Cloudpunk\Player.cs" />
<Compile Include="Cloudpunk\PlayerCar.cs" />
<Compile Include="Cloudpunk\Models\HolocashAccount.cs" />
<Compile Include="Cloudpunk\Models\Item.cs" />
<Compile Include="Cloudpunk\Enums\ItemCategory.cs" />
<Compile Include="Cloudpunk\Offsets.cs" />
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
Expand Down
13 changes: 13 additions & 0 deletions Cloudpunk-Trainer/Cloudpunk/Enums/ItemCategory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Cloudpunk_Trainer.Cloudpunk.Enums
{
public enum ItemCategory
{
General = 0,
Food = 1,
Drink = 2,
Drug = 3,
Apartment = 4,
Vehicle = 5,
Clothes = 6
}
}
57 changes: 32 additions & 25 deletions Cloudpunk-Trainer/Cloudpunk/Global.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using Process_Memory;
using Pro_Tweaker;
using Cloudpunk_Trainer.Models;

namespace Cloudpunk_Trainer.Cloudpunk
Expand Down Expand Up @@ -33,30 +33,37 @@ public override long Value
}
}

public override List<Offset> Offsets { get; } = new List<Offset>()
public long Player
{
new Offset("idleMusicTimer", typeof(float), 0xC0),
new Offset("advertisementTimer", typeof(float), 0xC4),
new Offset("makeCallTimer", typeof(float), 0x4D4),
new Offset("money", typeof(int), 0x508),
new Offset("numLocationsUnlocked", typeof(int), 0x5A0),
new Offset("numRepairs", typeof(int), 0x5A4),
new Offset("joosTimePassed", typeof(float), 0x610),
new Offset("joosTimeLeft", typeof(float), 0x614),
new Offset("alcoholTimePassed", typeof(float), 0x640),
new Offset("alcoholTimeLeft", typeof(float), 0x644),
new Offset("speedGainTimeLeft", typeof(float), 0x648),
new Offset("stimsTimePassed", typeof(float), 0x64C),
new Offset("stimsTimeLeft", typeof(float), 0x650),
new Offset("pheromonesTimePassed", typeof(float), 0x654),
new Offset("pheromonesTimeLeft", typeof(float), 0x658),
new Offset("foodCooldown", typeof(float), 0x65C),
new Offset("drinkCooldown", typeof(float), 0x660),
new Offset("drugCooldown", typeof(float), 0x664),
new Offset("timeSinceStart", typeof(float), 0x718)
};
get
{
if (memoryCave != null)
{
return memory.Reader.ReadInt64(new IntPtr(Value + 0x60));
}
else
{
return -1;
}
}
}

public Global(Memory memory)
public long PlayerCar
{
get
{
if (memoryCave != null)
{
return memory.Reader.ReadInt64(new IntPtr(Value + 0x70));
}
else
{
return -1;
}
}
}

public Global(Memory memory)
{
this.memory = memory;
}
Expand Down Expand Up @@ -88,11 +95,11 @@ public override bool Enable()

public override bool Disable()
{
memory.Writer.WriteBytes(patchAddress, new byte[] { 0xF3, 0x0F, 0x10, 0x81, 0xC4, 0x00, 0x00, 0x00 });
bool success = memory.Writer.WriteBytes(patchAddress, new byte[] { 0xF3, 0x0F, 0x10, 0x81, 0xC4, 0x00, 0x00, 0x00 });

Enabled = false;

return true;
return success;
}
}
}
83 changes: 83 additions & 0 deletions Cloudpunk-Trainer/Cloudpunk/Models/HolocashAccount.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
using Pro_Tweaker;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace Cloudpunk_Trainer.Cloudpunk.Models
{
public sealed class HolocashAccount : INotifyPropertyChanged
{
#region Private Backing Fields
private int funds;
#endregion

[Browsable(false)]
public IntPtr Address { get; set; }

public string KeyCode { get; set; }

[DisplayName("Default Amount")]
public int DefaultAmount { get; set; }

public int Funds
{
get
{
return funds;
}
set
{
if (value != funds)
{
funds = value;
NotifyPropertyChanged();
}
}
}

public HolocashAccount(IntPtr address)
{
Address = address;
}

public HolocashAccount(string keyCode, int defaultAmount, int funds)
{
KeyCode = keyCode;
DefaultAmount = defaultAmount;
Funds = funds;
}

public bool Read(Memory memory)
{
if (memory != null && memory.Process != null && memory.ProcessAlive != false && Address != IntPtr.Zero)
{
KeyCode = Utils.ReadUnityString(memory, IntPtr.Add(Address, 0x10));
DefaultAmount = memory.Reader.ReadInt(IntPtr.Add(Address, 0x28));
Funds = memory.Reader.ReadInt(IntPtr.Add(Address, 0x2C));
}

return false;
}

public bool Write(Memory memory)
{
if (memory != null && memory.Process != null && memory.ProcessAlive != false && Address != IntPtr.Zero)
{
bool result;

result = memory.Writer.WriteInt(IntPtr.Add(Address, 0x2C), Funds);

return result;
}

return false;
}

public event PropertyChangedEventHandler PropertyChanged;

private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
130 changes: 130 additions & 0 deletions Cloudpunk-Trainer/Cloudpunk/Models/Item.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
using Cloudpunk_Trainer.Cloudpunk.Enums;
using Pro_Tweaker;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace Cloudpunk_Trainer.Cloudpunk.Models
{
public sealed class Item : INotifyPropertyChanged
{
#region Private Backing Fields
private int amount;
private int totalAmountAvailable;
#endregion

[Browsable(false)]
public IntPtr Address { get; set; }

[DisplayName("Name")]
public string LocalizedName { get; set; }

[Browsable(false)]
[DisplayName("Description")]
public string localizedDescription { get; set; }

public ItemCategory Category { get; set; }

public int Amount
{
get
{
return amount;
}
set
{
if (value != amount)
{
amount = value;
NotifyPropertyChanged();
}
}
}

[DisplayName("Consumable")]
public bool IsConsumable { get; set; }

[DisplayName("Sellable")]
public bool CanBeSold { get; set; }

[DisplayName("Usable")]
public bool CanBeUsed { get; set; }

[DisplayName("Base Price")]
public int BasePrice { get; set; }

[DisplayName("Force Price")]
public bool ForceBasePrice { get; set; }

[DisplayName("Total Available")]
public int TotalAmountAvailable
{
get
{
return totalAmountAvailable;
}
set
{
if (value != totalAmountAvailable)
{
totalAmountAvailable = value;
NotifyPropertyChanged();
}
}
}

public float Cooldown { get; set; }

public Item(IntPtr address)
{
Address = address;
}

public bool Read(Memory memory)
{
if(memory != null && memory.Process != null && memory.ProcessAlive != false && Address != IntPtr.Zero)
{
LocalizedName = Utils.ReadUnityString(memory, IntPtr.Add(Address, 0x20));
Category = (ItemCategory)memory.Reader.ReadInt(IntPtr.Add(Address, 0x38));
Amount = memory.Reader.ReadInt(IntPtr.Add(Address, 0x3C));
IsConsumable = memory.Reader.ReadBool(IntPtr.Add(Address, 0x40));
CanBeSold = memory.Reader.ReadBool(IntPtr.Add(Address, 0x41));
CanBeUsed = memory.Reader.ReadBool(IntPtr.Add(Address, 0x42));
BasePrice = memory.Reader.ReadInt(IntPtr.Add(Address, 0x44));
ForceBasePrice = memory.Reader.ReadBool(IntPtr.Add(Address, 0x48));
TotalAmountAvailable = memory.Reader.ReadInt(IntPtr.Add(Address, 0x4C));
Cooldown = memory.Reader.ReadFloat(IntPtr.Add(Address, 0x70));
}

return false;
}

public bool Write(Memory memory)
{
if (memory != null && memory.Process != null && memory.ProcessAlive != false && Address != IntPtr.Zero)
{
bool result;

result = memory.Writer.WriteInt(IntPtr.Add(Address, 0x3C), Amount);
result = memory.Writer.WriteBool(IntPtr.Add(Address, 0x40), IsConsumable);
result = memory.Writer.WriteBool(IntPtr.Add(Address, 0x41), CanBeSold);
result = memory.Writer.WriteBool(IntPtr.Add(Address, 0x42), CanBeUsed);
result = memory.Writer.WriteInt(IntPtr.Add(Address, 0x44), BasePrice);
result = memory.Writer.WriteBool(IntPtr.Add(Address, 0x48), ForceBasePrice);
result = memory.Writer.WriteInt(IntPtr.Add(Address, 0x4C), TotalAmountAvailable);
result = memory.Writer.WriteFloat(IntPtr.Add(Address, 0x70), Cooldown);

return result;
}

return false;
}

public event PropertyChangedEventHandler PropertyChanged;

private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Loading

0 comments on commit a5acbeb

Please sign in to comment.