using BrewMonster.Assets.PerfectWorld.Scripts.Players; using BrewMonster.Network; using BrewMonster.Scripts; using BrewMonster.Scripts.Managers; using ModelRenderer.Scripts.Common; using ModelRenderer.Scripts.GameData; using UnityEngine; namespace BrewMonster { /// /// Pet shortcut for quick summoning/recalling pets /// public class CECSCPet : CECShortcut { /*#region Fields private int m_iPetIndex = -1; // Pet index in pet corral private PET_ESSENCE m_pPetEssence; // Pet essence data private bool m_bHasEssence = false; // Whether the pet essence has been loaded #endregion #region Constructors /// /// Default constructor /// public CECSCPet() { m_iSCType = (int)ShortcutType.SCT_PET; m_iPetIndex = -1; m_bHasEssence = false; } /// /// Copy constructor /// /// Source pet shortcut to copy from public CECSCPet(CECSCPet src) { m_iSCType = src.m_iSCType; m_iPetIndex = src.m_iPetIndex; m_pPetEssence = src.m_pPetEssence; m_bHasEssence = src.m_bHasEssence; } #endregion #region Initialization /// /// Initialize the pet shortcut with a pet index /// /// Index of the pet in the pet corral /// True if initialization succeeded public bool Init(int iPetIndex) { CECHostPlayer pHost = EC_Game.GetGameRun()?.GetHostPlayer(); if (pHost == null) return false; EC_PetCorral pPetCorral = pHost.GetPetCorral(); if (pPetCorral == null) return false; //CECPetData pPet = pPetCorral.GetPetData(iPetIndex); if (pPet == null) return false; elementdataman pDB = ElementDataManProvider.GetElementDataMan(); if (pDB == null) return false; DATA_TYPE dataType = DATA_TYPE.DT_INVALID; object essenceObj = pDB.get_data_ptr((uint)pPet.GetTemplateID(), ID_SPACE.ID_SPACE_ESSENCE, ref dataType); if (essenceObj == null || !(essenceObj is PET_ESSENCE)) return false; m_pPetEssence = (PET_ESSENCE)essenceObj; m_bHasEssence = true; m_iPetIndex = iPetIndex; return true; } #endregion #region CECShortcut Overrides /// /// Clone this pet shortcut /// /// A new instance with the same data public override CECShortcut Clone() { return new CECSCPet(this); } /// /// Execute the pet shortcut - summon or recall the pet /// /// True if execution succeeded public override bool Execute() { if (m_iPetIndex < 0) return false; CECHostPlayer pHost = EC_Game.GetGameRun()?.GetHostPlayer(); if (pHost == null) return false; EC_PetCorral pPetCorral = pHost.GetPetCorral(); if (pPetCorral == null) return false; //if (pPetCorral.GetActivePetIndex() == m_iPetIndex) //{ // // If this pet is the active one, recall it // pHost.RecallPet(); //} else { // Check action switcher for fly-to-ride transition CECActionSwitcherBase pSwitcher = pHost.GetActionSwitcher(); //if (pSwitcher != null && pSwitcher.OnFlyToRideAction(m_iPetIndex)) //{ // return true; //} // Summon this pet //pHost.SummonPet(m_iPetIndex); } return true; } /// /// Get the icon file path for this pet /// /// Icon file path //public override string GetIconFile() //{ // return m_pPetEssence?.file_icon ?? string.Empty; //} /// /// Get the description text for this pet /// /// Pet description //public override string GetDesc() //{ // // TODO: Implement pet description retrieval //} #endregion #region Public Methods /// /// Check if this pet is currently active /// /// True if this pet is the active pet //public bool IsActivePet() //{ // EC_PetCorral pPetCorral = EC_Game.GetGameRun()?.GetHostPlayer()?.GetPetCorral(); // if (pPetCorral == null) // return false; // return pPetCorral.GetActivePetIndex() == m_iPetIndex; //} #endregion #region Properties /// /// Get the pet index in pet corral /// /// Pet index public int GetPetIndex() { return m_iPetIndex; } /// /// Get the pet essence data /// /// Pet essence public PET_ESSENCE GetPetEssence() { return m_pPetEssence; } #endregion*/ } }