Skip to content

Commit

Permalink
update NPC imports
Browse files Browse the repository at this point in the history
  • Loading branch information
chirpxiv committed Jul 9, 2024
1 parent b9ac3b2 commit ca31d47
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 44 deletions.
34 changes: 19 additions & 15 deletions Anamnesis/Actor/Extensions/INpcBaseExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,24 +152,24 @@ private static CharacterFile ToFile(this INpcAppearance appearance)
file.FacePaint = (byte)appearance.FacePaint;
file.FacePaintColor = (byte)appearance.FacePaintColor;

file.MainHand = WeaponFromItem(appearance.MainHand, appearance.DyeMainHand);
file.OffHand = WeaponFromItem(appearance.OffHand, appearance.DyeOffHand, true);

file.HeadGear = GearFromItem(appearance.Head, appearance.DyeHead);
file.Body = GearFromItem(appearance.Body, appearance.DyeBody);
file.Hands = GearFromItem(appearance.Hands, appearance.DyeHands);
file.Legs = GearFromItem(appearance.Legs, appearance.DyeLegs);
file.Feet = GearFromItem(appearance.Feet, appearance.DyeFeet);
file.Ears = GearFromItem(appearance.Ears, appearance.DyeEars);
file.Neck = GearFromItem(appearance.Neck, appearance.DyeNeck);
file.Wrists = GearFromItem(appearance.Wrists, appearance.DyeWrists);
file.LeftRing = GearFromItem(appearance.LeftRing, appearance.DyeLeftRing);
file.RightRing = GearFromItem(appearance.RightRing, appearance.DyeRightRing);
file.MainHand = WeaponFromItem(appearance.MainHand, appearance.DyeMainHand, appearance.Dye2MainHand);
file.OffHand = WeaponFromItem(appearance.OffHand, appearance.DyeOffHand, appearance.Dye2OffHand, true);

file.HeadGear = GearFromItem(appearance.Head, appearance.DyeHead, appearance.Dye2Head);
file.Body = GearFromItem(appearance.Body, appearance.DyeBody, appearance.Dye2Body);
file.Hands = GearFromItem(appearance.Hands, appearance.DyeHands, appearance.Dye2Hands);
file.Legs = GearFromItem(appearance.Legs, appearance.DyeLegs, appearance.Dye2Legs);
file.Feet = GearFromItem(appearance.Feet, appearance.DyeFeet, appearance.Dye2Feet);
file.Ears = GearFromItem(appearance.Ears, appearance.DyeEars, appearance.Dye2Ears);
file.Neck = GearFromItem(appearance.Neck, appearance.DyeNeck, appearance.Dye2Neck);
file.Wrists = GearFromItem(appearance.Wrists, appearance.DyeWrists, appearance.Dye2Wrists);
file.LeftRing = GearFromItem(appearance.LeftRing, appearance.DyeLeftRing, appearance.Dye2LeftRing);
file.RightRing = GearFromItem(appearance.RightRing, appearance.DyeRightRing, appearance.Dye2RightRing);

return file;
}

private static CharacterFile.WeaponSave? WeaponFromItem(IItem? item, IDye? dye, bool isOffHand = false)
private static CharacterFile.WeaponSave? WeaponFromItem(IItem? item, IDye? dye, IDye? dye2, bool isOffHand = false)
{
if (item == null)
return null;
Expand All @@ -191,11 +191,13 @@ private static CharacterFile ToFile(this INpcAppearance appearance)

if (dye != null)
save.DyeId = dye.Id;
if (dye2 != null)
save.DyeId2 = dye2.Id;

return save;
}

private static CharacterFile.ItemSave? GearFromItem(IItem? item, IDye? dye)
private static CharacterFile.ItemSave? GearFromItem(IItem? item, IDye? dye, IDye? dye2)
{
if (item == null)
return null;
Expand All @@ -207,6 +209,8 @@ private static CharacterFile ToFile(this INpcAppearance appearance)

if (dye != null)
save.DyeId = dye.Id;
if (dye2 != null)
save.DyeId2 = dye2.Id;

return save;
}
Expand Down
24 changes: 24 additions & 0 deletions Anamnesis/GameData/Excel/BattleNpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,28 +107,40 @@ public BattleNpcAppearance(BattleNpc npc)
{
this.MainHand = LuminaExtensions.GetWeaponItem(ItemSlots.MainHand, npcEquip.ModelMainHand);
this.DyeMainHand = GameDataService.Dyes.Get(npcEquip.DyeMainHand.Row);
this.Dye2MainHand = GameDataService.Dyes.Get(npcEquip.Dye2MainHand.Row);
this.OffHand = LuminaExtensions.GetWeaponItem(ItemSlots.OffHand, npcEquip.ModelOffHand);
this.DyeOffHand = GameDataService.Dyes.Get(npcEquip.DyeOffHand.Row);
this.Dye2OffHand = GameDataService.Dyes.Get(npcEquip.Dye2OffHand.Row);
this.Head = LuminaExtensions.GetGearItem(ItemSlots.Head, npcEquip.ModelHead);
this.DyeHead = GameDataService.Dyes.Get(npcEquip.DyeHead.Row);
this.Dye2Head = GameDataService.Dyes.Get(npcEquip.Dye2Head.Row);
this.Body = LuminaExtensions.GetGearItem(ItemSlots.Body, npcEquip.ModelBody);
this.DyeBody = GameDataService.Dyes.Get(npcEquip.DyeBody.Row);
this.Dye2Body = GameDataService.Dyes.Get(npcEquip.Dye2Body.Row);
this.Hands = LuminaExtensions.GetGearItem(ItemSlots.Hands, npcEquip.ModelHead);
this.DyeHands = GameDataService.Dyes.Get(npcEquip.DyeHands.Row);
this.Dye2Hands = GameDataService.Dyes.Get(npcEquip.Dye2Hands.Row);
this.Legs = LuminaExtensions.GetGearItem(ItemSlots.Legs, npcEquip.ModelLegs);
this.DyeLegs = GameDataService.Dyes.Get(npcEquip.DyeLegs.Row);
this.Dye2Legs = GameDataService.Dyes.Get(npcEquip.Dye2Legs.Row);
this.Feet = LuminaExtensions.GetGearItem(ItemSlots.Feet, npcEquip.ModelFeet);
this.DyeFeet = GameDataService.Dyes.Get(npcEquip.DyeFeet.Row);
this.Dye2Feet = GameDataService.Dyes.Get(npcEquip.Dye2Feet.Row);
this.Ears = LuminaExtensions.GetGearItem(ItemSlots.Ears, npcEquip.ModelEars);
this.DyeEars = GameDataService.Dyes.Get(npcEquip.DyeEars.Row);
this.Dye2Ears = GameDataService.Dyes.Get(npcEquip.Dye2Ears.Row);
this.Neck = LuminaExtensions.GetGearItem(ItemSlots.Neck, npcEquip.ModelNeck);
this.DyeNeck = GameDataService.Dyes.Get(npcEquip.DyeNeck.Row);
this.Dye2Neck = GameDataService.Dyes.Get(npcEquip.Dye2Neck.Row);
this.Wrists = LuminaExtensions.GetGearItem(ItemSlots.Wrists, npcEquip.ModelWrists);
this.DyeWrists = GameDataService.Dyes.Get(npcEquip.DyeWrists.Row);
this.Dye2Wrists = GameDataService.Dyes.Get(npcEquip.Dye2Wrists.Row);
this.LeftRing = LuminaExtensions.GetGearItem(ItemSlots.LeftRing, npcEquip.ModelLeftRing);
this.DyeLeftRing = GameDataService.Dyes.Get(npcEquip.DyeLeftRing.Row);
this.Dye2LeftRing = GameDataService.Dyes.Get(npcEquip.Dye2LeftRing.Row);
this.RightRing = LuminaExtensions.GetGearItem(ItemSlots.RightRing, npcEquip.ModelRightRing);
this.DyeRightRing = GameDataService.Dyes.Get(npcEquip.DyeRightRing.Row);
this.Dye2RightRing = GameDataService.Dyes.Get(npcEquip.Dye2RightRing.Row);
}
}

Expand Down Expand Up @@ -163,27 +175,39 @@ public BattleNpcAppearance(BattleNpc npc)

public IItem? MainHand { get; private set; }
public IDye? DyeMainHand { get; private set; }
public IDye? Dye2MainHand { get; private set; }
public IItem? OffHand { get; private set; }
public IDye? DyeOffHand { get; private set; }
public IDye? Dye2OffHand { get; private set; }
public IItem? Head { get; private set; }
public IDye? DyeHead { get; private set; }
public IDye? Dye2Head { get; private set; }
public IItem? Body { get; private set; }
public IDye? DyeBody { get; private set; }
public IDye? Dye2Body { get; private set; }
public IItem? Legs { get; private set; }
public IDye? DyeLegs { get; private set; }
public IDye? Dye2Legs { get; private set; }
public IItem? Feet { get; private set; }
public IDye? DyeFeet { get; private set; }
public IDye? Dye2Feet { get; private set; }
public IItem? Hands { get; private set; }
public IDye? DyeHands { get; private set; }
public IDye? Dye2Hands { get; private set; }
public IItem? Wrists { get; private set; }
public IDye? DyeWrists { get; private set; }
public IDye? Dye2Wrists { get; private set; }
public IItem? Neck { get; private set; }
public IDye? DyeNeck { get; private set; }
public IDye? Dye2Neck { get; private set; }
public IItem? Ears { get; private set; }
public IDye? DyeEars { get; private set; }
public IDye? Dye2Ears { get; private set; }
public IItem? LeftRing { get; private set; }
public IDye? DyeLeftRing { get; private set; }
public IDye? Dye2LeftRing { get; private set; }
public IItem? RightRing { get; private set; }
public IDye? DyeRightRing { get; private set; }
public IDye? Dye2RightRing { get; private set; }
}
}
12 changes: 12 additions & 0 deletions Anamnesis/GameData/Excel/Companion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,17 @@ public CompanionAppearance(Companion companion)
public IDye DyeLeftRing => DyeUtility.NoneDye;
public IItem RightRing => ItemUtility.NoneItem;
public IDye DyeRightRing => DyeUtility.NoneDye;
public IDye Dye2MainHand => DyeUtility.NoneDye;
public IDye Dye2OffHand => DyeUtility.NoneDye;
public IDye Dye2Head => DyeUtility.NoneDye;
public IDye Dye2Body => DyeUtility.NoneDye;
public IDye Dye2Legs => DyeUtility.NoneDye;
public IDye Dye2Feet => DyeUtility.NoneDye;
public IDye Dye2Hands => DyeUtility.NoneDye;
public IDye Dye2Wrists => DyeUtility.NoneDye;
public IDye Dye2Neck => DyeUtility.NoneDye;
public IDye Dye2Ears => DyeUtility.NoneDye;
public IDye Dye2LeftRing => DyeUtility.NoneDye;
public IDye Dye2RightRing => DyeUtility.NoneDye;
}
}
82 changes: 53 additions & 29 deletions Anamnesis/GameData/Excel/EventNpcAppearance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Anamnesis.GameData.Excel;

using ExcelRow = Anamnesis.GameData.Sheets.ExcelRow;

[Sheet("ENpcBase", 0x927347d8)]
[Sheet("ENpcBase", 0x464052cd)]
public class EventNpcAppearance : ExcelRow, INpcAppearance
{
public uint ModelCharaRow { get; private set; }
Expand Down Expand Up @@ -44,28 +44,40 @@ public class EventNpcAppearance : ExcelRow, INpcAppearance

public IItem? MainHand { get; private set; }
public IDye? DyeMainHand { get; private set; }
public IDye? Dye2MainHand { get; private set; }
public IItem? OffHand { get; private set; }
public IDye? DyeOffHand { get; private set; }
public IDye? Dye2OffHand { get; private set; }
public IItem? Head { get; private set; }
public IDye? DyeHead { get; private set; }
public IDye? Dye2Head { get; private set; }
public IItem? Body { get; private set; }
public IDye? DyeBody { get; private set; }
public IDye? Dye2Body { get; private set; }
public IItem? Hands { get; private set; }
public IDye? DyeHands { get; private set; }
public IDye? Dye2Hands { get; private set; }
public IItem? Legs { get; private set; }
public IDye? DyeLegs { get; private set; }
public IDye? Dye2Legs { get; private set; }
public IItem? Feet { get; private set; }
public IDye? DyeFeet { get; private set; }
public IItem? Hands { get; private set; }
public IDye? DyeHands { get; private set; }
public IItem? Wrists { get; private set; }
public IDye? DyeWrists { get; private set; }
public IItem? Neck { get; private set; }
public IDye? DyeNeck { get; private set; }
public IDye? Dye2Feet { get; private set; }
public IItem? Ears { get; private set; }
public IDye? DyeEars { get; private set; }
public IDye? Dye2Ears { get; private set; }
public IItem? Neck { get; private set; }
public IDye? DyeNeck { get; private set; }
public IDye? Dye2Neck { get; private set; }
public IItem? Wrists { get; private set; }
public IDye? DyeWrists { get; private set; }
public IDye? Dye2Wrists { get; private set; }
public IItem? LeftRing { get; private set; }
public IDye? DyeLeftRing { get; private set; }
public IDye? Dye2LeftRing { get; private set; }
public IItem? RightRing { get; private set; }
public IDye? DyeRightRing { get; private set; }
public IDye? Dye2RightRing { get; private set; }

public override void PopulateData(RowParser parser, GameData gameData, Language language)
{
Expand Down Expand Up @@ -109,28 +121,40 @@ public override void PopulateData(RowParser parser, GameData gameData, Language

this.MainHand = LuminaExtensions.GetWeaponItem(ItemSlots.MainHand, parser.ReadColumn<ulong>(65));
this.DyeMainHand = parser.ReadRowReference<byte, Stain>(66);
this.OffHand = LuminaExtensions.GetWeaponItem(ItemSlots.OffHand, parser.ReadColumn<ulong>(67));
this.DyeOffHand = parser.ReadRowReference<byte, Stain>(68);
this.Head = this.GetItem(ItemSlots.Head, parser.ReadColumn<uint>(69), npcEquip?.ModelHead);
this.DyeHead = parser.ReadRowReference<byte, Stain>(70);
this.Body = this.GetItem(ItemSlots.Body, parser.ReadColumn<uint>(72), npcEquip?.ModelBody);
this.DyeBody = parser.ReadRowReference<byte, Stain>(73);
this.Hands = this.GetItem(ItemSlots.Hands, parser.ReadColumn<uint>(74), npcEquip?.ModelHands);
this.DyeHands = parser.ReadRowReference<byte, Stain>(75);
this.Legs = this.GetItem(ItemSlots.Legs, parser.ReadColumn<uint>(76), npcEquip?.ModelLegs);
this.DyeLegs = parser.ReadRowReference<byte, Stain>(77);
this.Feet = this.GetItem(ItemSlots.Feet, parser.ReadColumn<uint>(78), npcEquip?.ModelFeet);
this.DyeFeet = parser.ReadRowReference<byte, Stain>(79);
this.Ears = this.GetItem(ItemSlots.Ears, parser.ReadColumn<uint>(80), npcEquip?.ModelEars);
this.DyeEars = parser.ReadRowReference<byte, Stain>(81);
this.Neck = this.GetItem(ItemSlots.Neck, parser.ReadColumn<uint>(82), npcEquip?.ModelNeck);
this.DyeNeck = parser.ReadRowReference<byte, Stain>(83);
this.Wrists = this.GetItem(ItemSlots.Wrists, parser.ReadColumn<uint>(84), npcEquip?.ModelWrists);
this.DyeWrists = parser.ReadRowReference<byte, Stain>(85);
this.LeftRing = this.GetItem(ItemSlots.LeftRing, parser.ReadColumn<uint>(86), npcEquip?.ModelLeftRing);
this.DyeLeftRing = parser.ReadRowReference<byte, Stain>(87);
this.RightRing = this.GetItem(ItemSlots.RightRing, parser.ReadColumn<uint>(88), npcEquip?.ModelRightRing);
this.DyeRightRing = parser.ReadRowReference<byte, Stain>(89);
this.Dye2MainHand = parser.ReadRowReference<byte, Stain>(67);
this.OffHand = LuminaExtensions.GetWeaponItem(ItemSlots.OffHand, parser.ReadColumn<ulong>(68));
this.DyeOffHand = parser.ReadRowReference<byte, Stain>(69);
this.Dye2OffHand = parser.ReadRowReference<byte, Stain>(70);
this.Head = this.GetItem(ItemSlots.Head, parser.ReadColumn<uint>(71), npcEquip?.ModelHead);
this.DyeHead = parser.ReadRowReference<byte, Stain>(72);
this.Dye2Head = parser.ReadRowReference<byte, Stain>(73);
this.Body = this.GetItem(ItemSlots.Body, parser.ReadColumn<uint>(75), npcEquip?.ModelBody);
this.DyeBody = parser.ReadRowReference<byte, Stain>(76);
this.Dye2Body = parser.ReadRowReference<byte, Stain>(77);
this.Hands = this.GetItem(ItemSlots.Hands, parser.ReadColumn<uint>(78), npcEquip?.ModelHands);
this.DyeHands = parser.ReadRowReference<byte, Stain>(79);
this.Dye2Hands = parser.ReadRowReference<byte, Stain>(80);
this.Legs = this.GetItem(ItemSlots.Legs, parser.ReadColumn<uint>(81), npcEquip?.ModelLegs);
this.DyeLegs = parser.ReadRowReference<byte, Stain>(82);
this.Dye2Legs = parser.ReadRowReference<byte, Stain>(83);
this.Feet = this.GetItem(ItemSlots.Feet, parser.ReadColumn<uint>(84), npcEquip?.ModelFeet);
this.DyeFeet = parser.ReadRowReference<byte, Stain>(85);
this.Dye2Feet = parser.ReadRowReference<byte, Stain>(86);
this.Ears = this.GetItem(ItemSlots.Ears, parser.ReadColumn<uint>(87), npcEquip?.ModelEars);
this.DyeEars = parser.ReadRowReference<byte, Stain>(88);
this.Dye2Ears = parser.ReadRowReference<byte, Stain>(89);
this.Neck = this.GetItem(ItemSlots.Neck, parser.ReadColumn<uint>(90), npcEquip?.ModelNeck);
this.DyeNeck = parser.ReadRowReference<byte, Stain>(91);
this.Dye2Neck = parser.ReadRowReference<byte, Stain>(92);
this.Wrists = this.GetItem(ItemSlots.Wrists, parser.ReadColumn<uint>(93), npcEquip?.ModelWrists);
this.DyeWrists = parser.ReadRowReference<byte, Stain>(94);
this.Dye2Wrists = parser.ReadRowReference<byte, Stain>(95);
this.LeftRing = this.GetItem(ItemSlots.LeftRing, parser.ReadColumn<uint>(96), npcEquip?.ModelLeftRing);
this.DyeLeftRing = parser.ReadRowReference<byte, Stain>(97);
this.Dye2LeftRing = parser.ReadRowReference<byte, Stain>(98);
this.RightRing = this.GetItem(ItemSlots.RightRing, parser.ReadColumn<uint>(99), npcEquip?.ModelRightRing);
this.DyeRightRing = parser.ReadRowReference<byte, Stain>(100);
this.Dye2RightRing = parser.ReadRowReference<byte, Stain>(101);
}

protected IItem GetItem(ItemSlots slot, uint baseVal, uint? equipVal)
Expand Down
12 changes: 12 additions & 0 deletions Anamnesis/GameData/Excel/Mount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,17 @@ public MountAppearance(Mount mount)
public IDye DyeLeftRing => DyeUtility.NoneDye;
public IItem RightRing => ItemUtility.NoneItem;
public IDye DyeRightRing => DyeUtility.NoneDye;
public IDye Dye2MainHand => DyeUtility.NoneDye;
public IDye Dye2OffHand => DyeUtility.NoneDye;
public IDye Dye2Head => DyeUtility.NoneDye;
public IDye Dye2Body => DyeUtility.NoneDye;
public IDye Dye2Legs => DyeUtility.NoneDye;
public IDye Dye2Feet => DyeUtility.NoneDye;
public IDye Dye2Hands => DyeUtility.NoneDye;
public IDye Dye2Wrists => DyeUtility.NoneDye;
public IDye Dye2Neck => DyeUtility.NoneDye;
public IDye Dye2Ears => DyeUtility.NoneDye;
public IDye Dye2LeftRing => DyeUtility.NoneDye;
public IDye Dye2RightRing => DyeUtility.NoneDye;
}
}
12 changes: 12 additions & 0 deletions Anamnesis/GameData/Excel/Ornament.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,17 @@ public OrnamentAppearance(Ornament ornament)
public IDye DyeLeftRing => DyeUtility.NoneDye;
public IItem RightRing => ItemUtility.NoneItem;
public IDye DyeRightRing => DyeUtility.NoneDye;
public IDye Dye2MainHand => DyeUtility.NoneDye;
public IDye Dye2OffHand => DyeUtility.NoneDye;
public IDye Dye2Head => DyeUtility.NoneDye;
public IDye Dye2Body => DyeUtility.NoneDye;
public IDye Dye2Legs => DyeUtility.NoneDye;
public IDye Dye2Feet => DyeUtility.NoneDye;
public IDye Dye2Hands => DyeUtility.NoneDye;
public IDye Dye2Wrists => DyeUtility.NoneDye;
public IDye Dye2Neck => DyeUtility.NoneDye;
public IDye Dye2Ears => DyeUtility.NoneDye;
public IDye Dye2LeftRing => DyeUtility.NoneDye;
public IDye Dye2RightRing => DyeUtility.NoneDye;
}
}
12 changes: 12 additions & 0 deletions Anamnesis/GameData/Interfaces/INpcBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,38 @@ public interface INpcAppearance

IItem? MainHand { get; }
IDye? DyeMainHand { get; }
IDye? Dye2MainHand { get; }
IItem? OffHand { get; }
IDye? DyeOffHand { get; }
IDye? Dye2OffHand { get; }
IItem? Head { get; }
IDye? DyeHead { get; }
IDye? Dye2Head { get; }
IItem? Body { get; }
IDye? DyeBody { get; }
IDye? Dye2Body { get; }
IItem? Legs { get; }
IDye? DyeLegs { get; }
IDye? Dye2Legs { get; }
IItem? Feet { get; }
IDye? DyeFeet { get; }
IDye? Dye2Feet { get; }
IItem? Hands { get; }
IDye? DyeHands { get; }
IDye? Dye2Hands { get; }
IItem? Wrists { get; }
IDye? DyeWrists { get; }
IDye? Dye2Wrists { get; }
IItem? Neck { get; }
IDye? DyeNeck { get; }
IDye? Dye2Neck { get; }
IItem? Ears { get; }
IDye? DyeEars { get; }
IDye? Dye2Ears { get; }
IItem? LeftRing { get; }
IDye? DyeLeftRing { get; }
IDye? Dye2LeftRing { get; }
IItem? RightRing { get; }
IDye? DyeRightRing { get; }
IDye? Dye2RightRing { get; }
}

0 comments on commit ca31d47

Please sign in to comment.