private void DoGuildService() { // Check access to service if (!guild.CanAccessService(service)) { if (guild.IsMember()) { DaggerfallMessageBox msgBox = new DaggerfallMessageBox(uiManager, this); msgBox.SetTextTokens(DaggerfallUnity.Instance.TextProvider.GetRandomTokens(InsufficientRankId)); msgBox.ClickAnywhereToClose = true; msgBox.Show(); } else { DaggerfallUI.MessageBox(TextManager.Instance.GetText(textDatabase, "serviceMembersOnly")); } return; } // Handle known service DaggerfallTradeWindow tradeWindow; switch (service) { case GuildServices.Quests: GetQuest(); break; case GuildServices.Identify: CloseWindow(); uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.Identify, guild })); break; case GuildServices.Repair: CloseWindow(); uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.Repair, guild })); break; case GuildServices.Training: TrainingService(); break; case GuildServices.Donate: DonationService(); break; case GuildServices.CureDisease: CureDiseaseService(); break; case GuildServices.BuyPotions: CloseWindow(); tradeWindow = (DaggerfallTradeWindow)UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.Buy, guild }); tradeWindow.MerchantItems = GetMerchantPotions(); uiManager.PushWindow(tradeWindow); break; case GuildServices.MakePotions: MakePotionService(); break; case GuildServices.BuySpells: case GuildServices.BuySpellsMages: CloseWindow(); uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.SpellBook, new object[] { uiManager, this, true })); break; case GuildServices.MakeSpells: CloseWindow(); if (GameManager.Instance.PlayerEntity.Items.Contains(ItemGroups.MiscItems, (int)MiscItems.Spellbook)) { uiManager.PushWindow(DaggerfallUI.Instance.DfSpellMakerWindow); } else { DaggerfallUI.MessageBox(TextManager.Instance.GetText("ClassicEffects", "noSpellbook")); } break; case GuildServices.BuyMagicItems: // TODO: switch items depending on npcService? CloseWindow(); tradeWindow = (DaggerfallTradeWindow)UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.Buy, guild }); tradeWindow.MerchantItems = GetMerchantMagicItems(); uiManager.PushWindow(tradeWindow); break; case GuildServices.MakeMagicItems: CloseWindow(); uiManager.PushWindow(DaggerfallUI.Instance.DfItemMakerWindow); break; case GuildServices.SellMagicItems: CloseWindow(); uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.SellMagic, guild })); break; case GuildServices.Teleport: CloseWindow(); DaggerfallUI.Instance.DfTravelMapWindow.ActivateTeleportationTravel(); uiManager.PushWindow(DaggerfallUI.Instance.DfTravelMapWindow); break; case GuildServices.DaedraSummoning: DaedraSummoningService((int)npcService); break; case GuildServices.ReceiveArmor: ReceiveArmorService(); break; case GuildServices.ReceiveHouse: ReceiveHouseService(); break; case GuildServices.Spymaster: const int spyMasterGreetingTextId = 402; DaggerfallMessageBox msgBox = new DaggerfallMessageBox(uiManager, this); msgBox.SetTextTokens(DaggerfallUnity.Instance.TextProvider.GetRandomTokens(spyMasterGreetingTextId)); msgBox.ClickAnywhereToClose = true; msgBox.OnClose += SpyMasterGreetingPopUp_OnClose; msgBox.Show(); break; case GuildServices.BuySoulgems: CloseWindow(); tradeWindow = (DaggerfallTradeWindow)UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.Buy, guild }); tradeWindow.MerchantItems = GetMerchantMagicItems(true); uiManager.PushWindow(tradeWindow); break; default: CloseWindow(); Services.CustomGuildService customService; if (Services.GetCustomGuildService((int)service, out customService)) { customService(this); } else { DaggerfallUI.MessageBox("Guild service not yet implemented."); } break; } }
protected virtual void RepairButton_OnMouseClick(BaseScreenComponent sender, Vector2 position) { DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick); CloseWindow(); uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.Trade, new object[] { uiManager, this, DaggerfallTradeWindow.WindowModes.Repair, null })); }
private void LoadButton_OnMouseClick(BaseScreenComponent sender, Vector2 position) { DaggerfallUI.Instance.PlayOneShot(SoundClips.ButtonClick); uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.UnitySaveGame, new object[] { uiManager, DaggerfallUnitySaveGameWindow.Modes.LoadGame, this, false })); }
private void SwitchClassicButton_OnMouseClick(BaseScreenComponent sender, Vector2 position) { uiManager.PushWindow(UIWindowFactory.GetInstance(UIWindowType.LoadClassicGame, uiManager, null)); }
private void ConfirmSummon_OnButtonClick(DaggerfallMessageBox sender, DaggerfallMessageBox.MessageBoxButtons messageBoxButton) { sender.CloseWindow(); if (messageBoxButton == DaggerfallMessageBox.MessageBoxButtons.Yes) { PlayerEntity playerEntity = GameManager.Instance.PlayerEntity; int summonCost = FormulaHelper.CalculateDaedraSummoningCost(summonerFactionData.rep); if (playerEntity.GetGoldAmount() >= summonCost) { playerEntity.DeductGoldAmount(summonCost); WeatherManager weatherManager = GameManager.Instance.WeatherManager; // Sheogorath has a 5% (15% if stormy) chance to replace selected daedra. int sheoChance = (weatherManager.IsStorming) ? 15 : 5; if (Dice100.Roll() <= sheoChance) { daedraToSummon = daedraData[8]; } // Default 30% bonus is only applicable to some Daedra in specific weather conditions. int bonus = 0; if (daedraToSummon.bonusCond == Weather.WeatherType.Rain && weatherManager.IsRaining || daedraToSummon.bonusCond == Weather.WeatherType.Thunder && weatherManager.IsStorming || daedraToSummon.bonusCond == Weather.WeatherType.None) { bonus = 30; } // Get summoning chance for selected daedra and roll. int chance = FormulaHelper.CalculateDaedraSummoningChance(playerEntity.FactionData.GetReputation(daedraToSummon.factionId), bonus); int roll = Dice100.Roll(); Debug.LogFormat("Summoning {0} with chance = {1}%, Sheogorath chance = {2}%, roll = {3}, summoner rep = {4}, cost: {5}", daedraToSummon.vidFile.Substring(0, daedraToSummon.vidFile.Length - 4), chance, sheoChance, roll, summonerFactionData.rep, summonCost); if (roll > chance) { // Daedra stood you up! DaggerfallUI.MessageBox(SummonFailed, this); // Spawn daedric foes if failed at a witches coven. if (summonerFactionData.ggroup == (int)FactionFile.GuildGroups.Witches) { GameObjectHelper.CreateFoeSpawner(true, daedricFoes[Random.Range(0, 5)], Random.Range(1, 4), 4, 64); } return; } // Has this Daedra already been summoned by the player? if (playerEntity.FactionData.GetFlag(daedraToSummon.factionId, FactionFile.Flags.Summoned)) { // Close menu and push DaggerfallDaedraSummoningWindow here for video and dismissal.. CloseWindow(); uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.DaedraSummoned, new object[] { uiManager, daedraToSummon, SummonBefore, this })); } else { // Record the summoning. playerEntity.FactionData.SetFlag(daedraToSummon.factionId, FactionFile.Flags.Summoned); // Offer the quest to player. offeredQuest = GameManager.Instance.QuestListsManager.GetQuest(daedraToSummon.quest, summonerFactionData.id); if (offeredQuest != null) { // Close menu and push DaggerfallDaedraSummoningWindow here for video and custom quest offer.. CloseWindow(); uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.DaedraSummoned, new object[] { uiManager, daedraToSummon, offeredQuest })); } } } else { // Display customised not enough gold message so players don't need to guess the cost. TextFile.Token[] notEnoughGold = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(DaggerfallTradeWindow.NotEnoughGoldId); TextFile.Token[] msg = new TextFile.Token[] { new TextFile.Token() { formatting = TextFile.Formatting.Text, text = TextManager.Instance.GetLocalizedText("serviceSummonCost1") }, new TextFile.Token() { formatting = TextFile.Formatting.JustifyCenter }, new TextFile.Token() { formatting = TextFile.Formatting.Text, text = TextManager.Instance.GetLocalizedText("serviceSummonCost2") + summonCost + TextManager.Instance.GetLocalizedText("serviceSummonCost3") }, new TextFile.Token() { formatting = TextFile.Formatting.JustifyCenter }, new TextFile.Token() { formatting = TextFile.Formatting.NewLine }, notEnoughGold[0], new TextFile.Token() { formatting = TextFile.Formatting.JustifyCenter }, }; DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, uiManager.TopWindow); messageBox.SetTextTokens(msg, this); messageBox.ClickAnywhereToClose = true; messageBox.Show(); } } }
void StartNewGame() { uiManager.PushWindow(UIWindowFactory.GetInstance(UIWindowType.StartNewGameWizard, uiManager)); }
void LoadGame() { uiManager.PushWindow(UIWindowFactory.GetInstanceWithArgs(UIWindowType.UnitySaveGame, new object[] { uiManager, DaggerfallUnitySaveGameWindow.Modes.LoadGame, null, true })); }