public void MakeResidentList() { Residents = new Dictionary <int, Resident>(); try { var sheet = MainWindow.Realm.GameData.GetSheet <SaintCoinach.Xiv.ENpcResident>(); foreach (var Parse in sheet) { Residents.Add(Parse.Key, new Resident { Index = Parse.Key, Name = Parse.Singular }); } var eNpcBases = MainWindow.Realm.GameData.GetSheet <SaintCoinach.Xiv.ENpcBase>(); foreach (var parse in eNpcBases) { // Console.WriteLine($"{parse.NpcEquip.ModelHead[0]+ parse.NpcEquip.ModelHead[1]* 256},{parse.NpcEquip.ModelHead[2]}"); // Console.WriteLine(parse.NpcEquip.Key); int id = parse.Key; // int modelid = parse.ModelID; GearSet gear = new GearSet(); List <byte> customize = new List <byte>(); customize.AddRange(new List <byte>() { Convert.ToByte(parse.Race.Key), Convert.ToByte(parse.Gender) , Convert.ToByte(parse.BodyType), Convert.ToByte(parse.Height) , Convert.ToByte(parse.Tribe.Key), Convert.ToByte(parse.Face), Convert.ToByte(parse.HairStyle), Convert.ToByte(parse.HairHighlight) , Convert.ToByte(parse.SkinColor), Convert.ToByte(parse.EyeHeterochromia), Convert.ToByte(parse.HairColor), Convert.ToByte(parse.HairHighlightColor) , Convert.ToByte(parse.FacialFeature), Convert.ToByte(parse.FacialFeatureColor), Convert.ToByte(parse.Eyebrows), Convert.ToByte(parse.EyeColor) , Convert.ToByte(parse.EyeShape), Convert.ToByte(parse.Nose), Convert.ToByte(parse.Jaw), Convert.ToByte(parse.Mouth) , Convert.ToByte(parse.LipColor), Convert.ToByte(parse.BustOrTone1), Convert.ToByte(parse.ExtraFeature1), Convert.ToByte(parse.ExtraFeature2OrBust) , Convert.ToByte(parse.FacePaint), Convert.ToByte(parse.FacePaintColor) }); gear.ModelType = parse.ModelChara.Key; gear.Customize = customize.ToArray(); if (parse.NpcEquip.Key > 0) { gear.MainWep = new WepTuple(parse.NpcEquip.ModelMain.Value1, parse.NpcEquip.ModelMain.Value2, parse.NpcEquip.ModelMain.Value3, parse.NpcEquip.DyeMain.Key); gear.OffWep = new WepTuple(parse.NpcEquip.ModelSub.Value1, parse.NpcEquip.ModelSub.Value2, parse.NpcEquip.ModelSub.Value3, parse.NpcEquip.DyeOff.Key); gear.HeadGear = new GearTuple((parse.NpcEquip.ModelHead[0] + parse.NpcEquip.ModelHead[1] * 256), parse.NpcEquip.ModelHead[2], parse.NpcEquip.DyeHead.Key); gear.BodyGear = new GearTuple((parse.NpcEquip.ModelBody[0] + parse.NpcEquip.ModelBody[1] * 256), parse.NpcEquip.ModelBody[2], parse.NpcEquip.DyeBody.Key); gear.HandsGear = new GearTuple((parse.NpcEquip.ModelHands[0] + parse.NpcEquip.ModelHands[1] * 256), parse.NpcEquip.ModelHands[2], parse.NpcEquip.DyeHands.Key); gear.LegsGear = new GearTuple((parse.NpcEquip.ModelLegs[0] + parse.NpcEquip.ModelLegs[1] * 256), parse.NpcEquip.ModelLegs[2], parse.NpcEquip.DyeLegs.Key); gear.FeetGear = new GearTuple((parse.NpcEquip.ModelFeet[0] + parse.NpcEquip.ModelFeet[1] * 256), parse.NpcEquip.ModelFeet[2], parse.NpcEquip.DyeFeet.Key); gear.EarGear = new GearTuple((parse.NpcEquip.ModelEars[0] + parse.NpcEquip.ModelEars[1] * 256), parse.NpcEquip.ModelEars[2], 0); gear.NeckGear = new GearTuple((parse.NpcEquip.ModelNeck[0] + parse.NpcEquip.ModelNeck[1] * 256), parse.NpcEquip.ModelNeck[2], 0); gear.WristGear = new GearTuple((parse.NpcEquip.ModelWrists[0] + parse.NpcEquip.ModelWrists[1] * 256), parse.NpcEquip.ModelWrists[2], 0); gear.RRingGear = new GearTuple((parse.NpcEquip.ModelRightRing[0] + parse.NpcEquip.ModelRightRing[1] * 256), parse.NpcEquip.ModelRightRing[2], 0); gear.LRingGear = new GearTuple((parse.NpcEquip.ModelLeftRing[0] + parse.NpcEquip.ModelLeftRing[1] * 256), parse.NpcEquip.ModelLeftRing[2], 0); } else { gear.MainWep = new WepTuple(parse.ModelMain.Value1, parse.ModelMain.Value2, parse.ModelMain.Value3, parse.DyeMain.Key); gear.OffWep = new WepTuple(parse.ModelSub.Value1, parse.ModelSub.Value2, parse.ModelSub.Value3, parse.DyeOff.Key); gear.HeadGear = new GearTuple((parse.ModelHead[0] + parse.ModelHead[1] * 256), parse.ModelHead[2], parse.DyeHead.Key); gear.BodyGear = new GearTuple((parse.ModelBody[0] + parse.ModelBody[1] * 256), parse.ModelBody[2], parse.DyeBody.Key); gear.HandsGear = new GearTuple((parse.ModelHands[0] + parse.ModelHands[1] * 256), parse.ModelHands[2], parse.DyeHands.Key); gear.LegsGear = new GearTuple((parse.ModelLegs[0] + parse.ModelLegs[1] * 256), parse.ModelLegs[2], parse.DyeLegs.Key); gear.FeetGear = new GearTuple((parse.ModelFeet[0] + parse.ModelFeet[1] * 256), parse.ModelFeet[2], parse.DyeFeet.Key); gear.EarGear = new GearTuple((parse.ModelEars[0] + parse.ModelEars[1] * 256), parse.ModelEars[2], 0); gear.NeckGear = new GearTuple((parse.ModelNeck[0] + parse.ModelNeck[1] * 256), parse.ModelNeck[2], 0); gear.WristGear = new GearTuple((parse.ModelWrists[0] + parse.ModelWrists[1] * 256), parse.ModelWrists[2], 0); gear.RRingGear = new GearTuple((parse.ModelRightRing[0] + parse.ModelRightRing[1] * 256), parse.ModelRightRing[2], 0); gear.LRingGear = new GearTuple((parse.ModelLeftRing[0] + parse.ModelLeftRing[1] * 256), parse.ModelLeftRing[2], 0); } try { Residents[id].Gear = gear; } catch (Exception e) { throw e; } } } catch (Exception) { Residents = null; } }
public void MakeResidentList() { Residents = new Dictionary <int, CMResident>(); try { var npcResidentSheet = MainViewModel.lumina.GetExcelSheet <ENpcResident>(); foreach (var npc in npcResidentSheet) { Residents.Add((int)npc.RowId, new CMResident { Index = (int)npc.RowId, Name = npc.Singular }); } var npcBaseSheet = MainViewModel.lumina.GetExcelSheet <ENpcBase>(); foreach (var npc in npcBaseSheet) { var gear = new GearSet(); var customize = new List <byte>(); customize.AddRange(new List <byte>() { Convert.ToByte(npc.Race), npc.Gender, npc.BodyType, npc.Height, Convert.ToByte(npc.Tribe), npc.Face, npc.HairStyle, npc.HairHighlight, npc.SkinColor, npc.EyeHeterochromia, npc.HairColor, npc.HairHighlightColor, npc.FacialFeature, npc.FacialFeatureColor, npc.Eyebrows, npc.EyeColor, npc.EyeShape, npc.Nose, npc.Jaw, npc.Mouth, npc.LipColor, npc.BustOrTone1, npc.ExtraFeature1, npc.ExtraFeature2OrBust, npc.FacePaint, npc.FacePaintColor }); gear.ModelType = npc.ModelChara; gear.Customize = customize.ToArray(); WepTuple GetWeaponTuple(ulong model, Stain dye) => new WepTuple((short)model, (short)(model >> 16), (short)(model >> 32), (int)dye.RowId); GearTuple GetGearTuple(uint model, Stain dye = null) => new GearTuple((short)model, (short)(model >> 16), dye == null ? 0 : (int)dye.RowId); if (npc.NpcEquip.Row > 0) { gear.MainWep = GetWeaponTuple(npc.NpcEquip.Value.ModelMainHand, npc.NpcEquip.Value.DyeMainHand.Value); gear.OffWep = GetWeaponTuple(npc.NpcEquip.Value.ModelOffHand, npc.NpcEquip.Value.DyeOffHand.Value); gear.HeadGear = GetGearTuple(npc.NpcEquip.Value.ModelHead, npc.NpcEquip.Value.DyeHead.Value); gear.BodyGear = GetGearTuple(npc.NpcEquip.Value.ModelBody, npc.NpcEquip.Value.DyeBody.Value); gear.HandsGear = GetGearTuple(npc.NpcEquip.Value.ModelHands, npc.NpcEquip.Value.DyeHands.Value); gear.LegsGear = GetGearTuple(npc.NpcEquip.Value.ModelLegs, npc.NpcEquip.Value.DyeLegs.Value); gear.FeetGear = GetGearTuple(npc.NpcEquip.Value.ModelFeet, npc.NpcEquip.Value.DyeFeet.Value); gear.EarGear = GetGearTuple(npc.NpcEquip.Value.ModelEars); gear.NeckGear = GetGearTuple(npc.NpcEquip.Value.ModelNeck); gear.WristGear = GetGearTuple(npc.NpcEquip.Value.ModelWrists); gear.RRingGear = GetGearTuple(npc.NpcEquip.Value.ModelRightRing); gear.LRingGear = GetGearTuple(npc.NpcEquip.Value.ModelLeftRing); } else { gear.MainWep = GetWeaponTuple(npc.ModelMainHand, npc.DyeMainHand.Value); gear.OffWep = GetWeaponTuple(npc.ModelOffHand, npc.DyeOffHand.Value); gear.HeadGear = GetGearTuple(npc.ModelHead, npc.DyeHead.Value); gear.BodyGear = GetGearTuple(npc.ModelBody, npc.DyeBody.Value); gear.HandsGear = GetGearTuple(npc.ModelHands, npc.DyeHands.Value); gear.LegsGear = GetGearTuple(npc.ModelLegs, npc.DyeLegs.Value); gear.FeetGear = GetGearTuple(npc.ModelFeet, npc.DyeFeet.Value); gear.EarGear = GetGearTuple(npc.ModelEars); gear.NeckGear = GetGearTuple(npc.ModelNeck); gear.WristGear = GetGearTuple(npc.ModelWrists); gear.RRingGear = GetGearTuple(npc.ModelRightRing); gear.LRingGear = GetGearTuple(npc.ModelLeftRing); } Residents[(int)npc.RowId].Gear = gear; } } catch (Exception) { Residents = null; } }