// Token: 0x0600011E RID: 286 RVA: 0x0000B3C8 File Offset: 0x000095C8 private void Update() { if (Main.autofarm5.GetData <bool>()) { global::HeldEntity heldEntity = SilentCat1111.smethod_1(SilentCat1111.smethod_0()); BaseMelee baseMelee = heldEntity as BaseMelee; if (!SilentCat1111.smethod_2(baseMelee, null) && SilentCat1111.smethod_3() - this.float_0 >= baseMelee.repeatDelay * 0.5f + 0.01f && SilentCat1111.smethod_4(heldEntity, null)) { foreach (BaseNpc baseNpc in SilentCat1111.smethod_5()) { float num = Vector3.Distance(SilentCat1111.smethod_7(SilentCat1111.smethod_6(SilentCat1111.smethod_0())), SilentCat1111.smethod_7(SilentCat1111.smethod_6(baseNpc))); if (num < 7f && !SilentCat1111.smethod_8(baseNpc) && !SilentCat1111.smethod_9(baseNpc)) { using (PlayerAttack playerAttack = Pool.Get <PlayerAttack>()) { using (Attack attack = Pool.Get <Attack>()) { playerAttack.attack = attack; playerAttack.attack.hitID = baseNpc.net.ID; playerAttack.attack.hitPositionWorld = SilentCat1111.smethod_7(SilentCat1111.smethod_6(baseNpc)); playerAttack.attack.hitNormalWorld = (SilentCat1111.smethod_7(SilentCat1111.smethod_6(MainCamera.mainCamera)) - SilentCat1111.smethod_7(SilentCat1111.smethod_6(baseNpc))).normalized; playerAttack.attack.pointStart = Misc.localplayer.eyes.position; playerAttack.attack.pointEnd = baseNpc.transform.position; baseMelee.ServerRPC <PlayerAttack>("PlayerAttack", playerAttack); this.float_0 = Time.time; Debug.Log("YAS BITCH"); } } } } } } }
private static Item FindBestMelee(NPCHumanContext c) { if (c.Human.GetPathStatus() != (byte)0) { return((Item)null); } Item obj = (Item)null; BaseMelee baseMelee = (BaseMelee)null; foreach (Item allItem in c.Human.inventory.AllItems()) { if (allItem.info.category == ItemCategory.Weapon && !allItem.isBroken) { BaseMelee heldEntity = allItem.GetHeldEntity() as BaseMelee; if (Object.op_Implicit((Object)heldEntity)) { if (obj == null) { obj = allItem; baseMelee = heldEntity; } else if ((double)heldEntity.hostileScore > (double)baseMelee.hostileScore) { obj = allItem; baseMelee = heldEntity; } } } } return(obj); }
private void Start() { PC = GameObject.Find("PlayerBase").GetComponent <PlayerController>(); PR = GetComponentInParent <PlayerRotate>(); SwordRef = GetComponentInParent <BaseMelee>(); playerref = GameObject.Find("Player").GetComponent <Player>(); }
private static Item FindBestMelee(NPCHumanContext c) { if (c.Human.GetPathStatus() != 0) { return(null); } Item item = null; BaseMelee baseMelee = null; Item[] itemArray = c.Human.inventory.AllItems(); for (int i = 0; i < (int)itemArray.Length; i++) { Item item1 = itemArray[i]; if (item1.info.category == ItemCategory.Weapon && !item1.isBroken) { BaseMelee heldEntity = item1.GetHeldEntity() as BaseMelee; if (heldEntity) { if (item == null) { item = item1; baseMelee = heldEntity; } else if (heldEntity.hostileScore > baseMelee.hostileScore) { item = item1; baseMelee = heldEntity; } } } } return(item); }
public static void ImpactEffect(HitInfo info) { if (!info.DoHitEffects) { return; } string materialName = StringPool.Get(info.HitMaterial); string strName = EffectDictionary.GetParticle(info.damageTypes.GetMajorityDamageType(), materialName); string decal = EffectDictionary.GetDecal(info.damageTypes.GetMajorityDamageType(), materialName); if (TerrainMeta.WaterMap != null && info.HitMaterial != Projectile.WaterMaterialID() && info.HitMaterial != Projectile.FleshMaterialID() && info.HitPositionWorld.y < TerrainMeta.WaterMap.GetHeight(info.HitPositionWorld) && WaterLevel.Test(info.HitPositionWorld, false)) { return; } if (BaseEntityEx.IsValid(info.HitEntity)) { GameObjectRef impactEffect = info.HitEntity.GetImpactEffect(info); if (impactEffect.isValid) { strName = impactEffect.resourcePath; } Run(strName, info.HitEntity, info.HitBone, info.HitPositionLocal, info.HitNormalLocal); if (info.DoDecals) { Run(decal, info.HitEntity, info.HitBone, info.HitPositionLocal, info.HitNormalLocal); } } else { Type overrideType = Type.Generic; Run(strName, info.HitPositionWorld, info.HitNormalWorld, default(Vector3), overrideType); Run(decal, info.HitPositionWorld, info.HitNormalWorld, default(Vector3), overrideType); } if ((bool)info.WeaponPrefab) { BaseMelee baseMelee = info.WeaponPrefab as BaseMelee; if (baseMelee != null) { string strikeEffectPath = baseMelee.GetStrikeEffectPath(materialName); if (BaseEntityEx.IsValid(info.HitEntity)) { Run(strikeEffectPath, info.HitEntity, info.HitBone, info.HitPositionLocal, info.HitNormalLocal); } else { Run(strikeEffectPath, info.HitPositionWorld, info.HitNormalWorld); } } } if (info.damageTypes.Has(DamageType.Explosion)) { DoAdditiveImpactEffect(info, "assets/bundled/prefabs/fx/impacts/additive/explosion.prefab"); } if (info.damageTypes.Has(DamageType.Heat)) { DoAdditiveImpactEffect(info, "assets/bundled/prefabs/fx/impacts/additive/fire.prefab"); } }
// Token: 0x06000424 RID: 1060 RVA: 0x0001A2F8 File Offset: 0x000184F8 private void Update() { if (Main.suicide.GetData <bool>() && SilentMelee0.smethod_1(SilentMelee0.smethod_0()) && SilentMelee0.smethod_2(SilentMelee0.smethod_0()) && SilentMelee0.smethod_3() >= this.nextAttack) { global::BasePlayer basePlayer = null; float num = 99999f; if (SilentMelee0.smethod_4() != null) { foreach (global::BasePlayer basePlayer2 in SilentMelee0.smethod_4()) { Vector3 vector = SilentMelee0.smethod_7(MainCamera.mainCamera, SilentMelee0.smethod_6(SilentMelee0.smethod_5(basePlayer2, "head"))); if (vector.z > 0f) { Vector2 vector2 = new Vector2(vector.x, (float)SilentMelee0.smethod_8() - vector.y); float num2 = Mathf.Abs(Vector2.Distance(new Vector2((float)(SilentMelee0.smethod_9() / 2), (float)(SilentMelee0.smethod_8() / 2)), new Vector2(vector2.x, (float)Screen.height - vector2.y))); if (num2 <= num) { num = num2; basePlayer = basePlayer2; } } } } if (basePlayer != null && basePlayer.IsValid()) { Vector3 position = basePlayer.model.headBone.position; global::HeldEntity heldEntity = LocalPlayer.Entity.GetHeldEntity(); if (heldEntity != null && heldEntity.IsValid()) { float num3 = Vector3.Distance(LocalPlayer.Entity.transform.position, basePlayer.transform.position); BaseMelee baseMelee = heldEntity as BaseMelee; if (baseMelee != null && baseMelee.IsValid()) { if (num3 < 2f) { using (PlayerAttack playerAttack = Pool.Get <PlayerAttack>()) { playerAttack.attack = new Attack { hitID = basePlayer.net.ID, hitPositionWorld = basePlayer.FindBone("head").position, hitPositionLocal = new Vector3(-0.1f, -1f, 0f), hitNormalLocal = new Vector3(0f, -1f, 0f), hitNormalWorld = (MainCamera.mainCamera.transform.position - basePlayer.FindBone("head").position).normalized, pointStart = LocalPlayer.Entity.transform.position, pointEnd = basePlayer.FindBone("head").position }; baseMelee.ServerRPC <PlayerAttack>("PlayerAttack", playerAttack); Debug.Log("Stop hitting yourself xD"); } } this.nextAttack = Time.time + baseMelee.repeatDelay; } } } } }
public WeaponThrowEvent(BaseMelee weapon, BasePlayer basePlayer, ProjectileShoot projectileShoot, ProjectileShoot.Projectile projectile) { Weapon = weapon; Player = Server.GetPlayer(basePlayer); ProjectileShoot = projectileShoot; Projectile = projectile; Magnitude = projectile.startVel.magnitude; }
public static void ImpactEffect(HitInfo info) { if (!info.DoHitEffects) { return; } string materialName = StringPool.Get(info.HitMaterial); if (Object.op_Inequality((Object)TerrainMeta.WaterMap, (Object)null) && (int)info.HitMaterial != (int)Projectile.WaterMaterialID() && ((int)info.HitMaterial != (int)Projectile.FleshMaterialID() && info.HitPositionWorld.y < (double)WaterLevel.GetWaterDepth(info.HitPositionWorld))) { return; } string strName = EffectDictionary.GetParticle(info.damageTypes.GetMajorityDamageType(), materialName); string decal = EffectDictionary.GetDecal(info.damageTypes.GetMajorityDamageType(), materialName); if (info.HitEntity.IsValid()) { GameObjectRef impactEffect = info.HitEntity.GetImpactEffect(info); if (impactEffect.isValid) { strName = impactEffect.resourcePath; } Effect.server.Run(strName, info.HitEntity, info.HitBone, info.HitPositionLocal, info.HitNormalLocal, info.Predicted, false); Effect.server.Run(decal, info.HitEntity, info.HitBone, info.HitPositionLocal, info.HitNormalLocal, info.Predicted, false); } else { Effect.server.Run(strName, info.HitPositionWorld, info.HitNormalWorld, info.Predicted, false); Effect.server.Run(decal, info.HitPositionWorld, info.HitNormalWorld, info.Predicted, false); } if (Object.op_Implicit((Object)info.WeaponPrefab)) { BaseMelee weaponPrefab = info.WeaponPrefab as BaseMelee; if (Object.op_Inequality((Object)weaponPrefab, (Object)null)) { string strikeEffectPath = weaponPrefab.GetStrikeEffectPath(materialName); if (info.HitEntity.IsValid()) { Effect.server.Run(strikeEffectPath, info.HitEntity, info.HitBone, info.HitPositionLocal, info.HitNormalLocal, info.Predicted, false); } else { Effect.server.Run(strikeEffectPath, info.HitPositionWorld, info.HitNormalWorld, info.Predicted, false); } } } if (info.damageTypes.Has(DamageType.Explosion)) { Effect.server.DoAdditiveImpactEffect(info, "assets/bundled/prefabs/fx/impacts/additive/explosion.prefab"); } if (!info.damageTypes.Has(DamageType.Heat)) { return; } Effect.server.DoAdditiveImpactEffect(info, "assets/bundled/prefabs/fx/impacts/additive/fire.prefab"); }
public bool MeleeAttack() { AttackEntity heldEntity = this.GetHeldEntity() as AttackEntity; if (Object.op_Equality((Object)heldEntity, (Object)null)) { return(false); } BaseMelee baseMelee = heldEntity as BaseMelee; if (Object.op_Equality((Object)baseMelee, (Object)null)) { return(false); } baseMelee.ServerUse(this.damageScale); return(true); }
//Augmentations: To be added. public void LoadPrimary(Attack loadtk) { BaseWeapon temp = Instantiate(primW); primW = temp; primW.LoadWeapon(loadtk); if (_stats == null) { _stats = _me.myStats; //redundant, probably see if there's an easy injectable fix? } loadtk.dmgStats = _stats.GetHitStats(primW.WeaponDamage, primW.WeaponType); loadtk.Cooldown = primW.cooldown; //TEMP_DEBUG: Weapon Load Pool if (primW is BaseGun) { //Late check script if (pooler == null) { pooler = _me._pool; } BaseGun gun = primW as BaseGun; gun.FindAmmo(pooler); } else if (primW is BaseMagic) { //Late check script if (pooler == null) { pooler = _me._pool; } BaseMagic spell = primW as BaseMagic; spell.FindPool(pooler); } else if (primW is BaseMelee) { BaseMelee smack = primW as BaseMelee; smack.FindPoint(MeleePoint); } //Apply items here, or like, in the load function. }
public bool MeleeAttack() { AttackEntity heldEntity = base.GetHeldEntity() as AttackEntity; if (heldEntity == null) { return(false); } BaseMelee baseMelee = heldEntity as BaseMelee; if (baseMelee == null) { return(false); } baseMelee.ServerUse(this.damageScale); return(true); }
private void Update() { if (CFG.Setting.bvbvn && LocalPlayer.Entity && LocalPlayer.Entity.IsValid() && global::BasePlayer.VisiblePlayerList != null) { global::HeldEntity heldEntity = LocalPlayer.Entity.GetHeldEntity(); BaseMelee baseMelee = heldEntity as BaseMelee; if (!(baseMelee == null) && Time.time - nextAttack >= Time.deltaTime && heldEntity != null) { foreach (OreHotSpot player in companent.orehotspot) { global::Item activeItem = LocalPlayer.Entity.Belt.GetActiveItem(); if (player != null && !player.IsDestroyed && BaseEntityEx.IsValid(player) && BaseEntityEx.IsValid(baseMelee) && activeItem != null && (activeItem.info.shortname.Contains("bone.club") || activeItem.info.shortname.Contains("hammer.salvaged") || activeItem.info.shortname.Contains("icepick.salvaged") || activeItem.info.shortname.Contains("pickaxe") || activeItem.info.shortname.Contains("stone.pickaxe") || activeItem.info.shortname.Contains("rock") || activeItem.info.shortname.Contains("jackhammer"))) { int dist = (int)Vector3.Distance(MainCamera.mainCamera.transform.position, player.transform.position); if (dist < 4) { Ray ray = new Ray(menu.localplayer.eyes.transform.position, (player.transform.position - player.transform.position).normalized); using (PlayerAttack playerAttack = Facepunch.Pool.Get <PlayerAttack>()) { using (Attack attack = Facepunch.Pool.Get <Attack>()) { playerAttack.attack = attack; playerAttack.attack.hitID = player.net.ID; playerAttack.attack.hitBone = 0; playerAttack.attack.hitPositionWorld = player.transform.position; playerAttack.attack.hitNormalWorld = ray.direction; playerAttack.attack.pointStart = menu.localplayer.eyes.position; playerAttack.attack.pointEnd = player.transform.position; baseMelee.ServerRPC <PlayerAttack>("PlayerAttack", playerAttack); } }; nextAttack = UnityEngine.Time.time + baseMelee.repeatDelay; } } } } } }
private void Update() { if (CFG.Setting.hgf && LocalPlayer.Entity && LocalPlayer.Entity.IsValid() && Time.time >= nextAttack && global::BasePlayer.VisiblePlayerList != null) { foreach (StorageContainer storageContainer in companent.containers) { if (storageContainer != null && storageContainer.IsValid() && storageContainer.ShortPrefabName.Contains("barrel")) { Vector3 position = storageContainer.transform.position; global::HeldEntity heldEntity = LocalPlayer.Entity.GetHeldEntity(); if (heldEntity != null && heldEntity.IsValid() && storageContainer.ShortPrefabName.Contains("barrel")) { float num = Vector3.Distance(LocalPlayer.Entity.transform.position, storageContainer.transform.position); BaseMelee baseMelee = heldEntity as BaseMelee; if (baseMelee != null && baseMelee.IsValid() && num < 7f && storageContainer.ShortPrefabName.Contains("barrel")) { using (PlayerAttack playerAttack = Pool.Get <PlayerAttack>()) { playerAttack.attack = new Attack { hitID = storageContainer.net.ID, hitBone = 0U, hitPartID = 0U, hitMaterialID = 0U, hitItem = 0U, hitPositionWorld = storageContainer.transform.position, hitPositionLocal = new Vector3(-0.1f, -1f, 0f), hitNormalLocal = new Vector3(0f, -1f, 0f), hitNormalWorld = (MainCamera.mainCamera.transform.position - storageContainer.transform.position).normalized, pointStart = MainCamera.mainCamera.transform.position, pointEnd = storageContainer.transform.position }; baseMelee.ServerRPC <PlayerAttack>("PlayerAttack", playerAttack); } nextAttack = Time.time + baseMelee.repeatDelay; } } } } } }
void OnMeleeAttack(BaseMelee melee, HitInfo hitinfo) { if (hitinfo.HitEntity == null) { return; } if (hitinfo.HitEntity.GetComponent <ResourceDispenser>() != null) { ResourceDispenser disp = hitinfo.HitEntity.GetComponent <ResourceDispenser>(); if (resourceZones[disp] == null) { return; } foreach (Zone zone in resourceZones[disp]) { if (zone.info.nogather != null) { hitinfo.HitEntity = null; } } } }
// Token: 0x060003F2 RID: 1010 RVA: 0x00019C00 File Offset: 0x00017E00 private void Update() { if (Main.meleehack.GetData <bool>()) { global::HeldEntity heldEntity = SilentMelee.smethod_1(SilentMelee.smethod_0()); BaseMelee baseMelee = heldEntity as BaseMelee; if (!SilentMelee.smethod_2(baseMelee, null) && SilentMelee.smethod_3() - this.float_0 >= baseMelee.repeatDelay && SilentMelee.smethod_4(heldEntity, null)) { foreach (global::BasePlayer basePlayer in SilentMelee.smethod_5()) { float num = Vector3.Distance(SilentMelee.smethod_7(SilentMelee.smethod_6(SilentMelee.smethod_0())), SilentMelee.smethod_7(SilentMelee.smethod_6(basePlayer))); if (num < 7f && !SilentMelee.smethod_8(basePlayer) && !SilentMelee.smethod_9(basePlayer)) { if (Main.meleewalls.GetData <bool>()) { PlayerAttack playerAttack = Pool.Get <PlayerAttack>(); try { PlayerAttack playerAttack2 = playerAttack; Attack attack = SilentMelee.smethod_10(); attack.hitID = basePlayer.net.ID; attack.hitPositionWorld = SilentMelee.smethod_7(SilentMelee.smethod_6(SilentMelee.smethod_0())); attack.hitPositionLocal = SilentMelee.smethod_7(SilentMelee.smethod_6(SilentMelee.smethod_0())); attack.hitNormalLocal = SilentMelee.smethod_7(SilentMelee.smethod_6(SilentMelee.smethod_0())); attack.hitNormalWorld = SilentMelee.smethod_7(SilentMelee.smethod_6(SilentMelee.smethod_0())); attack.pointStart = SilentMelee.smethod_7(SilentMelee.smethod_6(SilentMelee.smethod_0())) + Vector3.up; attack.pointEnd = SilentMelee.smethod_7(SilentMelee.smethod_6(SilentMelee.smethod_0())) + Vector3.up; attack.ShouldPool = true; playerAttack2.attack = attack; baseMelee.ServerRPC <PlayerAttack>("PlayerAttack", playerAttack); goto IL_287; } finally { if (playerAttack != null) { SilentMelee.smethod_11(playerAttack); } } goto IL_19A; } goto IL_19A; IL_287: this.float_0 = Time.time; continue; IL_19A: using (PlayerAttack playerAttack3 = Pool.Get <PlayerAttack>()) { using (Attack attack2 = Pool.Get <Attack>()) { playerAttack3.attack = attack2; playerAttack3.attack.hitID = basePlayer.net.ID; playerAttack3.attack.hitPositionWorld = SilentMelee.smethod_7(SilentMelee.smethod_12(basePlayer, "head")); playerAttack3.attack.hitNormalWorld = (SilentMelee.smethod_7(SilentMelee.smethod_6(MainCamera.mainCamera)) - SilentMelee.smethod_7(SilentMelee.smethod_12(basePlayer, "head"))).normalized; playerAttack3.attack.pointStart = Misc.localplayer.eyes.position; playerAttack3.attack.pointEnd = basePlayer.FindBone("head").position; baseMelee.ServerRPC <PlayerAttack>("PlayerAttack", playerAttack3); Debug.Log("YAS BITCH"); } } goto IL_287; } } } } }
private void Update() { if (CFG.Setting.animal && LocalPlayer.Entity != null && BaseEntityEx.IsValid(LocalPlayer.Entity)) { HeldEntity хелд = LocalPlayer.Entity.GetHeldEntity(); BaseMelee мил = хелд as BaseMelee; if (мил == null) { return; } if (UnityEngine.Time.time - float_0 < мил.repeatDelay) { return; } if (хелд != null) { foreach (BaseNpc player in BaseNpc.VisibleNpcList) { if (player != null && !player.IsDead() && BaseEntityEx.IsValid(player) && BaseEntityEx.IsValid(мил)) { int дист = (int)Vector3.Distance(MainCamera.mainCamera.transform.position, player.FindBone("head").position); if (дист < 6f) { Ray ray = new Ray(LocalPlayer.Entity.transform.position, (player.FindBone("head").position - player.FindBone("head").position).normalized); using (PlayerAttack аттак = Facepunch.Pool.Get <PlayerAttack>()) { using (Attack attack = Facepunch.Pool.Get <Attack>()) { аттак.attack = attack; аттак.attack.hitID = player.net.ID; аттак.attack.hitBone = 698017942; аттак.attack.hitPositionWorld = player.FindBone("head").position; аттак.attack.hitNormalWorld = ray.direction; аттак.attack.pointStart = LocalPlayer.Entity.transform.position; аттак.attack.pointEnd = player.FindBone("head").position; мил.ServerRPC <PlayerAttack>("PlayerAttack", аттак); } }; float_0 = UnityEngine.Time.time; } } } } } if (CFG.Setting.rrrar && LocalPlayer.Entity != null) { HeldEntity heldEntity = LocalPlayer.Entity.GetHeldEntity(); BaseMelee baseMelee = heldEntity as BaseMelee; { foreach (BasePlayer player in BasePlayer.VisiblePlayerList) { if (player != null && !(baseMelee == null) && Time.time - float_0 >= baseMelee.repeatDelay && heldEntity != null && BaseEntityEx.IsValid(player) && BaseEntityEx.IsValid(baseMelee) && !player.IsLocalPlayer() && !player.IsDead() && !CFG.Setting.friendsList.Contains(player.userID)) { int dist = (int)Vector3.Distance(MainCamera.mainCamera.transform.position, player.model.headBone.transform.position + new Vector3(0f, 0.04f, 0.04f)); if (dist < this.dist) { Ray ray = new Ray(menu.localplayer.eyes.transform.position, (player.FindBone("head").position - player.FindBone("head").position).normalized); using (PlayerAttack playerAttack = Facepunch.Pool.Get <PlayerAttack>()) { if (CFG.Setting.milll) { Effect.client.Run(CFG.Setting.tt ? "assets/bundled/prefabs/fx/hit_notify.prefab" : "assets/bundled/prefabs/fx/headshot_2d.prefab", LocalPlayer.Entity.eyes.gameObject); playerAttack.attack = new Attack { hitID = player.net.ID, hitBone = (CFG.Setting.tt ? 3399023664U : 3198432U), hitPartID = (CFG.Setting.tt ? 1890214305U : 1744899316U), hitItem = 0u, hitPositionWorld = menu.localplayer.eyes.transform.position, hitPositionLocal = menu.localplayer.eyes.transform.position, hitNormalLocal = menu.localplayer.eyes.transform.position, hitNormalWorld = menu.localplayer.eyes.transform.position, pointStart = menu.localplayer.eyes.transform.position + Vector3.up, pointEnd = menu.localplayer.eyes.transform.position + Vector3.up, ShouldPool = true }; baseMelee.ServerRPC("PlayerAttack", playerAttack); } } using (PlayerAttack playerAttack = Facepunch.Pool.Get <PlayerAttack>()) { using (Attack attack = Facepunch.Pool.Get <Attack>()) { Effect.client.Run(CFG.Setting.tt ? "assets/bundled/prefabs/fx/hit_notify.prefab" : "assets/bundled/prefabs/fx/headshot_2d.prefab", LocalPlayer.Entity.eyes.gameObject); playerAttack.attack = attack; playerAttack.attack.hitID = player.net.ID; playerAttack.attack.hitBone = (CFG.Setting.tt ? 3399023664U : 3198432U); playerAttack.attack.hitPartID = (CFG.Setting.tt ? 1890214305U : 1744899316U); playerAttack.attack.hitPositionWorld = player.FindBone("head").position; playerAttack.attack.hitNormalWorld = ray.direction; playerAttack.attack.pointStart = menu.localplayer.eyes.position; playerAttack.attack.hitPositionLocal = new Vector3(-0.1f, -1f, 0f); playerAttack.attack.hitNormalLocal = new Vector3(0f, -1f, 0f); playerAttack.attack.pointEnd = player.FindBone("head").position; baseMelee.ServerRPC <PlayerAttack>("PlayerAttack", playerAttack); } }; float_0 = Time.time; } } } } } }
void OnMeleeAttack(BaseMelee melee, HitInfo hitinfo) { if (hitinfo.HitEntity == null) return; if(hitinfo.HitEntity.GetComponent<ResourceDispenser>() != null) { ResourceDispenser disp = hitinfo.HitEntity.GetComponent<ResourceDispenser>(); if (resourceZones[disp] == null) return; foreach (Zone zone in resourceZones[disp]) { if (zone.info.nogather != null) { hitinfo.HitEntity = null; } } } }
private object IOnPlayerAttack(BaseMelee melee, HitInfo info) => Interface.Call("OnPlayerAttack", melee.GetOwnerPlayer(), info);
private object OnMeleeAttack(BaseMelee melee, HitInfo hitinfo) { return Interface.CallHook("OnPlayerAttack", melee.ownerPlayer, hitinfo); }
/// <summary> /// Called from <c>BaseMelee.CLProject(BaseEntity.RPCMessage)</c> . /// </summary> public static void On_PlayerThrowWeapon(BaseMelee baseMelee, BaseEntity.RPCMessage msg) { BasePlayer messagePlayer = msg.player; if ((bool) baseMelee.CallMethod("VerifyClientAttack", messagePlayer) == false) { baseMelee.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); return; } if (!baseMelee.canThrowAsProjectile){ Debug.LogWarning(messagePlayer + " fired invalid projectile: Not throwable"); return; } Item item = baseMelee.GetItem(); if (item == null) { Debug.LogWarning(messagePlayer + " fired invalid projectile: Item not found"); return; } ItemModProjectile component = item.info.GetComponent<ItemModProjectile>(); if (component == null) { Debug.LogWarning(messagePlayer + " fired invalid projectile: Item mod not found"); return; } ProjectileShoot projectileShoot = ProjectileShoot.Deserialize(msg.read); if (projectileShoot.projectiles.Count != 1){ Debug.LogWarning(messagePlayer + " fired invalid projectile: Projectile count mismatch"); return; } messagePlayer.CleanupExpiredProjectiles(); foreach (ProjectileShoot.Projectile current in projectileShoot.projectiles) { if (messagePlayer.HasFiredProjectile(current.projectileID)) { Debug.LogWarning(messagePlayer + " fired invalid projectile: Duplicate ID ->" + current.projectileID); } else { Pre<WeaponThrowEvent> preWeaponThrowEvent = new Pre<WeaponThrowEvent>(baseMelee, messagePlayer, projectileShoot, current); OnNext("Pre_PlayerThrowWeapon", preWeaponThrowEvent); if (preWeaponThrowEvent.IsCanceled == false) { messagePlayer.NoteFiredProjectile(current.projectileID, current.startPos, current.startVel, baseMelee, item.info, item); Effect effect = new Effect(); effect.Init(Effect.Type.Projectile, current.startPos, current.startVel.normalized, msg.connection); effect.scale = preWeaponThrowEvent.Event.Magnitude; effect.pooledString = component.projectileObject.resourcePath; effect.number = current.seed; EffectNetwork.Send(effect); OnNext("On_PlayerThrowWeapon", preWeaponThrowEvent.Event); } } } item.SetParent(null); }
public void DoGather(HitInfo info) { if (!this.baseEntity.isServer || !info.CanGather || info.DidGather) { return; } if (this.gatherType == ResourceDispenser.GatherType.UNSET) { Debug.LogWarning((object)("Object :" + ((Object)((Component)this).get_gameObject()).get_name() + ": has unset gathertype!")); } else { BaseMelee ent = Object.op_Equality((Object)info.Weapon, (Object)null) ? (BaseMelee)null : (BaseMelee)((Component)info.Weapon).GetComponent <BaseMelee>(); float gatherDamage; float destroyFraction; if (Object.op_Inequality((Object)ent, (Object)null)) { ResourceDispenser.GatherPropertyEntry gatherInfoFromIndex = ent.GetGatherInfoFromIndex(this.gatherType); gatherDamage = gatherInfoFromIndex.gatherDamage * info.gatherScale; destroyFraction = gatherInfoFromIndex.destroyFraction; if ((double)gatherDamage == 0.0) { return; } ent.SendPunch(Vector3.op_Multiply(Vector3.op_Multiply(new Vector3(Random.Range(0.5f, 1f), Random.Range(-0.25f, -0.5f), 0.0f), -30f), gatherInfoFromIndex.conditionLost / 6f), 0.05f); ent.LoseCondition(gatherInfoFromIndex.conditionLost); if (!ent.IsValid() || ent.IsBroken()) { return; } info.DidGather = true; } else { gatherDamage = info.damageTypes.Total(); destroyFraction = 0.5f; } float fractionRemaining = this.fractionRemaining; this.GiveResources(info.Initiator, gatherDamage, destroyFraction, info.Weapon); this.UpdateFraction(); float damageAmount; if ((double)this.fractionRemaining <= 0.0) { damageAmount = this.baseEntity.MaxHealth(); if (info.DidGather && (double)destroyFraction < (double)this.maxDestroyFractionForFinishBonus) { this.AssignFinishBonus(info.InitiatorPlayer, 1f - destroyFraction); } } else { damageAmount = (fractionRemaining - this.fractionRemaining) * this.baseEntity.MaxHealth(); } this.baseEntity.OnAttacked(new HitInfo(info.Initiator, this.baseEntity, DamageType.Generic, damageAmount, ((Component)this).get_transform().get_position()) { gatherScale = 0.0f, PointStart = info.PointStart, PointEnd = info.PointEnd }); } }
public void DoGather(HitInfo info) { BaseMelee component; if (!base.baseEntity.isServer) { return; } if (!info.CanGather || info.DidGather) { return; } if (this.gatherType == ResourceDispenser.GatherType.UNSET) { Debug.LogWarning(string.Concat("Object :", base.gameObject.name, ": has unset gathertype!")); return; } float single = 0f; float single1 = 0f; if (info.Weapon == null) { component = null; } else { component = info.Weapon.GetComponent <BaseMelee>(); } BaseMelee baseMelee = component; if (baseMelee == null) { single = info.damageTypes.Total(); single1 = 0.5f; } else { ResourceDispenser.GatherPropertyEntry gatherInfoFromIndex = baseMelee.GetGatherInfoFromIndex(this.gatherType); single = gatherInfoFromIndex.gatherDamage * info.gatherScale; single1 = gatherInfoFromIndex.destroyFraction; if (single == 0f) { return; } baseMelee.SendPunch((new Vector3(UnityEngine.Random.Range(0.5f, 1f), UnityEngine.Random.Range(-0.25f, -0.5f), 0f) * -30f) * (gatherInfoFromIndex.conditionLost / 6f), 0.05f); baseMelee.LoseCondition(gatherInfoFromIndex.conditionLost); if (!baseMelee.IsValid() || baseMelee.IsBroken()) { return; } info.DidGather = true; } float single2 = this.fractionRemaining; this.GiveResources(info.Initiator, single, single1, info.Weapon); this.UpdateFraction(); float single3 = 0f; if (this.fractionRemaining > 0f) { single3 = (single2 - this.fractionRemaining) * base.baseEntity.MaxHealth(); } else { single3 = base.baseEntity.MaxHealth(); if (info.DidGather && single1 < this.maxDestroyFractionForFinishBonus) { this.AssignFinishBonus(info.InitiatorPlayer, 1f - single1); } } HitInfo hitInfo = new HitInfo(info.Initiator, base.baseEntity, DamageType.Generic, single3, base.transform.position) { gatherScale = 0f, PointStart = info.PointStart, PointEnd = info.PointEnd }; base.baseEntity.OnAttacked(hitInfo); }
public static void ImpactEffect(HitInfo info) { Vector3 vector3; string str = StringPool.Get(info.HitMaterial); string particle = EffectDictionary.GetParticle(info.damageTypes.GetMajorityDamageType(), str); string decal = EffectDictionary.GetDecal(info.damageTypes.GetMajorityDamageType(), str); if (TerrainMeta.WaterMap != null && info.HitMaterial != Projectile.WaterMaterialID() && info.HitMaterial != Projectile.FleshMaterialID() && info.HitPositionWorld.y < TerrainMeta.WaterMap.GetHeight(info.HitPositionWorld)) { return; } if (!info.HitEntity.IsValid()) { Vector3 hitPositionWorld = info.HitPositionWorld; Vector3 hitNormalWorld = info.HitNormalWorld; vector3 = new Vector3(); Effect.client.Run(particle, hitPositionWorld, hitNormalWorld, vector3); Vector3 hitPositionWorld1 = info.HitPositionWorld; Vector3 hitNormalWorld1 = info.HitNormalWorld; vector3 = new Vector3(); Effect.client.Run(decal, hitPositionWorld1, hitNormalWorld1, vector3); } else { GameObjectRef impactEffect = info.HitEntity.GetImpactEffect(info); if (impactEffect.isValid) { particle = impactEffect.resourcePath; } Effect.client.Run(particle, info.HitEntity, info.HitBone, info.HitPositionLocal, info.HitNormalLocal); if (info.DoDecals) { Effect.client.Run(decal, info.HitEntity, info.HitBone, info.HitPositionLocal, info.HitNormalLocal); } } if (info.WeaponPrefab) { BaseMelee weaponPrefab = info.WeaponPrefab as BaseMelee; if (weaponPrefab != null) { string strikeEffectPath = weaponPrefab.GetStrikeEffectPath(str); if (!info.HitEntity.IsValid()) { Vector3 vector31 = info.HitPositionWorld; Vector3 hitNormalWorld2 = info.HitNormalWorld; vector3 = new Vector3(); Effect.client.Run(strikeEffectPath, vector31, hitNormalWorld2, vector3); } else { Effect.client.Run(strikeEffectPath, info.HitEntity, info.HitBone, info.HitPositionLocal, info.HitNormalLocal); } } } if (info.damageTypes.Has(DamageType.Explosion)) { Effect.client.DoAdditiveImpactEffect(info, "assets/bundled/prefabs/fx/impacts/additive/explosion.prefab"); } if (info.damageTypes.Has(DamageType.Heat)) { Effect.client.DoAdditiveImpactEffect(info, "assets/bundled/prefabs/fx/impacts/additive/fire.prefab"); } }
private object OnMeleeAttack(BaseMelee melee, HitInfo hitinfo) { return(Interface.CallHook("OnPlayerAttack", melee.ownerPlayer, hitinfo)); }