private void Banditspecial(GameObject gameObject) { var component = gameObject.GetComponent <SkillLocator>(); var special = component.special; var skillDef = (SkillDef)ScriptableObject.CreateInstance(typeof(SkillDef)); skillDef.skillName = "Mortar"; skillDef.baseRechargeInterval = 5f; skillDef.baseMaxStock = 1; skillDef.rechargeStock = 1; skillDef.isBullets = false; skillDef.shootDelay = 0.3f; skillDef.beginSkillCooldownOnSkillEnd = false; skillDef.activationState = new SerializableEntityStateType(typeof(EntityStates.Toolbot.AimStunDrone)); skillDef.interruptPriority = InterruptPriority.Skill; skillDef.isCombatSkill = true; skillDef.noSprint = false; skillDef.canceledFromSprinting = false; skillDef.mustKeyPress = true; skillDef.requiredStock = 1; skillDef.stockToConsume = 1; //skillDef.icon = special.icon; var variant = new SkillFamily.Variant { skillDef = skillDef }; var skillFamily = special.skillFamily; Array.Resize(ref skillFamily.variants, skillFamily.variants.Length); skillFamily.variants[skillFamily.variants.Length - 1] = variant; }
public static void AddSkillVariant(SkillFamily skillFamily, NewSkillInfo nsi) { SkillDef skillDef = ScriptableObject.CreateInstance <SkillDef>(); skillDef.activationState = nsi.activationState; skillDef.activationStateMachineName = nsi.activationStateMachineName; skillDef.icon = nsi.icon; skillDef.skillName = nsi.skillName; skillDef.skillNameToken = nsi.skillNameToken; skillDef.skillDescriptionToken = nsi.skillDescriptionToken; skillDef.interruptPriority = nsi.interruptPriority; skillDef.baseRechargeInterval = nsi.baseRechargeInterval; skillDef.baseMaxStock = nsi.baseMaxStock; skillDef.rechargeStock = nsi.rechargeStock; skillDef.isBullets = nsi.isBullets; skillDef.shootDelay = nsi.shootDelay; skillDef.beginSkillCooldownOnSkillEnd = nsi.beginSkillCooldownOnSkillEnd; skillDef.requiredStock = nsi.requiredStock; skillDef.stockToConsume = nsi.stockToConsume; skillDef.isCombatSkill = nsi.isCombatSkill; skillDef.noSprint = nsi.noSprint; skillDef.canceledFromSprinting = nsi.canceledFromSprinting; skillDef.mustKeyPress = nsi.mustKeyPress; skillDef.fullRestockOnAssign = nsi.fullRestockOnAssign; SkillFamily.Variant variant = default; variant.skillDef = skillDef; variant.viewableNode = nsi.viewableNode; variant.unlockableName = nsi.unlockableName; int famVariantLength = skillFamily.variants.Length; Array.Resize(ref skillFamily.variants, famVariantLength + 1); skillFamily.variants[famVariantLength] = variant; }
private void CreateDefaultSpecial() { var skillDef = ScriptableObject.CreateInstance <ReactivatableSkillDef>(); var variant = new SkillFamily.Variant { skillDef = skillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node("SniperDefaultSpecial", false) }; var skillLoc = this.sniperBody.GetComponent <SkillLocator>(); var ind = skillLoc.special.skillFamily.variants.Length; Array.Resize <SkillFamily.Variant>(ref skillLoc.special.skillFamily.variants, ind + 1); skillLoc.special.skillFamily.variants[ind] = variant; LoadoutAPI.AddSkillDef(skillDef); LoadoutAPI.AddSkill(typeof(SniperKnife)); LoadoutAPI.AddSkill(typeof(SniperKnifeBlink)); LoadoutAPI.AddSkill(typeof(SniperKnifeSlash)); skillDef.activationState = new SerializableEntityStateType(typeof(SniperKnife)); skillDef.activationStateMachineName = "Weapon"; skillDef.interruptPriority = InterruptPriority.PrioritySkill; skillDef.icon = Resources.Load <Sprite>("NotAPath"); skillDef.reactivationState = new SerializableEntityStateType(typeof(SniperKnifeBlink)); skillDef.reactivationInterruptPriority = InterruptPriority.PrioritySkill; skillDef.reactivationIcon = Resources.Load <Sprite>("NotAPath"); skillDef.skillName = "SniperKnife"; skillDef.skillNameToken = "SNIPER_SPECIAL_NAME"; skillDef.skillDescriptionToken = "SNIPER_SPECIAL_DESC"; skillDef.isBullets = false; skillDef.beginSkillCooldownOnSkillEnd = false; skillDef.isCombatSkill = true; skillDef.noSprint = true; skillDef.canceledFromSprinting = false; skillDef.mustKeyPress = true; skillDef.fullRestockOnAssign = true; skillDef.reactivationNoSprint = false; skillDef.reactivationRestartsCooldown = false; skillDef.baseMaxStock = 1; skillDef.rechargeStock = 1; skillDef.requiredStock = 1; skillDef.stockToConsume = 1; skillDef.reactivationRequiredStock = 0; skillDef.reactivationStockToConsume = 0; skillDef.baseRechargeInterval = 10f; skillDef.shootDelay = 0.1f; skillDef.reactivationDelay = 0.2f; skillDef.reactivationWindow = 5f; }
private void RegisterSkills(GameObject sephPrefab) { // first get the locator var locator = sephPrefab.GetComponentInChildren <SkillLocator>(); // passive? locator.passiveSkill.enabled = true; locator.passiveSkill.skillDescriptionToken = "Attacks from Sephiroths Masamune leech life on hit."; locator.passiveSkill.skillNameToken = "Masamune"; locator.passiveSkill.icon = Assets.SephIcon; // create skill def for primary SkillDef primaryDef = SkillDef.CreateInstance <SkillDef>(); primaryDef.activationState = new EntityStates.SerializableEntityStateType(typeof(EntityStates.Sephiroth.Primary)); var field2 = typeof(EntityStates.SerializableEntityStateType)?.GetField("_typeName", BindingFlags.NonPublic | BindingFlags.Instance); field2?.SetValue(primaryDef.activationState, typeof(EntityStates.Sephiroth.Primary)?.AssemblyQualifiedName); primaryDef.baseRechargeInterval = 1f; primaryDef.baseMaxStock = 1; primaryDef.rechargeStock = 1; primaryDef.skillName = "SephSwipe"; primaryDef.skillNameToken = "Heartless Angel"; primaryDef.skillDescriptionToken = "Sephiroth unleashes a barrage of deadly precise attacks at high speed."; primaryDef.activationStateMachineName = locator.secondary.skillFamily.variants[0].skillDef.activationStateMachineName; primaryDef.isBullets = false; primaryDef.beginSkillCooldownOnSkillEnd = true; primaryDef.interruptPriority = EntityStates.InterruptPriority.Any; primaryDef.isCombatSkill = true; primaryDef.noSprint = false; primaryDef.canceledFromSprinting = false; primaryDef.mustKeyPress = true; primaryDef.requiredStock = 1; primaryDef.stockToConsume = 0; primaryDef.icon = Assets.SephIcon; // skill family for primary var primaryFam = SkillFamily.CreateInstance <SkillFamily>(); primaryFam.defaultVariantIndex = 0; SkillFamily.Variant[] variantsPrimary = new SkillFamily.Variant[1]; variantsPrimary[0] = new SkillFamily.Variant() { skillDef = primaryDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node("M1", false) }; primaryFam.variants = variantsPrimary; ((ScriptableObject)primaryFam).name = "sephPrimary"; //primary SkillAPI.AddSkill(typeof(EntityStates.Sephiroth.Primary)); SkillAPI.AddSkillDef(primaryDef); SkillAPI.AddSkillFamily(primaryFam); // add skills to player locator.primary.SetFieldValue <SkillFamily>("_skillFamily", primaryFam); }
// Token: 0x06001723 RID: 5923 RVA: 0x00064A78 File Offset: 0x00062C78 private static void GenerateViewables() { StringBuilder stringBuilder = new StringBuilder(); ViewablesCatalog.Node node = new ViewablesCatalog.Node("Loadout", true, null); ViewablesCatalog.Node parent = new ViewablesCatalog.Node("Bodies", true, node); for (int i = 0; i < BodyCatalog.bodyCount; i++) { if (SurvivorCatalog.GetSurvivorIndexFromBodyIndex(i) != SurvivorIndex.None) { string bodyName = BodyCatalog.GetBodyName(i); GenericSkill[] bodyPrefabSkillSlots = BodyCatalog.GetBodyPrefabSkillSlots(i); ViewablesCatalog.Node parent2 = new ViewablesCatalog.Node(bodyName, true, parent); for (int j = 0; j < bodyPrefabSkillSlots.Length; j++) { SkillFamily skillFamily = bodyPrefabSkillSlots[j].skillFamily; if (skillFamily.variants.Length > 1) { string skillFamilyName = SkillCatalog.GetSkillFamilyName(skillFamily.catalogIndex); uint num = 0U; while ((ulong)num < (ulong)((long)skillFamily.variants.Length)) { ref SkillFamily.Variant ptr = ref skillFamily.variants[(int)num]; string unlockableName = ptr.unlockableName; if (!string.IsNullOrEmpty(unlockableName)) { string skillName = SkillCatalog.GetSkillName(ptr.skillDef.skillIndex); stringBuilder.Append(skillFamilyName).Append(".").Append(skillName); string name = stringBuilder.ToString(); stringBuilder.Clear(); ViewablesCatalog.Node variantNode = new ViewablesCatalog.Node(name, false, parent2); ptr.viewableNode = variantNode; variantNode.shouldShowUnviewed = ((UserProfile userProfile) => !userProfile.HasViewedViewable(variantNode.fullName) && userProfile.HasUnlockable(unlockableName)); } num += 1U; } } } SkinDef[] bodySkins = BodyCatalog.GetBodySkins(i); if (bodySkins.Length > 1) { ViewablesCatalog.Node parent3 = new ViewablesCatalog.Node("Skins", true, parent2); for (int k = 0; k < bodySkins.Length; k++) { string unlockableName = bodySkins[k].unlockableName; if (!string.IsNullOrEmpty(unlockableName)) { ViewablesCatalog.Node skinNode = new ViewablesCatalog.Node(bodySkins[k].name, false, parent3); skinNode.shouldShowUnviewed = ((UserProfile userProfile) => !userProfile.HasViewedViewable(skinNode.fullName) && userProfile.HasUnlockable(unlockableName)); } } } } }
private SkillFamily.Variant[] GetVarients(List <ICustomSkill> skills) { var variants = new SkillFamily.Variant[skills.Count]; for (var i = 0; i < skills.Count(); i++) { var activationStateMachineName = dic[skills[i].SkillType] ?? "Unknown"; variants[i] = new SkillFamily.Variant() { skillDef = skills[i].GetSkillDefinition(activationStateMachineName), unlockableName = "", viewableNode = new ViewablesCatalog.Node(skills[i].SkillType.ToString(), false) }; } return(variants); }
// Token: 0x060023A8 RID: 9128 RVA: 0x0009BA40 File Offset: 0x00099C40 public static LoadoutPanelController.Row FromSkillSlot(LoadoutPanelController owner, int bodyIndex, int skillSlotIndex, GenericSkill skillSlot) { SkillFamily skillFamily = skillSlot.skillFamily; SkillLocator component = BodyCatalog.GetBodyPrefabBodyComponent(bodyIndex).GetComponent <SkillLocator>(); bool addWIPIcons = true; string titleToken; switch (component.FindSkillSlot(skillSlot)) { case SkillSlot.None: titleToken = "LOADOUT_SKILL_MISC"; addWIPIcons = false; break; case SkillSlot.Primary: titleToken = "LOADOUT_SKILL_PRIMARY"; addWIPIcons = false; break; case SkillSlot.Secondary: titleToken = "LOADOUT_SKILL_SECONDARY"; break; case SkillSlot.Utility: titleToken = "LOADOUT_SKILL_UTILITY"; break; case SkillSlot.Special: titleToken = "LOADOUT_SKILL_SPECIAL"; break; default: throw new ArgumentOutOfRangeException(); } LoadoutPanelController.Row row = new LoadoutPanelController.Row(owner, bodyIndex, titleToken); for (int i = 0; i < skillFamily.variants.Length; i++) { ref SkillFamily.Variant ptr = ref skillFamily.variants[i]; uint skillVariantIndexToAssign = (uint)i; row.AddButton(ptr.skillDef.icon, ptr.skillDef.skillNameToken, ptr.skillDef.skillDescriptionToken, row.primaryColor, delegate { Loadout loadout = new Loadout(); row.userProfile.CopyLoadout(loadout); loadout.bodyLoadoutManager.SetSkillVariant(bodyIndex, skillSlotIndex, skillVariantIndexToAssign); row.userProfile.SetLoadout(loadout); }, ptr.unlockableName, ptr.viewableNode, false); }
private static void AssignVariants(SkillFamily fam, SkillDef[] skills) { SkillFamily.Variant[] variants = new SkillFamily.Variant[skills.Length]; for (Int32 i = 0; i < skills.Length; i++) { variants[i] = new SkillFamily.Variant { skillDef = skills[i], unlockableName = "", viewableNode = new ViewablesCatalog.Node(skills[i].skillNameToken, false) }; SkillsCore.AddSkillDef(skills[i]); } fam.variants = variants; }
private void CreateDefaultPrimary() { var skillDef = ScriptableObject.CreateInstance <SkillDef>(); var variant = new SkillFamily.Variant { skillDef = skillDef, unlockableName = "", viewableNode = new ViewablesCatalog.Node("SniperDefaultPrimary", false) }; var skillLoc = this.sniperBody.GetComponent <SkillLocator>(); var ind = skillLoc.primary.skillFamily.variants.Length; Array.Resize <SkillFamily.Variant>(ref skillLoc.primary.skillFamily.variants, ind + 1); skillLoc.primary.skillFamily.variants[ind] = variant; LoadoutAPI.AddSkillDef(skillDef); LoadoutAPI.AddSkill(typeof(SniperShoot)); LoadoutAPI.AddSkill(typeof(SniperReload)); LoadoutAPI.AddSkill(typeof(SniperLoaded)); skillDef.activationState = new SerializableEntityStateType(typeof(SniperShoot)); skillDef.activationStateMachineName = "Load"; skillDef.interruptPriority = InterruptPriority.Skill; skillDef.icon = Resources.Load <Sprite>("NotAPath"); skillDef.skillName = "SniperShoot"; skillDef.skillNameToken = "SNIPER_PRIMARY_NAME"; skillDef.skillDescriptionToken = "SNIPER_PRIMARY_DESC"; skillDef.isBullets = false; skillDef.beginSkillCooldownOnSkillEnd = false; skillDef.isCombatSkill = true; skillDef.noSprint = true; skillDef.canceledFromSprinting = false; skillDef.mustKeyPress = true; skillDef.fullRestockOnAssign = true; skillDef.baseMaxStock = 1; skillDef.rechargeStock = 1; skillDef.requiredStock = 1; skillDef.stockToConsume = 1; skillDef.baseRechargeInterval = 0f; skillDef.shootDelay = 0.1f; }
private void CreateEngiSkill() { SkillDef def = ScriptableObject.CreateInstance <SkillDef>(); var family = engi.GetComponent <SkillLocator>().special.skillFamily; def.activationState = new EntityStates.SerializableEntityStateType(typeof(Skills.Engi.Special.PlaceOmegaTurret)); def.activationStateMachineName = "Weapon"; def.interruptPriority = EntityStates.InterruptPriority.Skill; def.icon = family.variants[1].skillDef.icon; def.baseRechargeInterval = (_DEBUGGING ? 1f : 60f); def.shootDelay = 0.0f; def.baseMaxStock = 1; def.rechargeStock = 1; def.requiredStock = 1; def.stockToConsume = 0; def.isBullets = false; def.beginSkillCooldownOnSkillEnd = true; def.isCombatSkill = false; def.noSprint = true; def.canceledFromSprinting = false; def.mustKeyPress = false; def.fullRestockOnAssign = true; var variant = new SkillFamily.Variant { viewableNode = new RoR2.ViewablesCatalog.Node("OmegaNodeThing", false), skillDef = def, unlockableName = "" }; RoR2Plugin.SkillsAPI.AddSkillDef(def); Array.Resize <SkillFamily.Variant>(ref family.variants, family.variants.Length + 1); family.variants[family.variants.Length - 1] = variant; }
private void RegisterSkills() { SkillAPI.AddSkill(typeof(States.Secondary.FireSpray)); var newSecondaryDef = ScriptableObject.CreateInstance <SkillDef>(); newSecondaryDef.activationState = new EntityStates.SerializableEntityStateType(typeof(States.Secondary.FireSpray)); newSecondaryDef.activationStateMachineName = "Mouth"; newSecondaryDef.baseMaxStock = 1; newSecondaryDef.baseRechargeInterval = 2f; newSecondaryDef.beginSkillCooldownOnSkillEnd = false; newSecondaryDef.canceledFromSprinting = false; newSecondaryDef.fullRestockOnAssign = true; newSecondaryDef.interruptPriority = EntityStates.InterruptPriority.Any; newSecondaryDef.isBullets = false; newSecondaryDef.isCombatSkill = true; newSecondaryDef.mustKeyPress = false; newSecondaryDef.noSprint = false; newSecondaryDef.rechargeStock = 1; newSecondaryDef.requiredStock = 1; newSecondaryDef.shootDelay = 0.3f; newSecondaryDef.skillDescriptionToken = ""; newSecondaryDef.skillName = ""; newSecondaryDef.skillNameToken = ""; newSecondaryDef.stockToConsume = 1; newSecondaryDef.icon = Resources.Load <Sprite>("NotAPath"); SkillFamily.Variant variant = new SkillFamily.Variant { skillDef = newSecondaryDef, unlockableName = "", viewableNode = new RoR2.ViewablesCatalog.Node("M2", false) }; var skillLocator = acridBody.GetComponent <SkillLocator>(); var skillFamily = skillLocator.secondary.skillFamily; var variants = skillFamily.variants; Array.Resize <SkillFamily.Variant>(ref variants, variants.Length + 1); variants[variants.Length - 1] = variant; skillFamily.variants = variants; SkillAPI.AddSkillDef(newSecondaryDef); var refState = (EntityStates.Croco.FireSpit)EntityStates.EntityState.Instantiate(new EntityStates.SerializableEntityStateType(typeof(EntityStates.Croco.FireSpit))); States.Secondary.FireSpray.effectPrefab = refState.effectPrefab; States.Secondary.FireSpray.attackString = refState.attackString; States.Secondary.FireSpray.baseDuration = refState.baseDuration; States.Secondary.FireSpray.bloom = refState.bloom; States.Secondary.FireSpray.force = refState.force; States.Secondary.FireSpray.recoilAmplitude = refState.recoilAmplitude; States.Secondary.FireSpray.damageRatio = refState.damageCoefficient * 1.1f / numberOfPellets; States.Secondary.FireSpray.spreadCone = Mathf.PI / 36f; States.Secondary.FireSpray.pellets = numberOfPellets; SkillAPI.AddSkill(typeof(States.Utility.PrepPoisonJump)); SkillAPI.AddSkill(typeof(States.Utility.PrepChainJump)); SkillAPI.AddSkill(typeof(States.Utility.BasePrepJump)); var utilityFamily = skillLocator.utility.skillFamily; var utilDef1 = utilityFamily.variants[0].skillDef; var utilDef2 = utilityFamily.variants[1].skillDef; utilDef1.activationState = new EntityStates.SerializableEntityStateType(typeof(States.Utility.PrepPoisonJump)); utilDef2.activationState = new EntityStates.SerializableEntityStateType(typeof(States.Utility.PrepChainJump)); utilDef1.mustKeyPress = true; utilDef2.mustKeyPress = true; utilDef1.beginSkillCooldownOnSkillEnd = true; utilDef2.beginSkillCooldownOnSkillEnd = true; utilDef1.noSprint = false; utilDef2.noSprint = false; }