private void SetupStarterPack(Character _char) { Debug.Log("SetupStarterPack for " + _char.gameObject.name); // give bag Item bag = ItemManager.Instance.GenerateItemNetwork(5300000); // adventurer bag if (bag != null) { _char.Inventory.TakeItem(bag.UID, false); At.Invoke(_char.Inventory.Equipment, "EquipWithoutAssociating", new object[] { bag, false }); // 1 random weapon, 1 random offhand ItemContainer target = _char.Inventory.Pouch; if (bag.GetComponentInChildren <ItemContainer>() is ItemContainer container) { target = container; } AddItemsToContainer(Templates.BR_Templates.Weapons_Low, 1, target.transform, true); // 1 random weapon AddItemsToContainer(Templates.BR_Templates.Offhands_Low, 1, target.transform, true); // 1 random offhand AddItemsToContainer(Templates.BR_Templates.Supplies_Low, 5, target.transform, true); // 5 random supplies // add starter skills AddItemsToContainer(Templates.StarterSkills, Templates.StarterSkills.Count(), target.transform); } else { //OLogger.Error("bag was null"); } }
public static bool Prefix(Blast __instance, ref List <Hitbox> ___cachedHitBox) { if (!__instance.OwnerCharacter || __instance.OwnerCharacter.IsAI || !PvP.Instance.FriendlyFireEnabled) { return(true); } Collider[] array = Physics.OverlapSphere(__instance.transform.position, __instance.Radius, Global.WeaponHittingMask); List <Character> list = new List <Character>(); ___cachedHitBox.Clear(); for (int i = 0; i < array.Length; i++) { Hitbox component = array[i].GetComponent <Hitbox>(); if (component != null && component.OwnerChar != null && component.OwnerChar.UID != __instance.OwnerCharacter.UID && !component.BlockBox && !list.Contains(component.OwnerChar)) //&& __instance.m_targetableFactions.Contains(component.OwnerChar.Faction) //&& (!__instance.IgnoreShooter || component.OwnerChar != __instance.OwnerCharacter)) { ___cachedHitBox.Add(component); list.Add(component.OwnerChar); } } //__instance.AffectHit(___cachedHitBox); At.Invoke(__instance, "AffectHit", ___cachedHitBox); return(false); }
private void SetFreeCam(bool active) { At.Invoke(VideoCamera.Instance, "SetCameraActive", active); if (active) { At.SetField(VideoCamera.Instance, "m_flyMode", true); Global.LockCursor(true); } }
private void CustomPlayerSetup(Character _char) { // wipe character var save = SaveManager.Instance.CreateNewCharacterSave(); save.PSave.NewSave = true; save.PSave.ManaPoint = 0; save.PSave.UID = _char.UID; save.PSave.Name = _char.Name; save.PSave.VisualData = _char.VisualData; save.PSave.Food = 1000f; save.PSave.Drink = 1000f; save.PSave.HardcoreMode = false; save.ApplyLoadedSaveToChar(_char); // ========= set custom stats ========== At.SetField(_char.Stats, "m_maxHealthStat", new Stat(500f)); At.SetField(_char.Stats, "m_maxStamina", new Stat(200f)); At.SetField(_char.Stats, "m_maxManaStat", new Stat(75f)); _char.Stats.GiveManaPoint(1); // ========= finalize ========== // disable character cheats _char.Cheats.Invincible = false; _char.Cheats.IndestructibleEquipment = false; _char.Cheats.NotAffectedByWeightPenalties = false; _char.Cheats.NeedsEnabled = true; // refresh stats At.Invoke(_char.Stats, "UpdateVitalStats"); _char.Stats.Reset(); _char.Stats.RestoreAllVitals(); if (At.GetField(_char.QuickSlotMngr, "m_quickSlots") is QuickSlot[] m_quickSlots) { for (int i = 0; i < m_quickSlots.Count(); i++) { _char.QuickSlotMngr.GetQuickSlot(i).Clear(); } } }
private IEnumerator GenerateSupplyDrops() { //OLogger.Warning("generating supply drops!"); if (ActiveItemContainers.Count() > 0) { if (PhotonNetwork.offlineMode) { RPCManager.Instance.RPCSendCleanup(); } else { RPCManager.Instance.photonView.RPC("RPCSendCleanup", PhotonTargets.All, new object[0]); } yield return(new WaitForSeconds(2f)); // wait 2 seconds after destroying the active objects, so we dont start destroying the new ones! } if (SupplyDropCounter == 1) { // first drop. generate initial supply caches for all players foreach (PlayerSystem ps in Global.Lobby.PlayersInLobby) { Character _char = ps.ControlledCharacter; TreasureChest stash = ItemManager.Instance.GenerateItemNetwork(1000110).GetComponent <TreasureChest>(); stash.transform.position = _char.transform.position + new Vector3(1.5f, 0, 1.5f); ActiveItemContainers.Add(stash.gameObject); if (!PhotonNetwork.offlineMode) { RPCManager.Instance.photonView.RPC("RPCGenerateStash", PhotonTargets.Others, new object[] { stash.ItemID, stash.UID, stash.transform.position.x, stash.transform.position.y, stash.transform.position.z }); } At.Invoke(stash, "InitDrops"); for (int i = 0; i < 5; i++) { At.SetField(stash, "m_hasGeneratedContent", false); stash.GenerateContents(); } } } else { RPCManager.SendMessageToAll("Supply Chests are spawning!"); // generate chest or ornate chest List <Vector3> locations = Templates.BR_Templates.SupplyDropLocations[SceneManagerHelper.ActiveSceneName].ToList(); // 1 supply drop per 2 players. minimum of 2 drops. int numOfDrops = (int)Math.Ceiling(PlayerManager.Instance.GetRemainingPlayers().Count() * 0.5f); numOfDrops = (int)Mathf.Clamp(numOfDrops, 2, locations.Count()); //Debug.Log("Generating " + numOfDrops + " supply drops from a locations list size of " + locations.Count()); for (int i = 0; i < numOfDrops; i++) { if (locations.Count == 0) { break; } int random = UnityEngine.Random.Range(0, locations.Count()); //Debug.Log("Rolled location index " + random); GenerateChestSingle(locations[random]); locations.RemoveAt(random); } } }
public static bool Prefix(Projectile __instance, Collider _collider, Vector3 _hitPoint, Vector3 _hitDir, ref float ___m_lastHitTimer, ref float ___m_targetLightIntensity, float ___m_lightStartIntensity, ref float ___m_lightIntensityFadeSpeed, SoundPlayer ___m_shootSound, SoundPlayer ___m_travelSound, ParticleSystem ___m_explosionFX, ref object[] ___m_explodeInfos) { if (!__instance.OwnerCharacter || __instance.OwnerCharacter.IsAI || !PvP.Instance.FriendlyFireEnabled) { return(true); } ___m_lastHitTimer = 5f; ___m_targetLightIntensity = ___m_lightStartIntensity * 1.8f; ___m_lightIntensityFadeSpeed = __instance.LightIntensityFade.x * 0.5f; if (___m_shootSound) { ___m_shootSound.Stop(false); } if (___m_travelSound) { ___m_travelSound.Stop(false); } Character character = null; if (_collider != null) { if (___m_explosionFX) { ___m_explosionFX.Play(); } character = _collider.GetCharacterOwner(); } bool blocked = false; if (character && __instance.OwnerCharacter != character) { if (!__instance.Unblockable && character.ShieldEquipped) { Hitbox component = _collider.GetComponent <Hitbox>(); if (component != null && component.BlockBox && character.Blocking && !character.Countering) { blocked = true; } } } else { character = null; } // __instance.OnProjectileHit(character, _hitPoint, _hitDir, blocked); At.Invoke(__instance, "OnProjectileHit", character, _hitPoint, _hitDir, blocked); ___m_explodeInfos[0] = character; ___m_explodeInfos[1] = _hitPoint; ___m_explodeInfos[2] = _hitDir; ___m_explodeInfos[3] = (_collider != null); __instance.SendMessage("OnExplodeDone", ___m_explodeInfos, SendMessageOptions.DontRequireReceiver); if (__instance.EndMode == Projectile.EndLifeMode.Normal || (__instance.EndMode == Projectile.EndLifeMode.EnvironmentOnly && (_collider == null || Global.FullEnvironmentMask == (Global.FullEnvironmentMask | 1 << _collider.gameObject.layer)))) { // __instance.EndLife(); At.Invoke(__instance, "EndLife"); } return(false); }