public bool directionColliding(CharacterBody.Direction dir) { if (dir == CharacterBody.Direction.LEFT) return LeftIsColliding (); else if (dir == CharacterBody.Direction.RIGHT) return RightIsColliding (); else if (dir == CharacterBody.Direction.UP) return TopIsColliding (); else return BotIsColliding (); }
public void AddShrineStack(Interactor interactor) { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.ShrineBloodBehavior::AddShrineStack(RoR2.Interactor)' called on client"); return; } this.waitingForRefresh = true; CharacterBody component = interactor.GetComponent <CharacterBody>(); if (component) { uint amount = (uint)(component.healthComponent.fullCombinedHealth * (float)this.purchaseInteraction.cost / 100f * this.goldToPaidHpRatio); if (component.master) { component.master.GiveMoney(amount); Chat.SendBroadcastChat(new Chat.SubjectFormatChatMessage { subjectAsCharacterBody = component, baseToken = "SHRINE_BLOOD_USE_MESSAGE", paramTokens = new string[] { amount.ToString() } }); } } EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData { origin = base.transform.position, rotation = Quaternion.identity, scale = 1f, color = Color.red }, true); this.purchaseCount++; this.refreshTimer = 2f; if (this.purchaseCount >= this.maxPurchaseCount) { this.symbolTransform.gameObject.SetActive(false); } }
private void GlobalEventManager_OnHitEnemy(On.RoR2.GlobalEventManager.orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { orig(self, damageInfo, victim); if (damageInfo.attacker && damageInfo.procCoefficient >= 1f) { CharacterBody attackerBody = damageInfo.attacker.GetComponent <CharacterBody>(); if (attackerBody) { if (attackerBody.HasBuff(Modules.Buffs.overchargeBuff)) { float damageCoefficient = 0.75f; float damageValue = Util.OnHitProcDamage(damageInfo.damage, attackerBody.damage, damageCoefficient); LightningOrb lightningOrb = new LightningOrb(); lightningOrb.origin = damageInfo.position; lightningOrb.damageValue = damageValue; lightningOrb.isCrit = damageInfo.crit; lightningOrb.bouncesRemaining = 3; lightningOrb.teamIndex = attackerBody.teamComponent.teamIndex; lightningOrb.attacker = damageInfo.attacker; lightningOrb.bouncedObjects = new List <HealthComponent> { victim.GetComponent <HealthComponent>() }; lightningOrb.procChainMask = damageInfo.procChainMask; lightningOrb.procChainMask.AddProc(ProcType.ChainLightning); lightningOrb.procCoefficient = 0f; lightningOrb.lightningType = LightningOrb.LightningType.Loader; lightningOrb.damageColorIndex = DamageColorIndex.Default; lightningOrb.range += 6f; HurtBox hurtBox = lightningOrb.PickNextTarget(damageInfo.position); if (hurtBox) { lightningOrb.target = hurtBox; OrbManager.instance.AddOrb(lightningOrb); } } } } }
public override float RecalculateAttackSpeed(float baseValue, CharacterBody character) { float BaseAttackSpeed = character.baseAttackSpeed + character.levelAttackSpeed * (character.level - 1); //Item efect float AttackSpeedBonus = 1f; if (character.inventory) { if (character.inventory.currentEquipmentIndex == EquipmentIndex.AffixYellow) { AttackSpeedBonus += 0.5f; } } //Buffs float AttackSpeedMult = AttackSpeedBonus + character.GetFieldValue <int[]>("buffs")[2] * 0.12f; if (character.HasBuff(BuffIndex.Warbanner)) { AttackSpeedMult += 0.3f; } if (character.HasBuff(BuffIndex.EnrageAncientWisp)) { AttackSpeedMult += 2f; } if (character.HasBuff(BuffIndex.WarCryBuff)) { AttackSpeedMult += 1f; } BaseAttackSpeed += ModItemManager.GetBonusForStat(character, StatIndex.AttackSpeed); AttackSpeedMult += ModItemManager.GetMultiplierForStat(character, StatIndex.AttackSpeed); float AttackSpeed = BaseAttackSpeed * AttackSpeedMult; //Debuff AttackSpeed *= 1 - (0.05f * character.GetBuffCount(BuffIndex.BeetleJuice)); return(AttackSpeed); }
public void OnPointerClick(PointerEventData eventData) { if (!NetworkServer.active || Inventory == null || IsMaster) { return; } if (ItemDropped) { return; } ItemDropped = true; CharacterBody characterBody = Inventory.GetComponent <CharacterMaster>().GetBody(); Api.Notification notification = characterBody.gameObject.AddComponent <Api.Notification>();; notification.transform.SetParent(characterBody.transform); notification.SetPosition(new Vector3((float)(Screen.width * 0.8), (float)(Screen.height * 0.25), 0)); Transform transform = characterBody.transform; if (EquipmentIndex != EquipmentIndex.None) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(EquipmentIndex); notification.SetIcon(Resources.Load <Texture>(equipmentDef.pickupIconPath)); notification.GetTitle = () => "Equipment dropped"; notification.GetDescription = () => $"{Language.GetString(equipmentDef.nameToken)}"; Inventory.SetEquipmentIndex(EquipmentIndex.None); PickupDropletController.CreatePickupDroplet(new PickupIndex(EquipmentIndex), transform.position, Vector3.up * 20f + transform.forward * 10f); Destroy(this); return; } ItemDef itemDef = ItemCatalog.GetItemDef(ItemIndex); notification.SetIcon(Resources.Load <Texture>(itemDef.pickupIconPath)); notification.GetTitle = () => "Item dropped"; notification.GetDescription = () => $"{Language.GetString(itemDef.nameToken)}"; Inventory.RemoveItem(ItemIndex, 1); PickupDropletController.CreatePickupDroplet(new PickupIndex(ItemIndex), transform.position, Vector3.up * 20f + transform.forward * 10f); Destroy(this); }
/* * public static string GetCleanseShrineText(float CurseCount) * { * string[] cleanseShrineText = * { * "The spectres don't disturb you.", * "You are touched by darkness.", * "You are wreathed in darkness.", * "Tarry not. They come for you.", * "No one can help you." * }; * switch (CurseCount) * { * case 0: * case 1: * case 2: * return cleanseShrineText[0]; * case 3: * case 4: * return cleanseShrineText[1]; * case 5: * case 6: * return cleanseShrineText[2]; * case 7: * case 8: * case 9: * return cleanseShrineText[3]; * default: * return cleanseShrineText[4]; * } * } * * public static float GetCurseCount(CharacterBody characterBody = null) * { * var curseIndex = Items.CurseController.curseTally; * if (!characterBody) * return HelperUtil.GetPlayersItemCount(curseIndex); * return characterBody.inventory.GetItemCount(curseIndex); * } */ public static void JamEnemy(CharacterBody body, float curseChance = 100f) { var curseEffect = Resources.Load <GameObject>("prefabs/effects/ImpSwipeEffect"); if (Util.CheckRoll(curseChance)) { EffectManager.SpawnEffect(curseEffect, new EffectData { origin = body.transform.position + Vector3.up * 2, //rotation = Util.QuaternionSafeLookRotation(Vector3.up), scale = 2f }, false); //body.AddBuff(Items.GungeonBuffController.Jammed); IsJammed jammed = body.gameObject.GetComponent <IsJammed>(); if (!jammed) { jammed = body.gameObject.AddComponent <IsJammed>(); } jammed.characterBody = body; } }
private void CharacterBody_Update(On.RoR2.CharacterBody.orig_Update orig, CharacterBody self) { orig(self); if (self.hasAuthority && self.isPlayerControlled && self.master && !LocalUserManager.readOnlyLocalUsersList[0].isUIFocused && Input.GetKeyDown(keyToDrop)) { if (NetworkServer.active) { if (preventMoneyDrops) { return; } ReleaseMoney(self.master); } else { self.AddTimedBuffAuthority(DoshContent.pendingDoshBuff.buffIndex, 1000000f); } } }
/// <summary> /// Spawn spite bombs the same way the game does, except the bomb's team is ALWAYS monster. /// </summary> /// <param name="body"></param> public void SpawnMonsterBombFromBody(CharacterBody body, int?bombOverride = null) { Vector3 corePosition = body.corePosition; int num = bombOverride ?? Mathf.Min(maxBombCount, Mathf.CeilToInt(body.bestFitRadius * extraBombPerRadius * cvSpiteBombCoefficient.value)); for (int i = 0; i < num; i++) { Vector3 b = UnityEngine.Random.insideUnitSphere * (bombSpawnBaseRadius + body.bestFitRadius * bombSpawnRadiusCoefficient); BombRequest bombRequest = new BombRequest { spawnPosition = corePosition, raycastOrigin = corePosition + b, bombBaseDamage = body.damage * bombDamageCoefficient, attacker = body.gameObject, teamIndex = TeamIndex.Monster, velocityY = UnityEngine.Random.Range(5f, 25f) }; //We add it to our own custom queue (thats why of the DelayerManager) AddEntry(bombRequest); } }
private void Start() { if (NetworkServer.active) { this.rng = new Xoroshiro128Plus(Run.instance.treasureRng.nextUlong); } if (Util.CheckRoll(this.spawnRate)) { this.body = base.GetComponent <CharacterBody>(); if (this.body) { this.master = this.body.master; if (this.master) { this.ApplyBuffs(); } } } }
public override void ElementBurst() { base.ElementBurst(); BlastAttack blastAttack = MakeBlastAttack(); blastAttack.Fire(); BlastAttack.HitPoint[] hits = blastAttack.CollectHits(); foreach (BlastAttack.HitPoint hit in hits) { CharacterBody victimBody = hit.hurtBox.healthComponent.body; if (victimBody) { if (!victimBody.HasBuff(Buffs.chillCooldown)) { victimBody.AddTimedBuff(Buffs.chillDebuff, StaticValues.chillDebuffDuration, StaticValues.chillDebuffMaxStacks); } } } }
// Token: 0x0600203F RID: 8255 RVA: 0x00097A9C File Offset: 0x00095C9C public virtual void OnBodyStart(CharacterBody newBody) { this.body = newBody; this.bodyTransform = newBody.transform; this.bodyCharacterDirection = newBody.GetComponent <CharacterDirection>(); this.bodyCharacterMotor = newBody.GetComponent <CharacterMotor>(); this.bodyInputBank = newBody.GetComponent <InputBankTest>(); this.bodyHealthComponent = newBody.GetComponent <HealthComponent>(); this.bodySkillLocator = newBody.GetComponent <SkillLocator>(); this.localNavigator.SetBody(newBody); base.enabled = true; if (this.stateMachine && Util.HasEffectiveAuthority(this.networkIdentity)) { this.stateMachine.enabled = true; this.stateMachine.SetNextState(EntityState.Instantiate(this.scanState)); } if (this.bodyInputBank) { this.desiredAimDirection = this.bodyInputBank.aimDirection; } }
// Token: 0x060026CC RID: 9932 RVA: 0x000A95BC File Offset: 0x000A77BC public void AddBodyLore(CharacterBody characterBody) { bool flag = false; string token = ""; string baseNameToken = characterBody.baseNameToken; if (!string.IsNullOrEmpty(baseNameToken)) { token = baseNameToken.Replace("_NAME", "_LORE"); if (!Language.IsTokenInvalid(token)) { flag = true; } } if (flag) { this.AddNotesPanel(Language.GetString(token)); return; } this.AddNotesPanel(Language.GetString("EARLY_ACCESS_LORE")); }
public static bool CheckForDebuffs(CharacterBody characterBody) { BuffIndex buffIndex = 0; BuffIndex buffCount = (BuffIndex)BuffCatalog.buffCount; while (buffIndex < buffCount) { BuffDef buffDef = BuffCatalog.GetBuffDef(buffIndex); if (buffDef.isDebuff && characterBody.HasBuff(buffIndex)) { if (characterBody.HasBuff(buffIndex)) { //Debug.Log("debuffs!"); return(true); } } buffIndex++; } Debug.Log("no debuffs?!"); return(false); }
public void initSamusHUD(CharacterBody characterbody) { character = characterbody; threatIntf.SetHudType(hudTypes.combat); threatIntf.SetThreatDistance(100f); tempHealth = character.healthComponent.fullCombinedHealth; curState = EHudState.Combat; //nextState = EHudState.None; // setState = EHudState.None; if (!hudcolors.init) { updateHudState(); } //InitializeFrameGluePermanent(); //InitializeDamageLight(); UpdateEnergy(0f, true); energyLow = false; UpdateMissile(0f, true); UpdateBallMode(true); //CheckFrameColors(); }
public static void RecalcStats(CharacterBody characterBody) { characterBody.SetFieldValue("experience", TeamManager.instance.GetTeamExperience(characterBody.teamComponent.teamIndex)); characterBody.SetFieldValue("level", TeamManager.instance.GetTeamLevel(characterBody.teamComponent.teamIndex)); /* Calculate Vanilla items effects * * TODO */ PlayerStats playerStats = null; //TODO: initialize this from characterBody foreach (var effectAction in CustomEffects) { effectAction(playerStats); } //characterBody.statsDirty = false; }
public void Awake() { if (!characterBody) { characterBody = gameObject.GetComponent <CharacterBody>(); } isNetwork = NetworkServer.active; this.localUser = LocalUserManager.readOnlyLocalUsersList[0]; foreach (var entityStateMachine in gameObject.GetComponents <EntityStateMachine>()) { if (entityStateMachine.customName == "Body") { outer = entityStateMachine; break; } } survivorDef = SurvivorCatalog.GetSurvivorDef(SurvivorCatalog.GetSurvivorIndexFromBodyIndex(characterBody.bodyIndex)); }
private void PurchaseInteraction_OnInteractionBegin(On.RoR2.PurchaseInteraction.orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { orig(self, activator); CharacterBody characterBody = activator.GetComponent <CharacterBody>(); if (characterBody && characterBody.inventory) { var itemCount = GetCount(characterBody); if (itemCount > 0) { var isBloodShrine = self.costType == CostTypeIndex.PercentHealth; if ((isBloodShrine && Mustache_BloodShrine) || !isBloodShrine) { if (Mustache_BloodShrine) { Heal(characterBody); } } } } }
public virtual void QueueBomb(CharacterBody body) { Vector3 corePosition = body.corePosition; float bombComputation = body.bestFitRadius * extraBombPerRadius * cvSpiteBombCoefficient.value; int num = Mathf.Min(maxBombCount, Mathf.CeilToInt(bombComputation)); for (int i = 0; i < num; i++) { Vector3 b = Random.insideUnitSphere * (bombSpawnBaseRadius + body.bestFitRadius * bombSpawnRadiusCoefficient); BombRequest item = new BombRequest { spawnPosition = corePosition, raycastOrigin = corePosition + b, bombBaseDamage = body.damage * bombDamageCoefficient, attacker = body.gameObject, teamIndex = body.teamComponent.teamIndex, velocityY = Random.Range(5f, 25f) }; Add(item); } }
private static void DrawViewLine(ConCommandArgs args) { var localMaster = PlayerCharacterMasterController.instances[0].master; GameObject bodyInstanceObject = localMaster.bodyInstanceObject; CharacterBody characterBody = bodyInstanceObject.GetComponent <CharacterBody>(); LaserPointerController laserPointerController = bodyInstanceObject.GetComponent <LaserPointerController>(); if (laserPointerController) { UnityEngine.Object.Destroy(laserPointerController); UnityEngine.Object.Destroy(bodyInstanceObject.GetComponent <LaserPointer>()); } else { laserPointerController = bodyInstanceObject.AddComponent <LaserPointerController>(); LaserPointer laserPointer = bodyInstanceObject.AddComponent <LaserPointer>(); laserPointer.laserDistance = 10000f; laserPointerController.source = characterBody.inputBank; laserPointerController.beam = laserPointer.line; } }
// Token: 0x060027C1 RID: 10177 RVA: 0x000AB228 File Offset: 0x000A9428 private void OnShrineChancePurchase(bool failed, Interactor interactor) { CharacterBody currentBody = this.serverAchievementTracker.networkUser.GetCurrentBody(); if (currentBody && currentBody.GetComponent <Interactor>() == interactor) { if (failed) { this.failedInARow++; if (this.failedInARow >= 3) { base.Grant(); return; } } else { this.failedInARow = 0; } } }
private void OnGrantItem( On.RoR2.GenericPickupController.orig_GrantItem orig, GenericPickupController self, CharacterBody body, Inventory inventory ) { GrantItem = orig; genericPickupController = self; ItemIndex itemIndex = PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex; if (PreventPickupConfigEntries.ContainsKey(itemIndex) && PreventPickupConfigEntries[itemIndex].Value) { GiveRandomItem(body, inventory, itemIndex); return; } orig.Invoke(self, body, inventory); }
private void ModifyDroneModel(CharacterBody bodyRed, CharacterBody bodyGreen) { GameObject customModel = assetBundle.LoadAsset <GameObject>("Assets/Drones/PsiBits/Model/mdlPsiBitRed.prefab"); droneBodyRed.ReplaceModel(customModel, DebugCheck()); customModel.transform.localRotation = Util.QuaternionSafeLookRotation(Vector3.left); customModel.InitializeDroneModelComponents(bodyRed, 3f); customModel.transform.Find("Core").gameObject.AddComponent <CoreFlicker>(); BodyRotation rotationComponent = customModel.transform.parent.gameObject.AddComponent <BodyRotation>(); rotationComponent.rotationDirection = -1; rotationComponent.rotationSpeed = 6f; customModel = assetBundle.LoadAsset <GameObject>("Assets/Drones/PsiBits/Model/mdlPsiBitGreen.prefab"); droneBodyGreen.ReplaceModel(customModel, DebugCheck()); customModel.transform.localRotation = Util.QuaternionSafeLookRotation(Vector3.left); customModel.InitializeDroneModelComponents(bodyGreen, 3f); customModel.transform.Find("Core").gameObject.AddComponent <CoreFlicker>(); rotationComponent = customModel.transform.parent.gameObject.AddComponent <BodyRotation>(); rotationComponent.rotationDirection = 1; rotationComponent.rotationSpeed = 6f; }
public static void FilterOutMinionGroup(this BullseyeSearch search, NetworkInstanceId netId) { List <MinionOwnership.MinionGroup> minionGroups = (List <MinionOwnership.MinionGroup>) typeof(MinionOwnership.MinionGroup).GetField("instancesList", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null); for (int i = 0; i < minionGroups.Count; i++) { if (netId == minionGroups[i].ownerId) { MinionOwnership[] members = minionGroups[i].GetFieldValue <MinionOwnership[]>("members"); for (int j = 0; j < minionGroups[i].memberCount; j++) { CharacterBody minionBody = members[j].GetComponent <CharacterMaster>().GetBody(); if (minionBody) { search.FilterOutGameObject(minionBody.gameObject); } } break; } } }
public static float GetModifiedDuration(CharacterBody body, bool isDebuff, float duration) { Inventory inventory = body.inventory; if (inventory) { int itemCount = inventory.GetItemCount(MysticsItemsContent.Items.MysticsItems_Cookie); if (itemCount > 0) { if (isDebuff) { duration = Mathf.Min(Mathf.Max(duration - debuffDuration - debuffDurationPerStack * (itemCount - 1), 1f), duration); } else { duration += buffDuration + buffDurationPerStack * (itemCount - 1); } } } return(duration); }
// Token: 0x06000EB3 RID: 3763 RVA: 0x00041354 File Offset: 0x0003F554 private void RecalculateHealth(GameObject playerObject) { this.rtpcPlayerHealthValue.value = 100f; if (this.target) { CharacterBody component = this.target.GetComponent <CharacterBody>(); if (component) { if (component.HasBuff(BuffIndex.Deafened)) { this.rtpcPlayerHealthValue.value = -100f; return; } HealthComponent healthComponent = component.healthComponent; if (healthComponent) { this.rtpcPlayerHealthValue.value = healthComponent.combinedHealthFraction * 100f; } } } }
private void UpdatePhotonFuel(CharacterBody tgt) { var cpt = tgt.GetComponent <PhotonJetpackComponent>(); if (!cpt) { cpt = tgt.gameObject.AddComponent <PhotonJetpackComponent>(); } int stacks = GetCount(tgt); cpt.fuelCap = stacks > 0 ? baseFuel + stackFuel * (stacks - 1) : 0; if (cpt.fuel > cpt.fuelCap) { cpt.fuel = cpt.fuelCap; } if (cpt.fuelCap == 0) { tgt.SetBuffCount(photonFuelBuff, 0); } }
public override void Effect(GlobalEventManager globalEventManager, DamageInfo damageInfo, GameObject victim, int itemCount) { CharacterBody body = damageInfo.attacker.GetComponent <CharacterBody>(); CharacterBody Attacker = damageInfo.attacker.GetComponent <CharacterBody>(); CharacterBody characterBody = victim ? victim.GetComponent <CharacterBody>() : null; CharacterMaster master = Attacker.master; Inventory inventory = master.inventory; TeamComponent Team = Attacker.GetComponent <TeamComponent>(); TeamIndex attackerTeamIndex = Team ? Team.teamIndex : TeamIndex.Neutral; Vector3 aimOrigin = Attacker.aimOrigin; Vector3 position = damageInfo.position; Vector3 forward = characterBody.corePosition - position; Quaternion rotation = forward.magnitude != 0.0 ? Util.QuaternionSafeLookRotation(forward) : UnityEngine.Random.rotationUniform; float damageCoefficient = (float)(1.25 + 1.25 * itemCount); float damage = Util.OnHitProcDamage(damageInfo.damage, Attacker.damage, damageCoefficient); #pragma warning disable CS0618 // Obsolete Warning Ignore ProjectileManager.instance.FireProjectile(Resources.Load <GameObject>("Prefabs/Projectiles/StickyBomb"), position, rotation, damageInfo.attacker, damage, 100f, damageInfo.crit, DamageColorIndex.Item, (GameObject)null, forward.magnitude * 60f); #pragma warning restore CS0618 }
public static void AddMaxShieldHelper(CharacterBody sender, StatHookEventArgs args, int inventoryCount, float baseStackHPPercent, float addStackHPPercent) { //if (inventoryCount > 0) //Keroro's preferred behavior. //{ // if (sender.inventory.GetItemCount(ItemIndex.ShieldOnly) > 0) // { // args.baseShieldAdd += ((sender.maxShield * baseStackHPPercent) + ((sender.maxShield * addStackHPPercent * (inventoryCount - 1)))); // } // else // { // args.baseShieldAdd += ((sender.maxHealth * baseStackHPPercent) + ((sender.maxHealth * addStackHPPercent) * (inventoryCount - 1))); // }; //} if (inventoryCount > 0) //Personal Shield Generator behavior. { if (sender.inventory.GetItemCount(RoR2Content.Items.ShieldOnly) > 0) //Retained the if-else statement to increase compatibility with mods that add HP in unexpected ways when the player does not have Transcendence. { //Max health before Transcendence transformation is not stored in any way. It must be recalculated manually. The following code was adapted from CharacterBody.RecalculateStats(). float calcHealthMultiplier = 1f //Base multiplier + (float)sender.inventory.GetItemCount(RoR2Content.Items.BoostHp) * 0.1f //BoostHp + (float)(sender.inventory.GetItemCount(RoR2Content.Items.Pearl) + sender.inventory.GetItemCount(RoR2Content.Items.ShinyPearl)) * 0.1f; //Pearls; float calcMaxHealth = ((sender.baseMaxHealth + sender.levelMaxHealth * (sender.level - 1)) //Base max HP + (float)sender.inventory.GetItemCount(RoR2Content.Items.Knurl) * 40f //Knurls + (sender.inventory.GetItemCount(RoR2Content.Items.Infusion) > 0 ? sender.inventory.infusionBonus : 0)) //Infusion * calcHealthMultiplier //Health multiplier - pearls and BoostHp / ((float)sender.inventory.GetItemCount(RoR2Content.Items.CutHp) + 1) //Shaped Glass * (sender.inventory.GetItemCount(RoR2Content.Items.InvadingDoppelganger) > 0 ? 10 : 1); //Check if you're a doppelganger. args.baseShieldAdd += (calcMaxHealth * baseStackHPPercent) + (calcMaxHealth * addStackHPPercent) * (inventoryCount - 1); } else { args.baseShieldAdd += ((sender.maxHealth * baseStackHPPercent) + ((sender.maxHealth * addStackHPPercent) * (inventoryCount - 1))); }; } }
public static void GetCharacter() { try { if (InGameCheck()) { LocalNetworkUser = null; foreach (NetworkUser readOnlyInstance in NetworkUser.readOnlyInstancesList) { if (readOnlyInstance.isLocalPlayer) { LocalNetworkUser = readOnlyInstance; LocalPlayer = LocalNetworkUser.master; LocalPlayerInv = LocalPlayer.GetComponent <Inventory>(); //gets player inventory LocalHealth = LocalPlayer.GetBody().GetComponent <HealthComponent>(); //gets players local health numbers LocalSkills = LocalPlayer.GetBody().GetComponent <SkillLocator>(); //gets current for local character skills LocalPlayerBody = LocalPlayer.GetBody().GetComponent <CharacterBody>(); //gets all stats for local character LocalMotor = LocalPlayer.GetBody().GetComponent <CharacterMotor>(); bool flag = !LocalPlayer.IsDeadAndOutOfLivesServer(); if (flag) { characterCollected = true; //Main.enableRespawnButton = true; } else { characterCollected = false; } } } } } catch (Exception e) { Debug.LogError($"GetCharacter caused an exception: {e}"); characterCollected = false; } }
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member private CharacterSpawnCard ImpOriginSetup(CharacterSpawnCard origCsc, Material material, Texture icon, string name, string subtitle, int renderInfoIndex) { GameObject masterObject = origCsc.prefab; masterObject = masterObject.InstantiateClone(masterObject.name + originSuffix, true); masterObjects.Add(masterObject); CharacterMaster master = masterObject.GetComponent <CharacterMaster>(); GameObject bodyObject = master.bodyPrefab; bodyObject = bodyObject.InstantiateClone(bodyObject.name + originSuffix, true); bodyObjects.Add(bodyObject); CharacterBody body = bodyObject.GetComponent <CharacterBody>(); body.baseNameToken += originSuffix; body.subtitleNameToken += originSuffix; LanguageAPI.Add(body.baseNameToken, name); LanguageAPI.Add(body.subtitleNameToken, subtitle); body.portraitIcon = icon; ModelLocator bodyModelLocator = bodyObject.GetComponent <ModelLocator>(); GameObject bodyModelTransformObject = bodyModelLocator.modelTransform.gameObject; CharacterModel bodyModel = bodyModelTransformObject.GetComponent <CharacterModel>(); bodyModel.baseRendererInfos[renderInfoIndex].defaultMaterial = material; master.bodyPrefab = bodyObject; CharacterSpawnCard newCsc = ScriptableObject.CreateInstance <CharacterSpawnCard>(); newCsc.name = origCsc.name + originSuffix; newCsc.prefab = masterObject; newCsc.sendOverNetwork = origCsc.sendOverNetwork; newCsc.hullSize = origCsc.hullSize; newCsc.nodeGraphType = origCsc.nodeGraphType; newCsc.requiredFlags = origCsc.requiredFlags; newCsc.forbiddenFlags = origCsc.forbiddenFlags; newCsc.directorCreditCost = origCsc.directorCreditCost; newCsc.occupyPosition = origCsc.occupyPosition; newCsc.loadout = origCsc.loadout; newCsc.noElites = origCsc.noElites; newCsc.forbiddenAsBoss = true; return(newCsc); }
internal static void CreatePrefab() { characterPrefab = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("prefabs/characterbodies/JellyfishBody"), "LordJammedBody", true); CharacterBody bodyComponent = characterPrefab.GetComponent <CharacterBody>(); //bodyComponent.bodyIndex = -1; //def: 19 bodyComponent.baseNameToken = "LORDOFTHEJAMMED_BODY_NAME"; // name token bodyComponent.subtitleNameToken = "LORDOFTHEJAMMED_BODY_SUBTITLE"; // subtitle token- used for umbras bodyComponent.bodyFlags = CharacterBody.BodyFlags.Mechanical; //bodyComponent.mainRootSpeed = 0; bodyComponent.baseMaxHealth = 10000; bodyComponent.levelMaxHealth = 10000; bodyComponent.baseRegen = 1000f; bodyComponent.levelRegen = 1000f; bodyComponent.baseMaxShield = 0; bodyComponent.levelMaxShield = 0; //bodyComponent.baseMoveSpeed = 12; bodyComponent.levelMoveSpeed = 0; //bodyComponent.baseAcceleration = 80; //bodyComponent.baseJumpPower = 0; bodyComponent.levelJumpPower = 0; //bodyComponent.baseDamage = 15; //bodyComponent.levelDamage = 1.5f; bodyComponent.baseAttackSpeed = 1; bodyComponent.levelAttackSpeed = 0; bodyComponent.baseCrit = 0; //bodyComponent.levelCrit = 0; bodyComponent.baseArmor = 10000; // 0.0099 damage multiplier bodyComponent.levelArmor = 0; bodyComponent.baseJumpCount = 0; bodyComponent.sprintingSpeedMultiplier = 1.45f; HealthComponent healthComponent = characterPrefab.GetComponent <HealthComponent>(); healthComponent.dontShowHealthbar = true; healthComponent.godMode = true; characterPrefab.GetComponent <SphereCollider>().enabled = false; }
public void SetBody(CharacterBody newBody) { body = newBody; }