예제 #1
0
        public override void OnPush()
        {
            base.OnPush();

            buildingDiscoveryData = GameManager.Instance.PlayerEnterExit.BuildingDiscoveryData;

            // Check guild advancement
            TextFile.Token[] updatedRank = guild.UpdateRank(playerEntity);
            if (updatedRank != null)
            {
                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, uiManager.TopWindow);
                messageBox.SetTextTokens(updatedRank, guild);
                messageBox.ClickAnywhereToClose = true;
                messageBox.Show();
            }
            // Check for free healing (Temple members)
            if (guild.FreeHealing())
            {
                // Free heal
                if (playerEntity.CurrentHealth < playerEntity.MaxHealth)
                {
                    playerEntity.SetHealth(playerEntity.MaxHealth);
                    DaggerfallUI.MessageBox(350);
                }
                // Check for free stat restoration (Temple members)
                EntityEffectManager playerEffectMgr = playerEntity.EntityBehaviour.GetComponent <EntityEffectManager>();
                if (playerEffectMgr != null)
                {
                    if (playerEffectMgr.HasDamagedAttributes())
                    {
                        DaggerfallMessageBox messageBox =
                            new DaggerfallMessageBox(uiManager, DaggerfallMessageBox.CommonMessageBoxButtons.YesNo, TempleResetStats, uiManager.TopWindow);
                        messageBox.OnButtonClick += ConfirmStatReset_OnButtonClick;
                        messageBox.Show();
                    }
                }
            }
            // Check for magicka restoration (sorcerers)
            if (guild.FreeMagickaRecharge() && playerEntity.CurrentMagicka < playerEntity.MaxMagicka)
            {
                DaggerfallMessageBox msgBox = new DaggerfallMessageBox(uiManager, this);
                msgBox.SetTextTokens(DaggerfallUnity.Instance.TextProvider.GetRandomTokens(SorcerorMagickaRecharge));
                msgBox.ClickAnywhereToClose = true;
                msgBox.Show();

                // Refill magicka
                playerEntity.SetMagicka(playerEntity.MaxMagicka);
            }
        }