Exemple #1
0
        private void MainPageResponses(int responseID)
        {
            NWPlayer player = GetPC();
            string   planet;
            int      price;
            string   destinationTag;

            switch (responseID)
            {
            case 1:     // Viscara
                planet         = "Viscara";
                price          = 100;
                destinationTag = "VISCARA_LANDING";
                break;

            case 2:     // Mon Cala
                planet         = "Mon Cala";
                price          = 200;
                destinationTag = "MON_CALA_LANDING";
                break;

            case 3:     // Hutlar
                planet         = "Hutlar";
                price          = 300;
                destinationTag = "HUTLAR_LANDING";
                break;

            case 4:     // Tatooine
                planet         = "Tatooine";
                price          = 400;
                destinationTag = "TATOOINE_LANDING";
                break;

            default: return;
            }

            string header = ColorTokenService.Green("Selected Destination: ") + planet + "\n";

            header += ColorTokenService.Green("Price: ") + price + "\n\n";
            header += "This trip is one-way and non-refundable. Are you sure you want to take this flight?";

            // Check if player has enough money
            if (player.Gold < price)
            {
                header += "\n\n" + ColorTokenService.Red("You do not have enough credits to purchase this flight!");
                SetResponseVisible("ConfirmPage", 1, false);
            }
            else
            {
                SetResponseVisible("ConfirmPage", 1, true);
            }

            // Store selected data for later use in the conversation.
            var model = new Model(price, destinationTag);

            SetDialogCustomData(model);

            SetPageHeader("ConfirmPage", header);
            ChangePage("ConfirmPage");
        }
Exemple #2
0
        private void ConfirmPageResponses(int responseID)
        {
            var player = GetPC();
            var model  = GetDialogCustomData <Model>();

            switch (responseID)
            {
            case 1:     // Confirm
                // Check gold again.
                if (player.Gold < model.Price)
                {
                    player.SendMessage(ColorTokenService.Red("You do not have enough credits to purchase this flight."));
                    return;
                }

                // Take the gold.
                _.TakeGoldFromCreature(model.Price, player, _.TRUE);

                // Get the location based on the waypoint tag.
                Location location = _.GetLocation(_.GetWaypointByTag(model.DestinationTag));

                // Transport player.
                player.AssignCommand(() =>
                {
                    _.ClearAllActions();
                    _.ActionJumpToLocation(location);
                });

                EndConversation();
                break;
            }
        }
Exemple #3
0
        private void LoadManageMarketListingDetailsPage()
        {
            var player   = GetPC();
            var model    = MarketService.GetPlayerMarketData(player);
            var category = DataService.MarketCategory.GetByID(model.ItemMarketCategoryID);

            // Build the header
            string header = ColorTokenService.Green("Galactic Trade Market - Manage Market Listing") + "\n\n";

            header += ColorTokenService.Green("Item: ") + model.ItemStackSize + "x " + model.ItemName + "\n";
            header += ColorTokenService.Green("Category: ") + category.Name + "\n";

            if (model.ItemRecommendedLevel > 0)
            {
                header += ColorTokenService.Green("Recommended Level: ") + model.ItemRecommendedLevel + "\n";
            }

            header += ColorTokenService.Green("Sell Price: ") + model.SellPrice + " credits\n";
            header += ColorTokenService.Green("Seller Note: ") + model.SellerNote + "\n\n";

            if (model.IsListingExpired)
            {
                header += ColorTokenService.Red("This listing has expired.");
            }
            else
            {
                DateTime now            = DateTime.UtcNow;
                var      delta          = model.ListingExpirationDate - now;
                string   expirationTime = TimeService.GetTimeLongIntervals(delta.Days, delta.Hours, delta.Minutes, delta.Seconds, false);
                header += ColorTokenService.Green("This listing expires in " + expirationTime + ".");
            }

            SetPageHeader("MarketListingDetailsPage", header);
        }
Exemple #4
0
        private void HandleGiveReport(NWPlayer player, int questID)
        {
            var pcStatus = DataService.PCQuestStatus.GetByPlayerAndQuestIDOrDefault(player.GlobalID, questID);

            if (pcStatus == null)
            {
                return;
            }
            var quest            = QuestService.GetQuestByID(questID);
            var state            = quest.GetState(pcStatus.QuestState);
            var hasItemObjective = state.GetObjectives().FirstOrDefault(x => x.GetType() == typeof(CollectItemObjective)) != null;

            // Quest has at least one "collect item" objective.
            if (hasItemObjective)
            {
                QuestService.RequestItemsFromPC(player, GetDialogTarget(), questID);
            }
            // All other quest types
            else if (quest.CanComplete(player))
            {
                quest.Complete(player, _.OBJECT_SELF, null);
                EndConversation();
            }
            // Missing a requirement.
            else
            {
                player.SendMessage(ColorTokenService.Red("One or more task is incomplete. Refer to your journal for more information."));
            }
        }
Exemple #5
0
        public Dice(


            )
        {
            GenericError = ColorTokenService.Red("Please enter /dice help for more information on how to use this command.");
        }
        private void HandleDisablePVPProtection()
        {
            Model dto = GetDialogCustomData <Model>();

            if (!PVPSanctuaryService.PlayerHasPVPSanctuary(GetPC()))
            {
                return;
            }

            if (dto.IsConfirmingDisableSanctuary)
            {
                PVPSanctuaryService.SetPlayerPVPSanctuaryOverride(GetPC(), true);
                dto.IsConfirmingDisableSanctuary = false;
                _.FloatingTextStringOnCreature(ColorTokenService.Red("PVP protection has been disabled. You may now attack and be attacked by other players."), GetPC().Object, _.FALSE);
                SetResponseText("MainPage", 1, "Disable PVP Protection");
            }
            else
            {
                dto.IsConfirmingDisableSanctuary = true;
                _.FloatingTextStringOnCreature(ColorTokenService.Red("WARNING: PVP protection prevents other players from attacking you. If you disable this, players will immediately be able to attack you anywhere. Click again to confirm."), GetPC().Object, _.FALSE);
                SetResponseText("MainPage", 1, "CONFIRM DISABLE PVP PROTECTION");
            }

            SetDialogCustomData(dto);

            ToggleDisablePVPProtectionOption();
        }
Exemple #7
0
        private void LoadConfirmSetModePage()
        {
            string header;
            var    model = GetDialogCustomData <Model>();

            switch (model.Mode)
            {
            case StructureModeType.None:
                header = "No mode will be set. This is probably an error. Inform an admin.";
                break;

            case StructureModeType.Residence:
                header = "Setting this building to a Residence enables you or another player to set it as a primary residence. This grants an overall XP bonus to that player based on the number of furniture structures placed inside of the building. Persistent storage structures may also be placed inside of a residence. Crafting structures may NOT be used inside of residences.";
                break;

            case StructureModeType.Workshop:
                header = "Setting this building to a Workshop enables you to place crafting devices and workbenches down. All workbenches inside the building receive a bonus based on the number of furniture structures placed inside of the building. Persistent storage structures may also be placed inside of a workshop. Players may NOT set a workshop as a primary residence.";
                break;

            case StructureModeType.Storefront:
                header = "Setting this building to a Storefront enables you to hire NPCs to sell your wares. Persistent storage structures cannot store items but they will increase the number of items you may sell at a time. The daily salary of your merchants will reduce based on the number of furniture structures placed inside of the building. Crafting structures may NOT be used inside storefronts. Players may NOT set a storefront as a primary residence.";
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            header += ColorTokenService.Red("\n\nWARNING:\n\n");
            header += GetWarning();

            SetPageHeader("ConfirmSetMode", header);
        }
Exemple #8
0
        public void LoadMainMenu()
        {
            ClearPageResponses("MainPage");

            string header = ColorTokenService.Green("HoloCom Menu\n\n");

            SetPageHeader("MainPage", header);

            NWPlayer user = GetPC();

            AddResponseToPage("MainPage", "End current call with " + HoloComService.GetTargetForActiveCall(user).Name, HoloComService.IsInCall(user), HoloComService.GetTargetForActiveCall(user));
            AddResponseToPage("MainPage", "Answer incoming call from " + HoloComService.GetCallSender(user).Name, HoloComService.IsCallReceiver(user) && !HoloComService.IsInCall(user), HoloComService.GetCallSender(user));
            AddResponseToPage("MainPage", "Decline incoming call from " + HoloComService.GetCallSender(user).Name, HoloComService.IsCallReceiver(user) && !HoloComService.IsInCall(user), HoloComService.GetCallSender(user));

            if (HoloComService.IsCallReceiver(user) || HoloComService.IsInCall(user) || HoloComService.IsCallSender(user))
            {
                return;
            }

            foreach (var player in NWModule.Get().Players)
            {
                if (player == user || !player.IsPlayer)
                {
                    continue;
                }
                string message = "Call " + player.Name;
                if (HoloComService.IsInCall(player))
                {
                    message += ColorTokenService.Red(" (LINE BUSY)");
                }
                AddResponseToPage("MainPage", message, true, player);
            }
        }
Exemple #9
0
        private void LoadManageMarketListingsPage()
        {
            string header = ColorTokenService.Green("Galactic Trade Market - Manage Market Listings") + "\n\n";

            header += "The following is a list of items you are currently selling. Pick one to edit or remove the listing.";
            SetPageHeader("MarketListingsPage", header);

            var player   = GetPC();
            var regionID = MarketService.GetMarketRegionID(NWGameObject.OBJECT_SELF);
            var listings = DataService.PCMarketListing.GetAllBySellerPlayerID(player.GlobalID)
                           .Where(x => x.DateSold == null &&
                                  x.DateRemoved == null &&
                                  x.MarketRegionID == regionID);

            ClearPageResponses("MarketListingsPage");
            foreach (var listing in listings)
            {
                string itemName = BuildItemName(listing);

                // Display an EXPIRED tag on the item name if the listing has expired.
                if (listing.DateExpires < DateTime.UtcNow)
                {
                    itemName += ColorTokenService.Red(" [EXPIRED]");
                }

                AddResponseToPage("MarketListingsPage", itemName, true, listing.ID);
            }
        }
Exemple #10
0
        private void HandleGiveReport(NWPlayer player, int questID)
        {
            var pcStatus = DataService.PCQuestStatus.GetByPlayerAndQuestIDOrDefault(player.GlobalID, questID);

            if (pcStatus == null)
            {
                return;
            }
            var state = DataService.QuestState.GetByID(pcStatus.CurrentQuestStateID);

            // Quest is calling for collecting items. Run that method.
            if (state.QuestTypeID == (int)QuestType.CollectItems)
            {
                QuestService.RequestItemsFromPC(player, GetDialogTarget(), questID);
            }
            // All other quest types
            else if (QuestService.CanPlayerCompleteQuest(player, questID))
            {
                QuestService.CompleteQuest(player, GetDialogTarget(), questID, null);
                EndConversation();
            }
            // Missing a requirement.
            else
            {
                player.SendMessage(ColorTokenService.Red("One or more task is incomplete. Refer to your journal for more information."));
            }
        }
Exemple #11
0
        private void BuildPlayerDetailsPage(Player player)
        {
            ClearPageResponses("PlayerDetailsPage");
            var data       = BaseService.GetPlayerTempData(GetPC());
            var permission = DataService.PCBaseStructurePermission.GetPlayerPrivatePermissionOrDefault(player.ID, data.StructureID);

            // Intentionally excluded permissions: CanAdjustPermissions, CanCancelLease
            bool canPlaceEditStructures      = permission?.CanPlaceEditStructures ?? false;
            bool canAccessStructureInventory = permission?.CanAccessStructureInventory ?? false;
            bool canEnterBuilding            = permission?.CanEnterBuilding ?? false;
            bool canAdjustPermissions        = permission?.CanAdjustPermissions ?? false;
            bool canRetrieveStructures       = permission?.CanRetrieveStructures ?? false;
            bool canRenameStructures         = permission?.CanRenameStructures ?? false;
            bool canEditPrimaryResidence     = permission?.CanEditPrimaryResidence ?? false;
            bool canRemovePrimaryResidence   = permission?.CanRemovePrimaryResidence ?? false;
            bool canChangeStructureMode      = permission?.CanChangeStructureMode ?? false;
            bool canAdjustPublicPermissions  = permission?.CanAdjustPublicPermissions ?? false;
            bool canFlyStarship = permission?.CanFlyStarship ?? false;

            bool isStarship = GetPC().Area.GetLocalInt("BUILDING_TYPE") == (int)Enumeration.BuildingType.Starship;

            string header = ColorTokenService.Green("Name: ") + player.CharacterName + "\n\n";

            header += ColorTokenService.Green("Permissions:\n\n");
            header += "Can Place/Edit Structures: " + (canPlaceEditStructures ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Access Structure Inventory: " + (canAccessStructureInventory ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Enter Building: " + (canEnterBuilding ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Adjust Permissions: " + (canAdjustPermissions ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Retrieve Structures: " + (canRetrieveStructures ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Rename Structures: " + (canRenameStructures ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Edit Primary Residence: " + (canEditPrimaryResidence ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Remove Primary Residence: " + (canRemovePrimaryResidence ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Change Structure Mode: " + (canChangeStructureMode ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Adjust PUBLIC Permissions: " + (canAdjustPublicPermissions ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";

            if (isStarship)
            {
                header += "Can Fly Starship: " + (canFlyStarship ? ColorTokenService.Green("YES") :ColorTokenService.Red("NO")) + "\n";
            }

            SetPageHeader("PlayerDetailsPage", header);

            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Place/Edit Structures", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Access Structure Inventory", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Enter Building", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Adjust Permissions", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Retrieve Structures", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Rename Structures", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Edit Primary Residence", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Remove Primary Residence", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Change Structure Mode", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Adjust PUBLIC Permissions", true, player);
            AddResponseToPage("PlayerDetailsPage", ColorTokenService.Red("WARNING") + ": Delete Player Permissions", true, player);
            // Add new non-conditional responses here to avoid confusing the response handling logic.
            if (isStarship)
            {
                AddResponseToPage("PlayerDetailsPage", "Toggle: Can Fly Starship", true, player);
            }
        }
Exemple #12
0
 public string ValidateArguments(NWPlayer user, params string[] args)
 {
     if (args.Length <= 0)
     {
         return(ColorTokenService.Red("Please specify a quantity. Example: /" + nameof(SpawnGold) + " 34"));
     }
     return(string.Empty);
 }
Exemple #13
0
        public string ValidateArguments(NWPlayer user, params string[] args)
        {
            if (args.Length <= 0)
            {
                return(ColorTokenService.Red("Please specify a resref and optionally a quantity. Example: /" + nameof(SpawnItem) + " my_resref 20"));
            }

            return(string.Empty);
        }
Exemple #14
0
        public string ValidateArguments(NWPlayer user, params string[] args)
        {
            if (args.Length < 1)
            {
                return(ColorTokenService.Red("Please enter /language help for more information on how to use this command."));
            }

            return(string.Empty);
        }
        private void SalvagePageResponses(int responseID)
        {
            var player = GetPC();
            var model  = CraftService.GetPlayerCraftingData(player);

            switch (responseID)
            {
            case 1:     // Reassemble Component(s)

                NWItem fuel = _.GetItemPossessedBy(player, "ass_power");
                // Look for reassembly fuel in the player's inventory.
                if (!fuel.IsValid)
                {
                    player.SendMessage(ColorTokenService.Red("You must have a 'Reassembly Fuel Cell' in your inventory in order to start this process."));
                    return;
                }

                if (model.IsConfirmingReassemble)
                {
                    // Calculate delay, fire off delayed event, and show timing bar.
                    float delay = CraftService.CalculateCraftingDelay(player, (int)SkillType.Harvesting);
                    NWNXPlayer.StartGuiTimingBar(player, delay, string.Empty);
                    var @event = new OnReassembleComplete(player, model.SerializedSalvageItem, model.SalvageComponentTypeID);
                    player.DelayEvent(delay, @event);

                    // Make the player play an animation.
                    player.AssignCommand(() =>
                    {
                        _.ClearAllActions();
                        _.ActionPlayAnimation(ANIMATION_LOOPING_GET_MID, 1.0f, delay);
                    });

                    // Show sparks halfway through the process.
                    _.DelayCommand(1.0f * (delay / 2.0f), () =>
                    {
                        _.ApplyEffectToObject(DURATION_TYPE_INSTANT, _.EffectVisualEffect(VFX_COM_BLOOD_SPARK_MEDIUM), NWGameObject.OBJECT_SELF);
                    });

                    // Immobilize the player while crafting.
                    Effect immobilize = _.EffectCutsceneImmobilize();
                    immobilize = _.TagEffect(immobilize, "CRAFTING_IMMOBILIZATION");
                    _.ApplyEffectToObject(DURATION_TYPE_PERMANENT, immobilize, player);

                    // Clear the temporary crafting data and end this conversation.
                    model.SerializedSalvageItem = string.Empty;
                    EndConversation();
                }
                else
                {
                    model.IsConfirmingReassemble = true;
                    SetResponseText("SalvagePage", 1, "CONFIRM REASSEMBLE COMPONENT(S)");
                }
                break;
            }
        }
Exemple #16
0
        public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args)
        {
            string     command   = args[0].ToLower();
            RacialType race      = (RacialType)user.RacialType;
            var        languages = LanguageService.Languages;

            if (command == "help")
            {
                List <string> commands = new List <string>
                {
                    "help: Displays this help text."
                };

                foreach (var language in languages)
                {
                    var chatText = language.ChatNames.ElementAt(0);
                    int count    = language.ChatNames.Count();

                    for (int x = 1; x < count; x++)
                    {
                        chatText += ", " + language.ChatNames.ElementAt(x);
                    }

                    commands.Add($"{chatText}: Sets the active language to {language.ProperName}.");
                }

                user.SendMessage(commands.Aggregate((a, b) => a + '\n' + b));
                return;
            }

            // Wookiees cannot speak any language besides Shyriiwook.
            if (race == RacialType.Wookiee &&
                command != SkillType.Shyriiwook.ToString().ToLower())
            {
                LanguageService.SetActiveLanguage(user, SkillType.Shyriiwook);
                user.SendMessage(ColorTokenService.Red("Wookiees can only speak Shyriiwook."));
                return;
            }


            foreach (var language in LanguageService.Languages)
            {
                if (language.ChatNames.Contains(command))
                {
                    LanguageService.SetActiveLanguage(user, language.Skill);
                    user.SendMessage($"Set active language to {language.ProperName}.");
                    return;
                }
            }

            user.SendMessage(ColorTokenService.Red($"Unknown language {command}."));
        }
Exemple #17
0
        private void BuildPlayerDetailsPage(Player player)
        {
            ClearPageResponses("PlayerDetailsPage");
            var data       = BaseService.GetPlayerTempData(GetPC());
            var permission = DataService.PCBasePermission.GetPlayerPrivatePermissionOrDefault(player.ID, data.PCBaseID);

            // Intentionally excluded permissions: CanAdjustPermissions, CanCancelLease
            bool canPlaceEditStructures      = permission?.CanPlaceEditStructures ?? false;
            bool canAccessStructureInventory = permission?.CanAccessStructureInventory ?? false;
            bool canManageBaseFuel           = permission?.CanManageBaseFuel ?? false;
            bool canExtendLease            = permission?.CanExtendLease ?? false;
            bool canEnterBuildings         = permission?.CanEnterBuildings ?? false;
            bool canRetrieveStructures     = permission?.CanRetrieveStructures ?? false;
            bool canRenameStructures       = permission?.CanRenameStructures ?? false;
            bool canEditPrimaryResidence   = permission?.CanEditPrimaryResidence ?? false;
            bool canRemovePrimaryResidence = permission?.CanRemovePrimaryResidence ?? false;
            bool canChangeStructureMode    = permission?.CanChangeStructureMode ?? false;
            bool canDockShip = permission?.CanDockStarship ?? false;
            bool canAdjustPublicPermissions = permission?.CanAdjustPublicPermissions ?? false;

            string header = ColorTokenService.Green("Name: ") + player.CharacterName + "\n\n";

            header += ColorTokenService.Green("Permissions:\n\n");
            header += "Can Place/Edit Structures: " + (canPlaceEditStructures ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Access Structure Inventory: " + (canAccessStructureInventory ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Manage Base Fuel: " + (canManageBaseFuel ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Extend Lease: " + (canExtendLease ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Enter Buildings: " + (canEnterBuildings ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Retrieve Structures: " + (canRetrieveStructures ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Rename Structures: " + (canRenameStructures ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Edit Primary Residence: " + (canEditPrimaryResidence ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Remove Primary Residence: " + (canRemovePrimaryResidence ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Change Structure Mode: " + (canChangeStructureMode ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Dock Starships: " + (canDockShip ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";
            header += "Can Adjust PUBLIC Permissions: " + (canAdjustPublicPermissions ? ColorTokenService.Green("YES") : ColorTokenService.Red("NO")) + "\n";

            SetPageHeader("PlayerDetailsPage", header);

            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Place/Edit Structures", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Access Structure Inventory", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Manage Base Fuel", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Extend Lease", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Enter Buildings", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Retrieve Structures", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Rename Structures", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Edit Primary Residence", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Change Structure Mode", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Dock Starships", true, player);
            AddResponseToPage("PlayerDetailsPage", "Toggle: Can Adjust PUBLIC Permissions", true, player);
            AddResponseToPage("PlayerDetailsPage", ColorTokenService.Red("WARNING") + ": Delete Player Permissions", true, player);
        }
Exemple #18
0
        private void HandleAddItem()
        {
            NWPlayer    player = _.GetLastDisturbed();
            NWItem      item   = _.GetInventoryDisturbItem();
            NWPlaceable device = Object.OBJECT_SELF;
            var         model  = MarketService.GetPlayerMarketData(player);

            // Serializing containers can be tricky so for the time being we'll leave them disabled.
            if (_.GetHasInventory(item) == TRUE)
            {
                ItemService.ReturnItem(player, item);
                player.SendMessage(ColorTokenService.Red("Containers cannot be sold on the market."));
                return;
            }

            // If selling an item, serialize it and store its information in the player's temporary data.
            if (model.IsSellingItem)
            {
                // Check the item's category. If one cannot be determined, the player cannot put it on the market.
                int marketCategoryID = MarketService.DetermineMarketCategory(item);
                if (marketCategoryID <= 0)
                {
                    ItemService.ReturnItem(player, item);
                    player.FloatingText("This item cannot be placed on the market.");
                    return;
                }

                model.ItemID               = item.GlobalID;
                model.ItemName             = item.Name;
                model.ItemRecommendedLevel = item.RecommendedLevel;
                model.ItemStackSize        = item.StackSize;
                model.ItemTag              = item.Tag;
                model.ItemResref           = item.Resref;
                model.ItemMarketCategoryID = marketCategoryID;
                model.ItemObject           = SerializationService.Serialize(item);
                model.SellPrice            = 0;
                model.LengthDays           = 7;

                item.Destroy();

                device.DestroyAllInventoryItems();
                device.IsLocked = false;
                model.IsReturningFromItemPicking = true;
                model.IsAccessingInventory       = false;
                DialogService.StartConversation(player, device, "MarketTerminal");
            }
            else
            {
                ItemService.ReturnItem(player, item);
            }
        }
Exemple #19
0
        private void ManageMarketListingDetailsResponses(int responseID)
        {
            var player = GetPC();
            var model  = MarketService.GetPlayerMarketData(player);

            switch (responseID)
            {
            case 1:     // Refresh
                LoadManageMarketListingDetailsPage();
                break;

            case 2:     // Remove Listing

                var listing = DataService.PCMarketListing.GetByID(model.ManageListingID);

                // Start by verifying the item is still in a valid state.
                if (listing.DateRemoved != null ||
                    listing.DateSold != null)
                {
                    player.FloatingText("That item is no longer available. It may have been sold or removed from the listing.");
                    ClearModelData();
                    LoadManageMarketListingsPage();
                    NavigationStack.Pop();     // Remove the duplicate "Back" page, since we're redirecting already.
                    ChangePage("MarketListingsPage", false);
                    return;
                }

                if (model.IsConfirming)
                {
                    SetResponseText("MarketListingDetailsPage", 2, ColorTokenService.Red("Remove Listing"));
                    model.IsConfirming = false;

                    SerializationService.DeserializeItem(listing.ItemObject, player);
                    listing.DateRemoved = DateTime.UtcNow;
                    DataService.SubmitDataChange(listing, DatabaseActionType.Update);

                    ClearModelData();
                    LoadManageMarketListingsPage();
                    NavigationStack.Pop();     // Remove the duplicate "Back" page, since we're redirecting already.
                    ChangePage("MarketListingsPage", false);
                }
                else
                {
                    SetResponseText("MarketListingDetailsPage", 2, ColorTokenService.Red("CONFIRM REMOVE LISTING"));
                    model.IsConfirming = true;
                }

                break;
            }
        }
        private void LoadSkillPage()
        {
            var model   = GetDialogCustomData <Model>();
            var skill   = DataService.Get <Skill>(model.SkillID);
            var pcSkill = DataService.Single <PCSkill>(x => x.PlayerID == GetPC().GlobalID&& x.SkillID == model.SkillID);
            var pool    = DataService.Single <PCSkillPool>(x => x.PlayerID == GetPC().GlobalID&& x.SkillCategoryID == model.SkillCategoryID);

            // Build the page header
            var header = ColorTokenService.Green("Skill: ") + skill.Name + "\n";

            header += ColorTokenService.Green("Current Rank: ") + pcSkill.Rank + "\n";
            header += ColorTokenService.Green("Ranks to Distribute: ") + pool.Levels + "\n\n";

            if (pcSkill.Rank >= MaxRankForDistribution || pcSkill.Rank >= skill.MaxRank)
            {
                header += ColorTokenService.Red("You cannot distribute any more ranks into this skill.");
            }
            else
            {
                header += ColorTokenService.Green("You may distribute a skill rank into this skill.");
            }

            SetPageHeader("SkillPage", header);

            // Reset the option text.
            SetResponseText("SkillPage", 1, "Distribute 1 Rank");
            SetResponseText("SkillPage", 2, "Distribute 5 Ranks");
            SetResponseText("SkillPage", 3, "Distribute 10 Ranks");

            // Show/hide options based on whether distribution is allowed.
            SetResponseVisible("SkillPage", 1, CanDistribute(1));
            SetResponseVisible("SkillPage", 2, CanDistribute(5));
            SetResponseVisible("SkillPage", 3, CanDistribute(10));

            // If confirming, capitalize the message to alert the player.
            if (model.DistributionType == 1)
            {
                SetResponseText("SkillPage", 1, "CONFIRM DISTRIBUTE 1 RANK");
            }
            else if (model.DistributionType == 2)
            {
                SetResponseText("SkillPage", 2, "CONFIRM DISTRIBUTE 5 RANKS");
            }
            else if (model.DistributionType == 3)
            {
                SetResponseText("SkillPage", 3, "CONFIRM DISTRIBUTE 10 RANKS");
            }
        }
Exemple #21
0
        private void ShowSaveWeaponOptions()
        {
            PCWeapon entity = GetPlayerWeapons(GetPC()) ?? new PCWeapon();

            ClearPageResponses("SaveWeaponPage");

            string responseText = entity.Weapon1 == null?ColorTokenService.Red("Save in Slot 1") : ColorTokenService.Green("Save in Slot 1");

            AddResponseToPage("SaveWeaponPage", responseText);

            responseText = entity.Weapon2 == null?ColorTokenService.Red("Save in Slot 2") : ColorTokenService.Green("Save in Slot 2");

            AddResponseToPage("SaveWeaponPage", responseText);

            responseText = entity.Weapon3 == null?ColorTokenService.Red("Save in Slot 3") : ColorTokenService.Green("Save in Slot 3");

            AddResponseToPage("SaveWeaponPage", responseText);

            responseText = entity.Weapon4 == null?ColorTokenService.Red("Save in Slot 4") : ColorTokenService.Green("Save in Slot 4");

            AddResponseToPage("SaveWeaponPage", responseText);

            responseText = entity.Weapon5 == null?ColorTokenService.Red("Save in Slot 5") : ColorTokenService.Green("Save in Slot 5");

            AddResponseToPage("SaveWeaponPage", responseText);

            responseText = entity.Weapon6 == null?ColorTokenService.Red("Save in Slot 6") : ColorTokenService.Green("Save in Slot 6");

            AddResponseToPage("SaveWeaponPage", responseText);

            responseText = entity.Weapon7 == null?ColorTokenService.Red("Save in Slot 7") : ColorTokenService.Green("Save in Slot 7");

            AddResponseToPage("SaveWeaponPage", responseText);

            responseText = entity.Weapon8 == null?ColorTokenService.Red("Save in Slot 8") : ColorTokenService.Green("Save in Slot 8");

            AddResponseToPage("SaveWeaponPage", responseText);

            responseText = entity.Weapon9 == null?ColorTokenService.Red("Save in Slot 9") : ColorTokenService.Green("Save in Slot 9");

            AddResponseToPage("SaveWeaponPage", responseText);

            responseText = entity.Weapon10 == null?ColorTokenService.Red("Save in Slot 10") : ColorTokenService.Green("Save in Slot 10");

            AddResponseToPage("SaveWeaponPage", responseText);
        }
Exemple #22
0
        private void ShowSaveOutfitOptions()
        {
            PCOutfit entity = GetPlayerOutfits(GetPC()) ?? new PCOutfit();

            ClearPageResponses("SaveOutfitPage");

            string responseText = entity.Outfit1 == null?ColorTokenService.Red("Save in Slot 1") : ColorTokenService.Green("Save in Slot 1");

            AddResponseToPage("SaveOutfitPage", responseText);

            responseText = entity.Outfit2 == null?ColorTokenService.Red("Save in Slot 2") : ColorTokenService.Green("Save in Slot 2");

            AddResponseToPage("SaveOutfitPage", responseText);

            responseText = entity.Outfit3 == null?ColorTokenService.Red("Save in Slot 3") : ColorTokenService.Green("Save in Slot 3");

            AddResponseToPage("SaveOutfitPage", responseText);

            responseText = entity.Outfit4 == null?ColorTokenService.Red("Save in Slot 4") : ColorTokenService.Green("Save in Slot 4");

            AddResponseToPage("SaveOutfitPage", responseText);

            responseText = entity.Outfit5 == null?ColorTokenService.Red("Save in Slot 5") : ColorTokenService.Green("Save in Slot 5");

            AddResponseToPage("SaveOutfitPage", responseText);

            responseText = entity.Outfit6 == null?ColorTokenService.Red("Save in Slot 6") : ColorTokenService.Green("Save in Slot 6");

            AddResponseToPage("SaveOutfitPage", responseText);

            responseText = entity.Outfit7 == null?ColorTokenService.Red("Save in Slot 7") : ColorTokenService.Green("Save in Slot 7");

            AddResponseToPage("SaveOutfitPage", responseText);

            responseText = entity.Outfit8 == null?ColorTokenService.Red("Save in Slot 8") : ColorTokenService.Green("Save in Slot 8");

            AddResponseToPage("SaveOutfitPage", responseText);

            responseText = entity.Outfit9 == null?ColorTokenService.Red("Save in Slot 9") : ColorTokenService.Green("Save in Slot 9");

            AddResponseToPage("SaveOutfitPage", responseText);

            responseText = entity.Outfit10 == null?ColorTokenService.Red("Save in Slot 10") : ColorTokenService.Green("Save in Slot 10");

            AddResponseToPage("SaveOutfitPage", responseText);
        }
        private string GetChanceColor(int chance)
        {
            string message = "-" + chance + "%-";

            if (chance <= 50)
            {
                return(ColorTokenService.Red(message));
            }
            else if (chance <= 80)
            {
                return(ColorTokenService.Yellow(message));
            }
            else
            {
                return(ColorTokenService.Green(message));
            }
        }
Exemple #24
0
        public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args)
        {
            var    staff   = DataService.AuthorizedDM.GetAll();
            string message = string.Empty;

            foreach (var member in staff)
            {
                string role   = member.DMRole == 1 ? "DM" : "Admin";
                string active = member.IsActive ?
                                ColorTokenService.Green(" [ACTIVE]") :
                                ColorTokenService.Red(" [INACTIVE]");

                message += member.ID + ": " + member.Name + " (" + member.CDKey + ") / " + role + active + "\n";
            }

            user.SendMessage(message);
        }
Exemple #25
0
        public string ValidateArguments(NWPlayer user, params string[] args)
        {
            if (args.Length < 1)
            {
                return(ColorTokenService.Red("Enter the ID from visualeffects.2da"));
            }

            try
            {
                int result = Int32.Parse(args[0]);
            }
            catch (FormatException)
            {
                return(ColorTokenService.Red("Enter the ID from visualeffects.2da"));
            }

            return(string.Empty);
        }
Exemple #26
0
        public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args)
        {
            var player = DataService.Player.GetByID(user.GlobalID);

            player.DisplayHolonet = !player.DisplayHolonet;
            user.SetLocalInt("DISPLAY_HOLONET", player.DisplayHolonet ? 1 : 0);

            DataService.SubmitDataChange(player, DatabaseActionType.Update);

            if (player.DisplayHolonet)
            {
                user.SendMessage("Holonet chat: " + ColorTokenService.Green("ENABLED"));
            }
            else
            {
                user.SendMessage("Holonet chat: " + ColorTokenService.Red("DISABLED"));
            }
        }
Exemple #27
0
        public override void Back(NWPlayer player, string beforeMovePage, string afterMovePage)
        {
            var model = MarketService.GetPlayerMarketData(player);

            // Leaving the Item Details page.
            if (beforeMovePage == "ItemDetailsPage")
            {
                model.IsConfirming = false;
                SetResponseText("ItemDetailsPage", 2, "Buy Item");
            }
            // Leaving the Sell Item page.
            else if (beforeMovePage == "SellItemPage")
            {
                ReturnSellingItem();
            }
            // Leaving the Market Listing Details page.
            else if (beforeMovePage == "MarketListingDetailsPage")
            {
                ClearModelData();
                SetResponseText("MarketListingDetailsPage", 2, ColorTokenService.Red("Remove Listing"));
            }
            // Returning to the Sell Item page.
            else if (afterMovePage == "SellItemPage")
            {
                LoadSellItemPage();
            }
            // Returning to the Browse By Category page
            else if (afterMovePage == "BrowseByCategoryPage")
            {
                LoadBrowseByCategoryPage();
            }
            // Returning to the Browse By Seller page
            else if (afterMovePage == "BrowseBySellerPage")
            {
                LoadBrowseBySellerPage();
            }
            // Returning to the Manage Market Listings page
            else if (afterMovePage == "MarketListingsPage")
            {
                LoadManageMarketListingsPage();
            }
        }
Exemple #28
0
        public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args)
        {
            string         command = args[0].ToLower();
            CustomRaceType race    = (CustomRaceType)user.RacialType;

            if (command == "help")
            {
                List <string> commands = new List <string>
                {
                    "help: Displays this help text."
                };

                foreach (SkillType language in LanguageService.GetLanguages())
                {
                    commands.Add($"{language.ToString()}: Sets the active language to {language.ToString()}.");
                }

                user.SendMessage(commands.Aggregate((a, b) => a + '\n' + b));
                return;
            }

            // Wookiees cannot speak any language besides Shyriiwook.
            if (race == CustomRaceType.Wookiee &&
                command != SkillType.Shyriiwook.ToString().ToLower())
            {
                LanguageService.SetActiveLanguage(user, SkillType.Shyriiwook);
                user.SendMessage(ColorTokenService.Red("Wookiees can only speak Shyriiwook."));
                return;
            }

            foreach (SkillType language in LanguageService.GetLanguages())
            {
                if (language.ToString().ToLower() == command)
                {
                    LanguageService.SetActiveLanguage(user, language);
                    user.SendMessage($"Set active language to {language.ToString()}.");
                    return;
                }
            }

            user.SendMessage(ColorTokenService.Red($"Unknown language {command}."));
        }
Exemple #29
0
        /// <summary>
        /// Spawns an item by resref in the user's inventory.
        /// </summary>
        /// <param name="user"></param>
        /// <param name="target"></param>
        /// <param name="targetLocation"></param>
        /// <param name="args"></param>
        public void DoAction(NWPlayer user, NWObject target, NWLocation targetLocation, params string[] args)
        {
            string resref   = args[0];
            int    quantity = 1;

            if (args.Length > 1)
            {
                if (!int.TryParse(args[1], out quantity))
                {
                    return;
                }
            }

            NWItem item = (_.CreateItemOnObject(resref, user.Object, quantity));

            if (!item.IsValid)
            {
                user.SendMessage(ColorTokenService.Red("Item not found! Did you enter the correct ResRef?"));
                return;
            }

            item.IsIdentified = true;
        }
Exemple #30
0
        private string GetColorString(int colorID)
        {
            string colorText;

            switch (colorID)
            {
            case 1:     // Blue
                colorText = ColorTokenService.Blue("BLUE");
                break;

            case 2:     // Green
                colorText = ColorTokenService.Green("GREEN");
                break;

            case 3:     // Red
                colorText = ColorTokenService.Red("RED");
                break;

            default: return(string.Empty);
            }

            return(colorText);
        }