public override void OnReadProperties(PacketReader stream) { base.OnReadProperties(stream); this.ItemType = (ItemTypes)stream.ReadByte(); this.name = stream.ReadString(); this.visualChange = stream.ReadString(); this.Material = (ItemMaterials)stream.ReadByte(); if (stream.ReadBit()) { this.Range = stream.ReadUShort(); } if (stream.ReadBit()) { this.Damage = stream.ReadUShort(); } if (stream.ReadBit()) { this.Protection = stream.ReadUShort(); } if (stream.ReadBit()) { this.InvOffset = stream.ReadVec3f(); } if (stream.ReadBit()) { this.InvRotation = stream.ReadCompressedAngles(); } }
public static ItemMaterial?GetItemMaterial(short itemId) { if (ItemMaterials.ContainsKey(itemId)) { return(ItemMaterials[itemId]); } return(null); }
public RequiredItemMaterials HowMuchIsNeeded(ChaldeaServant currentServant, ChaldeaServant goalServant, GrailCostNiceJson grailCostNiceJson, ServantNiceJson currentServantNiceJson) { // Validate the two servant objects are the same servant if (currentServant.ServantBasicInfo != goalServant.ServantBasicInfo) { return(null); } // Set up _requiredItemMaterials = new RequiredItemMaterials(); // Allows nice JSON info to be saved prior, if provided if (currentServantNiceJson != null && currentServantNiceJson.Id == currentServant.ServantBasicInfo.Id) { _currentServantNiceJson = currentServantNiceJson; } else { return(_requiredItemMaterials); } /* Calculate ascension materials, QP, and/or grails */ if (currentServant.ServantLevel < goalServant.ServantLevel) { AscensionLevel[] allAscensionLevels = AscensionLevels(currentServant.ServantBasicInfo.Rarity); // Find the required ascension levels with removing ascensions above the goal List <AscensionLevel> requiredAscensionLevels = allAscensionLevels .Where(i => currentServant.ServantLevel < i.LevelCap) .ToList(); requiredAscensionLevels.RemoveAll(c => goalServant.ServantLevel < c.LevelCap); // Ascension materials if (requiredAscensionLevels.Count > 0) { foreach (AscensionLevel ascensionLevel in requiredAscensionLevels) { ItemMaterials ascensionItemMaterials = AscensionItemMaterials(ascensionLevel); if (ascensionItemMaterials == null) { continue; } _requiredItemMaterials.Qp += ascensionItemMaterials.Qp; AddItemMaterials(ascensionItemMaterials.Items); } } // Grails if (goalServant.ServantLevel > allAscensionLevels[^ 1].LevelCap) { IEnumerable <GrailInfo> grailInfoList = GetGrailRarityInfo(goalServant.ServantBasicInfo.Rarity, grailCostNiceJson) .Where(g => g.AddLevelMax + currentServant.ServantLevel <= goalServant.ServantLevel); foreach (GrailInfo grailInfo in grailInfoList) { _requiredItemMaterials.Qp += grailInfo.Qp; _requiredItemMaterials.GrailCount++; } } // Overall ember count CalculateEmbersNeeded(currentServant, goalServant, _currentServantNiceJson.ExpGrowth); } /* Calculate skill materials and QP */ for (int i = 0; i < 3; i++) { int currentSkillLevel = currentServant.SkillLevels[i]; int goalSkillLevel = goalServant.SkillLevels[i]; if (currentSkillLevel < goalSkillLevel) { for (int j = currentSkillLevel; j < goalSkillLevel; j++) { switch (j) { case 1: AddItemMaterials(_currentServantNiceJson.SkillMaterials.FirstSkill.Items); _requiredItemMaterials.Qp += _currentServantNiceJson.SkillMaterials.FirstSkill.Qp; break; case 2: AddItemMaterials(_currentServantNiceJson.SkillMaterials.SecondSkill.Items); _requiredItemMaterials.Qp += _currentServantNiceJson.SkillMaterials.SecondSkill.Qp; break; case 3: AddItemMaterials(_currentServantNiceJson.SkillMaterials.ThirdSkill.Items); _requiredItemMaterials.Qp += _currentServantNiceJson.SkillMaterials.ThirdSkill.Qp; break; case 4: AddItemMaterials(_currentServantNiceJson.SkillMaterials.FourthSkill.Items); _requiredItemMaterials.Qp += _currentServantNiceJson.SkillMaterials.FourthSkill.Qp; break; case 5: AddItemMaterials(_currentServantNiceJson.SkillMaterials.FifthSkill.Items); _requiredItemMaterials.Qp += _currentServantNiceJson.SkillMaterials.FifthSkill.Qp; break; case 6: AddItemMaterials(_currentServantNiceJson.SkillMaterials.SixthSkill.Items); _requiredItemMaterials.Qp += _currentServantNiceJson.SkillMaterials.SixthSkill.Qp; break; case 7: AddItemMaterials(_currentServantNiceJson.SkillMaterials.SeventhSkill.Items); _requiredItemMaterials.Qp += _currentServantNiceJson.SkillMaterials.SeventhSkill.Qp; break; case 8: AddItemMaterials(_currentServantNiceJson.SkillMaterials.EighthSkill.Items); _requiredItemMaterials.Qp += _currentServantNiceJson.SkillMaterials.EighthSkill.Qp; break; case 9: AddItemMaterials(_currentServantNiceJson.SkillMaterials.NinthSkill.Items); _requiredItemMaterials.Qp += _currentServantNiceJson.SkillMaterials.NinthSkill.Qp; break; } } } } return(_requiredItemMaterials); }