From dd20fcd4db14996f1458eaa589562fdddf39f373 Mon Sep 17 00:00:00 2001 From: Nayla Hanegan Date: Mon, 16 Sep 2024 17:00:12 -0400 Subject: [PATCH] MP2 bonus stars --- codes/marioParty2.py | 39 ++++++++++++++++++++++ events/marioParty2_bonusStarReplace.py | 46 ++++++++++++++++++++++++++ frames/marioParty2_frame.py | 25 ++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 events/marioParty2_bonusStarReplace.py diff --git a/codes/marioParty2.py b/codes/marioParty2.py index 863dbab..f63e2e5 100644 --- a/codes/marioParty2.py +++ b/codes/marioParty2.py @@ -235,4 +235,43 @@ def getItemReplaceTwo(itemHex1, itemHex2, spaceName, spaceName2): 800FD341 00{itemHex2} D00FD375 00{itemHex1} 800FD375 00{itemHex2} +''' + +def getStarReplaceTwo1(amount, amountDec): + return f''' +MP5 - Replace Minigame Star with {amountDec} +D10FA63E 0052 +80103F04 0080 +D10FA63E 0052 +80103F07 00{amount} +D10FA63E 0052 +80103F50 0080 +D10FA63E 0052 +80103F53 00{amount} +''' + +def getStarReplaceTwo2(amount, amountDec): + return f''' +MP5 - Replace Coin Star with {amountDec} +D10FA63E 0052 +80104314 0080 +D10FA63E 0052 +80104317 00{amount} +D10FA63E 0052 +80104360 0080 +D10FA63E 0052 +80104363 00{amount} +''' + +def getStarReplaceTwo3(amount, amountDec): + return f''' +MP5 - Replace Happening Star with {amountDec} +D10FA63E 0052 +80104724 0080 +D10FA63E 0052 +80104727 00{amount} +D10FA63E 0052 +80104770 0080 +D10FA63E 0052 +80104773 00{amount} ''' \ No newline at end of file diff --git a/events/marioParty2_bonusStarReplace.py b/events/marioParty2_bonusStarReplace.py new file mode 100644 index 0000000..e1b876e --- /dev/null +++ b/events/marioParty2_bonusStarReplace.py @@ -0,0 +1,46 @@ +# ============================================ +# Mario Party Toolkit +# Author: Nayla Hanegan (naylahanegan@gmail.com) +# Date: 7/12/2024 +# License: MIT +# ============================================ + +from codes.marioParty2 import * +from functions import * + +import pyperclip + +def customBonusStarEvent_mp2(star1, star2, star3, stars2): + starSlot1 = star1.get() + starSlot2 = star2.get() + starSlot3 = star3.get() + + starHex = ["NONE", "E8", "EA", "EC", "ED", "EE", "EF", "F0", "F1", "F2", "F3"] + + starSlot1Num = stars2.index(starSlot1) + starSlot1Hex = starHex[starSlot1Num] + + starSlot2Num = stars2.index(starSlot2) + starSlot2Hex = starHex[starSlot2Num] + + starSlot3Num = stars2.index(starSlot3) + starSlot3Hex = starHex[starSlot3Num] + + mpStar21 = getStarReplaceTwo1(starSlot1Hex, starSlot1) + mpStar22 = getStarReplaceTwo2(starSlot2Hex, starSlot2) + mpStar23 = getStarReplaceTwo3(starSlot3Hex, starSlot3) + + if starSlot1Hex == "NONE": + mpStar21 = "" + if starSlot2Hex == "NONE": + mpStar22 = "" + if starSlot3Hex == "NONE": + mpStar23 = "" + + generatedCode = mpStar21 + mpStar22 + mpStar23 + + generatedCode = generatedCode.strip() + pyperclip.copy(generatedCode) + + print("Generated codes copied to the clipboard.") + createDialog("Operation Sucessful", "success", "Generated codes copied to clipboard!.", None) diff --git a/frames/marioParty2_frame.py b/frames/marioParty2_frame.py index e42c774..3874bb0 100644 --- a/frames/marioParty2_frame.py +++ b/frames/marioParty2_frame.py @@ -12,6 +12,7 @@ from events.marioParty2_itemReplace import * from events.marioParty2_handicap import * from events.marioParty2_mgreplace import * +from events.marioParty2_bonusStarReplace import * # Import custom tkinter module as ctk import customtkinter as ctk @@ -26,6 +27,7 @@ def create_mario_party_2_interface(frame): tabview.add("Item Prices") tabview.add("Item Replacement") tabview.add("Star Handicaps") + tabview.add("Bonus Star Replacement") tabview.set("Coins Mods") # Function to create an entry field and checkbox @@ -180,4 +182,27 @@ def create_entry(tab, row, icon_path, label_text, color, placeholder): parse_stars_button = ctk.CTkButton(master=tabview.tab("Star Handicaps"), command=lambda: handicapEvent_mp2(p1Stars, p2Stars, p3Stars, p4Stars), text="Generate Codes") parse_stars_button.place(x=10, y=800) + + stars2 = ["None", "Minigame Star", "Coin Star", "Happening Star", "Red Star", "Blue Star", "Chance Time Star", "Bowser Space Star", "Battle Space Star", "Item Space Star", "Bank Space Star"] + + label = ctk.CTkLabel(master=tabview.tab("Bonus Star Replacement"), text=" Replace Minigame Star with: ", font=("Arial", 16)) + label.grid(row=0, column=0, sticky="w") + + star1 = ctk.CTkComboBox(master=tabview.tab("Bonus Star Replacement"), values=stars2) + star1.grid(row=0, column=1, pady=10) + + label = ctk.CTkLabel(master=tabview.tab("Bonus Star Replacement"), text=" Replace Coin Star with: ", font=("Arial", 16)) + label.grid(row=1, column=0, sticky="w") + + star2 = ctk.CTkComboBox(master=tabview.tab("Bonus Star Replacement"), values=stars2) + star2.grid(row=1, column=1, pady=10) + + label = ctk.CTkLabel(master=tabview.tab("Bonus Star Replacement"), text=" Replace Happening Star with: ", font=("Arial", 16)) + label.grid(row=2, column=0, sticky="w") + + star3 = ctk.CTkComboBox(master=tabview.tab("Bonus Star Replacement"), values=stars2) + star3.grid(row=2, column=1, pady=10) + + parseButton = ctk.CTkButton(master=tabview.tab("Bonus Star Replacement"), command=lambda: customBonusStarEvent_mp2(star1, star2, star3, stars2), text="Generate Codes") + parseButton.place(x=10, y=800) return frame \ No newline at end of file