xabbo-scripts/Scripts/PlacePlantsV2.csx
Administrator 7a548130a3 Move all scripts into Scripts/ subfolder
Keeps the repo root clean - only README.md visible on landing page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 09:49:37 +01:00

27 lines
1.5 KiB
C#

class PetInfo {
public int Id {get;set;} public string Name {get;set;}
public PetFigureData FigureData {get;set;} public int Level {get;set;}
public PetInfo(IReadOnlyPacket p) { Id = p.ReadInt();p.ReadString();FigureData = new PetFigureData(p);p.ReadInt();}}
class PetFigureData {
public int TypeId {get;set;} public int PaletteId {get;set;}
public string Color {get;set;} public int BreedId {get;set;}
public List<int[]> CustomParts {get;set;} = new();
public PetFigureData(IReadOnlyPacket p) {TypeId = p.ReadInt();p.ReadInt();p.ReadString(); p.ReadInt();
var len = p.ReadInt();for (var i = 0; i < len; i++) CustomParts.Add(new[] { p.ReadInt(), p.ReadInt(), p.ReadInt() });}}
OnIntercept(In.PetInventory, e => {
var pets = new List<PetInfo>(); var fragments = e.Packet.ReadInt(); var currentFragment = e.Packet.ReadInt();
Log($"{currentFragment}/{fragments}");
if (currentFragment == 0) pets.Clear();
var petCount = e.Packet.ReadInt();
for (var petIdx = 0; petIdx < petCount; petIdx++) pets.Add(new PetInfo(e.Packet));
Task.Run(async () => {
if (currentFragment == (fragments - 1)) {var plantPets = pets.Where(x => x.FigureData.TypeId == 16).ToList();
int currentPlant = 0;
foreach (var plant in plantPets) {
currentPlant++; Status($"[{plant.Id}] {currentPlant}/{plantPets.Count}");
var tile = Rand(Heightmap.Where(t => t.IsFree));
Send(Out["PlacePet"], plant.Id, tile.X,tile.Y); Delay(750);
Send(Out["CompostPlant"],plant.Id);;}}});});
Send(Out.GetPetInventory); Wait();