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

Locked cards say "Unknown" instead of "Locked" in the library #120

Closed
BlackSharpYL opened this issue Aug 27, 2018 · 9 comments
Closed

Locked cards say "Unknown" instead of "Locked" in the library #120

BlackSharpYL opened this issue Aug 27, 2018 · 9 comments

Comments

@BlackSharpYL
Copy link

As title. Only happens to modded characters.

@kiooeht
Copy link
Collaborator

kiooeht commented Aug 30, 2018

Are you sure? "Unknown" is for when a card is unlocked but not seen and as far as I can tell from looking at the game's code, that's the only way it should be able to say "Unknown" instead of "Locked".

@BlackSharpYL
Copy link
Author

BlackSharpYL commented Aug 30, 2018

Here is what I did and what I have observed:
I locked certain cards by doing // servant unlock 1 BaseMod.addUnlockBundle(new CustomUnlockBundle( "Manipulate", "Moondial", "Enbodiment" ), TheServantEnum.THE_SERVANT, 1); UnlockTracker.addCard("Manipulate"); UnlockTracker.addCard("Moondial"); UnlockTracker.addCard("Enbodiment");
Then I deleted everything in the Preferences folder, and restarted the game.
The card library was not accessible because I just deleted my saves so I started an Ironclad game and abandoned the game right away.
Then I looked into the card library and found the cards at the bottom of the library and said "Unknown".

20180830165016

Then I used the relic Orrery to test if any of these cards were actually unlocked. They were not.

@kiooeht
Copy link
Collaborator

kiooeht commented Aug 31, 2018

You're currently unlocking every card in receiveEditCards, did you get rid of that?

@BlackSharpYL
Copy link
Author

Yes, of course. What i have left is BaseMod.addCard(new Strike_Silver()); and alike.

@kiooeht
Copy link
Collaborator

kiooeht commented Aug 31, 2018

It looks like all the locked cards and relics are hardcoded. You can see them in UnlockTracker.refresh().

I'll fix it to work with the CustomUnlockBundle, but no promises that it will make it in before today's update.

@kiooeht
Copy link
Collaborator

kiooeht commented Aug 31, 2018

OK, there's a SetUnlocksSubscriber hook for this exact thing. Just call UnlockTracker.addCard and/or UnlockTracker.addRelic in the receiveSetUnlocks from that hook and you should be good.

@BlackSharpYL
Copy link
Author

OK, there's a SetUnlocksSubscriber hook for this exact thing. Just call UnlockTracker.addCard and/or UnlockTracker.addRelic in the receiveSetUnlocks from that hook and you should be good.

I have already done this when I submitted this issue and it did not work.

@Seeonee
Copy link

Seeonee commented Mar 12, 2019

I believe I've found the issue with this as well as the fix. I'm a bit new to contributing on GitHub so I'm still figuring out how to issue a pull request.

Anyways, I think the issue lies in basemod.patches.com.megacrit.cardcrawl.screens.compendium.CardLibraryScreen.EverythingFix.setLockStatus#Postfix

Lines 81-82 look like this:
CardGroup group = new CardGroup(CardGroup.CardGroupType.UNSPECIFIED); group.group = CardLibrary.getCardList(CardLibrary.LibraryType.valueOf(colors[icolor].name()));

...and should be replaced with this single line:
CardGroup group = Fields.cardGroupMap.get(colors[icolor]);

Currently, new CardGroups are being built from the Library, instead of using the ones saved to basemod.patches.com.megacrit.cardcrawl.screens.compendium.CardLibraryScreen.EverythingFix.Fields#cardGroupMap.

These (new) groups are passed to com.megacrit.cardcrawl.screens.compendium.CardLibraryScreen#lockStatusHelper which does a lookup against the UnlockTracker, removes certain cards, and adds locked copies. Since the groups are then discarded and no changes are ever made to the cardGroupMap groups, those don't reflect the lock changes when they're displayed later by com.megacrit.cardcrawl.screens.compendium.CardLibraryScreen#open

@kiooeht
Copy link
Collaborator

kiooeht commented Mar 13, 2019

Fixed by #203.

@kiooeht kiooeht closed this as completed Mar 13, 2019
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

No branches or pull requests

3 participants