private void MainPageInit(DialogPage page) { var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayerTripleTriad = DB.Get <PlayerTripleTriad>(playerId) ?? new PlayerTripleTriad(); var model = GetDataModel <Model>(); page.Header = "Which deck would you like to use?"; page.AddResponse(ColorToken.Green("View Cards"), () => SwitchConversation(nameof(TripleTriadPlayerDialog))); foreach (var(_, deck) in dbPlayerTripleTriad.Decks) { if (deck.Card1 != CardType.Invalid && deck.Card2 != CardType.Invalid && deck.Card3 != CardType.Invalid && deck.Card4 != CardType.Invalid && deck.Card5 != CardType.Invalid) { page.AddResponse($"Choose Deck: {deck.Name}", () => { TripleTriad.StartGame(player, deck, OBJECT_SELF, model.NPCDeck); EndConversation(); }); } } }
private void MainPageInit(DialogPage page) { var model = GetDataModel <Model>(); page.Header = "Please select a skill."; page.AddResponse(Skill.GetSkillDetails(SkillType.Blacksmithing).Name, () => { model.SelectedSkill = SkillType.Blacksmithing; ChangePage(CategoryPageId); }); page.AddResponse(Skill.GetSkillDetails(SkillType.Leathercraft).Name, () => { model.SelectedSkill = SkillType.Leathercraft; ChangePage(CategoryPageId); }); page.AddResponse(Skill.GetSkillDetails(SkillType.Alchemy).Name, () => { model.SelectedSkill = SkillType.Alchemy; ChangePage(CategoryPageId); }); page.AddResponse(Skill.GetSkillDetails(SkillType.Cooking).Name, () => { model.SelectedSkill = SkillType.Cooking; ChangePage(CategoryPageId); }); }
private void ChangeStoreNameInit(DialogPage page) { var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayerStore = DB.Get <PlayerStore>(playerId) ?? new PlayerStore(); var newStoreName = GetLocalString(player, "NEW_STORE_NAME"); if (string.IsNullOrWhiteSpace(newStoreName)) { newStoreName = dbPlayerStore.StoreName; } page.Header = ColorToken.Green("Store Name: ") + dbPlayerStore.StoreName + "\n" + ColorToken.Green("New Name: ") + newStoreName + "\n\n" + "Set your store's name by entering it in the chat bar. Press 'Refresh' to see changes."; page.AddResponse(ColorToken.Green("Refresh"), () => { }); page.AddResponse("Set Name", () => { dbPlayerStore.StoreName = newStoreName; DB.Set(playerId, dbPlayerStore); PlayerMarket.UpdateCacheEntry(playerId, dbPlayerStore); }); SetLocalBool(player, "IS_SETTING_STORE_NAME", true); }
/// <summary> /// Handles the "Sell House Page" header and responses. /// </summary> /// <param name="page">The page we're building.</param> private void SellHousePageInit(DialogPage page) { var player = GetPC(); var playerId = GetObjectUUID(player); var dbHouse = DB.Get <PlayerHouse>(playerId); var model = GetDataModel <Model>(); var houseDetail = Housing.GetHouseTypeDetail(dbHouse.HouseType); var gil = houseDetail.Price / 2; page.Header = ColorToken.Red("WARNING: ") + "You are about to sell your property. All items contained inside will be permanently lost!\n\n" + "It is highly recommended you pick up all items and furniture inside before selling the property.\n\n" + ColorToken.Green($"You will receive {gil} gil for the sale of this property. Are you sure you wish to sell it?"); if (model.IsConfirmingSell) { page.AddResponse(ColorToken.Red($"CONFIRM SELL PROPERTY"), () => { DB.Delete <PlayerHouse>(playerId); GiveGoldToCreature(player, gil); FloatingTextStringOnCreature($"Property sold successfully for {gil} gil.", player, false); EndConversation(); Log.Write(LogGroup.PlayerHousing, $"Player {GetName(player)} (ID = '{playerId}') sold their property for {gil} gil."); }); } else { page.AddResponse(ColorToken.Red("Sell Property"), () => { model.IsConfirmingSell = true; }); } }
private void EditMyShopInit(DialogPage page) { var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayerStore = DB.Get <PlayerStore>(playerId) ?? new PlayerStore { StoreName = $"{GetName(player)}'s Store" }; page.Header = ColorToken.Green("Store Name: ") + dbPlayerStore.StoreName + "\n" + ColorToken.Green("Lease Expires: ") + GetLeaseStatus() + "\n" + ColorToken.Green("Tax Rate: ") + (int)(dbPlayerStore.TaxRate * 100) + "%\n" + ColorToken.Green("Status: ") + (dbPlayerStore.IsOpen ? "OPEN" : "CLOSED") + "\n\n" + "Please select an option."; // The Till will be filled only if the player sold an item. if (dbPlayerStore.Till > 0) { page.AddResponse(ColorToken.Green($"Retrieve {dbPlayerStore.Till} Gil"), () => { GiveGoldToCreature(player, dbPlayerStore.Till); dbPlayerStore.Till = 0; DB.Set(playerId, dbPlayerStore); PlayerMarket.UpdateCacheEntry(playerId, dbPlayerStore); }); } page.AddResponse("Change Store Name", () => { ChangePage(ChangeStoreNamePageId); }); page.AddResponse("Edit Item List", () => { if (PlayerMarket.IsStoreBeingAccessed(playerId)) { FloatingTextStringOnCreature("Your store is currently being accessed by another player. Close your store and wait until they finish to try this action again.", player, false); return; } ChangePage(EditItemListPageId); }); page.AddResponse(dbPlayerStore.IsOpen ? "Close Store" : "Open Store", () => { dbPlayerStore.IsOpen = !dbPlayerStore.IsOpen; DB.Set(playerId, dbPlayerStore); PlayerMarket.UpdateCacheEntry(playerId, dbPlayerStore); }); page.AddResponse("Extend Lease", () => { ChangePage(ExtendLeasePageId); }); DB.Set(playerId, dbPlayerStore); PlayerMarket.UpdateCacheEntry(playerId, dbPlayerStore); }
private void MainInit(DialogPage page) { page.Header = "Please select an option."; page.AddResponse("View Shops", () => { ChangePage(ViewShopsPageId); }); page.AddResponse("Edit My Shop", () => { ChangePage(EditMyShopPageId); }); }
private void MainPageInit(DialogPage page) { var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayer = DB.Get <Player>(playerId); var perkCount = dbPlayer.Perks.Count; page.Header = ColorToken.Green("Total SP: ") + dbPlayer.TotalSPAcquired + " / " + Skill.SkillCap + "\n" + ColorToken.Green("Available SP: ") + dbPlayer.UnallocatedSP + "\n" + ColorToken.Green("Total Perks: ") + perkCount + "\n"; page.AddResponse("View My Perks", () => ChangePage(ViewMyPerksPageId)); page.AddResponse("Buy Perks", () => ChangePage(CategoryPageId)); }
private void EditItemListInit(DialogPage page) { var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayer = DB.Get <Player>(playerId); var dbPlayerStore = DB.Get <PlayerStore>(playerId); var model = GetDataModel <Model>(); var itemLimit = 5 + dbPlayer.SeedProgress.Rank * 5; page.Header = ColorToken.Green("Listing Limit: ") + dbPlayerStore.ItemsForSale.Count + " / " + itemLimit + "\n" + ColorToken.Green("SeeD Rank: ") + dbPlayer.SeedProgress.Rank + "\n\n" + "Please select the 'List Items' option to add an item to your store. Otherwise select any other option to edit that listing."; page.AddResponse($"{ColorToken.Green("List Items")}", () => { if (dbPlayerStore.ItemsForSale.Count >= itemLimit) { FloatingTextStringOnCreature("You have reached your listing limit. Increase your SeeD rank or remove another listing.", player, false); return; } var terminal = OBJECT_SELF; SetEventScript(terminal, EventScript.Placeable_OnOpen, "mkt_term_open"); SetEventScript(terminal, EventScript.Placeable_OnClosed, "mkt_term_closed"); SetEventScript(terminal, EventScript.Placeable_OnInventoryDisturbed, "mkt_term_dist"); SetEventScript(terminal, EventScript.Placeable_OnUsed, string.Empty); AssignCommand(player, () => ActionInteractObject(terminal)); }); foreach (var(itemId, item) in dbPlayerStore.ItemsForSale) { var responseName = $"{item.StackSize}x {item.Name} [{item.Price} gil]"; page.AddResponse(responseName, () => { // Someone bought the item already. Don't let them progress. if (!dbPlayerStore.ItemsForSale.ContainsKey(itemId)) { FloatingTextStringOnCreature("This item has already been sold. Please select another.", player, false); return; } model.SelectedItemId = itemId; ChangePage(ListingPageId); }); } }
/// <summary> /// Handles the card selection 'confirm deck' logic. /// </summary> /// <param name="page">The page to build.</param> private void DeckCardSelectionConfirmDeckPageInit(DialogPage page) { page.Header = "Is this deck okay?"; page.AddResponse($"{ColorToken.Green("Confirm Deck")}", () => { var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayerTripleTriad = DB.Get <PlayerTripleTriad>(playerId); var model = GetDataModel <Model>(); var deck = dbPlayerTripleTriad.Decks.ContainsKey(model.SelectedDeckId) ? dbPlayerTripleTriad.Decks[model.SelectedDeckId] : new CardDeck { Name = "New Deck" }; deck.Card1 = (CardType)GetLocalInt(player, "CARD_MENU_DECK_CARD_1"); deck.Card2 = (CardType)GetLocalInt(player, "CARD_MENU_DECK_CARD_2"); deck.Card3 = (CardType)GetLocalInt(player, "CARD_MENU_DECK_CARD_3"); deck.Card4 = (CardType)GetLocalInt(player, "CARD_MENU_DECK_CARD_4"); deck.Card5 = (CardType)GetLocalInt(player, "CARD_MENU_DECK_CARD_5"); dbPlayerTripleTriad.Decks[model.SelectedDeckId] = deck; DB.Set(playerId, dbPlayerTripleTriad); DeleteLocalInt(player, "CARD_MENU_CURRENT_MODE"); NavigationStack = model.NavigationStackBeforeDeckBuilding; ChangePage(DeckListPageId, false); }); }
/// <summary> /// Handles the deck list logic. /// </summary> /// <param name="page">The page to build</param> private void DeckListPageInit(DialogPage page) { var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayerTripleTriad = DB.Get <PlayerTripleTriad>(playerId); var model = GetDataModel <Model>(); page.Header = "You may have a maximum of 20 decks saved at a time. Decks must contain exactly five cards. \n\nPlease select a deck."; for (var deck = 1; deck <= 20; deck++) { var deckName = "[None]"; if (dbPlayerTripleTriad.Decks.ContainsKey(deck)) { deckName = dbPlayerTripleTriad.Decks[deck].Name; } var deckId = deck; // Copy the deck Id for use inside the delegate. page.AddResponse($"Deck #{deck}: {deckName}", () => { model.SelectedDeckId = deckId; LoadDeckOntoPC(deckId); SetLocalInt(player, "CARD_MENU_CURRENT_MODE", (int)Mode.DeckBuilder); ChangePage(DeckDetailsPageId); }); } }
/// <summary> /// Handles the card list logic. /// </summary> /// <param name="page">The page to build</param> private void ViewCardsPageInit(DialogPage page) { var model = GetDataModel <Model>(); var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayerTripleTriad = DB.Get <PlayerTripleTriad>(playerId) ?? new PlayerTripleTriad(); var availableCards = TripleTriad.GetAllCardsAtLevel(model.SelectedCardLevel); page.Header = $"{ColorToken.Green("Level: ")} {model.SelectedCardLevel}\n\n" + $"The following is the list of cards available at this level. Cards in {ColorToken.Green("GREEN")} have been acquired. Those in {ColorToken.Red("RED")} have not. Only one card per type can be collected.\n\n" + "Please select a card."; foreach (var(type, card) in availableCards) { if (!card.IsVisibleInMenu) { continue; } var option = dbPlayerTripleTriad.AvailableCards.ContainsKey(type) ? ColorToken.Green(card.Name) : ColorToken.Red(card.Name); page.AddResponse(option, () => { model.SelectedCardType = type; SetLocalInt(player, "CARD_MENU_SELECTED_CARD_ID", (int)model.SelectedCardType); ChangePage(ViewCardDetailsPageId); }); } }
private void SelectDeckPageInit(DialogPage page) { var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayerTripleTriad = DB.Get <PlayerTripleTriad>(playerId) ?? new PlayerTripleTriad(); var model = GetDataModel <Model>(); page.Header = "Please select a deck from the list below. You can create decks from the rest menu (press 'R').\n\n"; foreach (var(deckId, deck) in dbPlayerTripleTriad.Decks) { // Ensure the deck is valid. if (deck.Card1 != CardType.Invalid && deck.Card2 != CardType.Invalid && deck.Card3 != CardType.Invalid && deck.Card4 != CardType.Invalid && deck.Card5 != CardType.Invalid) { page.AddResponse($"Select Deck: {deck.Name}", () => { model.SelectedDeckId = deckId; dbPlayerTripleTriad.LastDeckId = deckId; DB.Set(playerId, dbPlayerTripleTriad); ClearNavigationStack(); ChangePage(MainPageId, false); }); } } }
/// <summary> /// Handles the "Purchase List Page" header and responses. /// </summary> /// <param name="page">The page we're building.</param> private void PurchaseHouseLayoutListPageInit(DialogPage page) { var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayer = DB.Get <Player>(playerId); var seedRank = dbPlayer.SeedProgress.Rank; var availableLayouts = Housing.GetActiveHouseTypes(); var model = GetDataModel <Model>(); page.Header = "You can purchase any of the following layouts. Please note that this list is restricted based on your current SeeD rank. Complete missions to raise your SeeD rank and unlock new layouts.\n\n" + ColorToken.Green("Your SeeD Rank: ") + seedRank; foreach (var layout in availableLayouts) { // Player's SeeD rank isn't high enough to purchase this layout. if (seedRank < layout.Value.RequiredSeedRank) { continue; } page.AddResponse(layout.Value.Name, () => { model.SelectedHouseType = layout.Key; ChangePage(PurchaseHouseLayoutDetailPageId); }); } }
private void MainPageInit(DialogPage page) { var player = GetPC(); page.Header = ColorToken.Green("Home Point") + "\n\n" + "You can set your home point to this location. If you should die, you will return to your last home point."; page.AddResponse("Set Home Point", () => { if (!GetIsPC(player) || GetIsDM(player)) { return; } var playerId = GetObjectUUID(player); var dbPlayer = DB.Get <Player>(playerId); var position = GetPosition(OBJECT_SELF); var area = GetArea(OBJECT_SELF); var areaResref = GetResRef(area); var orientation = GetFacing(OBJECT_SELF); dbPlayer.RespawnLocationX = position.X; dbPlayer.RespawnLocationY = position.Y; dbPlayer.RespawnLocationZ = position.Z; dbPlayer.RespawnAreaResref = areaResref; dbPlayer.RespawnLocationOrientation = orientation; FloatingTextStringOnCreature("Home point set!", player, false); EndConversation(); }); }
private void CategoryPageInit(DialogPage page) { void SelectCategory(PerkCategoryType category) { var model = GetDataModel <Model>(); model.SelectedCategory = category; ChangePage(PerkListPageId); } page.Header = "Please select a category."; var player = GetPC(); var categoriesAvailable = GetPerksAvailableToPC(player) .Select(s => s.Category) .Distinct(); foreach (var category in categoriesAvailable) { var categoryDetail = Perk.GetPerkCategoryDetails(category); page.AddResponse(categoryDetail.Name, () => SelectCategory(category)); } }
private void MainPageInit(DialogPage page) { Model model = GetDataModel <Model>(); var quest = Quest.GetQuestById(model.QuestId); void HandleRewardSelection(IQuestReward reward) { quest.Complete(GetPC(), GetPC(), reward); EndConversation(); } page.Header = "Please select a reward."; var player = GetPC(); string questId = GetLocalString(player, "QST_REWARD_SELECTION_QUEST_ID"); DeleteLocalString(player, "QST_REWARD_SELECTION_QUEST_ID"); var rewardItems = quest.GetRewards().Where(x => x.IsSelectable); model.QuestId = questId; foreach (var reward in rewardItems) { page.AddResponse(reward.MenuName, () => { HandleRewardSelection(reward); }); } }
private void MainPageInit(DialogPage page) { var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayer = DB.Get <Player>(playerId); var toggleAchievementNotificationText = dbPlayer.Settings.DisplayAchievementNotification ? "Disable Achievement Notification" : "Enable Achievement Notification"; page.Header = ColorToken.Green("Achievement Notifications: ") + (dbPlayer.Settings.DisplayAchievementNotification ? "ENABLED" : "DISABLED") + "\n" + "\nYou may adjust your personal character settings here."; page.AddResponse("Change Battle Theme", () => ChangePage(ChangeBattleThemeId)); page.AddResponse(toggleAchievementNotificationText, () => { dbPlayer.Settings.DisplayAchievementNotification = !dbPlayer.Settings.DisplayAchievementNotification; }); }
/// <summary> /// Handles the card selection logic for deck building. /// This differs from the card viewer in that cards show based on which cards the player owns. /// </summary> /// <param name="page">The page to build.</param> private void DeckCardSelectionListPageInit(DialogPage page) { var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayerTripleTriad = DB.Get <PlayerTripleTriad>(playerId); var model = GetDataModel <Model>(); var cardsAtLevel = TripleTriad.GetAllCardsAtLevel(model.SelectedCardLevel); page.Header = $"{ColorToken.Green("Level: ")} {model.SelectedCardLevel}\n\n" + "Please select cards to add to this deck."; if (model.CurrentCardNumber > 1) { page.AddResponse(ColorToken.Red("Remove Card"), RemoveTopMostCard); } foreach (var(cardType, card) in cardsAtLevel) { if (!card.IsVisibleInMenu) { continue; } // Only one of each card type can be added to decks. if (IsInActiveDeck(cardType)) { continue; } if (dbPlayerTripleTriad.AvailableCards.ContainsKey(cardType)) { page.AddResponse($"Add: {card.Name}", () => { SetLocalInt(player, $"CARD_MENU_DECK_CARD_{model.CurrentCardNumber}", (int)cardType); model.CurrentCardNumber++; // This was the last card. if (model.CurrentCardNumber > 5) { ChangePage(DeckCardSelectionConfirmDeckPageId); } }); } } }
/// <summary> /// Builds the Main Page. /// </summary> /// <param name="page">The page to build.</param> private void MainPageInit(DialogPage page) { var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayer = DB.Get <Player>(playerId); // Get all player skills and then sum them up by the rank. var totalSkillCount = dbPlayer.TotalSPAcquired; var playerName = GetName(player); string header = ColorToken.Green("Name: ") + playerName + "\n"; header += ColorToken.Green("Skill Points: ") + totalSkillCount + " / " + Skill.SkillCap + "\n"; header += ColorToken.Green("Unallocated SP: ") + dbPlayer.UnallocatedSP + "\n"; header += ColorToken.Green("Unallocated XP: ") + dbPlayer.UnallocatedXP + "\n"; page.Header = header; page.AddResponse("View Skills", () => SwitchConversation("ViewSkillsDialog")); page.AddResponse("View Perks", () => SwitchConversation("ViewPerksDialog")); page.AddResponse("View Achievements", () => SwitchConversation("ViewAchievementsDialog")); page.AddResponse("View Blueprints", () => SwitchConversation("ViewBlueprintsDialog")); page.AddResponse("Modify Item Appearance", () => SwitchConversation("ModifyItemAppearanceDialog")); page.AddResponse("Player Settings", () => SwitchConversation("PlayerSettingsDialog")); page.AddResponse("Open Trash Can (Destroy Items)", () => { EndConversation(); var location = GetLocation(player); var trashCan = CreateObject(ObjectType.Placeable, "trash_can", location); AssignCommand(player, () => ActionInteractObject(trashCan)); DelayCommand(0.2f, () => SetUseableFlag(trashCan, false)); }); }
private void SongDetailInit(DialogPage page) { var model = GetDataModel <Model>(); var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayer = DB.Get <Player>(playerId); var currentBattleThemeId = dbPlayer.Settings.BattleThemeId; var battleSongs = Music.GetBattleSongs(); var header = ColorToken.Green("Current Battle Theme: "); if (currentBattleThemeId == null) { header += "(Area determines theme)"; } else { var song = battleSongs[(int)currentBattleThemeId]; header += song.DisplayName; } page.Header = header + "\n\n" + ColorToken.Green("Selecting Theme: ") + battleSongs[model.SelectedBattleThemeId].DisplayName; page.AddResponse("Preview Song", () => { var area = GetArea(player); model.CurrentDayTimeTheme = MusicBackgroundGetDayTrack(area); model.CurrentNightTimeTheme = MusicBackgroundGetNightTrack(area); Core.NWNX.Player.MusicBackgroundChangeTimeToggle(player, model.SelectedBattleThemeId, false); Core.NWNX.Player.MusicBackgroundChangeTimeToggle(player, model.SelectedBattleThemeId, true); }); page.AddResponse("Select Song", () => { dbPlayer.Settings.BattleThemeId = model.SelectedBattleThemeId; DB.Set(playerId, dbPlayer); Core.NWNX.Player.MusicBattleChange(player, model.SelectedBattleThemeId); }); }
/// <summary> /// Handles the card selection level logic for deck building. /// This differs from the card viewer in that levels show based on which cards the player owns. /// </summary> /// <param name="page">The page to build.</param> private void DeckCardSelectionLevelsPageInit(DialogPage page) { var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayerTripleTriad = DB.Get <PlayerTripleTriad>(playerId); var model = GetDataModel <Model>(); var levels = new HashSet <int>(); page.Header = "Please select cards to add to this deck."; if (model.CurrentCardNumber > 1) { page.AddResponse(ColorToken.Red("Remove Card"), RemoveTopMostCard); } foreach (var(cardType, _) in dbPlayerTripleTriad.AvailableCards) { var card = TripleTriad.GetCardByType(cardType); if (!card.IsVisibleInMenu) { continue; } if (!levels.Contains(card.Level)) { levels.Add(card.Level); } } page.Header = $"{ColorToken.Green("Select card #")} {model.CurrentCardNumber}"; foreach (var level in levels) { page.AddResponse($"Level {level}", () => { model.SelectedCardLevel = level; ChangePage(DeckCardSelectionListPageId); }); } }
private void MainPageInit(DialogPage page) { var player = GetPC(); page.Header = $"What would you like to do?"; page.AddResponse("Exit", () => { var area = GetArea(OBJECT_SELF); Housing.JumpToOriginalLocation(player); DelayCommand(6.0f, () => Housing.AttemptCleanUpInstance(area)); }); }
/// <summary> /// Handles main page logic. /// </summary> /// <param name="page">The page to build</param> private void MainPageInit(DialogPage page) { var player = GetPC(); page.Header = ColorToken.Green("Triple Triad Menu"); page.AddResponse("View Cards", () => { SetLocalInt(player, "CARD_MENU_CURRENT_MODE", (int)Mode.CardViewer); ChangePage(ViewCardLevelsPageId); }); page.AddResponse("Manage Decks", () => { if (TripleTriad.DoesPlayerHavePendingGame(player)) { FloatingTextStringOnCreature("Decks cannot be managed while you have a game reservation pending. Cancel the reservation to manage your decks.", player, false); return; } ChangePage(DeckListPageId); }); }
/// <summary> /// Loads the main page header and response options. /// </summary> /// <param name="page">The dialog page to adjust.</param> private void MainPageInit(DialogPage page) { var player = GetPC(); var playerId = GetObjectUUID(player); var hasHouse = DB.Exists <PlayerHouse>(playerId); // Player currently owns a house. // Provide options to adjust existing house. if (hasHouse) { var house = DB.Get <PlayerHouse>(playerId); var detail = Housing.GetHouseTypeDetail(house.HouseType); page.Header = ColorToken.Green("Layout Type: ") + detail.Name + "\n" + ColorToken.Green("Furniture Limit: ") + house.Furnitures.Count + " / " + detail.FurnitureLimit + "\n\n" + "What would you like to do?"; page.AddResponse("Enter", () => { var instance = Housing.LoadPlayerHouse(playerId); var entrancePosition = Housing.GetEntrancePosition(house.HouseType); var location = Location(instance, entrancePosition, 0.0f); Housing.StoreOriginalLocation(player); AssignCommand(player, () => ActionJumpToLocation(location)); }); page.AddResponse("Sell Home", () => { ChangePage(SellHousePageId); }); } // Player doesn't own a house. // Provide options to buy one. else { PurchaseHouseLayoutListPageInit(page); } }
private void ChangeBattleThemeInit(DialogPage page) { var model = GetDataModel <Model>(); var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayer = DB.Get <Player>(playerId); var currentBattleThemeId = dbPlayer.Settings.BattleThemeId; var battleSongs = Music.GetBattleSongs(); var header = ColorToken.Green("Current Battle Theme: "); if (currentBattleThemeId == null) { header += "(Area determines theme)"; } else { var song = battleSongs[(int)currentBattleThemeId]; header += song.DisplayName; } page.Header = header; page.AddResponse(ColorToken.Green("Use Area Theme"), () => { dbPlayer.Settings.BattleThemeId = null; Core.NWNX.Player.MusicBattleChange(player, 0); DB.Set(playerId, dbPlayer); }); foreach (var song in battleSongs) { page.AddResponse(song.Value.DisplayName, () => { model.SelectedBattleThemeId = song.Key; ChangePage(SongDetailId); }); } }
/// <summary> /// Handles the deck name change logic. /// </summary> /// <param name="page">The page to build</param> private void ChangeDeckNamePageInit(DialogPage page) { var player = GetPC(); var playerId = GetObjectUUID(player); var dbPlayerTripleTriad = DB.Get <PlayerTripleTriad>(playerId); var model = GetDataModel <Model>(); var deck = dbPlayerTripleTriad.Decks.ContainsKey(model.SelectedDeckId) ? dbPlayerTripleTriad.Decks[model.SelectedDeckId] : new CardDeck(); var deckName = string.IsNullOrWhiteSpace(deck.Name) ? "[None]" : deck.Name; var selectedDeckName = GetLocalString(player, "CARD_MENU_DECK_NAME"); var newDeckName = selectedDeckName; if (string.IsNullOrWhiteSpace(newDeckName)) { newDeckName = ColorToken.Yellow("[NO CHANGE]"); } page.Header = $"{ColorToken.Green("Current Deck Name: ")} {deckName}\n" + $"{ColorToken.Green("New Deck Name: ")} {newDeckName}\n\n" + $"Please type the new name of your deck into the chat bar. Note that deck names may be no longer than {MaxDeckNameLength} characters. Use 'Refresh' to see the changes. Use 'Set Name' to confirm the change."; page.AddResponse(ColorToken.Green("Refresh"), () => { }); if (!string.IsNullOrWhiteSpace(selectedDeckName)) { page.AddResponse("Set Name", () => { deck.Name = selectedDeckName; DeleteLocalString(player, "CARD_MENU_DECK_NAME"); DB.Set(playerId, dbPlayerTripleTriad); }); } SetLocalBool(player, "CARD_MENU_LISTENING_FOR_NAME_CHANGE", true); }
private void MainPageInit(DialogPage page) { var model = GetDataModel <Model>(); var dbHouse = DB.Get <PlayerHouse>(model.OwnerUUID); var houseDetail = Housing.GetHouseTypeDetail(dbHouse.HouseType); var furnitureDetail = Housing.GetFurnitureDetail(model.FurnitureType); page.Header = ColorToken.Green("Furniture: ") + furnitureDetail.Name + "\n" + ColorToken.Green("Furniture Limit: ") + dbHouse.Furnitures.Count + " / " + houseDetail.FurnitureLimit + "\n\n" + "Please select an action to take."; // Furniture has been placed. Only give options to adjust positioning/rotation if (model.HasBeenPlaced) { page.AddResponse("Pick Up", PickUpFurniture); page.AddResponse("Move", () => ChangePage(MovePageId)); page.AddResponse("Rotate", () => ChangePage(RotatePageId)); } // Furniture hasn't been placed yet. else { page.AddResponse("Place", PlaceFurniture); } }
private void ViewShopsInit(DialogPage page) { page.Header = "Please select a shop."; var stores = PlayerMarket.GetAllActiveStores(); foreach (var(key, name) in stores) { page.AddResponse(name, () => { PlayerMarket.OpenPlayerStore(GetPC(), key); EndConversation(); }); } }
private void RecipeListPageInit(DialogPage page) { var model = GetDataModel <Model>(); page.Header = "Please select a recipe."; foreach (var(key, value) in Craft.GetRecipesBySkillAndCategory(model.SelectedSkill, model.SelectedCategory)) { page.AddResponse(value.Name, () => { model.SelectedRecipe = key; ChangePage(RecipePageId); }); } }
/// <summary> /// Handles the card level list logic. /// </summary> /// <param name="page">The page to build</param> private void ViewCardLevelsPageInit(DialogPage page) { var model = GetDataModel <Model>(); page.Header = "Please select a card level."; for (var level = 1; level <= 10; level++) { var levelSelection = level; // Copy the value so the following delegate uses the correct number. page.AddResponse($"Level {level}", () => { model.SelectedCardLevel = levelSelection; ChangePage(ViewCardsPageId); }); } }