summaryrefslogtreecommitdiff
path: root/Animal.cs
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2026-10-09 13:13:59 -0400
committerAndrew Opalach <andrew@akon.city> 2026-10-09 13:13:59 -0400
commita66fbdfab71ece98223d257f3a6da7ab0339ee1f (patch)
tree5289018b0b7130d9509eff971b060d0699f71b92 /Animal.cs
parent8abc6082c701084d505fa4fdf391a8cbf69e4fec (diff)
downloadNewCamera-a66fbdfab71ece98223d257f3a6da7ab0339ee1f.tar.gz
NewCamera-a66fbdfab71ece98223d257f3a6da7ab0339ee1f.tar.bz2
NewCamera-a66fbdfab71ece98223d257f3a6da7ab0339ee1f.zip
Bunch of wip stuffHEADmaster
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'Animal.cs')
-rw-r--r--Animal.cs162
1 files changed, 141 insertions, 21 deletions
diff --git a/Animal.cs b/Animal.cs
index 1d27650..0b0e754 100644
--- a/Animal.cs
+++ b/Animal.cs
@@ -5,18 +5,12 @@ namespace SharpPluginLoader.Core.Entities
public class Animal : Entity
{
/// <summary>
- /// The sAnimal singleton instance
- /// </summary>
- public static MtObject SingletonInstance => SingletonManager.GetSingleton("sAnimal")!;
-
- /// <summary>
/// Gets a list of all animals in the game
/// </summary>
/// <returns></returns>
public static Animal[] GetAllAnimals()
{
- lock (_animals)
- return _animals.ToArray();
+ lock (_animals) return _animals.ToArray();
}
/// <summary>
@@ -29,30 +23,156 @@ namespace SharpPluginLoader.Core.Entities
public int Id => Get<int>(0x1AF8); // +0x294
public int OtherId => Get<int>(0x1AF0);
- private static void AnimalAddHook(nint instance)
+ private static nint uGmAnimalCtorHook(nint unknownPtr, int unknownInt)
{
- var animal = new Animal(instance);
- lock (_animals) _animals.Add(animal);
- _animalAddHook.Original(instance);
+ nint animalObject = _uGmAnimalCtor.Original(unknownPtr, unknownInt);
+ lock (_animals) _animals.Add(new Animal(animalObject));
+ return animalObject;
}
- private static nint AnimalRemoveHook(nint instance)
+ private static nint uGmAnimalDestructorHook(nint animalObject)
{
- var animal = new Animal(instance);
- lock(_animals) _animals.Remove(animal);
- return _animalRemoveHook.Original(instance);
+ lock(_animals)
+ {
+ for (int i = 0; i < _animals.Count; i++)
+ {
+ if (_animals[i].Instance == animalObject)
+ {
+ _animals.RemoveAt(i);
+ break;
+ }
+ }
+ }
+ return _uGmAnimalDestructor.Original(animalObject);
}
internal static void Initialize()
{
- _animalAddHook = Hook.Create<AnimalAddDelegate>(0x141D2F610, AnimalAddHook);
- _animalRemoveHook = Hook.Create<AnimalRemoveDelegate>(0x141D289D0, AnimalRemoveHook);
+ _uGmAnimalCtor = Hook.Create<uGmAnimalCtor>(0x141D285C0, uGmAnimalCtorHook);
+ _uGmAnimalDestructor = Hook.Create<uGmAnimalDestructor>(0x141D289D0, uGmAnimalDestructorHook);
}
- private delegate void AnimalAddDelegate(nint instance);
- private delegate nint AnimalRemoveDelegate(nint instance);
- private static Hook<AnimalAddDelegate> _animalAddHook = null!;
- private static Hook<AnimalRemoveDelegate> _animalRemoveHook = null!;
+ private delegate nint uGmAnimalCtor(nint unknownPtr, int unknownInt);
+ private delegate nint uGmAnimalDestructor(nint animalObject);
+ private static Hook<uGmAnimalCtor> _uGmAnimalCtor = null!;
+ private static Hook<uGmAnimalDestructor> _uGmAnimalDestructor = null!;
private static readonly List<Animal> _animals = [];
}
+
+ /// <summary>
+ /// Represents an animal id
+ /// </summary>
+ public enum AnimalType : uint
+ {
+ /*
+ Shepherd Hare = 1,
+ Pilot Hare = 1,
+ Woodland Pteryx = 2,
+ Forest Pteryx = 2,
+ Cobalt Flutterfly = 3,
+ Phantom Flutterfly = 3,
+ Climbing Joyperch = 4,
+ Forest Gekko = 5,
+ Wildspire Gekko = 5,
+ Gloom Gekko = 5,
+ Moonlight Gekko = 5,
+ Vaporonid = 6,
+ Scavantula = 6,
+ Revolture = 7,
+ Blissbill = 7,
+ Stonebill = 7,
+ Omenfly = 8,
+ Augurfly = 8,
+ Scalebat = 9,
+ Gold Scalebat = 9,
+ Dung Beetle = 10,
+ Bomb Beetle = 10,
+ Rime Beetle = 10,
+ Pink Parexus = 11,
+ Great Pink Parexus = 11,
+ Burst Arowana = 12,
+ Bomb Arowana = 12,
+ Great Burst Arowana = 12,
+ Great Bomb Arowana = 12,
+ Elegant Coralbird = 13,
+ Dapper Coralbird = 13,
+ Andangler = 14,
+ Downy Crake = 15,
+ Bristly Crake = 15,
+ Hopguppy = 16,
+ Petricanths = 17,
+ Paratoad = 18,
+ Sleeptoad = 18,
+ Nitrotoad = 18,
+ Wiggler = 19,
+ Wiggler Queen = 19,
+ Vigorwasp = 20,
+ Giant Vigorwasp = 20,
+ Flying Meduso = 21,
+ Carrier Ant = 22,
+ Hercudrome = 23,
+ Gold Hercudrome = 23,
+ Prism Hercudrome = 23,
+ Emperor Hopper = 24,
+ Tyrant Hopper = 24,
+ Flashfly = 25,
+ 羽虫 = 26,
+ ハエ = 27,
+ ハチ = 28,
+ 蛍 = 29,
+ Grandfather Mantagrell = 30,
+ Iron Helmcrab = 31,
+ Soldier Helmcrab = 31,
+ Emerald Helmcrab = 31,
+ Gold Helmcrab = 31,
+ Shiny Gold Helmcrab = 31,
+ 苦蟲 = 32,
+ 光蟲 = 32,
+ 不死蟲 = 32,
+ 雷光蟲 = 32,
+ 佳餚蟲 = 32,
+ Whetfish = 33,
+ Great Whetfish = 33,
+ Gastronome Tuna = 34,
+ Great Gastronome Tuna = 34,
+ King Marlin = 35,
+ Great King Marlin = 35,
+ 楔虫 = 36,
+ Goldenfish = 37,
+ Platinumfish = 37,
+ Great Goldenfish = 37,
+ Great Platinumfish = 37,
+ Goldenfry = 38,
+ Great Goldenfry = 38,
+ Sushifish = 39,
+ Great Sushifish = 39,
+ Gunpowderfish = 40,
+ Great Gunpowderfish = 40,
+ Copper Calappa = 41,
+ Gold Calappa = 41,
+ Tsuchinoko = 42,
+ Cactuar = 43,
+ Cactuar Cutting = 43,
+ Flowering Cactuar Cutting = 43,
+ Nekker = 44,
+ Pearlspring Macaque = 50,
+ Goldspring Macaque = 50,
+ Crowned Prawn = 51,
+ Moon Slug = 52,
+ Duffel Penguin = 53,
+ Arrowhead Gekko = 54,
+ Blue Diva = 55,
+ Sealord's Crestfish = 56,
+ Glass Parexus = 57,
+ Great Glass Parexus = 57,
+ Wintermoon Nettle = 58,
+ Moly = 59,
+ Mossy Moly = 59,
+ Rocky Moly = 59,
+ Fluffy Moly = 59,
+ Spiny Moly = 59,
+ Rowdy Moly = 59,
+ Frosty Moly = 59
+ */
+ }
}