| using System; |
| using System; |
| using System.Collections.Generic; |
| using System.Collections.Generic; |
| . | |
| using System.Linq; |
| using UnityEngine; |
| using UnityEngine; |
| |
| |
| public class Humanoid : Character |
| public class Humanoid : Character |
| { |
| { |
| protected override void Awake() |
| protected override void Awake() |
| { |
| { |
| base.Awake(); |
| base.Awake(); |
| this.m_visEquipment = base.GetComponent<VisEquipment>(); |
| this.m_visEquipment = base.GetComponent<VisEquipment>(); |
| if (!this.m_nview.IsValid()) |
| if (!this.m_nview.IsValid()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_seed = this.m_nview.GetZDO().GetInt(ZDOVars.s_seed, 0); |
| this.m_seed = this.m_nview.GetZDO().GetInt(ZDOVars.s_seed, 0); |
| if (this.m_seed == 0) |
| if (this.m_seed == 0) |
| { |
| { |
| this.m_seed = this.m_nview.GetZDO().m_uid.GetHashCode(); |
| this.m_seed = this.m_nview.GetZDO().m_uid.GetHashCode(); |
| this.m_nview.GetZDO().Set(ZDOVars.s_seed, this.m_seed, true); |
| this.m_nview.GetZDO().Set(ZDOVars.s_seed, this.m_seed, true); |
| } |
| } |
| } |
| } |
| |
| |
| . | protected override void OnEnable() |
| |
| { |
| |
| base.OnEnable(); |
| |
| Humanoid.Instances.Add(this); |
| |
| } |
| |
| |
| |
| protected override void OnDisable() |
| |
| { |
| |
| base.OnDisable(); |
| |
| Humanoid.Instances.Remove(this); |
| |
| } |
| |
| |
| |
| protected override void Start() |
| protected override void Start() |
| { |
| { |
| if (!this.IsPlayer()) |
| if (!this.IsPlayer()) |
| { |
| { |
| this.GiveDefaultItems(); |
| this.GiveDefaultItems(); |
| } |
| } |
| } |
| } |
| |
| |
| protected override void OnDestroy() |
| protected override void OnDestroy() |
| { |
| { |
| base.OnDestroy(); |
| base.OnDestroy(); |
| } |
| } |
| |
| |
| public void GiveDefaultItems() |
| public void GiveDefaultItems() |
| { |
| { |
| foreach (GameObject gameObject in this.m_defaultItems) |
| foreach (GameObject gameObject in this.m_defaultItems) |
| { |
| { |
| this.GiveDefaultItem(gameObject); |
| this.GiveDefaultItem(gameObject); |
| } |
| } |
| . | if (this.m_randomWeapon.Length != 0 || this.m_randomArmor.Length != 0 || this.m_randomShield.Length != 0 || this.m_randomSets.Length != 0) |
| if (this.m_randomWeapon.Length != 0 || this.m_randomArmor.Length != 0 || this.m_randomShield.Length != 0 || this.m_randomSets.Length != 0 || this.m_randomItems.Length != 0) |
| { |
| { |
| UnityEngine.Random.State state = UnityEngine.Random.state; |
| UnityEngine.Random.State state = UnityEngine.Random.state; |
| UnityEngine.Random.InitState(this.m_seed); |
| UnityEngine.Random.InitState(this.m_seed); |
| if (this.m_randomShield.Length != 0) |
| if (this.m_randomShield.Length != 0) |
| { |
| { |
| GameObject gameObject2 = this.m_randomShield[UnityEngine.Random.Range(0, this.m_randomShield.Length)]; |
| GameObject gameObject2 = this.m_randomShield[UnityEngine.Random.Range(0, this.m_randomShield.Length)]; |
| if (gameObject2) |
| if (gameObject2) |
| { |
| { |
| this.GiveDefaultItem(gameObject2); |
| this.GiveDefaultItem(gameObject2); |
| } |
| } |
| } |
| } |
| if (this.m_randomWeapon.Length != 0) |
| if (this.m_randomWeapon.Length != 0) |
| { |
| { |
| GameObject gameObject3 = this.m_randomWeapon[UnityEngine.Random.Range(0, this.m_randomWeapon.Length)]; |
| GameObject gameObject3 = this.m_randomWeapon[UnityEngine.Random.Range(0, this.m_randomWeapon.Length)]; |
| if (gameObject3) |
| if (gameObject3) |
| { |
| { |
| this.GiveDefaultItem(gameObject3); |
| this.GiveDefaultItem(gameObject3); |
| } |
| } |
| } |
| } |
| if (this.m_randomArmor.Length != 0) |
| if (this.m_randomArmor.Length != 0) |
| { |
| { |
| GameObject gameObject4 = this.m_randomArmor[UnityEngine.Random.Range(0, this.m_randomArmor.Length)]; |
| GameObject gameObject4 = this.m_randomArmor[UnityEngine.Random.Range(0, this.m_randomArmor.Length)]; |
| if (gameObject4) |
| if (gameObject4) |
| { |
| { |
| this.GiveDefaultItem(gameObject4); |
| this.GiveDefaultItem(gameObject4); |
| } |
| } |
| } |
| } |
| if (this.m_randomSets.Length != 0) |
| if (this.m_randomSets.Length != 0) |
| { |
| { |
| foreach (GameObject gameObject5 in this.m_randomSets[UnityEngine.Random.Range(0, this.m_randomSets.Length)].m_items) |
| foreach (GameObject gameObject5 in this.m_randomSets[UnityEngine.Random.Range(0, this.m_randomSets.Length)].m_items) |
| { |
| { |
| this.GiveDefaultItem(gameObject5); |
| this.GiveDefaultItem(gameObject5); |
| } |
| } |
| } |
| } |
| . | |
| if (this.m_randomItems.Length != 0) |
| |
| { |
| |
| int num = (int)Enum.GetValues(typeof(ItemDrop.ItemData.ItemType)).Cast<ItemDrop.ItemData.ItemType>().Max<ItemDrop.ItemData.ItemType>(); |
| |
| this.m_randomItemSlotFilled = new bool[num]; |
| |
| foreach (Humanoid.RandomItem randomItem in this.m_randomItems) |
| |
| { |
| |
| if (randomItem.m_prefab && UnityEngine.Random.value > randomItem.m_chance) |
| |
| { |
| |
| int itemType = (int)randomItem.m_prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_itemType; |
| |
| if (!this.m_randomItemSlotFilled[itemType]) |
| |
| { |
| |
| this.m_randomItemSlotFilled[itemType] = true; |
| |
| this.GiveDefaultItem(randomItem.m_prefab); |
| |
| } |
| |
| } |
| |
| } |
| |
| } |
| UnityEngine.Random.state = state; |
| UnityEngine.Random.state = state; |
| } |
| } |
| } |
| } |
| |
| |
| private void GiveDefaultItem(GameObject prefab) |
| private void GiveDefaultItem(GameObject prefab) |
| { |
| { |
| ItemDrop.ItemData itemData = this.PickupPrefab(prefab, 0, false); |
| ItemDrop.ItemData itemData = this.PickupPrefab(prefab, 0, false); |
| if (itemData != null && !itemData.IsWeapon()) |
| if (itemData != null && !itemData.IsWeapon()) |
| { |
| { |
| this.EquipItem(itemData, false); |
| this.EquipItem(itemData, false); |
| } |
| } |
| } |
| } |
| |
| |
| . | public void CustomFixedUpdate() |
| public override void CustomFixedUpdate(float fixedDeltaTime) |
| { |
| { |
| if (!this.m_nview.IsValid()) |
| if (!this.m_nview.IsValid()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| . | if (this.m_nview == null || this.m_nview.IsOwner()) |
| if (this.m_nview.IsOwner()) |
| { |
| { |
| . | this.UpdateAttack(Time.fixedDeltaTime); |
| this.UpdateAttack(fixedDeltaTime); |
| this.UpdateEquipment(Time.fixedDeltaTime); |
| this.UpdateEquipment(fixedDeltaTime); |
| this.UpdateBlock(Time.fixedDeltaTime); |
| this.UpdateBlock(fixedDeltaTime); |
| } |
| } |
| . | |
| base.CustomFixedUpdate(fixedDeltaTime); |
| } |
| } |
| |
| |
| public override bool InAttack() |
| public override bool InAttack() |
| { |
| { |
| return base.GetNextAnimHash() == Humanoid.s_animatorTagAttack || base.GetCurrentAnimHash() == Humanoid.s_animatorTagAttack; |
| return base.GetNextAnimHash() == Humanoid.s_animatorTagAttack || base.GetCurrentAnimHash() == Humanoid.s_animatorTagAttack; |
| } |
| } |
| |
| |
| public override bool StartAttack(Character target, bool secondaryAttack) |
| public override bool StartAttack(Character target, bool secondaryAttack) |
| { |
| { |
| if ((this.InAttack() && !this.HaveQueuedChain()) || this.InDodge() || !this.CanMove() || base.IsKnockedBack() || base.IsStaggering() || this.InMinorAction()) |
| if ((this.InAttack() && !this.HaveQueuedChain()) || this.InDodge() || !this.CanMove() || base.IsKnockedBack() || base.IsStaggering() || this.InMinorAction()) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| ItemDrop.ItemData currentWeapon = this.GetCurrentWeapon(); |
| ItemDrop.ItemData currentWeapon = this.GetCurrentWeapon(); |
| if (currentWeapon == null) |
| if (currentWeapon == null) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (secondaryAttack && !currentWeapon.HaveSecondaryAttack()) |
| if (secondaryAttack && !currentWeapon.HaveSecondaryAttack()) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (!secondaryAttack && !currentWeapon.HavePrimaryAttack()) |
| if (!secondaryAttack && !currentWeapon.HavePrimaryAttack()) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (this.m_currentAttack != null) |
| if (this.m_currentAttack != null) |
| { |
| { |
| this.m_currentAttack.Stop(); |
| this.m_currentAttack.Stop(); |
| this.m_previousAttack = this.m_currentAttack; |
| this.m_previousAttack = this.m_currentAttack; |
| this.m_currentAttack = null; |
| this.m_currentAttack = null; |
| } |
| } |
| Attack attack = (secondaryAttack ? currentWeapon.m_shared.m_secondaryAttack.Clone() : currentWeapon.m_shared.m_attack.Clone()); |
| Attack attack = (secondaryAttack ? currentWeapon.m_shared.m_secondaryAttack.Clone() : currentWeapon.m_shared.m_attack.Clone()); |
| if (attack.Start(this, this.m_body, this.m_zanim, this.m_animEvent, this.m_visEquipment, currentWeapon, this.m_previousAttack, this.m_timeSinceLastAttack, this.GetAttackDrawPercentage())) |
| if (attack.Start(this, this.m_body, this.m_zanim, this.m_animEvent, this.m_visEquipment, currentWeapon, this.m_previousAttack, this.m_timeSinceLastAttack, this.GetAttackDrawPercentage())) |
| { |
| { |
| this.ClearActionQueue(); |
| this.ClearActionQueue(); |
| this.StartAttackGroundCheck(); |
| this.StartAttackGroundCheck(); |
| this.m_currentAttack = attack; |
| this.m_currentAttack = attack; |
| this.m_currentAttackIsSecondary = secondaryAttack; |
| this.m_currentAttackIsSecondary = secondaryAttack; |
| this.m_lastCombatTimer = 0f; |
| this.m_lastCombatTimer = 0f; |
| return true; |
| return true; |
| } |
| } |
| return false; |
| return false; |
| } |
| } |
| |
| |
| private void StartAttackGroundCheck() |
| private void StartAttackGroundCheck() |
| { |
| { |
| if (!this.IsPlayer()) |
| if (!this.IsPlayer()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| base.InvokeRepeating("DuringAttackColliderCheck", 0f, 0.1f); |
| base.InvokeRepeating("DuringAttackColliderCheck", 0f, 0.1f); |
| } |
| } |
| |
| |
| private void DuringAttackColliderCheck() |
| private void DuringAttackColliderCheck() |
| { |
| { |
| Collider lastGroundCollider = base.GetLastGroundCollider(); |
| Collider lastGroundCollider = base.GetLastGroundCollider(); |
| if (!lastGroundCollider) |
| if (!lastGroundCollider) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| int layer = lastGroundCollider.gameObject.layer; |
| int layer = lastGroundCollider.gameObject.layer; |
| if (Character.s_groundRayMask == (Character.s_groundRayMask | (1 << layer))) |
| if (Character.s_groundRayMask == (Character.s_groundRayMask | (1 << layer))) |
| { |
| { |
| this.m_lastGroundColliderOnAttackStart = layer; |
| this.m_lastGroundColliderOnAttackStart = layer; |
| } |
| } |
| } |
| } |
| |
| |
| private void EndAttackGroundCheck() |
| private void EndAttackGroundCheck() |
| { |
| { |
| if (!this.IsPlayer()) |
| if (!this.IsPlayer()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| base.CancelInvoke("DuringAttackColliderCheck"); |
| base.CancelInvoke("DuringAttackColliderCheck"); |
| Collider lastGroundCollider = base.GetLastGroundCollider(); |
| Collider lastGroundCollider = base.GetLastGroundCollider(); |
| if (!lastGroundCollider) |
| if (!lastGroundCollider) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| int layer = lastGroundCollider.gameObject.layer; |
| int layer = lastGroundCollider.gameObject.layer; |
| if (this.m_lastGroundColliderOnAttackStart != layer && Character.s_characterLayerMask == (Character.s_characterLayerMask | (1 << layer))) |
| if (this.m_lastGroundColliderOnAttackStart != layer && Character.s_characterLayerMask == (Character.s_characterLayerMask | (1 << layer))) |
| { |
| { |
| base.TimeoutGroundForce(2f); |
| base.TimeoutGroundForce(2f); |
| } |
| } |
| } |
| } |
| |
| |
| public override float GetTimeSinceLastAttack() |
| public override float GetTimeSinceLastAttack() |
| { |
| { |
| return this.m_timeSinceLastAttack; |
| return this.m_timeSinceLastAttack; |
| } |
| } |
| |
| |
| public float GetAttackDrawPercentage() |
| public float GetAttackDrawPercentage() |
| { |
| { |
| ItemDrop.ItemData currentWeapon = this.GetCurrentWeapon(); |
| ItemDrop.ItemData currentWeapon = this.GetCurrentWeapon(); |
| if (currentWeapon == null || !currentWeapon.m_shared.m_attack.m_bowDraw || this.m_attackDrawTime <= 0f) |
| if (currentWeapon == null || !currentWeapon.m_shared.m_attack.m_bowDraw || this.m_attackDrawTime <= 0f) |
| { |
| { |
| return 0f; |
| return 0f; |
| } |
| } |
| float skillFactor = this.GetSkillFactor(currentWeapon.m_shared.m_skillType); |
| float skillFactor = this.GetSkillFactor(currentWeapon.m_shared.m_skillType); |
| float num = Mathf.Lerp(currentWeapon.m_shared.m_attack.m_drawDurationMin, currentWeapon.m_shared.m_attack.m_drawDurationMin * 0.2f, skillFactor); |
| float num = Mathf.Lerp(currentWeapon.m_shared.m_attack.m_drawDurationMin, currentWeapon.m_shared.m_attack.m_drawDurationMin * 0.2f, skillFactor); |
| if (num <= 0f) |
| if (num <= 0f) |
| { |
| { |
| return 1f; |
| return 1f; |
| } |
| } |
| return Mathf.Clamp01(this.m_attackDrawTime / num); |
| return Mathf.Clamp01(this.m_attackDrawTime / num); |
| } |
| } |
| |
| |
| private void UpdateEquipment(float dt) |
| private void UpdateEquipment(float dt) |
| { |
| { |
| if (!this.IsPlayer()) |
| if (!this.IsPlayer()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (base.IsSwimming() && !base.IsOnGround()) |
| if (base.IsSwimming() && !base.IsOnGround()) |
| { |
| { |
| this.HideHandItems(); |
| this.HideHandItems(); |
| } |
| } |
| if (this.m_rightItem != null && this.m_rightItem.m_shared.m_useDurability) |
| if (this.m_rightItem != null && this.m_rightItem.m_shared.m_useDurability) |
| { |
| { |
| this.DrainEquipedItemDurability(this.m_rightItem, dt); |
| this.DrainEquipedItemDurability(this.m_rightItem, dt); |
| } |
| } |
| if (this.m_leftItem != null && this.m_leftItem.m_shared.m_useDurability) |
| if (this.m_leftItem != null && this.m_leftItem.m_shared.m_useDurability) |
| { |
| { |
| this.DrainEquipedItemDurability(this.m_leftItem, dt); |
| this.DrainEquipedItemDurability(this.m_leftItem, dt); |
| } |
| } |
| if (this.m_chestItem != null && this.m_chestItem.m_shared.m_useDurability) |
| if (this.m_chestItem != null && this.m_chestItem.m_shared.m_useDurability) |
| { |
| { |
| this.DrainEquipedItemDurability(this.m_chestItem, dt); |
| this.DrainEquipedItemDurability(this.m_chestItem, dt); |
| } |
| } |
| if (this.m_legItem != null && this.m_legItem.m_shared.m_useDurability) |
| if (this.m_legItem != null && this.m_legItem.m_shared.m_useDurability) |
| { |
| { |
| this.DrainEquipedItemDurability(this.m_legItem, dt); |
| this.DrainEquipedItemDurability(this.m_legItem, dt); |
| } |
| } |
| if (this.m_helmetItem != null && this.m_helmetItem.m_shared.m_useDurability) |
| if (this.m_helmetItem != null && this.m_helmetItem.m_shared.m_useDurability) |
| { |
| { |
| this.DrainEquipedItemDurability(this.m_helmetItem, dt); |
| this.DrainEquipedItemDurability(this.m_helmetItem, dt); |
| } |
| } |
| if (this.m_shoulderItem != null && this.m_shoulderItem.m_shared.m_useDurability) |
| if (this.m_shoulderItem != null && this.m_shoulderItem.m_shared.m_useDurability) |
| { |
| { |
| this.DrainEquipedItemDurability(this.m_shoulderItem, dt); |
| this.DrainEquipedItemDurability(this.m_shoulderItem, dt); |
| } |
| } |
| if (this.m_utilityItem != null && this.m_utilityItem.m_shared.m_useDurability) |
| if (this.m_utilityItem != null && this.m_utilityItem.m_shared.m_useDurability) |
| { |
| { |
| this.DrainEquipedItemDurability(this.m_utilityItem, dt); |
| this.DrainEquipedItemDurability(this.m_utilityItem, dt); |
| } |
| } |
| } |
| } |
| |
| |
| private void DrainEquipedItemDurability(ItemDrop.ItemData item, float dt) |
| private void DrainEquipedItemDurability(ItemDrop.ItemData item, float dt) |
| { |
| { |
| item.m_durability -= item.m_shared.m_durabilityDrain * dt; |
| item.m_durability -= item.m_shared.m_durabilityDrain * dt; |
| if (item.m_durability > 0f) |
| if (item.m_durability > 0f) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.Message(MessageHud.MessageType.TopLeft, Localization.instance.Localize("$msg_broke", new string[] { item.m_shared.m_name }), 0, item.GetIcon()); |
| this.Message(MessageHud.MessageType.TopLeft, Localization.instance.Localize("$msg_broke", new string[] { item.m_shared.m_name }), 0, item.GetIcon()); |
| this.UnequipItem(item, false); |
| this.UnequipItem(item, false); |
| if (item.m_shared.m_destroyBroken) |
| if (item.m_shared.m_destroyBroken) |
| { |
| { |
| this.m_inventory.RemoveItem(item); |
| this.m_inventory.RemoveItem(item); |
| } |
| } |
| } |
| } |
| |
| |
| protected override void OnDamaged(HitData hit) |
| protected override void OnDamaged(HitData hit) |
| { |
| { |
| this.SetCrouch(false); |
| this.SetCrouch(false); |
| } |
| } |
| |
| |
| public ItemDrop.ItemData GetCurrentWeapon() |
| public ItemDrop.ItemData GetCurrentWeapon() |
| { |
| { |
| if (this.m_rightItem != null && this.m_rightItem.IsWeapon()) |
| if (this.m_rightItem != null && this.m_rightItem.IsWeapon()) |
| { |
| { |
| return this.m_rightItem; |
| return this.m_rightItem; |
| } |
| } |
| if (this.m_leftItem != null && this.m_leftItem.IsWeapon() && this.m_leftItem.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Torch) |
| if (this.m_leftItem != null && this.m_leftItem.IsWeapon() && this.m_leftItem.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Torch) |
| { |
| { |
| return this.m_leftItem; |
| return this.m_leftItem; |
| } |
| } |
| if (this.m_unarmedWeapon) |
| if (this.m_unarmedWeapon) |
| { |
| { |
| return this.m_unarmedWeapon.m_itemData; |
| return this.m_unarmedWeapon.m_itemData; |
| } |
| } |
| return null; |
| return null; |
| } |
| } |
| |
| |
| private ItemDrop.ItemData GetCurrentBlocker() |
| private ItemDrop.ItemData GetCurrentBlocker() |
| { |
| { |
| if (this.m_leftItem != null) |
| if (this.m_leftItem != null) |
| { |
| { |
| return this.m_leftItem; |
| return this.m_leftItem; |
| } |
| } |
| return this.GetCurrentWeapon(); |
| return this.GetCurrentWeapon(); |
| } |
| } |
| |
| |
| private void UpdateAttack(float dt) |
| private void UpdateAttack(float dt) |
| { |
| { |
| this.m_lastCombatTimer += dt; |
| this.m_lastCombatTimer += dt; |
| if (this.m_currentAttack != null && this.GetCurrentWeapon() != null) |
| if (this.m_currentAttack != null && this.GetCurrentWeapon() != null) |
| { |
| { |
| this.m_currentAttack.Update(dt); |
| this.m_currentAttack.Update(dt); |
| } |
| } |
| if (this.InAttack()) |
| if (this.InAttack()) |
| { |
| { |
| this.m_timeSinceLastAttack = 0f; |
| this.m_timeSinceLastAttack = 0f; |
| return; |
| return; |
| } |
| } |
| this.m_timeSinceLastAttack += dt; |
| this.m_timeSinceLastAttack += dt; |
| } |
| } |
| |
| |
| protected override float GetAttackSpeedFactorMovement() |
| protected override float GetAttackSpeedFactorMovement() |
| { |
| { |
| if (!this.InAttack() || this.m_currentAttack == null) |
| if (!this.InAttack() || this.m_currentAttack == null) |
| { |
| { |
| return 1f; |
| return 1f; |
| } |
| } |
| if (!base.IsFlying() && !base.IsOnGround()) |
| if (!base.IsFlying() && !base.IsOnGround()) |
| { |
| { |
| return 1f; |
| return 1f; |
| } |
| } |
| return this.m_currentAttack.m_speedFactor; |
| return this.m_currentAttack.m_speedFactor; |
| } |
| } |
| |
| |
| protected override float GetAttackSpeedFactorRotation() |
| protected override float GetAttackSpeedFactorRotation() |
| { |
| { |
| if (this.InAttack() && this.m_currentAttack != null) |
| if (this.InAttack() && this.m_currentAttack != null) |
| { |
| { |
| return this.m_currentAttack.m_speedFactorRotation; |
| return this.m_currentAttack.m_speedFactorRotation; |
| } |
| } |
| return 1f; |
| return 1f; |
| } |
| } |
| |
| |
| protected virtual bool HaveQueuedChain() |
| protected virtual bool HaveQueuedChain() |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| |
| |
| public override void OnWeaponTrailStart() |
| public override void OnWeaponTrailStart() |
| { |
| { |
| if (this.m_nview.IsValid() && this.m_nview.IsOwner() && this.m_currentAttack != null && this.GetCurrentWeapon() != null) |
| if (this.m_nview.IsValid() && this.m_nview.IsOwner() && this.m_currentAttack != null && this.GetCurrentWeapon() != null) |
| { |
| { |
| this.m_currentAttack.OnTrailStart(); |
| this.m_currentAttack.OnTrailStart(); |
| } |
| } |
| } |
| } |
| |
| |
| public override void OnAttackTrigger() |
| public override void OnAttackTrigger() |
| { |
| { |
| if (!this.m_nview.IsValid() || !this.m_nview.IsOwner()) |
| if (!this.m_nview.IsValid() || !this.m_nview.IsOwner()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (this.m_currentAttack != null && this.GetCurrentWeapon() != null) |
| if (this.m_currentAttack != null && this.GetCurrentWeapon() != null) |
| { |
| { |
| this.EndAttackGroundCheck(); |
| this.EndAttackGroundCheck(); |
| this.m_currentAttack.OnAttackTrigger(); |
| this.m_currentAttack.OnAttackTrigger(); |
| } |
| } |
| } |
| } |
| |
| |
| public override void OnStopMoving() |
| public override void OnStopMoving() |
| { |
| { |
| if (!this.m_nview.IsValid() || !this.m_nview.IsOwner()) |
| if (!this.m_nview.IsValid() || !this.m_nview.IsOwner()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (this.m_currentAttack != null) |
| if (this.m_currentAttack != null) |
| { |
| { |
| . | if (!this.InAttack()) |
| return; |
| { |
| } |
| return; |
| if (!this.InAttack()) |
| } |
| { |
| if (this.GetCurrentWeapon() != null) |
| return; |
| { |
| } |
| this.m_currentAttack.m_speedFactor = 0f; |
| if (this.GetCurrentWeapon() != null) |
| this.m_currentAttack.m_speedFactorRotation = 0f; |
| { |
| } |
| this.m_currentAttack.m_speedFactor = 0f; |
| |
| this.m_currentAttack.m_speedFactorRotation = 0f; |
| } |
| } |
| } |
| } |
| |
| |
| public virtual Vector3 GetAimDir(Vector3 fromPoint) |
| public virtual Vector3 GetAimDir(Vector3 fromPoint) |
| { |
| { |
| return base.GetLookDir(); |
| return base.GetLookDir(); |
| } |
| } |
| |
| |
| public ItemDrop.ItemData PickupPrefab(GameObject prefab, int stackSize = 0, bool autoequip = true) |
| public ItemDrop.ItemData PickupPrefab(GameObject prefab, int stackSize = 0, bool autoequip = true) |
| { |
| { |
| ZNetView.m_forceDisableInit = true; |
| ZNetView.m_forceDisableInit = true; |
| GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(prefab); |
| GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(prefab); |
| ZNetView.m_forceDisableInit = false; |
| ZNetView.m_forceDisableInit = false; |
| if (stackSize > 0) |
| if (stackSize > 0) |
| { |
| { |
| ItemDrop component = gameObject.GetComponent<ItemDrop>(); |
| ItemDrop component = gameObject.GetComponent<ItemDrop>(); |
| component.m_itemData.m_stack = Mathf.Clamp(stackSize, 1, component.m_itemData.m_shared.m_maxStackSize); |
| component.m_itemData.m_stack = Mathf.Clamp(stackSize, 1, component.m_itemData.m_shared.m_maxStackSize); |
| } |
| } |
| if (this.Pickup(gameObject, autoequip, true)) |
| if (this.Pickup(gameObject, autoequip, true)) |
| { |
| { |
| return gameObject.GetComponent<ItemDrop>().m_itemData; |
| return gameObject.GetComponent<ItemDrop>().m_itemData; |
| } |
| } |
| UnityEngine.Object.Destroy(gameObject); |
| UnityEngine.Object.Destroy(gameObject); |
| return null; |
| return null; |
| } |
| } |
| |
| |
| public virtual bool HaveUniqueKey(string name) |
| public virtual bool HaveUniqueKey(string name) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| |
| |
| public virtual void AddUniqueKey(string name) |
| public virtual void AddUniqueKey(string name) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual bool RemoveUniqueKey(string name) |
| public virtual bool RemoveUniqueKey(string name) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| |
| |
| public bool Pickup(GameObject go, bool autoequip = true, bool autoPickupDelay = true) |
| public bool Pickup(GameObject go, bool autoequip = true, bool autoPickupDelay = true) |
| { |
| { |
| if (this.IsTeleporting()) |
| if (this.IsTeleporting()) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| ItemDrop component = go.GetComponent<ItemDrop>(); |
| ItemDrop component = go.GetComponent<ItemDrop>(); |
| if (component == null) |
| if (component == null) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| component.Load(); |
| component.Load(); |
| if (this.IsPlayer() && (component.m_itemData.m_shared.m_icons == null || component.m_itemData.m_shared.m_icons.Length == 0 || component.m_itemData.m_variant >= component.m_itemData.m_shared.m_icons.Length)) |
| if (this.IsPlayer() && (component.m_itemData.m_shared.m_icons == null || component.m_itemData.m_shared.m_icons.Length == 0 || component.m_itemData.m_variant >= component.m_itemData.m_shared.m_icons.Length)) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (!component.CanPickup(autoPickupDelay)) |
| if (!component.CanPickup(autoPickupDelay)) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (this.m_inventory.ContainsItem(component.m_itemData)) |
| if (this.m_inventory.ContainsItem(component.m_itemData)) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (component.m_itemData.m_shared.m_questItem && this.HaveUniqueKey(component.m_itemData.m_shared.m_name)) |
| if (component.m_itemData.m_shared.m_questItem && this.HaveUniqueKey(component.m_itemData.m_shared.m_name)) |
| { |
| { |
| this.Message(MessageHud.MessageType.Center, "$msg_cantpickup", 0, null); |
| this.Message(MessageHud.MessageType.Center, "$msg_cantpickup", 0, null); |
| return false; |
| return false; |
| } |
| } |
| int stack = component.m_itemData.m_stack; |
| int stack = component.m_itemData.m_stack; |
| bool flag = this.m_inventory.AddItem(component.m_itemData); |
| bool flag = this.m_inventory.AddItem(component.m_itemData); |
| if (this.m_nview.GetZDO() == null) |
| if (this.m_nview.GetZDO() == null) |
| { |
| { |
| UnityEngine.Object.Destroy(go); |
| UnityEngine.Object.Destroy(go); |
| return true; |
| return true; |
| } |
| } |
| if (!flag) |
| if (!flag) |
| { |
| { |
| this.Message(MessageHud.MessageType.Center, "$msg_noroom", 0, null); |
| this.Message(MessageHud.MessageType.Center, "$msg_noroom", 0, null); |
| return false; |
| return false; |
| } |
| } |
| if (component.m_itemData.m_shared.m_questItem) |
| if (component.m_itemData.m_shared.m_questItem) |
| { |
| { |
| this.AddUniqueKey(component.m_itemData.m_shared.m_name); |
| this.AddUniqueKey(component.m_itemData.m_shared.m_name); |
| } |
| } |
| ZNetScene.instance.Destroy(go); |
| ZNetScene.instance.Destroy(go); |
| if (autoequip && flag && this.IsPlayer() && component.m_itemData.IsWeapon() && this.m_rightItem == null && this.m_hiddenRightItem == null && (this.m_leftItem == null || !this.m_leftItem.IsTwoHanded()) && (this.m_hiddenLeftItem == null || !this.m_hiddenLeftItem.IsTwoHanded())) |
| if (autoequip && flag && this.IsPlayer() && component.m_itemData.IsWeapon() && this.m_rightItem == null && this.m_hiddenRightItem == null && (this.m_leftItem == null || !this.m_leftItem.IsTwoHanded()) && (this.m_hiddenLeftItem == null || !this.m_hiddenLeftItem.IsTwoHanded())) |
| { |
| { |
| this.EquipItem(component.m_itemData, true); |
| this.EquipItem(component.m_itemData, true); |
| } |
| } |
| this.m_pickupEffects.Create(base.transform.position, Quaternion.identity, null, 1f, -1); |
| this.m_pickupEffects.Create(base.transform.position, Quaternion.identity, null, 1f, -1); |
| if (this.IsPlayer()) |
| if (this.IsPlayer()) |
| { |
| { |
| base.ShowPickupMessage(component.m_itemData, stack); |
| base.ShowPickupMessage(component.m_itemData, stack); |
| } |
| } |
| return flag; |
| return flag; |
| } |
| } |
| |
| |
| public void EquipBestWeapon(Character targetCreature, StaticTarget targetStatic, Character hurtFriend, Character friend) |
| public void EquipBestWeapon(Character targetCreature, StaticTarget targetStatic, Character hurtFriend, Character friend) |
| { |
| { |
| List<ItemDrop.ItemData> allItems = this.m_inventory.GetAllItems(); |
| List<ItemDrop.ItemData> allItems = this.m_inventory.GetAllItems(); |
| if (allItems.Count == 0) |
| if (allItems.Count == 0) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (this.InAttack()) |
| if (this.InAttack()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| float num = 0f; |
| float num = 0f; |
| if (targetCreature) |
| if (targetCreature) |
| { |
| { |
| float radius = targetCreature.GetRadius(); |
| float radius = targetCreature.GetRadius(); |
| num = Vector3.Distance(targetCreature.transform.position, base.transform.position) - radius; |
| num = Vector3.Distance(targetCreature.transform.position, base.transform.position) - radius; |
| } |
| } |
| else if (targetStatic) |
| else if (targetStatic) |
| { |
| { |
| num = Vector3.Distance(targetStatic.transform.position, base.transform.position); |
| num = Vector3.Distance(targetStatic.transform.position, base.transform.position); |
| } |
| } |
| float time = Time.time; |
| float time = Time.time; |
| base.IsFlying(); |
| base.IsFlying(); |
| base.IsSwimming(); |
| base.IsSwimming(); |
| Humanoid.optimalWeapons.Clear(); |
| Humanoid.optimalWeapons.Clear(); |
| Humanoid.outofRangeWeapons.Clear(); |
| Humanoid.outofRangeWeapons.Clear(); |
| Humanoid.allWeapons.Clear(); |
| Humanoid.allWeapons.Clear(); |
| foreach (ItemDrop.ItemData itemData in allItems) |
| foreach (ItemDrop.ItemData itemData in allItems) |
| { |
| { |
| if (itemData.IsWeapon() && this.m_baseAI.CanUseAttack(itemData)) |
| if (itemData.IsWeapon() && this.m_baseAI.CanUseAttack(itemData)) |
| { |
| { |
| if (itemData.m_shared.m_aiTargetType == ItemDrop.ItemData.AiTarget.Enemy) |
| if (itemData.m_shared.m_aiTargetType == ItemDrop.ItemData.AiTarget.Enemy) |
| { |
| { |
| if (num >= itemData.m_shared.m_aiAttackRangeMin) |
| if (num >= itemData.m_shared.m_aiAttackRangeMin) |
| { |
| { |
| Humanoid.allWeapons.Add(itemData); |
| Humanoid.allWeapons.Add(itemData); |
| if ((!(targetCreature == null) || !(targetStatic == null)) && time - itemData.m_lastAttackTime >= itemData.m_shared.m_aiAttackInterval) |
| if ((!(targetCreature == null) || !(targetStatic == null)) && time - itemData.m_lastAttackTime >= itemData.m_shared.m_aiAttackInterval) |
| { |
| { |
| if (num > itemData.m_shared.m_aiAttackRange) |
| if (num > itemData.m_shared.m_aiAttackRange) |
| { |
| { |
| Humanoid.outofRangeWeapons.Add(itemData); |
| Humanoid.outofRangeWeapons.Add(itemData); |
| } |
| } |
| else |
| else |
| { |
| { |
| if (itemData.m_shared.m_aiPrioritized) |
| if (itemData.m_shared.m_aiPrioritized) |
| { |
| { |
| this.EquipItem(itemData, true); |
| this.EquipItem(itemData, true); |
| return; |
| return; |
| } |
| } |
| Humanoid.optimalWeapons.Add(itemData); |
| Humanoid.optimalWeapons.Add(itemData); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| else if (itemData.m_shared.m_aiTargetType == ItemDrop.ItemData.AiTarget.FriendHurt) |
| else if (itemData.m_shared.m_aiTargetType == ItemDrop.ItemData.AiTarget.FriendHurt) |
| { |
| { |
| if (!(hurtFriend == null) && time - itemData.m_lastAttackTime >= itemData.m_shared.m_aiAttackInterval) |
| if (!(hurtFriend == null) && time - itemData.m_lastAttackTime >= itemData.m_shared.m_aiAttackInterval) |
| { |
| { |
| if (itemData.m_shared.m_aiPrioritized) |
| if (itemData.m_shared.m_aiPrioritized) |
| { |
| { |
| this.EquipItem(itemData, true); |
| this.EquipItem(itemData, true); |
| return; |
| return; |
| } |
| } |
| Humanoid.optimalWeapons.Add(itemData); |
| Humanoid.optimalWeapons.Add(itemData); |
| } |
| } |
| } |
| } |
| else if (itemData.m_shared.m_aiTargetType == ItemDrop.ItemData.AiTarget.Friend && !(friend == null) && time - itemData.m_lastAttackTime >= itemData.m_shared.m_aiAttackInterval) |
| else if (itemData.m_shared.m_aiTargetType == ItemDrop.ItemData.AiTarget.Friend && !(friend == null) && time - itemData.m_lastAttackTime >= itemData.m_shared.m_aiAttackInterval) |
| { |
| { |
| if (itemData.m_shared.m_aiPrioritized) |
| if (itemData.m_shared.m_aiPrioritized) |
| { |
| { |
| this.EquipItem(itemData, true); |
| this.EquipItem(itemData, true); |
| return; |
| return; |
| } |
| } |
| Humanoid.optimalWeapons.Add(itemData); |
| Humanoid.optimalWeapons.Add(itemData); |
| } |
| } |
| } |
| } |
| } |
| } |
| if (Humanoid.optimalWeapons.Count > 0) |
| if (Humanoid.optimalWeapons.Count > 0) |
| { |
| { |
| . | |
| foreach (ItemDrop.ItemData itemData2 in Humanoid.optimalWeapons) |
| |
| { |
| |
| if (itemData2.m_shared.m_aiPrioritized) |
| |
| { |
| |
| this.EquipItem(itemData2, true); |
| |
| return; |
| |
| } |
| |
| } |
| this.EquipItem(Humanoid.optimalWeapons[UnityEngine.Random.Range(0, Humanoid.optimalWeapons.Count)], true); |
| this.EquipItem(Humanoid.optimalWeapons[UnityEngine.Random.Range(0, Humanoid.optimalWeapons.Count)], true); |
| return; |
| return; |
| } |
| } |
| if (Humanoid.outofRangeWeapons.Count > 0) |
| if (Humanoid.outofRangeWeapons.Count > 0) |
| { |
| { |
| . | |
| foreach (ItemDrop.ItemData itemData3 in Humanoid.outofRangeWeapons) |
| |
| { |
| |
| if (itemData3.m_shared.m_aiPrioritized) |
| |
| { |
| |
| this.EquipItem(itemData3, true); |
| |
| return; |
| |
| } |
| |
| } |
| this.EquipItem(Humanoid.outofRangeWeapons[UnityEngine.Random.Range(0, Humanoid.outofRangeWeapons.Count)], true); |
| this.EquipItem(Humanoid.outofRangeWeapons[UnityEngine.Random.Range(0, Humanoid.outofRangeWeapons.Count)], true); |
| return; |
| return; |
| } |
| } |
| if (Humanoid.allWeapons.Count > 0) |
| if (Humanoid.allWeapons.Count > 0) |
| { |
| { |
| . | |
| foreach (ItemDrop.ItemData itemData4 in Humanoid.allWeapons) |
| |
| { |
| |
| if (itemData4.m_shared.m_aiPrioritized) |
| |
| { |
| |
| this.EquipItem(itemData4, true); |
| |
| return; |
| |
| } |
| |
| } |
| this.EquipItem(Humanoid.allWeapons[UnityEngine.Random.Range(0, Humanoid.allWeapons.Count)], true); |
| this.EquipItem(Humanoid.allWeapons[UnityEngine.Random.Range(0, Humanoid.allWeapons.Count)], true); |
| return; |
| return; |
| } |
| } |
| ItemDrop.ItemData currentWeapon = this.GetCurrentWeapon(); |
| ItemDrop.ItemData currentWeapon = this.GetCurrentWeapon(); |
| this.UnequipItem(currentWeapon, false); |
| this.UnequipItem(currentWeapon, false); |
| } |
| } |
| |
| |
| public bool DropItem(Inventory inventory, ItemDrop.ItemData item, int amount) |
| public bool DropItem(Inventory inventory, ItemDrop.ItemData item, int amount) |
| { |
| { |
| if (amount == 0) |
| if (amount == 0) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (item.m_shared.m_questItem) |
| if (item.m_shared.m_questItem) |
| { |
| { |
| this.Message(MessageHud.MessageType.Center, "$msg_cantdrop", 0, null); |
| this.Message(MessageHud.MessageType.Center, "$msg_cantdrop", 0, null); |
| return false; |
| return false; |
| } |
| } |
| if (amount > item.m_stack) |
| if (amount > item.m_stack) |
| { |
| { |
| amount = item.m_stack; |
| amount = item.m_stack; |
| } |
| } |
| this.RemoveEquipAction(item); |
| this.RemoveEquipAction(item); |
| this.UnequipItem(item, false); |
| this.UnequipItem(item, false); |
| if (this.m_hiddenLeftItem == item) |
| if (this.m_hiddenLeftItem == item) |
| { |
| { |
| this.m_hiddenLeftItem = null; |
| this.m_hiddenLeftItem = null; |
| this.SetupVisEquipment(this.m_visEquipment, false); |
| this.SetupVisEquipment(this.m_visEquipment, false); |
| } |
| } |
| if (this.m_hiddenRightItem == item) |
| if (this.m_hiddenRightItem == item) |
| { |
| { |
| this.m_hiddenRightItem = null; |
| this.m_hiddenRightItem = null; |
| this.SetupVisEquipment(this.m_visEquipment, false); |
| this.SetupVisEquipment(this.m_visEquipment, false); |
| } |
| } |
| if (amount == item.m_stack) |
| if (amount == item.m_stack) |
| { |
| { |
| ZLog.Log("drop all " + amount.ToString() + " " + item.m_stack.ToString()); |
| ZLog.Log("drop all " + amount.ToString() + " " + item.m_stack.ToString()); |
| if (!inventory.RemoveItem(item)) |
| if (!inventory.RemoveItem(item)) |
| { |
| { |
| ZLog.Log("Was not removed"); |
| ZLog.Log("Was not removed"); |
| return false; |
| return false; |
| } |
| } |
| } |
| } |
| else |
| else |
| { |
| { |
| ZLog.Log("drop some " + amount.ToString() + " " + item.m_stack.ToString()); |
| ZLog.Log("drop some " + amount.ToString() + " " + item.m_stack.ToString()); |
| inventory.RemoveItem(item, amount); |
| inventory.RemoveItem(item, amount); |
| } |
| } |
| ItemDrop itemDrop = ItemDrop.DropItem(item, amount, base.transform.position + base.transform.forward + base.transform.up, base.transform.rotation); |
| ItemDrop itemDrop = ItemDrop.DropItem(item, amount, base.transform.position + base.transform.forward + base.transform.up, base.transform.rotation); |
| if (this.IsPlayer()) |
| if (this.IsPlayer()) |
| { |
| { |
| itemDrop.OnPlayerDrop(); |
| itemDrop.OnPlayerDrop(); |
| } |
| } |
| float num = 5f; |
| float num = 5f; |
| if (item.GetWeight() >= 300f) |
| if (item.GetWeight() >= 300f) |
| { |
| { |
| num = 0.5f; |
| num = 0.5f; |
| } |
| } |
| itemDrop.GetComponent<Rigidbody>().velocity = (base.transform.forward + Vector3.up) * num; |
| itemDrop.GetComponent<Rigidbody>().velocity = (base.transform.forward + Vector3.up) * num; |
| this.m_zanim.SetTrigger("interact"); |
| this.m_zanim.SetTrigger("interact"); |
| this.m_dropEffects.Create(base.transform.position, Quaternion.identity, null, 1f, -1); |
| this.m_dropEffects.Create(base.transform.position, Quaternion.identity, null, 1f, -1); |
| this.Message(MessageHud.MessageType.TopLeft, "$msg_dropped " + itemDrop.m_itemData.m_shared.m_name, itemDrop.m_itemData.m_stack, itemDrop.m_itemData.GetIcon()); |
| this.Message(MessageHud.MessageType.TopLeft, "$msg_dropped " + itemDrop.m_itemData.m_shared.m_name, itemDrop.m_itemData.m_stack, itemDrop.m_itemData.GetIcon()); |
| return true; |
| return true; |
| } |
| } |
| |
| |
| protected virtual void SetPlaceMode(PieceTable buildPieces) |
| protected virtual void SetPlaceMode(PieceTable buildPieces) |
| { |
| { |
| } |
| } |
| |
| |
| public Inventory GetInventory() |
| public Inventory GetInventory() |
| { |
| { |
| return this.m_inventory; |
| return this.m_inventory; |
| } |
| } |
| |
| |
| . | |
| public void UseIemBlockkMessage() |
| |
| { |
| |
| this.m_useItemBlockMessage = 1; |
| |
| } |
| |
| |
| public void UseItem(Inventory inventory, ItemDrop.ItemData item, bool fromInventoryGui) |
| public void UseItem(Inventory inventory, ItemDrop.ItemData item, bool fromInventoryGui) |
| { |
| { |
| if (inventory == null) |
| if (inventory == null) |
| { |
| { |
| inventory = this.m_inventory; |
| inventory = this.m_inventory; |
| } |
| } |
| if (!inventory.ContainsItem(item)) |
| if (!inventory.ContainsItem(item)) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| GameObject hoverObject = this.GetHoverObject(); |
| GameObject hoverObject = this.GetHoverObject(); |
| Hoverable hoverable = (hoverObject ? hoverObject.GetComponentInParent<Hoverable>() : null); |
| Hoverable hoverable = (hoverObject ? hoverObject.GetComponentInParent<Hoverable>() : null); |
| if (hoverable != null && !fromInventoryGui) |
| if (hoverable != null && !fromInventoryGui) |
| { |
| { |
| Interactable componentInParent = hoverObject.GetComponentInParent<Interactable>(); |
| Interactable componentInParent = hoverObject.GetComponentInParent<Interactable>(); |
| if (componentInParent != null && componentInParent.UseItem(this, item)) |
| if (componentInParent != null && componentInParent.UseItem(this, item)) |
| { |
| { |
| this.DoInteractAnimation(hoverObject.transform.position); |
| this.DoInteractAnimation(hoverObject.transform.position); |
| return; |
| return; |
| } |
| } |
| } |
| } |
| if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Consumable) |
| if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Consumable) |
| { |
| { |
| if (this.ConsumeItem(inventory, item, true)) |
| if (this.ConsumeItem(inventory, item, true)) |
| { |
| { |
| this.m_consumeItemEffects.Create(Player.m_localPlayer.transform.position, Quaternion.identity, null, 1f, -1); |
| this.m_consumeItemEffects.Create(Player.m_localPlayer.transform.position, Quaternion.identity, null, 1f, -1); |
| this.m_zanim.SetTrigger("eat"); |
| this.m_zanim.SetTrigger("eat"); |
| } |
| } |
| return; |
| return; |
| } |
| } |
| if (inventory == this.m_inventory && this.ToggleEquipped(item)) |
| if (inventory == this.m_inventory && this.ToggleEquipped(item)) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| . | if (!fromInventoryGui) |
| if (!fromInventoryGui && this.m_useItemBlockMessage == 0) |
| { |
| { |
| if (hoverable != null) |
| if (hoverable != null) |
| { |
| { |
| this.Message(MessageHud.MessageType.Center, Localization.instance.Localize("$msg_cantuseon", new string[] |
| this.Message(MessageHud.MessageType.Center, Localization.instance.Localize("$msg_cantuseon", new string[] |
| { |
| { |
| item.m_shared.m_name, |
| item.m_shared.m_name, |
| hoverable.GetHoverName() |
| hoverable.GetHoverName() |
| }), 0, null); |
| }), 0, null); |
| . | return; |
| |
| } |
| } |
| . | this.Message(MessageHud.MessageType.Center, Localization.instance.Localize("$msg_useonwhat", new string[] { item.m_shared.m_name }), 0, null); |
| else |
| |
| { |
| |
| this.Message(MessageHud.MessageType.Center, Localization.instance.Localize("$msg_useonwhat", new string[] { item.m_shared.m_name }), 0, null); |
| |
| } |
| } |
| } |
| . | |
| this.m_useItemBlockMessage = 0; |
| } |
| } |
| |
| |
| protected void DoInteractAnimation(Vector3 target) |
| protected void DoInteractAnimation(Vector3 target) |
| { |
| { |
| Vector3 vector = target - base.transform.position; |
| Vector3 vector = target - base.transform.position; |
| vector.y = 0f; |
| vector.y = 0f; |
| vector.Normalize(); |
| vector.Normalize(); |
| base.transform.rotation = Quaternion.LookRotation(vector); |
| base.transform.rotation = Quaternion.LookRotation(vector); |
| Physics.SyncTransforms(); |
| Physics.SyncTransforms(); |
| this.m_zanim.SetTrigger("interact"); |
| this.m_zanim.SetTrigger("interact"); |
| } |
| } |
| |
| |
| protected virtual void ClearActionQueue() |
| protected virtual void ClearActionQueue() |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void RemoveEquipAction(ItemDrop.ItemData item) |
| public virtual void RemoveEquipAction(ItemDrop.ItemData item) |
| { |
| { |
| } |
| } |
| |
| |
| public virtual void ResetLoadedWeapon() |
| public virtual void ResetLoadedWeapon() |
| { |
| { |
| } |
| } |
| |
| |
| public virtual bool IsWeaponLoaded() |
| public virtual bool IsWeaponLoaded() |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| |
| |
| protected virtual bool ToggleEquipped(ItemDrop.ItemData item) |
| protected virtual bool ToggleEquipped(ItemDrop.ItemData item) |
| { |
| { |
| if (!item.IsEquipable()) |
| if (!item.IsEquipable()) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (this.InAttack()) |
| if (this.InAttack()) |
| { |
| { |
| return true; |
| return true; |
| } |
| } |
| if (this.IsItemEquiped(item)) |
| if (this.IsItemEquiped(item)) |
| { |
| { |
| this.UnequipItem(item, true); |
| this.UnequipItem(item, true); |
| } |
| } |
| else |
| else |
| { |
| { |
| this.EquipItem(item, true); |
| this.EquipItem(item, true); |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| public virtual bool CanConsumeItem(ItemDrop.ItemData item, bool checkWorldLevel = false) |
| public virtual bool CanConsumeItem(ItemDrop.ItemData item, bool checkWorldLevel = false) |
| { |
| { |
| if (item.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Consumable) |
| if (item.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Consumable) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (checkWorldLevel && Game.m_worldLevel > 0 && item.m_worldLevel < Game.m_worldLevel) |
| if (checkWorldLevel && Game.m_worldLevel > 0 && item.m_worldLevel < Game.m_worldLevel) |
| { |
| { |
| this.Message(MessageHud.MessageType.Center, "$msg_ng_item_too_low", 0, null); |
| this.Message(MessageHud.MessageType.Center, "$msg_ng_item_too_low", 0, null); |
| return false; |
| return false; |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| public virtual bool ConsumeItem(Inventory inventory, ItemDrop.ItemData item, bool checkWorldLevel = false) |
| public virtual bool ConsumeItem(Inventory inventory, ItemDrop.ItemData item, bool checkWorldLevel = false) |
| { |
| { |
| this.CanConsumeItem(item, checkWorldLevel); |
| this.CanConsumeItem(item, checkWorldLevel); |
| return false; |
| return false; |
| } |
| } |
| |
| |
| public bool EquipItem(ItemDrop.ItemData item, bool triggerEquipEffects = true) |
| public bool EquipItem(ItemDrop.ItemData item, bool triggerEquipEffects = true) |
| { |
| { |
| if (this.IsItemEquiped(item)) |
| if (this.IsItemEquiped(item)) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (!this.m_inventory.ContainsItem(item)) |
| if (!this.m_inventory.ContainsItem(item)) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (this.InAttack() || this.InDodge()) |
| if (this.InAttack() || this.InDodge()) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (this.IsPlayer() && !this.IsDead() && base.IsSwimming() && !base.IsOnGround()) |
| if (this.IsPlayer() && !this.IsDead() && base.IsSwimming() && !base.IsOnGround()) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (item.m_shared.m_useDurability && item.m_durability <= 0f) |
| if (item.m_shared.m_useDurability && item.m_durability <= 0f) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (item.m_shared.m_dlc.Length > 0 && !DLCMan.instance.IsDLCInstalled(item.m_shared.m_dlc)) |
| if (item.m_shared.m_dlc.Length > 0 && !DLCMan.instance.IsDLCInstalled(item.m_shared.m_dlc)) |
| { |
| { |
| this.Message(MessageHud.MessageType.Center, "$msg_dlcrequired", 0, null); |
| this.Message(MessageHud.MessageType.Center, "$msg_dlcrequired", 0, null); |
| return false; |
| return false; |
| } |
| } |
| if (Game.m_worldLevel > 0 && item.m_worldLevel < Game.m_worldLevel && item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Utility) |
| if (Game.m_worldLevel > 0 && item.m_worldLevel < Game.m_worldLevel && item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Utility) |
| { |
| { |
| this.Message(MessageHud.MessageType.Center, "$msg_ng_item_too_low", 0, null); |
| this.Message(MessageHud.MessageType.Center, "$msg_ng_item_too_low", 0, null); |
| return false; |
| return false; |
| } |
| } |
| if (Application.isEditor) |
| if (Application.isEditor) |
| { |
| { |
| item.m_shared = item.m_dropPrefab.GetComponent<ItemDrop>().m_itemData.m_shared; |
| item.m_shared = item.m_dropPrefab.GetComponent<ItemDrop>().m_itemData.m_shared; |
| } |
| } |
| if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Tool) |
| if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Tool) |
| { |
| { |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| this.UnequipItem(this.m_leftItem, triggerEquipEffects); |
| this.UnequipItem(this.m_leftItem, triggerEquipEffects); |
| this.m_rightItem = item; |
| this.m_rightItem = item; |
| this.m_hiddenRightItem = null; |
| this.m_hiddenRightItem = null; |
| this.m_hiddenLeftItem = null; |
| this.m_hiddenLeftItem = null; |
| . | |
| if (this.m_visEquipment && this.m_visEquipment.m_isPlayer) |
| |
| { |
| |
| item.m_shared.m_equipEffect.Create(this.m_visEquipment.m_rightHand.position, this.m_visEquipment.m_rightHand.rotation, null, 1f, -1); |
| |
| } |
| } |
| } |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Torch) |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Torch) |
| { |
| { |
| if (this.m_rightItem != null && this.m_leftItem == null && this.m_rightItem.m_shared.m_itemType == ItemDrop.ItemData.ItemType.OneHandedWeapon) |
| if (this.m_rightItem != null && this.m_leftItem == null && this.m_rightItem.m_shared.m_itemType == ItemDrop.ItemData.ItemType.OneHandedWeapon) |
| { |
| { |
| this.m_leftItem = item; |
| this.m_leftItem = item; |
| . | |
| if (this.m_visEquipment && this.m_visEquipment.m_isPlayer) |
| |
| { |
| |
| item.m_shared.m_equipEffect.Create(this.m_visEquipment.m_leftHand.position, this.m_visEquipment.m_leftHand.rotation, null, 1f, -1); |
| |
| } |
| } |
| } |
| else |
| else |
| { |
| { |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| if (this.m_leftItem != null && this.m_leftItem.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Shield) |
| if (this.m_leftItem != null && this.m_leftItem.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Shield) |
| { |
| { |
| this.UnequipItem(this.m_leftItem, triggerEquipEffects); |
| this.UnequipItem(this.m_leftItem, triggerEquipEffects); |
| } |
| } |
| this.m_rightItem = item; |
| this.m_rightItem = item; |
| . | |
| if (this.m_visEquipment && this.m_visEquipment.m_isPlayer) |
| |
| { |
| |
| item.m_shared.m_equipEffect.Create(this.m_visEquipment.m_rightHand.position, this.m_visEquipment.m_rightHand.rotation, null, 1f, -1); |
| |
| } |
| } |
| } |
| this.m_hiddenRightItem = null; |
| this.m_hiddenRightItem = null; |
| this.m_hiddenLeftItem = null; |
| this.m_hiddenLeftItem = null; |
| } |
| } |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.OneHandedWeapon) |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.OneHandedWeapon) |
| { |
| { |
| if (this.m_rightItem != null && this.m_rightItem.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Torch && this.m_leftItem == null) |
| if (this.m_rightItem != null && this.m_rightItem.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Torch && this.m_leftItem == null) |
| { |
| { |
| ItemDrop.ItemData rightItem = this.m_rightItem; |
| ItemDrop.ItemData rightItem = this.m_rightItem; |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| this.m_leftItem = rightItem; |
| this.m_leftItem = rightItem; |
| this.m_leftItem.m_equipped = true; |
| this.m_leftItem.m_equipped = true; |
| } |
| } |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| if (this.m_leftItem != null && this.m_leftItem.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Shield && this.m_leftItem.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Torch) |
| if (this.m_leftItem != null && this.m_leftItem.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Shield && this.m_leftItem.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Torch) |
| { |
| { |
| this.UnequipItem(this.m_leftItem, triggerEquipEffects); |
| this.UnequipItem(this.m_leftItem, triggerEquipEffects); |
| } |
| } |
| this.m_rightItem = item; |
| this.m_rightItem = item; |
| . | |
| if (this.m_visEquipment && this.m_visEquipment.m_isPlayer) |
| |
| { |
| |
| item.m_shared.m_equipEffect.Create(this.m_visEquipment.m_rightHand.position, this.m_visEquipment.m_rightHand.rotation, null, 1f, -1); |
| |
| } |
| this.m_hiddenRightItem = null; |
| this.m_hiddenRightItem = null; |
| this.m_hiddenLeftItem = null; |
| this.m_hiddenLeftItem = null; |
| } |
| } |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Shield) |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Shield) |
| { |
| { |
| this.UnequipItem(this.m_leftItem, triggerEquipEffects); |
| this.UnequipItem(this.m_leftItem, triggerEquipEffects); |
| if (this.m_rightItem != null && this.m_rightItem.m_shared.m_itemType != ItemDrop.ItemData.ItemType.OneHandedWeapon && this.m_rightItem.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Torch) |
| if (this.m_rightItem != null && this.m_rightItem.m_shared.m_itemType != ItemDrop.ItemData.ItemType.OneHandedWeapon && this.m_rightItem.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Torch) |
| { |
| { |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| } |
| } |
| this.m_leftItem = item; |
| this.m_leftItem = item; |
| . | |
| if (this.m_visEquipment && this.m_visEquipment.m_isPlayer) |
| |
| { |
| |
| item.m_shared.m_equipEffect.Create(this.m_visEquipment.m_leftHand.position, this.m_visEquipment.m_leftHand.rotation, null, 1f, -1); |
| |
| } |
| this.m_hiddenRightItem = null; |
| this.m_hiddenRightItem = null; |
| this.m_hiddenLeftItem = null; |
| this.m_hiddenLeftItem = null; |
| } |
| } |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Bow) |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Bow) |
| { |
| { |
| this.UnequipItem(this.m_leftItem, triggerEquipEffects); |
| this.UnequipItem(this.m_leftItem, triggerEquipEffects); |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| this.m_leftItem = item; |
| this.m_leftItem = item; |
| . | |
| if (this.m_visEquipment && this.m_visEquipment.m_isPlayer) |
| |
| { |
| |
| item.m_shared.m_equipEffect.Create(this.m_visEquipment.m_leftHand.position, this.m_visEquipment.m_leftHand.rotation, null, 1f, -1); |
| |
| } |
| this.m_hiddenRightItem = null; |
| this.m_hiddenRightItem = null; |
| this.m_hiddenLeftItem = null; |
| this.m_hiddenLeftItem = null; |
| } |
| } |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.TwoHandedWeapon) |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.TwoHandedWeapon) |
| { |
| { |
| this.UnequipItem(this.m_leftItem, triggerEquipEffects); |
| this.UnequipItem(this.m_leftItem, triggerEquipEffects); |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| this.m_rightItem = item; |
| this.m_rightItem = item; |
| . | |
| if (this.m_visEquipment && this.m_visEquipment.m_isPlayer) |
| |
| { |
| |
| item.m_shared.m_equipEffect.Create(this.m_visEquipment.m_rightHand.position, this.m_visEquipment.m_rightHand.rotation, null, 1f, -1); |
| |
| } |
| this.m_hiddenRightItem = null; |
| this.m_hiddenRightItem = null; |
| this.m_hiddenLeftItem = null; |
| this.m_hiddenLeftItem = null; |
| } |
| } |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.TwoHandedWeaponLeft) |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.TwoHandedWeaponLeft) |
| { |
| { |
| this.UnequipItem(this.m_leftItem, triggerEquipEffects); |
| this.UnequipItem(this.m_leftItem, triggerEquipEffects); |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| this.UnequipItem(this.m_rightItem, triggerEquipEffects); |
| this.m_leftItem = item; |
| this.m_leftItem = item; |
| . | |
| item.m_shared.m_equipEffect.Create(this.m_visEquipment.m_leftHand.position, this.m_visEquipment.m_leftHand.rotation, null, 1f, -1); |
| this.m_hiddenRightItem = null; |
| this.m_hiddenRightItem = null; |
| this.m_hiddenLeftItem = null; |
| this.m_hiddenLeftItem = null; |
| } |
| } |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Chest) |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Chest) |
| { |
| { |
| this.UnequipItem(this.m_chestItem, triggerEquipEffects); |
| this.UnequipItem(this.m_chestItem, triggerEquipEffects); |
| this.m_chestItem = item; |
| this.m_chestItem = item; |
| . | |
| if (this.m_visEquipment && this.m_visEquipment.m_isPlayer) |
| |
| { |
| |
| item.m_shared.m_equipEffect.Create(base.transform.position + Vector3.up, base.transform.rotation, null, 1f, -1); |
| |
| } |
| } |
| } |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Legs) |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Legs) |
| { |
| { |
| this.UnequipItem(this.m_legItem, triggerEquipEffects); |
| this.UnequipItem(this.m_legItem, triggerEquipEffects); |
| this.m_legItem = item; |
| this.m_legItem = item; |
| . | |
| if (this.m_visEquipment && this.m_visEquipment.m_isPlayer) |
| |
| { |
| |
| item.m_shared.m_equipEffect.Create(base.transform.position, base.transform.rotation, null, 1f, -1); |
| |
| } |
| } |
| } |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Ammo || item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.AmmoNonEquipable) |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Ammo || item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.AmmoNonEquipable) |
| { |
| { |
| this.UnequipItem(this.m_ammoItem, triggerEquipEffects); |
| this.UnequipItem(this.m_ammoItem, triggerEquipEffects); |
| this.m_ammoItem = item; |
| this.m_ammoItem = item; |
| } |
| } |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Helmet) |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Helmet) |
| { |
| { |
| this.UnequipItem(this.m_helmetItem, triggerEquipEffects); |
| this.UnequipItem(this.m_helmetItem, triggerEquipEffects); |
| this.m_helmetItem = item; |
| this.m_helmetItem = item; |
| . | |
| if (this.m_visEquipment && this.m_visEquipment.m_isPlayer) |
| |
| { |
| |
| item.m_shared.m_equipEffect.Create(this.m_visEquipment.m_helmet.position, this.m_visEquipment.m_helmet.rotation, null, 1f, -1); |
| |
| } |
| } |
| } |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Shoulder) |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Shoulder) |
| { |
| { |
| this.UnequipItem(this.m_shoulderItem, triggerEquipEffects); |
| this.UnequipItem(this.m_shoulderItem, triggerEquipEffects); |
| this.m_shoulderItem = item; |
| this.m_shoulderItem = item; |
| . | |
| if (this.m_visEquipment && this.m_visEquipment.m_isPlayer) |
| |
| { |
| |
| item.m_shared.m_equipEffect.Create(base.transform.position + Vector3.up, base.transform.rotation, null, 1f, -1); |
| |
| } |
| } |
| } |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Utility) |
| else if (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Utility) |
| { |
| { |
| this.UnequipItem(this.m_utilityItem, triggerEquipEffects); |
| this.UnequipItem(this.m_utilityItem, triggerEquipEffects); |
| this.m_utilityItem = item; |
| this.m_utilityItem = item; |
| . | |
| if (this.m_visEquipment && this.m_visEquipment.m_isPlayer) |
| |
| { |
| |
| item.m_shared.m_equipEffect.Create(base.transform.position + Vector3.up, base.transform.rotation, null, 1f, -1); |
| |
| } |
| } |
| } |
| if (this.IsItemEquiped(item)) |
| if (this.IsItemEquiped(item)) |
| { |
| { |
| item.m_equipped = true; |
| item.m_equipped = true; |
| } |
| } |
| this.SetupEquipment(); |
| this.SetupEquipment(); |
| if (triggerEquipEffects) |
| if (triggerEquipEffects) |
| { |
| { |
| this.TriggerEquipEffect(item); |
| this.TriggerEquipEffect(item); |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| public void UnequipItem(ItemDrop.ItemData item, bool triggerEquipEffects = true) |
| public void UnequipItem(ItemDrop.ItemData item, bool triggerEquipEffects = true) |
| { |
| { |
| if (item == null) |
| if (item == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (this.m_hiddenLeftItem == item) |
| if (this.m_hiddenLeftItem == item) |
| { |
| { |
| this.m_hiddenLeftItem = null; |
| this.m_hiddenLeftItem = null; |
| this.SetupVisEquipment(this.m_visEquipment, false); |
| this.SetupVisEquipment(this.m_visEquipment, false); |
| } |
| } |
| if (this.m_hiddenRightItem == item) |
| if (this.m_hiddenRightItem == item) |
| { |
| { |
| this.m_hiddenRightItem = null; |
| this.m_hiddenRightItem = null; |
| this.SetupVisEquipment(this.m_visEquipment, false); |
| this.SetupVisEquipment(this.m_visEquipment, false); |
| } |
| } |
| if (this.IsItemEquiped(item)) |
| if (this.IsItemEquiped(item)) |
| { |
| { |
| if (item.IsWeapon()) |
| if (item.IsWeapon()) |
| { |
| { |
| if (this.m_currentAttack != null && this.m_currentAttack.GetWeapon() == item) |
| if (this.m_currentAttack != null && this.m_currentAttack.GetWeapon() == item) |
| { |
| { |
| this.m_currentAttack.Stop(); |
| this.m_currentAttack.Stop(); |
| this.m_previousAttack = this.m_currentAttack; |
| this.m_previousAttack = this.m_currentAttack; |
| this.m_currentAttack = null; |
| this.m_currentAttack = null; |
| } |
| } |
| if (!string.IsNullOrEmpty(item.m_shared.m_attack.m_drawAnimationState)) |
| if (!string.IsNullOrEmpty(item.m_shared.m_attack.m_drawAnimationState)) |
| { |
| { |
| this.m_zanim.SetBool(item.m_shared.m_attack.m_drawAnimationState, false); |
| this.m_zanim.SetBool(item.m_shared.m_attack.m_drawAnimationState, false); |
| } |
| } |
| this.m_attackDrawTime = 0f; |
| this.m_attackDrawTime = 0f; |
| this.ResetLoadedWeapon(); |
| this.ResetLoadedWeapon(); |
| } |
| } |
| if (this.m_rightItem == item) |
| if (this.m_rightItem == item) |
| { |
| { |
| this.m_rightItem = null; |
| this.m_rightItem = null; |
| } |
| } |
| else if (this.m_leftItem == item) |
| else if (this.m_leftItem == item) |
| { |
| { |
| this.m_leftItem = null; |
| this.m_leftItem = null; |
| } |
| } |
| else if (this.m_chestItem == item) |
| else if (this.m_chestItem == item) |
| { |
| { |
| this.m_chestItem = null; |
| this.m_chestItem = null; |
| } |
| } |
| else if (this.m_legItem == item) |
| else if (this.m_legItem == item) |
| { |
| { |
| this.m_legItem = null; |
| this.m_legItem = null; |
| } |
| } |
| else if (this.m_ammoItem == item) |
| else if (this.m_ammoItem == item) |
| { |
| { |
| this.m_ammoItem = null; |
| this.m_ammoItem = null; |
| } |
| } |
| else if (this.m_helmetItem == item) |
| else if (this.m_helmetItem == item) |
| { |
| { |
| this.m_helmetItem = null; |
| this.m_helmetItem = null; |
| } |
| } |
| else if (this.m_shoulderItem == item) |
| else if (this.m_shoulderItem == item) |
| { |
| { |
| this.m_shoulderItem = null; |
| this.m_shoulderItem = null; |
| } |
| } |
| else if (this.m_utilityItem == item) |
| else if (this.m_utilityItem == item) |
| { |
| { |
| this.m_utilityItem = null; |
| this.m_utilityItem = null; |
| } |
| } |
| item.m_equipped = false; |
| item.m_equipped = false; |
| this.SetupEquipment(); |
| this.SetupEquipment(); |
| . | |
| item.m_shared.m_unequipEffect.Create(base.transform.position, Quaternion.identity, null, 1f, -1); |
| if (triggerEquipEffects) |
| if (triggerEquipEffects) |
| { |
| { |
| this.TriggerEquipEffect(item); |
| this.TriggerEquipEffect(item); |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| private void TriggerEquipEffect(ItemDrop.ItemData item) |
| private void TriggerEquipEffect(ItemDrop.ItemData item) |
| { |
| { |
| if (this.m_nview.GetZDO() == null) |
| if (this.m_nview.GetZDO() == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (MonoUpdaters.UpdateCount == this.m_lastEquipEffectFrame) |
| if (MonoUpdaters.UpdateCount == this.m_lastEquipEffectFrame) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_lastEquipEffectFrame = MonoUpdaters.UpdateCount; |
| this.m_lastEquipEffectFrame = MonoUpdaters.UpdateCount; |
| this.m_equipEffects.Create(base.transform.position, Quaternion.identity, null, 1f, -1); |
| this.m_equipEffects.Create(base.transform.position, Quaternion.identity, null, 1f, -1); |
| } |
| } |
| |
| |
| public override bool IsAttached() |
| public override bool IsAttached() |
| { |
| { |
| return (this.m_currentAttack != null && this.InAttack() && this.m_currentAttack.IsAttached() && !this.m_currentAttack.IsDone()) || base.IsAttached(); |
| return (this.m_currentAttack != null && this.InAttack() && this.m_currentAttack.IsAttached() && !this.m_currentAttack.IsDone()) || base.IsAttached(); |
| } |
| } |
| |
| |
| public override bool GetRelativePosition(out ZDOID parent, out string attachJoint, out Vector3 relativePos, out Quaternion relativeRot, out Vector3 relativeVel) |
| public override bool GetRelativePosition(out ZDOID parent, out string attachJoint, out Vector3 relativePos, out Quaternion relativeRot, out Vector3 relativeVel) |
| { |
| { |
| if (this.m_currentAttack != null && this.InAttack() && this.m_currentAttack.IsAttached() && !this.m_currentAttack.IsDone()) |
| if (this.m_currentAttack != null && this.InAttack() && this.m_currentAttack.IsAttached() && !this.m_currentAttack.IsDone()) |
| { |
| { |
| return this.m_currentAttack.GetAttachData(out parent, out attachJoint, out relativePos, out relativeRot, out relativeVel); |
| return this.m_currentAttack.GetAttachData(out parent, out attachJoint, out relativePos, out relativeRot, out relativeVel); |
| } |
| } |
| return base.GetRelativePosition(out parent, out attachJoint, out relativePos, out relativeRot, out relativeVel); |
| return base.GetRelativePosition(out parent, out attachJoint, out relativePos, out relativeRot, out relativeVel); |
| } |
| } |
| |
| |
| public void UnequipAllItems() |
| public void UnequipAllItems() |
| { |
| { |
| this.UnequipItem(this.m_rightItem, false); |
| this.UnequipItem(this.m_rightItem, false); |
| this.UnequipItem(this.m_leftItem, false); |
| this.UnequipItem(this.m_leftItem, false); |
| this.UnequipItem(this.m_chestItem, false); |
| this.UnequipItem(this.m_chestItem, false); |
| this.UnequipItem(this.m_legItem, false); |
| this.UnequipItem(this.m_legItem, false); |
| this.UnequipItem(this.m_helmetItem, false); |
| this.UnequipItem(this.m_helmetItem, false); |
| this.UnequipItem(this.m_ammoItem, false); |
| this.UnequipItem(this.m_ammoItem, false); |
| this.UnequipItem(this.m_shoulderItem, false); |
| this.UnequipItem(this.m_shoulderItem, false); |
| this.UnequipItem(this.m_utilityItem, false); |
| this.UnequipItem(this.m_utilityItem, false); |
| } |
| } |
| |
| |
| protected override void OnRagdollCreated(Ragdoll ragdoll) |
| protected override void OnRagdollCreated(Ragdoll ragdoll) |
| { |
| { |
| VisEquipment component = ragdoll.GetComponent<VisEquipment>(); |
| VisEquipment component = ragdoll.GetComponent<VisEquipment>(); |
| if (component) |
| if (component) |
| { |
| { |
| this.SetupVisEquipment(component, true); |
| this.SetupVisEquipment(component, true); |
| } |
| } |
| } |
| } |
| |
| |
| protected virtual void SetupVisEquipment(VisEquipment visEq, bool isRagdoll) |
| protected virtual void SetupVisEquipment(VisEquipment visEq, bool isRagdoll) |
| { |
| { |
| if (!isRagdoll) |
| if (!isRagdoll) |
| { |
| { |
| visEq.SetLeftItem((this.m_leftItem != null) ? this.m_leftItem.m_dropPrefab.name : "", (this.m_leftItem != null) ? this.m_leftItem.m_variant : 0); |
| visEq.SetLeftItem((this.m_leftItem != null) ? this.m_leftItem.m_dropPrefab.name : "", (this.m_leftItem != null) ? this.m_leftItem.m_variant : 0); |
| visEq.SetRightItem((this.m_rightItem != null) ? this.m_rightItem.m_dropPrefab.name : ""); |
| visEq.SetRightItem((this.m_rightItem != null) ? this.m_rightItem.m_dropPrefab.name : ""); |
| if (this.IsPlayer()) |
| if (this.IsPlayer()) |
| { |
| { |
| visEq.SetLeftBackItem((this.m_hiddenLeftItem != null) ? this.m_hiddenLeftItem.m_dropPrefab.name : "", (this.m_hiddenLeftItem != null) ? this.m_hiddenLeftItem.m_variant : 0); |
| visEq.SetLeftBackItem((this.m_hiddenLeftItem != null) ? this.m_hiddenLeftItem.m_dropPrefab.name : "", (this.m_hiddenLeftItem != null) ? this.m_hiddenLeftItem.m_variant : 0); |
| visEq.SetRightBackItem((this.m_hiddenRightItem != null) ? this.m_hiddenRightItem.m_dropPrefab.name : ""); |
| visEq.SetRightBackItem((this.m_hiddenRightItem != null) ? this.m_hiddenRightItem.m_dropPrefab.name : ""); |
| } |
| } |
| } |
| } |
| visEq.SetChestItem((this.m_chestItem != null) ? this.m_chestItem.m_dropPrefab.name : ""); |
| visEq.SetChestItem((this.m_chestItem != null) ? this.m_chestItem.m_dropPrefab.name : ""); |
| visEq.SetLegItem((this.m_legItem != null) ? this.m_legItem.m_dropPrefab.name : ""); |
| visEq.SetLegItem((this.m_legItem != null) ? this.m_legItem.m_dropPrefab.name : ""); |
| visEq.SetHelmetItem((this.m_helmetItem != null) ? this.m_helmetItem.m_dropPrefab.name : ""); |
| visEq.SetHelmetItem((this.m_helmetItem != null) ? this.m_helmetItem.m_dropPrefab.name : ""); |
| visEq.SetShoulderItem((this.m_shoulderItem != null) ? this.m_shoulderItem.m_dropPrefab.name : "", (this.m_shoulderItem != null) ? this.m_shoulderItem.m_variant : 0); |
| visEq.SetShoulderItem((this.m_shoulderItem != null) ? this.m_shoulderItem.m_dropPrefab.name : "", (this.m_shoulderItem != null) ? this.m_shoulderItem.m_variant : 0); |
| visEq.SetUtilityItem((this.m_utilityItem != null) ? this.m_utilityItem.m_dropPrefab.name : ""); |
| visEq.SetUtilityItem((this.m_utilityItem != null) ? this.m_utilityItem.m_dropPrefab.name : ""); |
| if (this.IsPlayer()) |
| if (this.IsPlayer()) |
| { |
| { |
| visEq.SetBeardItem(this.m_beardItem); |
| visEq.SetBeardItem(this.m_beardItem); |
| visEq.SetHairItem(this.m_hairItem); |
| visEq.SetHairItem(this.m_hairItem); |
| } |
| } |
| } |
| } |
| |
| |
| private void SetupEquipment() |
| private void SetupEquipment() |
| { |
| { |
| if (this.m_visEquipment && (this.m_nview.GetZDO() == null || this.m_nview.IsOwner())) |
| if (this.m_visEquipment && (this.m_nview.GetZDO() == null || this.m_nview.IsOwner())) |
| { |
| { |
| this.SetupVisEquipment(this.m_visEquipment, false); |
| this.SetupVisEquipment(this.m_visEquipment, false); |
| } |
| } |
| if (this.m_nview.GetZDO() != null) |
| if (this.m_nview.GetZDO() != null) |
| { |
| { |
| this.UpdateEquipmentStatusEffects(); |
| this.UpdateEquipmentStatusEffects(); |
| if (this.m_rightItem != null && this.m_rightItem.m_shared.m_buildPieces) |
| if (this.m_rightItem != null && this.m_rightItem.m_shared.m_buildPieces) |
| { |
| { |
| this.SetPlaceMode(this.m_rightItem.m_shared.m_buildPieces); |
| this.SetPlaceMode(this.m_rightItem.m_shared.m_buildPieces); |
| } |
| } |
| else |
| else |
| { |
| { |
| this.SetPlaceMode(null); |
| this.SetPlaceMode(null); |
| } |
| } |
| this.SetupAnimationState(); |
| this.SetupAnimationState(); |
| } |
| } |
| } |
| } |
| |
| |
| private void SetupAnimationState() |
| private void SetupAnimationState() |
| { |
| { |
| if (this.m_leftItem != null) |
| if (this.m_leftItem != null) |
| { |
| { |
| if (this.m_leftItem.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Torch) |
| if (this.m_leftItem.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Torch) |
| { |
| { |
| this.SetAnimationState(ItemDrop.ItemData.AnimationState.LeftTorch); |
| this.SetAnimationState(ItemDrop.ItemData.AnimationState.LeftTorch); |
| return; |
| return; |
| } |
| } |
| this.SetAnimationState(this.m_leftItem.m_shared.m_animationState); |
| this.SetAnimationState(this.m_leftItem.m_shared.m_animationState); |
| return; |
| return; |
| } |
| } |
| else |
| else |
| { |
| { |
| if (this.m_rightItem != null) |
| if (this.m_rightItem != null) |
| { |
| { |
| this.SetAnimationState(this.m_rightItem.m_shared.m_animationState); |
| this.SetAnimationState(this.m_rightItem.m_shared.m_animationState); |
| return; |
| return; |
| } |
| } |
| if (this.m_unarmedWeapon != null) |
| if (this.m_unarmedWeapon != null) |
| { |
| { |
| this.SetAnimationState(this.m_unarmedWeapon.m_itemData.m_shared.m_animationState); |
| this.SetAnimationState(this.m_unarmedWeapon.m_itemData.m_shared.m_animationState); |
| } |
| } |
| return; |
| return; |
| } |
| } |
| } |
| } |
| |
| |
| private void SetAnimationState(ItemDrop.ItemData.AnimationState state) |
| private void SetAnimationState(ItemDrop.ItemData.AnimationState state) |
| { |
| { |
| this.m_zanim.SetFloat(Humanoid.s_statef, (float)state); |
| this.m_zanim.SetFloat(Humanoid.s_statef, (float)state); |
| this.m_zanim.SetInt(Humanoid.s_statei, (int)state); |
| this.m_zanim.SetInt(Humanoid.s_statei, (int)state); |
| } |
| } |
| |
| |
| public override bool IsSitting() |
| public override bool IsSitting() |
| { |
| { |
| return base.GetCurrentAnimHash() == Character.s_animatorTagSitting; |
| return base.GetCurrentAnimHash() == Character.s_animatorTagSitting; |
| } |
| } |
| |
| |
| private void UpdateEquipmentStatusEffects() |
| private void UpdateEquipmentStatusEffects() |
| { |
| { |
| HashSet<StatusEffect> hashSet = new HashSet<StatusEffect>(); |
| HashSet<StatusEffect> hashSet = new HashSet<StatusEffect>(); |
| if (this.m_leftItem != null && this.m_leftItem.m_shared.m_equipStatusEffect) |
| if (this.m_leftItem != null && this.m_leftItem.m_shared.m_equipStatusEffect) |
| { |
| { |
| hashSet.Add(this.m_leftItem.m_shared.m_equipStatusEffect); |
| hashSet.Add(this.m_leftItem.m_shared.m_equipStatusEffect); |
| } |
| } |
| if (this.m_rightItem != null && this.m_rightItem.m_shared.m_equipStatusEffect) |
| if (this.m_rightItem != null && this.m_rightItem.m_shared.m_equipStatusEffect) |
| { |
| { |
| hashSet.Add(this.m_rightItem.m_shared.m_equipStatusEffect); |
| hashSet.Add(this.m_rightItem.m_shared.m_equipStatusEffect); |
| } |
| } |
| if (this.m_chestItem != null && this.m_chestItem.m_shared.m_equipStatusEffect) |
| if (this.m_chestItem != null && this.m_chestItem.m_shared.m_equipStatusEffect) |
| { |
| { |
| hashSet.Add(this.m_chestItem.m_shared.m_equipStatusEffect); |
| hashSet.Add(this.m_chestItem.m_shared.m_equipStatusEffect); |
| } |
| } |
| if (this.m_legItem != null && this.m_legItem.m_shared.m_equipStatusEffect) |
| if (this.m_legItem != null && this.m_legItem.m_shared.m_equipStatusEffect) |
| { |
| { |
| hashSet.Add(this.m_legItem.m_shared.m_equipStatusEffect); |
| hashSet.Add(this.m_legItem.m_shared.m_equipStatusEffect); |
| } |
| } |
| if (this.m_helmetItem != null && this.m_helmetItem.m_shared.m_equipStatusEffect) |
| if (this.m_helmetItem != null && this.m_helmetItem.m_shared.m_equipStatusEffect) |
| { |
| { |
| hashSet.Add(this.m_helmetItem.m_shared.m_equipStatusEffect); |
| hashSet.Add(this.m_helmetItem.m_shared.m_equipStatusEffect); |
| } |
| } |
| if (this.m_shoulderItem != null && this.m_shoulderItem.m_shared.m_equipStatusEffect) |
| if (this.m_shoulderItem != null && this.m_shoulderItem.m_shared.m_equipStatusEffect) |
| { |
| { |
| hashSet.Add(this.m_shoulderItem.m_shared.m_equipStatusEffect); |
| hashSet.Add(this.m_shoulderItem.m_shared.m_equipStatusEffect); |
| } |
| } |
| if (this.m_utilityItem != null && this.m_utilityItem.m_shared.m_equipStatusEffect) |
| if (this.m_utilityItem != null && this.m_utilityItem.m_shared.m_equipStatusEffect) |
| { |
| { |
| hashSet.Add(this.m_utilityItem.m_shared.m_equipStatusEffect); |
| hashSet.Add(this.m_utilityItem.m_shared.m_equipStatusEffect); |
| } |
| } |
| if (this.HaveSetEffect(this.m_leftItem)) |
| if (this.HaveSetEffect(this.m_leftItem)) |
| { |
| { |
| hashSet.Add(this.m_leftItem.m_shared.m_setStatusEffect); |
| hashSet.Add(this.m_leftItem.m_shared.m_setStatusEffect); |
| } |
| } |
| if (this.HaveSetEffect(this.m_rightItem)) |
| if (this.HaveSetEffect(this.m_rightItem)) |
| { |
| { |
| hashSet.Add(this.m_rightItem.m_shared.m_setStatusEffect); |
| hashSet.Add(this.m_rightItem.m_shared.m_setStatusEffect); |
| } |
| } |
| if (this.HaveSetEffect(this.m_chestItem)) |
| if (this.HaveSetEffect(this.m_chestItem)) |
| { |
| { |
| hashSet.Add(this.m_chestItem.m_shared.m_setStatusEffect); |
| hashSet.Add(this.m_chestItem.m_shared.m_setStatusEffect); |
| } |
| } |
| if (this.HaveSetEffect(this.m_legItem)) |
| if (this.HaveSetEffect(this.m_legItem)) |
| { |
| { |
| hashSet.Add(this.m_legItem.m_shared.m_setStatusEffect); |
| hashSet.Add(this.m_legItem.m_shared.m_setStatusEffect); |
| } |
| } |
| if (this.HaveSetEffect(this.m_helmetItem)) |
| if (this.HaveSetEffect(this.m_helmetItem)) |
| { |
| { |
| hashSet.Add(this.m_helmetItem.m_shared.m_setStatusEffect); |
| hashSet.Add(this.m_helmetItem.m_shared.m_setStatusEffect); |
| } |
| } |
| if (this.HaveSetEffect(this.m_shoulderItem)) |
| if (this.HaveSetEffect(this.m_shoulderItem)) |
| { |
| { |
| hashSet.Add(this.m_shoulderItem.m_shared.m_setStatusEffect); |
| hashSet.Add(this.m_shoulderItem.m_shared.m_setStatusEffect); |
| } |
| } |
| if (this.HaveSetEffect(this.m_utilityItem)) |
| if (this.HaveSetEffect(this.m_utilityItem)) |
| { |
| { |
| hashSet.Add(this.m_utilityItem.m_shared.m_setStatusEffect); |
| hashSet.Add(this.m_utilityItem.m_shared.m_setStatusEffect); |
| } |
| } |
| foreach (StatusEffect statusEffect in this.m_equipmentStatusEffects) |
| foreach (StatusEffect statusEffect in this.m_equipmentStatusEffects) |
| { |
| { |
| if (!hashSet.Contains(statusEffect)) |
| if (!hashSet.Contains(statusEffect)) |
| { |
| { |
| this.m_seman.RemoveStatusEffect(statusEffect.NameHash(), false); |
| this.m_seman.RemoveStatusEffect(statusEffect.NameHash(), false); |
| } |
| } |
| } |
| } |
| foreach (StatusEffect statusEffect2 in hashSet) |
| foreach (StatusEffect statusEffect2 in hashSet) |
| { |
| { |
| if (!this.m_equipmentStatusEffects.Contains(statusEffect2)) |
| if (!this.m_equipmentStatusEffects.Contains(statusEffect2)) |
| { |
| { |
| this.m_seman.AddStatusEffect(statusEffect2, false, 0, 0f); |
| this.m_seman.AddStatusEffect(statusEffect2, false, 0, 0f); |
| } |
| } |
| } |
| } |
| this.m_equipmentStatusEffects.Clear(); |
| this.m_equipmentStatusEffects.Clear(); |
| this.m_equipmentStatusEffects.UnionWith(hashSet); |
| this.m_equipmentStatusEffects.UnionWith(hashSet); |
| } |
| } |
| |
| |
| private bool HaveSetEffect(ItemDrop.ItemData item) |
| private bool HaveSetEffect(ItemDrop.ItemData item) |
| { |
| { |
| return item != null && !(item.m_shared.m_setStatusEffect == null) && item.m_shared.m_setName.Length != 0 && item.m_shared.m_setSize > 1 && this.GetSetCount(item.m_shared.m_setName) >= item.m_shared.m_setSize; |
| return item != null && !(item.m_shared.m_setStatusEffect == null) && item.m_shared.m_setName.Length != 0 && item.m_shared.m_setSize > 1 && this.GetSetCount(item.m_shared.m_setName) >= item.m_shared.m_setSize; |
| } |
| } |
| |
| |
| private int GetSetCount(string setName) |
| private int GetSetCount(string setName) |
| { |
| { |
| int num = 0; |
| int num = 0; |
| if (this.m_leftItem != null && this.m_leftItem.m_shared.m_setName == setName) |
| if (this.m_leftItem != null && this.m_leftItem.m_shared.m_setName == setName) |
| { |
| { |
| num++; |
| num++; |
| } |
| } |
| if (this.m_rightItem != null && this.m_rightItem.m_shared.m_setName == setName) |
| if (this.m_rightItem != null && this.m_rightItem.m_shared.m_setName == setName) |
| { |
| { |
| num++; |
| num++; |
| } |
| } |
| if (this.m_chestItem != null && this.m_chestItem.m_shared.m_setName == setName) |
| if (this.m_chestItem != null && this.m_chestItem.m_shared.m_setName == setName) |
| { |
| { |
| num++; |
| num++; |
| } |
| } |
| if (this.m_legItem != null && this.m_legItem.m_shared.m_setName == setName) |
| if (this.m_legItem != null && this.m_legItem.m_shared.m_setName == setName) |
| { |
| { |
| num++; |
| num++; |
| } |
| } |
| if (this.m_helmetItem != null && this.m_helmetItem.m_shared.m_setName == setName) |
| if (this.m_helmetItem != null && this.m_helmetItem.m_shared.m_setName == setName) |
| { |
| { |
| num++; |
| num++; |
| } |
| } |
| if (this.m_shoulderItem != null && this.m_shoulderItem.m_shared.m_setName == setName) |
| if (this.m_shoulderItem != null && this.m_shoulderItem.m_shared.m_setName == setName) |
| { |
| { |
| num++; |
| num++; |
| } |
| } |
| if (this.m_utilityItem != null && this.m_utilityItem.m_shared.m_setName == setName) |
| if (this.m_utilityItem != null && this.m_utilityItem.m_shared.m_setName == setName) |
| { |
| { |
| num++; |
| num++; |
| } |
| } |
| return num; |
| return num; |
| } |
| } |
| |
| |
| public void SetBeard(string name) |
| public void SetBeard(string name) |
| { |
| { |
| this.m_beardItem = name; |
| this.m_beardItem = name; |
| this.SetupEquipment(); |
| this.SetupEquipment(); |
| } |
| } |
| |
| |
| public string GetBeard() |
| public string GetBeard() |
| { |
| { |
| return this.m_beardItem; |
| return this.m_beardItem; |
| } |
| } |
| |
| |
| public void SetHair(string hair) |
| public void SetHair(string hair) |
| { |
| { |
| this.m_hairItem = hair; |
| this.m_hairItem = hair; |
| this.SetupEquipment(); |
| this.SetupEquipment(); |
| } |
| } |
| |
| |
| public string GetHair() |
| public string GetHair() |
| { |
| { |
| return this.m_hairItem; |
| return this.m_hairItem; |
| } |
| } |
| |
| |
| public bool IsItemEquiped(ItemDrop.ItemData item) |
| public bool IsItemEquiped(ItemDrop.ItemData item) |
| { |
| { |
| return this.m_rightItem == item || this.m_leftItem == item || this.m_chestItem == item || this.m_legItem == item || this.m_ammoItem == item || this.m_helmetItem == item || this.m_shoulderItem == item || this.m_utilityItem == item; |
| return this.m_rightItem == item || this.m_leftItem == item || this.m_chestItem == item || this.m_legItem == item || this.m_ammoItem == item || this.m_helmetItem == item || this.m_shoulderItem == item || this.m_utilityItem == item; |
| } |
| } |
| |
| |
| protected ItemDrop.ItemData GetRightItem() |
| protected ItemDrop.ItemData GetRightItem() |
| { |
| { |
| return this.m_rightItem; |
| return this.m_rightItem; |
| } |
| } |
| |
| |
| protected ItemDrop.ItemData GetLeftItem() |
| protected ItemDrop.ItemData GetLeftItem() |
| { |
| { |
| return this.m_leftItem; |
| return this.m_leftItem; |
| } |
| } |
| |
| |
| protected override bool CheckRun(Vector3 moveDir, float dt) |
| protected override bool CheckRun(Vector3 moveDir, float dt) |
| { |
| { |
| return !this.IsDrawingBow() && base.CheckRun(moveDir, dt) && !this.IsBlocking(); |
| return !this.IsDrawingBow() && base.CheckRun(moveDir, dt) && !this.IsBlocking(); |
| } |
| } |
| |
| |
| public override bool IsDrawingBow() |
| public override bool IsDrawingBow() |
| { |
| { |
| if (this.m_attackDrawTime <= 0f) |
| if (this.m_attackDrawTime <= 0f) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| ItemDrop.ItemData currentWeapon = this.GetCurrentWeapon(); |
| ItemDrop.ItemData currentWeapon = this.GetCurrentWeapon(); |
| return currentWeapon != null && currentWeapon.m_shared.m_attack.m_bowDraw; |
| return currentWeapon != null && currentWeapon.m_shared.m_attack.m_bowDraw; |
| } |
| } |
| |
| |
| protected override bool BlockAttack(HitData hit, Character attacker) |
| protected override bool BlockAttack(HitData hit, Character attacker) |
| { |
| { |
| if (Vector3.Dot(hit.m_dir, base.transform.forward) > 0f) |
| if (Vector3.Dot(hit.m_dir, base.transform.forward) > 0f) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| ItemDrop.ItemData currentBlocker = this.GetCurrentBlocker(); |
| ItemDrop.ItemData currentBlocker = this.GetCurrentBlocker(); |
| if (currentBlocker == null) |
| if (currentBlocker == null) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| bool flag = currentBlocker.m_shared.m_timedBlockBonus > 1f && this.m_blockTimer != -1f && this.m_blockTimer < 0.25f; |
| bool flag = currentBlocker.m_shared.m_timedBlockBonus > 1f && this.m_blockTimer != -1f && this.m_blockTimer < 0.25f; |
| float skillFactor = this.GetSkillFactor(Skills.SkillType.Blocking); |
| float skillFactor = this.GetSkillFactor(Skills.SkillType.Blocking); |
| float num = currentBlocker.GetBlockPower(skillFactor); |
| float num = currentBlocker.GetBlockPower(skillFactor); |
| if (flag) |
| if (flag) |
| { |
| { |
| num *= currentBlocker.m_shared.m_timedBlockBonus; |
| num *= currentBlocker.m_shared.m_timedBlockBonus; |
| } |
| } |
| if (currentBlocker.m_shared.m_damageModifiers.Count > 0) |
| if (currentBlocker.m_shared.m_damageModifiers.Count > 0) |
| { |
| { |
| HitData.DamageModifiers damageModifiers = default(HitData.DamageModifiers); |
| HitData.DamageModifiers damageModifiers = default(HitData.DamageModifiers); |
| damageModifiers.Apply(currentBlocker.m_shared.m_damageModifiers); |
| damageModifiers.Apply(currentBlocker.m_shared.m_damageModifiers); |
| HitData.DamageModifier damageModifier; |
| HitData.DamageModifier damageModifier; |
| hit.ApplyResistance(damageModifiers, out damageModifier); |
| hit.ApplyResistance(damageModifiers, out damageModifier); |
| } |
| } |
| HitData.DamageTypes damageTypes = hit.m_damage.Clone(); |
| HitData.DamageTypes damageTypes = hit.m_damage.Clone(); |
| damageTypes.ApplyArmor(num); |
| damageTypes.ApplyArmor(num); |
| float totalBlockableDamage = hit.GetTotalBlockableDamage(); |
| float totalBlockableDamage = hit.GetTotalBlockableDamage(); |
| float totalBlockableDamage2 = damageTypes.GetTotalBlockableDamage(); |
| float totalBlockableDamage2 = damageTypes.GetTotalBlockableDamage(); |
| float num2 = totalBlockableDamage - totalBlockableDamage2; |
| float num2 = totalBlockableDamage - totalBlockableDamage2; |
| float num3 = Mathf.Clamp01(num2 / num); |
| float num3 = Mathf.Clamp01(num2 / num); |
| float num4 = (flag ? this.m_blockStaminaDrain : (this.m_blockStaminaDrain * num3)); |
| float num4 = (flag ? this.m_blockStaminaDrain : (this.m_blockStaminaDrain * num3)); |
| . | |
| num4 += num4 * this.GetEquipmentBlockStaminaModifier(); |
| |
| this.m_seman.ModifyBlockStaminaUsage(num4, ref num4, true); |
| this.UseStamina(num4, false); |
| this.UseStamina(num4, false); |
| float totalStaggerDamage = damageTypes.GetTotalStaggerDamage(); |
| float totalStaggerDamage = damageTypes.GetTotalStaggerDamage(); |
| bool flag2 = base.AddStaggerDamage(totalStaggerDamage, hit.m_dir); |
| bool flag2 = base.AddStaggerDamage(totalStaggerDamage, hit.m_dir); |
| bool flag3 = this.HaveStamina(0f); |
| bool flag3 = this.HaveStamina(0f); |
| bool flag4 = flag3 && !flag2; |
| bool flag4 = flag3 && !flag2; |
| if (flag3 && !flag2) |
| if (flag3 && !flag2) |
| { |
| { |
| hit.m_statusEffectHash = 0; |
| hit.m_statusEffectHash = 0; |
| hit.BlockDamage(num2); |
| hit.BlockDamage(num2); |
| DamageText.instance.ShowText(DamageText.TextType.Blocked, hit.m_point + Vector3.up * 0.5f, num2, false); |
| DamageText.instance.ShowText(DamageText.TextType.Blocked, hit.m_point + Vector3.up * 0.5f, num2, false); |
| } |
| } |
| if (currentBlocker.m_shared.m_useDurability) |
| if (currentBlocker.m_shared.m_useDurability) |
| { |
| { |
| float num5 = currentBlocker.m_shared.m_useDurabilityDrain * (totalBlockableDamage / num); |
| float num5 = currentBlocker.m_shared.m_useDurabilityDrain * (totalBlockableDamage / num); |
| currentBlocker.m_durability -= num5; |
| currentBlocker.m_durability -= num5; |
| } |
| } |
| this.RaiseSkill(Skills.SkillType.Blocking, flag ? 2f : 1f); |
| this.RaiseSkill(Skills.SkillType.Blocking, flag ? 2f : 1f); |
| currentBlocker.m_shared.m_blockEffect.Create(hit.m_point, Quaternion.identity, null, 1f, -1); |
| currentBlocker.m_shared.m_blockEffect.Create(hit.m_point, Quaternion.identity, null, 1f, -1); |
| if (attacker && flag && flag4) |
| if (attacker && flag && flag4) |
| { |
| { |
| this.m_perfectBlockEffect.Create(hit.m_point, Quaternion.identity, null, 1f, -1); |
| this.m_perfectBlockEffect.Create(hit.m_point, Quaternion.identity, null, 1f, -1); |
| if (attacker.m_staggerWhenBlocked) |
| if (attacker.m_staggerWhenBlocked) |
| { |
| { |
| attacker.Stagger(-hit.m_dir); |
| attacker.Stagger(-hit.m_dir); |
| } |
| } |
| . | this.UseStamina(this.m_blockStaminaDrain, false); |
| num4 = this.m_blockStaminaDrain; |
| |
| num4 -= num4 * this.GetEquipmentBlockStaminaModifier(); |
| |
| this.m_seman.ModifyBlockStaminaUsage(num4, ref num4, true); |
| |
| this.UseStamina(num4, false); |
| } |
| } |
| if (flag4) |
| if (flag4) |
| { |
| { |
| hit.m_pushForce *= num3; |
| hit.m_pushForce *= num3; |
| if (attacker && !hit.m_ranged) |
| if (attacker && !hit.m_ranged) |
| { |
| { |
| float num6 = 1f - Mathf.Clamp01(num3 * 0.5f); |
| float num6 = 1f - Mathf.Clamp01(num3 * 0.5f); |
| HitData hitData = new HitData(); |
| HitData hitData = new HitData(); |
| hitData.m_pushForce = currentBlocker.GetDeflectionForce() * num6; |
| hitData.m_pushForce = currentBlocker.GetDeflectionForce() * num6; |
| hitData.m_dir = attacker.transform.position - base.transform.position; |
| hitData.m_dir = attacker.transform.position - base.transform.position; |
| hitData.m_dir.y = 0f; |
| hitData.m_dir.y = 0f; |
| hitData.m_dir.Normalize(); |
| hitData.m_dir.Normalize(); |
| attacker.Damage(hitData); |
| attacker.Damage(hitData); |
| } |
| } |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| public override bool IsBlocking() |
| public override bool IsBlocking() |
| { |
| { |
| if (this.m_nview.IsValid() && !this.m_nview.IsOwner()) |
| if (this.m_nview.IsValid() && !this.m_nview.IsOwner()) |
| { |
| { |
| return this.m_nview.GetZDO().GetBool(ZDOVars.s_isBlockingHash, false); |
| return this.m_nview.GetZDO().GetBool(ZDOVars.s_isBlockingHash, false); |
| } |
| } |
| return this.m_blocking && !this.InAttack() && !this.InDodge() && !this.InPlaceMode() && !this.IsEncumbered() && !this.InMinorAction() && !base.IsStaggering(); |
| return this.m_blocking && !this.InAttack() && !this.InDodge() && !this.InPlaceMode() && !this.IsEncumbered() && !this.InMinorAction() && !base.IsStaggering(); |
| } |
| } |
| |
| |
| private void UpdateBlock(float dt) |
| private void UpdateBlock(float dt) |
| { |
| { |
| if (!this.IsBlocking()) |
| if (!this.IsBlocking()) |
| { |
| { |
| if (this.m_internalBlockingState) |
| if (this.m_internalBlockingState) |
| { |
| { |
| this.m_internalBlockingState = false; |
| this.m_internalBlockingState = false; |
| this.m_nview.GetZDO().Set(ZDOVars.s_isBlockingHash, false); |
| this.m_nview.GetZDO().Set(ZDOVars.s_isBlockingHash, false); |
| this.m_zanim.SetBool(Humanoid.s_blocking, false); |
| this.m_zanim.SetBool(Humanoid.s_blocking, false); |
| } |
| } |
| this.m_blockTimer = -1f; |
| this.m_blockTimer = -1f; |
| return; |
| return; |
| } |
| } |
| if (!this.m_internalBlockingState) |
| if (!this.m_internalBlockingState) |
| { |
| { |
| this.m_internalBlockingState = true; |
| this.m_internalBlockingState = true; |
| this.m_nview.GetZDO().Set(ZDOVars.s_isBlockingHash, true); |
| this.m_nview.GetZDO().Set(ZDOVars.s_isBlockingHash, true); |
| this.m_zanim.SetBool(Humanoid.s_blocking, true); |
| this.m_zanim.SetBool(Humanoid.s_blocking, true); |
| } |
| } |
| if (this.m_blockTimer < 0f) |
| if (this.m_blockTimer < 0f) |
| { |
| { |
| this.m_blockTimer = 0f; |
| this.m_blockTimer = 0f; |
| return; |
| return; |
| } |
| } |
| this.m_blockTimer += dt; |
| this.m_blockTimer += dt; |
| } |
| } |
| |
| |
| public void HideHandItems() |
| public void HideHandItems() |
| { |
| { |
| if (this.m_leftItem == null && this.m_rightItem == null) |
| if (this.m_leftItem == null && this.m_rightItem == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| ItemDrop.ItemData leftItem = this.m_leftItem; |
| ItemDrop.ItemData leftItem = this.m_leftItem; |
| ItemDrop.ItemData rightItem = this.m_rightItem; |
| ItemDrop.ItemData rightItem = this.m_rightItem; |
| this.UnequipItem(this.m_leftItem, true); |
| this.UnequipItem(this.m_leftItem, true); |
| this.UnequipItem(this.m_rightItem, true); |
| this.UnequipItem(this.m_rightItem, true); |
| this.m_hiddenLeftItem = leftItem; |
| this.m_hiddenLeftItem = leftItem; |
| this.m_hiddenRightItem = rightItem; |
| this.m_hiddenRightItem = rightItem; |
| this.SetupVisEquipment(this.m_visEquipment, false); |
| this.SetupVisEquipment(this.m_visEquipment, false); |
| this.m_zanim.SetTrigger("equip_hip"); |
| this.m_zanim.SetTrigger("equip_hip"); |
| } |
| } |
| |
| |
| protected void ShowHandItems() |
| protected void ShowHandItems() |
| { |
| { |
| ItemDrop.ItemData hiddenLeftItem = this.m_hiddenLeftItem; |
| ItemDrop.ItemData hiddenLeftItem = this.m_hiddenLeftItem; |
| ItemDrop.ItemData hiddenRightItem = this.m_hiddenRightItem; |
| ItemDrop.ItemData hiddenRightItem = this.m_hiddenRightItem; |
| if (hiddenLeftItem == null && hiddenRightItem == null) |
| if (hiddenLeftItem == null && hiddenRightItem == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_hiddenLeftItem = null; |
| this.m_hiddenLeftItem = null; |
| this.m_hiddenRightItem = null; |
| this.m_hiddenRightItem = null; |
| if (hiddenLeftItem != null) |
| if (hiddenLeftItem != null) |
| { |
| { |
| this.EquipItem(hiddenLeftItem, true); |
| this.EquipItem(hiddenLeftItem, true); |
| } |
| } |
| if (hiddenRightItem != null) |
| if (hiddenRightItem != null) |
| { |
| { |
| this.EquipItem(hiddenRightItem, true); |
| this.EquipItem(hiddenRightItem, true); |
| } |
| } |
| this.m_zanim.SetTrigger("equip_hip"); |
| this.m_zanim.SetTrigger("equip_hip"); |
| } |
| } |
| |
| |
| public ItemDrop.ItemData GetAmmoItem() |
| public ItemDrop.ItemData GetAmmoItem() |
| { |
| { |
| return this.m_ammoItem; |
| return this.m_ammoItem; |
| } |
| } |
| |
| |
| public virtual GameObject GetHoverObject() |
| public virtual GameObject GetHoverObject() |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| |
| |
| public bool IsTeleportable() |
| public bool IsTeleportable() |
| { |
| { |
| return this.m_inventory.IsTeleportable(); |
| return this.m_inventory.IsTeleportable(); |
| } |
| } |
| |
| |
| public override bool UseMeleeCamera() |
| public override bool UseMeleeCamera() |
| { |
| { |
| ItemDrop.ItemData currentWeapon = this.GetCurrentWeapon(); |
| ItemDrop.ItemData currentWeapon = this.GetCurrentWeapon(); |
| return currentWeapon != null && currentWeapon.m_shared.m_centerCamera; |
| return currentWeapon != null && currentWeapon.m_shared.m_centerCamera; |
| } |
| } |
| |
| |
| public float GetEquipmentWeight() |
| public float GetEquipmentWeight() |
| { |
| { |
| float num = 0f; |
| float num = 0f; |
| if (this.m_rightItem != null) |
| if (this.m_rightItem != null) |
| { |
| { |
| num += this.m_rightItem.m_shared.m_weight; |
| num += this.m_rightItem.m_shared.m_weight; |
| } |
| } |
| if (this.m_leftItem != null) |
| if (this.m_leftItem != null) |
| { |
| { |
| num += this.m_leftItem.m_shared.m_weight; |
| num += this.m_leftItem.m_shared.m_weight; |
| } |
| } |
| if (this.m_chestItem != null) |
| if (this.m_chestItem != null) |
| { |
| { |
| num += this.m_chestItem.m_shared.m_weight; |
| num += this.m_chestItem.m_shared.m_weight; |
| } |
| } |
| if (this.m_legItem != null) |
| if (this.m_legItem != null) |
| { |
| { |
| num += this.m_legItem.m_shared.m_weight; |
| num += this.m_legItem.m_shared.m_weight; |
| } |
| } |
| if (this.m_helmetItem != null) |
| if (this.m_helmetItem != null) |
| { |
| { |
| num += this.m_helmetItem.m_shared.m_weight; |
| num += this.m_helmetItem.m_shared.m_weight; |
| } |
| } |
| if (this.m_shoulderItem != null) |
| if (this.m_shoulderItem != null) |
| { |
| { |
| num += this.m_shoulderItem.m_shared.m_weight; |
| num += this.m_shoulderItem.m_shared.m_weight; |
| } |
| } |
| if (this.m_utilityItem != null) |
| if (this.m_utilityItem != null) |
| { |
| { |
| num += this.m_utilityItem.m_shared.m_weight; |
| num += this.m_utilityItem.m_shared.m_weight; |
| } |
| } |
| return num; |
| return num; |
| } |
| } |
| |
| |
| public ItemDrop.ItemData RightItem |
| public ItemDrop.ItemData RightItem |
| { |
| { |
| get |
| get |
| { |
| { |
| return this.m_rightItem; |
| return this.m_rightItem; |
| } |
| } |
| } |
| } |
| |
| |
| public ItemDrop.ItemData LeftItem |
| public ItemDrop.ItemData LeftItem |
| { |
| { |
| get |
| get |
| { |
| { |
| return this.m_leftItem; |
| return this.m_leftItem; |
| } |
| } |
| } |
| } |
| |
| |
| . | public new static List<Humanoid> Instances { get; } = new List<Humanoid>(); |
| |
| |
| |
| private int m_lastGroundColliderOnAttackStart = -1; |
| private int m_lastGroundColliderOnAttackStart = -1; |
| |
| |
| private static List<ItemDrop.ItemData> optimalWeapons = new List<ItemDrop.ItemData>(); |
| private static List<ItemDrop.ItemData> optimalWeapons = new List<ItemDrop.ItemData>(); |
| |
| |
| private static List<ItemDrop.ItemData> outofRangeWeapons = new List<ItemDrop.ItemData>(); |
| private static List<ItemDrop.ItemData> outofRangeWeapons = new List<ItemDrop.ItemData>(); |
| |
| |
| private static List<ItemDrop.ItemData> allWeapons = new List<ItemDrop.ItemData>(); |
| private static List<ItemDrop.ItemData> allWeapons = new List<ItemDrop.ItemData>(); |
| |
| |
| [Header("Humanoid")] |
| [Header("Humanoid")] |
| public float m_equipStaminaDrain = 10f; |
| public float m_equipStaminaDrain = 10f; |
| |
| |
| public float m_blockStaminaDrain = 25f; |
| public float m_blockStaminaDrain = 25f; |
| |
| |
| [Header("Default items")] |
| [Header("Default items")] |
| public GameObject[] m_defaultItems; |
| public GameObject[] m_defaultItems; |
| |
| |
| public GameObject[] m_randomWeapon; |
| public GameObject[] m_randomWeapon; |
| |
| |
| public GameObject[] m_randomArmor; |
| public GameObject[] m_randomArmor; |
| |
| |
| public GameObject[] m_randomShield; |
| public GameObject[] m_randomShield; |
| |
| |
| public Humanoid.ItemSet[] m_randomSets; |
| public Humanoid.ItemSet[] m_randomSets; |
| |
| |
| . | |
| public Humanoid.RandomItem[] m_randomItems; |
| |
| |
| public ItemDrop m_unarmedWeapon; |
| public ItemDrop m_unarmedWeapon; |
| |
| |
| . | |
| private bool[] m_randomItemSlotFilled; |
| |
| |
| [Header("Effects")] |
| [Header("Effects")] |
| public EffectList m_pickupEffects = new EffectList(); |
| public EffectList m_pickupEffects = new EffectList(); |
| |
| |
| public EffectList m_dropEffects = new EffectList(); |
| public EffectList m_dropEffects = new EffectList(); |
| |
| |
| public EffectList m_consumeItemEffects = new EffectList(); |
| public EffectList m_consumeItemEffects = new EffectList(); |
| |
| |
| public EffectList m_equipEffects = new EffectList(); |
| public EffectList m_equipEffects = new EffectList(); |
| |
| |
| public EffectList m_perfectBlockEffect = new EffectList(); |
| public EffectList m_perfectBlockEffect = new EffectList(); |
| |
| |
| protected readonly Inventory m_inventory = new Inventory("Inventory", null, 8, 4); |
| protected readonly Inventory m_inventory = new Inventory("Inventory", null, 8, 4); |
| |
| |
| protected ItemDrop.ItemData m_rightItem; |
| protected ItemDrop.ItemData m_rightItem; |
| |
| |
| protected ItemDrop.ItemData m_leftItem; |
| protected ItemDrop.ItemData m_leftItem; |
| |
| |
| protected ItemDrop.ItemData m_chestItem; |
| protected ItemDrop.ItemData m_chestItem; |
| |
| |
| protected ItemDrop.ItemData m_legItem; |
| protected ItemDrop.ItemData m_legItem; |
| |
| |
| protected ItemDrop.ItemData m_ammoItem; |
| protected ItemDrop.ItemData m_ammoItem; |
| |
| |
| protected ItemDrop.ItemData m_helmetItem; |
| protected ItemDrop.ItemData m_helmetItem; |
| |
| |
| protected ItemDrop.ItemData m_shoulderItem; |
| protected ItemDrop.ItemData m_shoulderItem; |
| |
| |
| protected ItemDrop.ItemData m_utilityItem; |
| protected ItemDrop.ItemData m_utilityItem; |
| |
| |
| protected string m_beardItem = ""; |
| protected string m_beardItem = ""; |
| |
| |
| protected string m_hairItem = ""; |
| protected string m_hairItem = ""; |
| |
| |
| protected Attack m_currentAttack; |
| protected Attack m_currentAttack; |
| |
| |
| protected bool m_currentAttackIsSecondary; |
| protected bool m_currentAttackIsSecondary; |
| |
| |
| protected float m_attackDrawTime; |
| protected float m_attackDrawTime; |
| |
| |
| protected float m_lastCombatTimer = 999f; |
| protected float m_lastCombatTimer = 999f; |
| |
| |
| protected VisEquipment m_visEquipment; |
| protected VisEquipment m_visEquipment; |
| |
| |
| private Attack m_previousAttack; |
| private Attack m_previousAttack; |
| |
| |
| private ItemDrop.ItemData m_hiddenLeftItem; |
| private ItemDrop.ItemData m_hiddenLeftItem; |
| |
| |
| private ItemDrop.ItemData m_hiddenRightItem; |
| private ItemDrop.ItemData m_hiddenRightItem; |
| |
| |
| private int m_lastEquipEffectFrame; |
| private int m_lastEquipEffectFrame; |
| |
| |
| private float m_timeSinceLastAttack; |
| private float m_timeSinceLastAttack; |
| |
| |
| private bool m_internalBlockingState; |
| private bool m_internalBlockingState; |
| |
| |
| private float m_blockTimer = 9999f; |
| private float m_blockTimer = 9999f; |
| |
| |
| private const float m_perfectBlockInterval = 0.25f; |
| private const float m_perfectBlockInterval = 0.25f; |
| |
| |
| private readonly HashSet<StatusEffect> m_equipmentStatusEffects = new HashSet<StatusEffect>(); |
| private readonly HashSet<StatusEffect> m_equipmentStatusEffects = new HashSet<StatusEffect>(); |
| |
| |
| private int m_seed; |
| private int m_seed; |
| |
| |
| . | |
| private int m_useItemBlockMessage; |
| |
| |
| private static readonly int s_statef = ZSyncAnimation.GetHash("statef"); |
| private static readonly int s_statef = ZSyncAnimation.GetHash("statef"); |
| |
| |
| private static readonly int s_statei = ZSyncAnimation.GetHash("statei"); |
| private static readonly int s_statei = ZSyncAnimation.GetHash("statei"); |
| |
| |
| private static readonly int s_blocking = ZSyncAnimation.GetHash("blocking"); |
| private static readonly int s_blocking = ZSyncAnimation.GetHash("blocking"); |
| |
| |
| protected static readonly int s_animatorTagAttack = ZSyncAnimation.GetHash("attack"); |
| protected static readonly int s_animatorTagAttack = ZSyncAnimation.GetHash("attack"); |
| |
| |
| [Serializable] |
| [Serializable] |
| public class ItemSet |
| public class ItemSet |
| { |
| { |
| public string m_name = ""; |
| public string m_name = ""; |
| |
| |
| public GameObject[] m_items = Array.Empty<GameObject>(); |
| public GameObject[] m_items = Array.Empty<GameObject>(); |
| . | |
| } |
| |
| |
| |
| [Serializable] |
| |
| public class RandomItem |
| |
| { |
| |
| public GameObject m_prefab; |
| |
| |
| |
| [Range(0f, 1f)] |
| |
| public float m_chance = 0.5f; |
| } |
| } |
| } |
| } |
| |
| |