private static bool Prefix(InventoryGui __instance) { if (WorldofValheimZones.ServerMode) { return(true); } bool isInArea = false; // Ward Check if (Client.Ward.Drop && PrivateArea.CheckInPrivateArea(Player.m_localPlayer.transform.position, false)) { if (!PrivateArea.CheckAccess(Player.m_localPlayer.transform.position, 0f, true, false)) { bool test = PrivateArea.CheckAccess(Player.m_localPlayer.transform.position); long PlayerID = Player.m_localPlayer.GetPlayerID(); Util.DoAreaEffectW(Player.m_localPlayer.transform.position); MessageHud.instance.ShowMessage(MessageHud.MessageType.TopLeft, "This is a Warded Area", 0, null); isInArea = true; return(!isInArea); } } if (Util.RestrictionCheck("noitemdrop")) { isInArea = true; Util.DoAreaEffect(Player.m_localPlayer.transform.position + Vector3.up * 0.5f); MessageHud.instance.ShowMessage(MessageHud.MessageType.TopLeft, "This is a Private Area", 0, null); } return(!isInArea); }
static void Prefix(long sender, ref float v) { if (configEnableStaminaDrainReduction.Value) { if (PrivateArea.CheckInPrivateArea(Player.m_localPlayer.transform.position)) { v -= v * configStaminaDrainReductionPercent.Value / 100; } } }
static bool Prefix(TreeLog __instance, ref HitData hit, ZNetView ___m_nview) { if (___m_nview != null) { if (PrivateArea.CheckInPrivateArea(__instance.transform.position)) { ApplyDamageReduction(ref hit, configFloraDamageReduction.Value); } } return(true); }
public static float getFoodDrainMod() { if (configEnableFoodDrainReduction.Value) { if (PrivateArea.CheckInPrivateArea(Player.m_localPlayer.transform.position)) { return(1 - configFoodDrainReductionPercent.Value / 100); } } return(1f); }
public static bool Damage(WearNTear __instance, ref HitData hit) { if (AccessTools.FieldRefAccess <WearNTear, ZNetView>(__instance, "m_nview").IsValid()) { var Ply = Player.m_localPlayer; if (Ply != null && PrivateArea.CheckInPrivateArea(hit.m_point, true)) { return(SmartBepInMods.Tools.Patching.Constants.CONST.SKIP); } } return(SmartBepInMods.Tools.Patching.Constants.CONST.NOSKIP); }
private static bool Prefix(WearNTear __instance, HitData hit) { if (WorldofValheimZones.ServerMode) { return(true); } bool isInArea = false; // Is the area we are searching in a Warded area. if (Client.Ward.Damage && PrivateArea.CheckInPrivateArea(__instance.transform.position, false)) { ZDOID attacker = hit.m_attacker; bool isplayer = false; foreach (var character in Character.GetAllCharacters()) { if (character.GetZDOID() == attacker) { if (character.GetComponent <Player>()) { isplayer = true; } } } // It's a player so lets see if it has access. if (isplayer) { if (!PrivateArea.CheckAccess(Player.m_localPlayer.transform.position, 0f, true, false)) { Util.DoAreaEffectW(__instance.transform.position); MessageHud.instance.ShowMessage(MessageHud.MessageType.TopLeft, "This is a Warded Area", 0, null); isInArea = true; return(!isInArea); } } else { // It's not a player so lets send out a Ward notification and block the damage. PrivateArea.CheckInPrivateArea(__instance.transform.position, true); isInArea = true; return(!isInArea); } } // Is the user restricted by NoBuildDamage? if (Util.RestrictionCheck("nobuilddamage")) { isInArea = true; Util.DoAreaEffect(__instance.transform.position + Vector3.up * 0.5f); MessageHud.instance.ShowMessage(MessageHud.MessageType.TopLeft, "This is a Private Area", 0, null); } return(!isInArea); }
static bool Prefix(Destructible __instance, ref HitData hit, ZNetView ___m_nview) { if (___m_nview != null) { if (PrivateArea.CheckInPrivateArea(__instance.transform.position)) { if (configPlantsDamageReduction.Value > 0) { var name = ___m_nview.GetPrefabName().ToLower(); if (name.Contains("carrot") || name.Contains("barley") || name.Contains("turnip") || name.Contains("flax")) { ApplyDamageReduction(ref hit, configPlantsDamageReduction.Value); } } else { ApplyDamageReduction(ref hit, configFloraDamageReduction.Value); } } } return(true); }
// Token: 0x0600102D RID: 4141 RVA: 0x000722DC File Offset: 0x000704DC private void RPC_Damage(long sender, HitData hit) { if (!this.m_nview.IsOwner()) { return; } if (this.m_nview.GetZDO().GetFloat("health", this.m_health) <= 0f) { return; } HitData.DamageModifier type; hit.ApplyResistance(this.m_damages, out type); float totalDamage = hit.GetTotalDamage(); if (this.m_piece && this.m_piece.IsPlacedByPlayer()) { PrivateArea.CheckInPrivateArea(base.transform.position, true); } DamageText.instance.ShowText(type, hit.m_point, totalDamage, false); if (totalDamage <= 0f) { return; } this.ApplyDamage(totalDamage); this.m_hitEffect.Create(hit.m_point, Quaternion.identity, base.transform, 1f); if (this.m_hitNoise > 0f) { Player closestPlayer = Player.GetClosestPlayer(hit.m_point, 10f); if (closestPlayer) { closestPlayer.AddNoise(this.m_hitNoise); } } if (this.m_onDamaged != null) { this.m_onDamaged(); } }
private void Update() { if (configEnableAutoRepair.Value) { var cur_time = DateTime.Now.Ticks; if ((cur_time - l_saved_time) / TimeSpan.TicksPerSecond >= configRepairInterval.Value) { l_saved_time = cur_time; List <WearNTear> list = WearNTear.GetAllInstaces(); if (list.Count > 0) { foreach (WearNTear item in list) { ZNetView view = (ZNetView)GetInstanceField(item, "m_nview"); if (view != null) { if (PrivateArea.CheckInPrivateArea(item.transform.position)) { float health = view.GetZDO().GetFloat("health"); if (!(health > 0) || !(health < item.m_health)) { continue; } var res_health = health + item.m_health * configRepairAmountPercent.Value / 100; if (res_health > item.m_health) { res_health = item.m_health; } view.GetZDO().Set("health", res_health); view.InvokeRPC(ZNetView.Everybody, "WNTHealthChanged", new object[] { res_health }); } } } } } } }
private static bool Prefix(Player __instance) { if (WorldofValheimZones.ServerMode) { return(true); } bool isInArea = false; Vector3 point = __instance.transform.position; // Ward Check if (Client.Ward.Pickup && PrivateArea.CheckInPrivateArea(Player.m_localPlayer.transform.position, false)) { if (!PrivateArea.CheckAccess(Player.m_localPlayer.transform.position, 0f, false, false)) { isInArea = true; return(!isInArea); } } if (Util.RestrictionCheck("noitempickup")) { isInArea = true; } return(!isInArea); }
public static bool Damage(Destructible __instance, ref HitData hit) { if (AccessTools.FieldRefAccess <Destructible, ZNetView>(__instance, "m_nview").IsValid()) { var Ply = Player.m_localPlayer; if (Ply != null && __instance.GetComponent <SpawnArea>() != null && PrivateArea.CheckInPrivateArea(hit.m_point, true)) { return(SmartBepInMods.Tools.Patching.Constants.CONST.SKIP); } } return(SmartBepInMods.Tools.Patching.Constants.CONST.NOSKIP); }
private static bool Prefix(WearNTear __instance, long sender, HitData hit) { return(!PrivateArea.CheckInPrivateArea(__instance.transform.position, true)); }