| using System; |
| using System; |
| using System.Collections.Generic; |
| using System.Collections.Generic; |
| using UnityEngine; |
| using UnityEngine; |
| |
| |
| public class ItemStand : MonoBehaviour, Interactable, Hoverable |
| public class ItemStand : MonoBehaviour, Interactable, Hoverable |
| { |
| { |
| private void Awake() |
| private void Awake() |
| { |
| { |
| this.m_nview = (this.m_netViewOverride ? this.m_netViewOverride : base.gameObject.GetComponent<ZNetView>()); |
| this.m_nview = (this.m_netViewOverride ? this.m_netViewOverride : base.gameObject.GetComponent<ZNetView>()); |
| if (this.m_nview.GetZDO() == null) |
| if (this.m_nview.GetZDO() == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| WearNTear component = base.GetComponent<WearNTear>(); |
| WearNTear component = base.GetComponent<WearNTear>(); |
| if (component) |
| if (component) |
| { |
| { |
| WearNTear wearNTear = component; |
| WearNTear wearNTear = component; |
| wearNTear.m_onDestroyed = (Action)Delegate.Combine(wearNTear.m_onDestroyed, new Action(this.OnDestroyed)); |
| wearNTear.m_onDestroyed = (Action)Delegate.Combine(wearNTear.m_onDestroyed, new Action(this.OnDestroyed)); |
| } |
| } |
| this.m_nview.Register("DropItem", new Action<long>(this.RPC_DropItem)); |
| this.m_nview.Register("DropItem", new Action<long>(this.RPC_DropItem)); |
| this.m_nview.Register("RequestOwn", new Action<long>(this.RPC_RequestOwn)); |
| this.m_nview.Register("RequestOwn", new Action<long>(this.RPC_RequestOwn)); |
| this.m_nview.Register("DestroyAttachment", new Action<long>(this.RPC_DestroyAttachment)); |
| this.m_nview.Register("DestroyAttachment", new Action<long>(this.RPC_DestroyAttachment)); |
| this.m_nview.Register<string, int, int>("SetVisualItem", new Action<long, string, int, int>(this.RPC_SetVisualItem)); |
| this.m_nview.Register<string, int, int>("SetVisualItem", new Action<long, string, int, int>(this.RPC_SetVisualItem)); |
| base.InvokeRepeating("UpdateVisual", 1f, 4f); |
| base.InvokeRepeating("UpdateVisual", 1f, 4f); |
| } |
| } |
| |
| |
| private void OnDestroyed() |
| private void OnDestroyed() |
| { |
| { |
| if (this.m_nview.IsOwner()) |
| if (this.m_nview.IsOwner()) |
| { |
| { |
| this.DropItem(); |
| this.DropItem(); |
| } |
| } |
| } |
| } |
| |
| |
| public string GetHoverText() |
| public string GetHoverText() |
| { |
| { |
| if (!Player.m_localPlayer) |
| if (!Player.m_localPlayer) |
| { |
| { |
| return ""; |
| return ""; |
| } |
| } |
| if (!PrivateArea.CheckAccess(base.transform.position, 0f, false, false)) |
| if (!PrivateArea.CheckAccess(base.transform.position, 0f, false, false)) |
| { |
| { |
| return Localization.instance.Localize(this.m_name + "\n$piece_noaccess"); |
| return Localization.instance.Localize(this.m_name + "\n$piece_noaccess"); |
| } |
| } |
| if (this.HaveAttachment()) |
| if (this.HaveAttachment()) |
| { |
| { |
| if (this.m_canBeRemoved) |
| if (this.m_canBeRemoved) |
| { |
| { |
| return Localization.instance.Localize(this.m_name + " ( " + this.m_currentItemName + " )\n[<color=yellow><b>$KEY_Use</b></color>] $piece_itemstand_take"); |
| return Localization.instance.Localize(this.m_name + " ( " + this.m_currentItemName + " )\n[<color=yellow><b>$KEY_Use</b></color>] $piece_itemstand_take"); |
| } |
| } |
| if (!(this.m_guardianPower != null)) |
| if (!(this.m_guardianPower != null)) |
| { |
| { |
| return ""; |
| return ""; |
| } |
| } |
| if (base.IsInvoking("DelayedPowerActivation")) |
| if (base.IsInvoking("DelayedPowerActivation")) |
| { |
| { |
| return ""; |
| return ""; |
| } |
| } |
| . | |
| string tooltipString = this.m_guardianPower.GetTooltipString(); |
| if (this.IsGuardianPowerActive(Player.m_localPlayer)) |
| if (this.IsGuardianPowerActive(Player.m_localPlayer)) |
| { |
| { |
| . | return ""; |
| return Localization.instance.Localize(string.Concat(new string[] |
| |
| { |
| |
| "<color=orange>", |
| |
| this.m_guardianPower.m_name, |
| |
| "</color>\n", |
| |
| tooltipString, |
| |
| "\n\n$guardianstone_hook_alreadyactive" |
| |
| })); |
| } |
| } |
| . | string tooltipString = this.m_guardianPower.GetTooltipString(); |
| |
| return Localization.instance.Localize(string.Concat(new string[] |
| return Localization.instance.Localize(string.Concat(new string[] |
| { |
| { |
| "<color=orange>", |
| "<color=orange>", |
| this.m_guardianPower.m_name, |
| this.m_guardianPower.m_name, |
| "</color>\n", |
| "</color>\n", |
| tooltipString, |
| tooltipString, |
| "\n\n[<color=yellow><b>$KEY_Use</b></color>] $guardianstone_hook_activate" |
| "\n\n[<color=yellow><b>$KEY_Use</b></color>] $guardianstone_hook_activate" |
| })); |
| })); |
| } |
| } |
| else |
| else |
| { |
| { |
| if (this.m_autoAttach && this.m_supportedItems.Count == 1) |
| if (this.m_autoAttach && this.m_supportedItems.Count == 1) |
| { |
| { |
| return Localization.instance.Localize(this.m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_itemstand_attach"); |
| return Localization.instance.Localize(this.m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_itemstand_attach"); |
| } |
| } |
| return Localization.instance.Localize(this.m_name + "\n[<color=yellow><b>1-8</b></color>] $piece_itemstand_attach"); |
| return Localization.instance.Localize(this.m_name + "\n[<color=yellow><b>1-8</b></color>] $piece_itemstand_attach"); |
| } |
| } |
| } |
| } |
| |
| |
| public string GetHoverName() |
| public string GetHoverName() |
| { |
| { |
| return this.m_name; |
| return this.m_name; |
| } |
| } |
| |
| |
| public bool Interact(Humanoid user, bool hold, bool alt) |
| public bool Interact(Humanoid user, bool hold, bool alt) |
| { |
| { |
| if (hold) |
| if (hold) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (!PrivateArea.CheckAccess(base.transform.position, 0f, true, false)) |
| if (!PrivateArea.CheckAccess(base.transform.position, 0f, true, false)) |
| { |
| { |
| return true; |
| return true; |
| } |
| } |
| if (!this.HaveAttachment()) |
| if (!this.HaveAttachment()) |
| { |
| { |
| if (this.m_autoAttach && this.m_supportedItems.Count == 1) |
| if (this.m_autoAttach && this.m_supportedItems.Count == 1) |
| { |
| { |
| ItemDrop.ItemData item = user.GetInventory().GetItem(this.m_supportedItems[0].m_itemData.m_shared.m_name, -1, false); |
| ItemDrop.ItemData item = user.GetInventory().GetItem(this.m_supportedItems[0].m_itemData.m_shared.m_name, -1, false); |
| if (item != null) |
| if (item != null) |
| { |
| { |
| this.UseItem(user, item); |
| this.UseItem(user, item); |
| return true; |
| return true; |
| } |
| } |
| user.Message(MessageHud.MessageType.Center, "$piece_itemstand_missingitem", 0, null); |
| user.Message(MessageHud.MessageType.Center, "$piece_itemstand_missingitem", 0, null); |
| return false; |
| return false; |
| } |
| } |
| } |
| } |
| else |
| else |
| { |
| { |
| if (this.m_canBeRemoved) |
| if (this.m_canBeRemoved) |
| { |
| { |
| this.m_nview.InvokeRPC("DropItem", Array.Empty<object>()); |
| this.m_nview.InvokeRPC("DropItem", Array.Empty<object>()); |
| return true; |
| return true; |
| } |
| } |
| if (this.m_guardianPower != null) |
| if (this.m_guardianPower != null) |
| { |
| { |
| if (base.IsInvoking("DelayedPowerActivation")) |
| if (base.IsInvoking("DelayedPowerActivation")) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (this.IsGuardianPowerActive(user)) |
| if (this.IsGuardianPowerActive(user)) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| user.Message(MessageHud.MessageType.Center, "$guardianstone_hook_power_activate ", 0, null); |
| user.Message(MessageHud.MessageType.Center, "$guardianstone_hook_power_activate ", 0, null); |
| this.m_activatePowerEffects.Create(base.transform.position, base.transform.rotation, null, 1f, -1); |
| this.m_activatePowerEffects.Create(base.transform.position, base.transform.rotation, null, 1f, -1); |
| this.m_activatePowerEffectsPlayer.Create(user.transform.position, Quaternion.identity, user.transform, 1f, -1); |
| this.m_activatePowerEffectsPlayer.Create(user.transform.position, Quaternion.identity, user.transform, 1f, -1); |
| base.Invoke("DelayedPowerActivation", this.m_powerActivationDelay); |
| base.Invoke("DelayedPowerActivation", this.m_powerActivationDelay); |
| return true; |
| return true; |
| } |
| } |
| } |
| } |
| return false; |
| return false; |
| } |
| } |
| |
| |
| private bool IsGuardianPowerActive(Humanoid user) |
| private bool IsGuardianPowerActive(Humanoid user) |
| { |
| { |
| return (user as Player).GetGuardianPowerName() == this.m_guardianPower.name; |
| return (user as Player).GetGuardianPowerName() == this.m_guardianPower.name; |
| } |
| } |
| |
| |
| private void DelayedPowerActivation() |
| private void DelayedPowerActivation() |
| { |
| { |
| Player localPlayer = Player.m_localPlayer; |
| Player localPlayer = Player.m_localPlayer; |
| if (localPlayer == null) |
| if (localPlayer == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| localPlayer.SetGuardianPower(this.m_guardianPower.name); |
| localPlayer.SetGuardianPower(this.m_guardianPower.name); |
| } |
| } |
| |
| |
| public bool UseItem(Humanoid user, ItemDrop.ItemData item) |
| public bool UseItem(Humanoid user, ItemDrop.ItemData item) |
| { |
| { |
| if (this.HaveAttachment()) |
| if (this.HaveAttachment()) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| if (!this.CanAttach(item)) |
| if (!this.CanAttach(item)) |
| { |
| { |
| user.Message(MessageHud.MessageType.Center, "$piece_itemstand_cantattach", 0, null); |
| user.Message(MessageHud.MessageType.Center, "$piece_itemstand_cantattach", 0, null); |
| return true; |
| return true; |
| } |
| } |
| if (!this.m_nview.IsOwner()) |
| if (!this.m_nview.IsOwner()) |
| { |
| { |
| this.m_nview.InvokeRPC("RequestOwn", Array.Empty<object>()); |
| this.m_nview.InvokeRPC("RequestOwn", Array.Empty<object>()); |
| } |
| } |
| this.m_queuedItem = item; |
| this.m_queuedItem = item; |
| base.CancelInvoke("UpdateAttach"); |
| base.CancelInvoke("UpdateAttach"); |
| base.InvokeRepeating("UpdateAttach", 0f, 0.1f); |
| base.InvokeRepeating("UpdateAttach", 0f, 0.1f); |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private void RPC_DropItem(long sender) |
| private void RPC_DropItem(long sender) |
| { |
| { |
| if (!this.m_nview.IsOwner()) |
| if (!this.m_nview.IsOwner()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (!this.m_canBeRemoved) |
| if (!this.m_canBeRemoved) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.DropItem(); |
| this.DropItem(); |
| } |
| } |
| |
| |
| public void DestroyAttachment() |
| public void DestroyAttachment() |
| { |
| { |
| this.m_nview.InvokeRPC("DestroyAttachment", Array.Empty<object>()); |
| this.m_nview.InvokeRPC("DestroyAttachment", Array.Empty<object>()); |
| } |
| } |
| |
| |
| public void RPC_DestroyAttachment(long sender) |
| public void RPC_DestroyAttachment(long sender) |
| { |
| { |
| if (!this.m_nview.IsOwner()) |
| if (!this.m_nview.IsOwner()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (!this.HaveAttachment()) |
| if (!this.HaveAttachment()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_nview.GetZDO().Set(ZDOVars.s_item, ""); |
| this.m_nview.GetZDO().Set(ZDOVars.s_item, ""); |
| this.m_nview.InvokeRPC(ZNetView.Everybody, "SetVisualItem", new object[] { "", 0, 0 }); |
| this.m_nview.InvokeRPC(ZNetView.Everybody, "SetVisualItem", new object[] { "", 0, 0 }); |
| this.m_destroyEffects.Create(this.m_dropSpawnPoint.position, Quaternion.identity, null, 1f, -1); |
| this.m_destroyEffects.Create(this.m_dropSpawnPoint.position, Quaternion.identity, null, 1f, -1); |
| } |
| } |
| |
| |
| private void DropItem() |
| private void DropItem() |
| { |
| { |
| if (!this.HaveAttachment()) |
| if (!this.HaveAttachment()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| string @string = this.m_nview.GetZDO().GetString(ZDOVars.s_item, ""); |
| string @string = this.m_nview.GetZDO().GetString(ZDOVars.s_item, ""); |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(@string); |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(@string); |
| if (itemPrefab) |
| if (itemPrefab) |
| { |
| { |
| Vector3 vector = Vector3.zero; |
| Vector3 vector = Vector3.zero; |
| Quaternion quaternion = Quaternion.identity; |
| Quaternion quaternion = Quaternion.identity; |
| Transform transform = itemPrefab.transform.Find("attach"); |
| Transform transform = itemPrefab.transform.Find("attach"); |
| if (itemPrefab.transform.Find("attachobj") && transform) |
| if (itemPrefab.transform.Find("attachobj") && transform) |
| { |
| { |
| quaternion = transform.transform.localRotation; |
| quaternion = transform.transform.localRotation; |
| vector = transform.transform.localPosition; |
| vector = transform.transform.localPosition; |
| } |
| } |
| GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(itemPrefab, this.m_dropSpawnPoint.position + vector, this.m_dropSpawnPoint.rotation * quaternion); |
| GameObject gameObject = UnityEngine.Object.Instantiate<GameObject>(itemPrefab, this.m_dropSpawnPoint.position + vector, this.m_dropSpawnPoint.rotation * quaternion); |
| gameObject.GetComponent<ItemDrop>().LoadFromExternalZDO(this.m_nview.GetZDO()); |
| gameObject.GetComponent<ItemDrop>().LoadFromExternalZDO(this.m_nview.GetZDO()); |
| gameObject.GetComponent<Rigidbody>().velocity = Vector3.up * 4f; |
| gameObject.GetComponent<Rigidbody>().velocity = Vector3.up * 4f; |
| this.m_effects.Create(this.m_dropSpawnPoint.position, Quaternion.identity, null, 1f, -1); |
| this.m_effects.Create(this.m_dropSpawnPoint.position, Quaternion.identity, null, 1f, -1); |
| } |
| } |
| this.m_nview.GetZDO().Set(ZDOVars.s_item, ""); |
| this.m_nview.GetZDO().Set(ZDOVars.s_item, ""); |
| this.m_nview.InvokeRPC(ZNetView.Everybody, "SetVisualItem", new object[] { "", 0, 0 }); |
| this.m_nview.InvokeRPC(ZNetView.Everybody, "SetVisualItem", new object[] { "", 0, 0 }); |
| } |
| } |
| |
| |
| private Transform GetAttach(ItemDrop.ItemData item) |
| private Transform GetAttach(ItemDrop.ItemData item) |
| { |
| { |
| return this.m_attachOther; |
| return this.m_attachOther; |
| } |
| } |
| |
| |
| private void UpdateAttach() |
| private void UpdateAttach() |
| { |
| { |
| if (!this.m_nview.IsOwner()) |
| if (!this.m_nview.IsOwner()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| base.CancelInvoke("UpdateAttach"); |
| base.CancelInvoke("UpdateAttach"); |
| Player localPlayer = Player.m_localPlayer; |
| Player localPlayer = Player.m_localPlayer; |
| if (this.m_queuedItem != null && localPlayer != null && localPlayer.GetInventory().ContainsItem(this.m_queuedItem) && !this.HaveAttachment()) |
| if (this.m_queuedItem != null && localPlayer != null && localPlayer.GetInventory().ContainsItem(this.m_queuedItem) && !this.HaveAttachment()) |
| { |
| { |
| ItemDrop.ItemData itemData = this.m_queuedItem.Clone(); |
| ItemDrop.ItemData itemData = this.m_queuedItem.Clone(); |
| itemData.m_stack = 1; |
| itemData.m_stack = 1; |
| this.m_nview.GetZDO().Set(ZDOVars.s_item, this.m_queuedItem.m_dropPrefab.name); |
| this.m_nview.GetZDO().Set(ZDOVars.s_item, this.m_queuedItem.m_dropPrefab.name); |
| ItemDrop.SaveToZDO(itemData, this.m_nview.GetZDO()); |
| ItemDrop.SaveToZDO(itemData, this.m_nview.GetZDO()); |
| localPlayer.UnequipItem(this.m_queuedItem, true); |
| localPlayer.UnequipItem(this.m_queuedItem, true); |
| localPlayer.GetInventory().RemoveOneItem(this.m_queuedItem); |
| localPlayer.GetInventory().RemoveOneItem(this.m_queuedItem); |
| this.m_nview.InvokeRPC(ZNetView.Everybody, "SetVisualItem", new object[] |
| this.m_nview.InvokeRPC(ZNetView.Everybody, "SetVisualItem", new object[] |
| { |
| { |
| itemData.m_dropPrefab.name, |
| itemData.m_dropPrefab.name, |
| itemData.m_variant, |
| itemData.m_variant, |
| itemData.m_quality |
| itemData.m_quality |
| }); |
| }); |
| Transform attach = this.GetAttach(this.m_queuedItem); |
| Transform attach = this.GetAttach(this.m_queuedItem); |
| this.m_effects.Create(attach.transform.position, Quaternion.identity, null, 1f, -1); |
| this.m_effects.Create(attach.transform.position, Quaternion.identity, null, 1f, -1); |
| Game.instance.IncrementPlayerStat(PlayerStatType.ItemStandUses, 1f); |
| Game.instance.IncrementPlayerStat(PlayerStatType.ItemStandUses, 1f); |
| } |
| } |
| this.m_queuedItem = null; |
| this.m_queuedItem = null; |
| } |
| } |
| |
| |
| private void RPC_RequestOwn(long sender) |
| private void RPC_RequestOwn(long sender) |
| { |
| { |
| if (!this.m_nview.IsOwner()) |
| if (!this.m_nview.IsOwner()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_nview.GetZDO().SetOwner(sender); |
| this.m_nview.GetZDO().SetOwner(sender); |
| } |
| } |
| |
| |
| private void UpdateVisual() |
| private void UpdateVisual() |
| { |
| { |
| if (this.m_nview == null || !this.m_nview.IsValid()) |
| if (this.m_nview == null || !this.m_nview.IsValid()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| string @string = this.m_nview.GetZDO().GetString(ZDOVars.s_item, ""); |
| string @string = this.m_nview.GetZDO().GetString(ZDOVars.s_item, ""); |
| int @int = this.m_nview.GetZDO().GetInt(ZDOVars.s_variant, 0); |
| int @int = this.m_nview.GetZDO().GetInt(ZDOVars.s_variant, 0); |
| int int2 = this.m_nview.GetZDO().GetInt(ZDOVars.s_quality, 1); |
| int int2 = this.m_nview.GetZDO().GetInt(ZDOVars.s_quality, 1); |
| this.SetVisualItem(@string, @int, int2); |
| this.SetVisualItem(@string, @int, int2); |
| } |
| } |
| |
| |
| private void RPC_SetVisualItem(long sender, string itemName, int variant, int quality) |
| private void RPC_SetVisualItem(long sender, string itemName, int variant, int quality) |
| { |
| { |
| this.SetVisualItem(itemName, variant, quality); |
| this.SetVisualItem(itemName, variant, quality); |
| } |
| } |
| |
| |
| private void SetVisualItem(string itemName, int variant, int quality) |
| private void SetVisualItem(string itemName, int variant, int quality) |
| { |
| { |
| if (this.m_visualName == itemName && this.m_visualVariant == variant) |
| if (this.m_visualName == itemName && this.m_visualVariant == variant) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.m_visualName = itemName; |
| this.m_visualName = itemName; |
| this.m_visualVariant = variant; |
| this.m_visualVariant = variant; |
| this.m_currentItemName = ""; |
| this.m_currentItemName = ""; |
| if (this.m_visualName == "") |
| if (this.m_visualName == "") |
| { |
| { |
| UnityEngine.Object.Destroy(this.m_visualItem); |
| UnityEngine.Object.Destroy(this.m_visualItem); |
| return; |
| return; |
| } |
| } |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemName); |
| GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemName); |
| if (itemPrefab == null) |
| if (itemPrefab == null) |
| { |
| { |
| ZLog.LogWarning("Missing item prefab " + itemName); |
| ZLog.LogWarning("Missing item prefab " + itemName); |
| return; |
| return; |
| } |
| } |
| . | GameObject attachPrefab = this.GetAttachPrefab(itemPrefab); |
| GameObject attachPrefab = ItemStand.GetAttachPrefab(itemPrefab); |
| if (attachPrefab == null) |
| if (attachPrefab == null) |
| { |
| { |
| ZLog.LogWarning("Failed to get attach prefab for item " + itemName); |
| ZLog.LogWarning("Failed to get attach prefab for item " + itemName); |
| return; |
| return; |
| } |
| } |
| ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); |
| ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); |
| this.m_currentItemName = component.m_itemData.m_shared.m_name; |
| this.m_currentItemName = component.m_itemData.m_shared.m_name; |
| Transform attach = this.GetAttach(component.m_itemData); |
| Transform attach = this.GetAttach(component.m_itemData); |
| . | Transform transform = itemPrefab.transform.Find("attachobj"); |
| GameObject attachGameObject = ItemStand.GetAttachGameObject(attachPrefab); |
| GameObject gameObject = ((transform != null) ? transform.gameObject : null); |
| this.m_visualItem = UnityEngine.Object.Instantiate<GameObject>(attachGameObject, attach.position, attach.rotation, attach); |
| this.m_visualItem = UnityEngine.Object.Instantiate<GameObject>((gameObject != null) ? gameObject : attachPrefab, attach.position, attach.rotation, attach); |
| |
| this.m_visualItem.transform.localPosition = attachPrefab.transform.localPosition; |
| this.m_visualItem.transform.localPosition = attachPrefab.transform.localPosition; |
| this.m_visualItem.transform.localRotation = attachPrefab.transform.localRotation; |
| this.m_visualItem.transform.localRotation = attachPrefab.transform.localRotation; |
| this.m_visualItem.transform.localScale = Vector3.Scale(attachPrefab.transform.localScale, component.m_itemData.GetScale((float)quality)); |
| this.m_visualItem.transform.localScale = Vector3.Scale(attachPrefab.transform.localScale, component.m_itemData.GetScale((float)quality)); |
| IEquipmentVisual componentInChildren = this.m_visualItem.GetComponentInChildren<IEquipmentVisual>(); |
| IEquipmentVisual componentInChildren = this.m_visualItem.GetComponentInChildren<IEquipmentVisual>(); |
| if (componentInChildren != null) |
| if (componentInChildren != null) |
| { |
| { |
| componentInChildren.Setup(this.m_visualVariant); |
| componentInChildren.Setup(this.m_visualVariant); |
| } |
| } |
| } |
| } |
| |
| |
| . | private GameObject GetAttachPrefab(GameObject item) |
| public static GameObject GetAttachPrefab(GameObject item) |
| { |
| { |
| Transform transform = item.transform.Find("attach"); |
| Transform transform = item.transform.Find("attach"); |
| if (transform) |
| if (transform) |
| { |
| { |
| return transform.gameObject; |
| return transform.gameObject; |
| } |
| } |
| return null; |
| return null; |
| } |
| } |
| |
| |
| . | |
| public static GameObject GetAttachGameObject(GameObject prefab) |
| |
| { |
| |
| Transform transform = prefab.transform.Find("attachobj"); |
| |
| if (!(transform != null)) |
| |
| { |
| |
| return prefab; |
| |
| } |
| |
| return transform.gameObject; |
| |
| } |
| |
| |
| private bool CanAttach(ItemDrop.ItemData item) |
| private bool CanAttach(ItemDrop.ItemData item) |
| { |
| { |
| . | return !(this.GetAttachPrefab(item.m_dropPrefab) == null) && !this.IsUnsupported(item) && this.IsSupported(item) && (this.m_supportedTypes.Count == 0 || this.m_supportedTypes.Contains(item.m_shared.m_itemType)); |
| return !(ItemStand.GetAttachPrefab(item.m_dropPrefab) == null) && !this.IsUnsupported(item) && this.IsSupported(item) && (this.m_supportedTypes.Count == 0 || this.m_supportedTypes.Contains(item.m_shared.m_itemType)); |
| } |
| } |
| |
| |
| public bool IsUnsupported(ItemDrop.ItemData item) |
| public bool IsUnsupported(ItemDrop.ItemData item) |
| { |
| { |
| using (List<ItemDrop>.Enumerator enumerator = this.m_unsupportedItems.GetEnumerator()) |
| using (List<ItemDrop>.Enumerator enumerator = this.m_unsupportedItems.GetEnumerator()) |
| { |
| { |
| while (enumerator.MoveNext()) |
| while (enumerator.MoveNext()) |
| { |
| { |
| if (enumerator.Current.m_itemData.m_shared.m_name == item.m_shared.m_name) |
| if (enumerator.Current.m_itemData.m_shared.m_name == item.m_shared.m_name) |
| { |
| { |
| return true; |
| return true; |
| } |
| } |
| } |
| } |
| } |
| } |
| return false; |
| return false; |
| } |
| } |
| |
| |
| public bool IsSupported(ItemDrop.ItemData item) |
| public bool IsSupported(ItemDrop.ItemData item) |
| { |
| { |
| if (this.m_supportedItems.Count == 0) |
| if (this.m_supportedItems.Count == 0) |
| { |
| { |
| return true; |
| return true; |
| } |
| } |
| using (List<ItemDrop>.Enumerator enumerator = this.m_supportedItems.GetEnumerator()) |
| using (List<ItemDrop>.Enumerator enumerator = this.m_supportedItems.GetEnumerator()) |
| { |
| { |
| while (enumerator.MoveNext()) |
| while (enumerator.MoveNext()) |
| { |
| { |
| if (enumerator.Current.m_itemData.m_shared.m_name == item.m_shared.m_name) |
| if (enumerator.Current.m_itemData.m_shared.m_name == item.m_shared.m_name) |
| { |
| { |
| return true; |
| return true; |
| } |
| } |
| } |
| } |
| } |
| } |
| return false; |
| return false; |
| } |
| } |
| |
| |
| public bool HaveAttachment() |
| public bool HaveAttachment() |
| { |
| { |
| return this.m_nview.IsValid() && this.m_nview.GetZDO().GetString(ZDOVars.s_item, "") != ""; |
| return this.m_nview.IsValid() && this.m_nview.GetZDO().GetString(ZDOVars.s_item, "") != ""; |
| } |
| } |
| |
| |
| public string GetAttachedItem() |
| public string GetAttachedItem() |
| { |
| { |
| if (!this.m_nview.IsValid()) |
| if (!this.m_nview.IsValid()) |
| { |
| { |
| return ""; |
| return ""; |
| } |
| } |
| return this.m_nview.GetZDO().GetString(ZDOVars.s_item, ""); |
| return this.m_nview.GetZDO().GetString(ZDOVars.s_item, ""); |
| } |
| } |
| |
| |
| public ZNetView m_netViewOverride; |
| public ZNetView m_netViewOverride; |
| |
| |
| public string m_name = ""; |
| public string m_name = ""; |
| |
| |
| public Transform m_attachOther; |
| public Transform m_attachOther; |
| |
| |
| public Transform m_dropSpawnPoint; |
| public Transform m_dropSpawnPoint; |
| |
| |
| public bool m_canBeRemoved = true; |
| public bool m_canBeRemoved = true; |
| |
| |
| public bool m_autoAttach; |
| public bool m_autoAttach; |
| |
| |
| public List<ItemDrop.ItemData.ItemType> m_supportedTypes = new List<ItemDrop.ItemData.ItemType>(); |
| public List<ItemDrop.ItemData.ItemType> m_supportedTypes = new List<ItemDrop.ItemData.ItemType>(); |
| |
| |
| public List<ItemDrop> m_unsupportedItems = new List<ItemDrop>(); |
| public List<ItemDrop> m_unsupportedItems = new List<ItemDrop>(); |
| |
| |
| public List<ItemDrop> m_supportedItems = new List<ItemDrop>(); |
| public List<ItemDrop> m_supportedItems = new List<ItemDrop>(); |
| |
| |
| public EffectList m_effects = new EffectList(); |
| public EffectList m_effects = new EffectList(); |
| |
| |
| public EffectList m_destroyEffects = new EffectList(); |
| public EffectList m_destroyEffects = new EffectList(); |
| |
| |
| [Header("Guardian power")] |
| [Header("Guardian power")] |
| public float m_powerActivationDelay = 2f; |
| public float m_powerActivationDelay = 2f; |
| |
| |
| public StatusEffect m_guardianPower; |
| public StatusEffect m_guardianPower; |
| |
| |
| public EffectList m_activatePowerEffects = new EffectList(); |
| public EffectList m_activatePowerEffects = new EffectList(); |
| |
| |
| public EffectList m_activatePowerEffectsPlayer = new EffectList(); |
| public EffectList m_activatePowerEffectsPlayer = new EffectList(); |
| |
| |
| private string m_visualName = ""; |
| private string m_visualName = ""; |
| |
| |
| private int m_visualVariant; |
| private int m_visualVariant; |
| |
| |
| private GameObject m_visualItem; |
| private GameObject m_visualItem; |
| |
| |
| private string m_currentItemName = ""; |
| private string m_currentItemName = ""; |
| |
| |
| private ItemDrop.ItemData m_queuedItem; |
| private ItemDrop.ItemData m_queuedItem; |
| |
| |
| private ZNetView m_nview; |
| private ZNetView m_nview; |
| } |
| } |
| |
| |