Greasy Fork

Greasy Fork is available in English.

Popmundo Fixed Itinerary Booker

Sets the tour's starting point from the itinerary and prevents booking the same club in the same week. Includes selector fixes, a simplified settings form, a stop button, and complete storage cleanup. Now with dynamic start/end dates.

当前为 2025-09-03 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

作者
thebestone
评分
0 0 0
版本
4.9
创建于
2025-09-03
更新于
2025-09-03
大小
29.5 KB
许可证
暂无
适用于

This Tampermonkey script automates the process of booking a concert tour in the online game Popmundo. It operates from the "Book Show" page, following a predefined itinerary and user-configurable rules to find and book suitable venues.


📜 Description & Key Features

This script is designed to streamline the tedious task of scheduling a long tour. It intelligently calculates dates, travel times, and available show slots to book a series of concerts automatically.

  • ⚙️ Customizable Settings: Before starting, a user-friendly form appears, allowing you to set the tour's start city, start/end dates, preferred show times, and criteria for venues, such as minimum/maximum price and whether they must have a 5-star rating.
  • 🗺️ Fixed Itinerary: The script follows a long, predefined tour route (TOUR_ITINERARY) with specified travel times between cities. You can start the tour from any city in this list.
  • 🧠 Smart Scheduling: It calculates the artist's arrival time in each new city and finds the next available show slot according to your settings. It's built to avoid booking two shows on the same day in the same city if you enable the option.
  • 🚫 Prevents Double Booking: The script keeps track of clubs you've booked and prevents booking the same venue again within the same game week (Monday to Sunday).
  • 🛑 Failsafe Stop Button: A "Stop Booker" button is always visible, allowing you to halt the script at any time. This will also clear all stored tour data from your browser.
  • 🔄 Resilient Operation: The script saves its progress (localStorage) and settings (sessionStorage), allowing it to automatically resume its task even after the page reloads, which is necessary when changing cities in the game.

🚀 How to Use

Here’s how to get the script up and running.

1. Prerequisites

You must have a browser extension for managing userscripts. The most common ones are:

  • Tampermonkey (Recommended for Chrome, Firefox, Edge, Safari)
  • Greasemonkey (For Firefox)
  • Violentmonkey (For various browsers)

2. Installation

  1. Open your userscript manager's dashboard (e.g., the Tampermonkey extension icon).
  2. Create a new script by clicking the Add a new script or + tab.
  3. Delete any default code that appears in the editor.
  4. Copy the entire script you provided and paste it into the editor.
  5. Save the script by going to File > Save. The script will automatically activate when you visit a Popmundo page.

3. Execution

  1. Log in to Popmundo.
  2. Navigate to your artist's page and go to the page for booking a show. The script is designed to run on URLs like https://*.popmundo.com/World/Popmundo.aspx/Artist/BookShow/*.
  3. The Tour Booker Settings form will appear as an overlay. Adjust the settings as desired and click Save and Start.
  4. The script will take over, automatically filling in forms, searching for clubs, and booking shows according to your plan.
  5. You can monitor its progress in the browser's developer console (usually opened with F12).

4. Stopping the Script

If you need to stop the process, simply click the red Stop Booker button at the bottom-right of the screen. The script will halt and clean up all its stored data.


💻 Code Breakdown

This section explains the core components of the script's logic.

Configuration

At the top of the script, you'll find the main configuration objects:

  • DEFAULTS: This object holds the default values that appear in the settings form, such as the initial date, club price range, and show times. The start and end dates are dynamically set to a 7-day period starting from today.
  • TOUR_ITINERARY: This is an array of objects, where each object represents a leg of the tour. It defines the city and the travelHours required to get there from the previous city in the list. This is the master plan the script follows.

generateAndStoreTour Function

This is the "brain" of the script. It runs once at the beginning to create a complete schedule based on your settings.

  1. It identifies your chosen INITIAL_CITY in the TOUR_ITINERARY and starts planning from there.
  2. It maintains a lastActionTime variable, which is updated after every planned show and travel leg.
  3. For each city, it loops to book the number of shows you specified (SHOWS_PER_CITY).
  4. It calculates arrival time and then calls findNextShowSlot to determine the soonest valid date and time for a concert.
  5. Key Bug Fix: The comments in this function highlight an important fix. Previously, if scheduling a show exceeded the tour's FINAL_DATE, the entire planning process would stop. The corrected logic uses a simple break instead of a labeled break (break tourPlanningLoop). This ensures that if the final date is reached for one city, the script simply stops planning for that city and moves on to the next one, rather than ending the tour prematurely.
// --- 🛠️ FIX APPLIED HERE ---
// If the next show is past the final date, stop adding shows for THIS city and move to the next.
if (nextShowTime > finalDate) {
    console.log(`🛑 Final date ${settings.FINAL_DATE} reached while planning for ${leg.city}. Moving to the next city.`);
    break; // This now only breaks the inner loop (for shows per city), not the 'tourPlanningLoop'.
}

runAutoBooker Function

This is the main "engine" that executes on the "Book Show" page. It acts as a state machine that determines what to do based on the current page content and the saved tour plan.

  • State Management: It heavily relies on the browser's storage:
    • localStorage: Used for data that needs to persist even if you close the browser tab. This includes the full popmundo_planned_tour, the popmundo_show_index (which show is next), and the list of popmundo_booked_clubs.
    • sessionStorage: Used for data that should only last for the current browser session. This includes your chosen popmundo_session_settings and a flag to stop the script.
  • Page Interaction Flow:
    1. If the wrong city is selected, it corrects the selection, which triggers a page reload by the game. It saves the target date/time to sessionStorage to restore them after the reload.
    2. If the clubs table is not yet visible, it fills in the date and time from the plan and clicks the Find Clubs button.
    3. If the clubs table is visible, it filters the venues based on your criteria (stars, price, and not already booked that week).
    4. It selects the best valid club (highest price), clicks the radio button, and then clicks the Book Show button.
    5. Finally, it calls handleConfirmationPopup to automatically click "Yes" on the confirmation dialog.