Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch BotForce XML writer #3905

Closed

Conversation

AaronGullickson
Copy link
Member

This PR changes the XML writer to EntityListFile.WriteEntityList. Currently that method is private so this PR should only be merged after MegaMek/megamek#5282 which makes it public and accessible.

Currently BotForce entities are written using the MHQXML writer. However, this writer is not up to date and misses important information like a lot of the deployment variables, as well as any assigned pilot portraits. From the notes on this method, it seems like there is a push to move all of this over to EntityListfile.WriteEntityList which is up to date. I need an XML writer that is up to date because the Story Arcs PR #2997 uses all kinds of entity information to set up better scenarios, particularly deployment information.

The PR on GitHub is now more up to date than this document so I am removing it to avoid confusion.
This pops up a dialog with some narrative information. Right now It just uses the default Java messageDialog, so that I could test whether it is functioning correctly. The next step will be to create a custom dialog.
This is a better custom dialog for displaying NarrativeStoryEvents. It is set up using a grid layout so that it will be easy to add optional custom images later, although that functionality is not yet implemented.
This implements the ChoiceStoryEvent which provides a dialog to the user with a choice to make. The dialog sucks and I still need to implement the XML writing but the rest is working.
This allows me to specifically include a final status for the mission in the trigger.
This change allows me to use the full range of victory/defeat statuses. To handle the problem of forcing users to create a StoryOutcome for each one, the getResult function now searches for the highest existing ScenarioStatus in the StoryOutcomes hash that is not higher than the actual outcome. This will allow people to set "cut points" to define different outcomes. For example if I use "PYRRHIC_VICTORY" as the only StoryOutcome result, then any victory result would trigger it while draws and defeats would get the default condition. A simple way to get just Victory/Draw/Defeat is to set up StoryOutcomes for PYRRHIC_VICTORY/DRAW/DECISIVE_DEFEAT. Alternatively, the last one can be left out and all defeats will just get the default stuff, if it exists.
At the moment, I am just loading the old mekhq splash screen here for testing purposes. Eventually, I will want to give the creator more control and the ability to include their own images.

I am not resizing the image, but rather adjusting the size of the dialog to fit the image. So creators will be responsible for creating reasonably sized images. The 500x350 size of the splash images works pretty well as does the 256x350 size of the new default portrait image. So something in that ballpark should generally work well.
Every StoryEvent can now have a StoryIcon object which will display an image in any dialog displayed. Right now MHQ only reads in data from the main data/images/storyarc directory which contains the old mhq splash images. I am hoping to at some point also read in data from the creator's separate storyarc directory.
The personality class contains portrait and title information. A hash of personalities is maintained on StoryArc, by UUID id. Right now it doesn't do anything but the goal is to optionally associate a StoryEvent with a Personality which will affect how dialogs are displayed.
When a personalityId is used in a StoryEvent, the dialog will use their portrait and title for the image. This can be used to deliver a narrativeStoryEvent or ChoiceStoryEvent as if from a person
The Personality class now has a variable that is an id for a person in the campaign from which data is pulled. This data is updated each time the StoryArc.getPersonality method is ran.
I am using custom images locally that will not be on GH so anyone using this at the moment will see red Xs instead of some portraits.
This creates better timing so that the first dialog popups for the story arc appear after the main MekHQ GUI
I switched this to the int of the campaign id, but no longer need that given changes to the codebase so switching it back to what it is on the master.
This was inadvertently switched in a refactoring
To handle loading images from the story arc directory, I created StoryPortrait which subclasses Portrait but looks in a new directory associated with the story arc directory if it cannot find the portrait in the default directory. This directory is initialized when the campaign loads the story arc.
This is identical to the work on story arc specific portraits but for images used as splash images in the dialog
I decided to change the name of this object to better reflect what it is. I changed all associated methods and directories as well.
The refactored class can now check on any status
@AaronGullickson AaronGullickson self-assigned this Mar 25, 2024
@AaronGullickson
Copy link
Member Author

Whoops, I branched this off of story arcs - Ignore this will send in a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant