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

Gravo not listed as merchant #37

Merged
merged 3 commits into from Mar 28, 2021
Merged

Gravo not listed as merchant #37

merged 3 commits into from Mar 28, 2021

Conversation

szapp
Copy link
Collaborator

@szapp szapp commented Mar 26, 2021

Gravo isn't listed in "Diary/General info/Merchant in the Old Camp" if the topic wasn't previously created.

@AmProsius AmProsius added this to To Do in v1.0.0 via automation Jan 6, 2021
@catalinstoian
Copy link

catalinstoian commented Jan 16, 2021

func VOID DIA_Gravo_HelpHow_Info()
{
AI_Output (other, self,"DIA_Gravo_HelpHow_15_00"); //If I was in trouble, YOU could help me? How?
AI_Output (self, other,"DIA_Gravo_HelpHow_04_01"); //Well, let's assume you're in trouble with Thorus. You better never get into trouble with him, but then, well, you never know.
AI_Output (self, other,"DIA_Gravo_HelpHow_04_02"); //Thorus can be quite stubborn - when he's pissed off with you once, he'll never talk to you again. And that's a bad thing.
AI_Output (self, other,"DIA_Gravo_HelpHow_04_03"); //As a greenhorn, you depend on him. So you come to see me. I know a lot of people here Thorus listens to.
AI_Output (self, other,"DIA_Gravo_HelpHow_04_04"); //They put in a good word for you, and Thorus is your friend again. Of course the boys want to see some ore for these kind of favors. Your ore.
AI_Output (self, other,"DIA_Gravo_HelpHow_04_05"); //And I take care that your ore gets to the right people...
B_LogEntry(GE_TraderOC,"The digger Gravo is selling a special kind of service. If I get in trouble with important people in the Camp, I can pay him to settle it.");
};

changed to

func VOID DIA_Gravo_HelpHow_Info()
{
	AI_Output (other, self,"DIA_Gravo_HelpHow_15_00"); //If I was in trouble, YOU could help me? How?
	AI_Output (self, other,"DIA_Gravo_HelpHow_04_01"); //Well, let's assume you're in trouble with Thorus. You better never get into trouble with him, but then, well, you never know.
	AI_Output (self, other,"DIA_Gravo_HelpHow_04_02"); //Thorus can be quite stubborn - when he's pissed off with you once, he'll never talk to you again. And that's a bad thing.
	AI_Output (self, other,"DIA_Gravo_HelpHow_04_03"); //As a greenhorn, you depend on him. So you come to see me. I know a lot of people here Thorus listens to.
	AI_Output (self, other,"DIA_Gravo_HelpHow_04_04"); //They put in a good word for you, and Thorus is your friend again. Of course the boys want to see some ore for these kind of favors. Your ore.
	AI_Output (self, other,"DIA_Gravo_HelpHow_04_05"); //And I take care that your ore gets to the right people...
	Log_CreateTopic (GE_TraderOC,LOG_NOTE);
	B_LogEntry(GE_TraderOC,"The digger Gravo is selling a special kind of service. If I get in trouble with important people in the Camp, I can pay him to settle it.");
};

@szapp szapp added the type: revert on save The fix for this issue impacts the game and should be reverted when saving. label Jan 24, 2021
@szapp
Copy link
Collaborator

szapp commented Jan 24, 2021

This fix will only work, if the player has the patch installed while this dialog takes place. If the patch is only installed afterwards, Gravo will remain not listed. We could add another check at the start of the game to see if the dialog had already been told but Gravo not listed to add him.

Either way, adding him to the list of merchants will remain in the game save.

@AmProsius AmProsius removed this from To Do in v1.0.0 Jan 26, 2021
@AmProsius AmProsius added the provided fix This issue has a fix provided in the comments. label Feb 11, 2021
@AmProsius
Copy link
Owner Author

Either way, adding him to the list of merchants will remain in the game save.

Will this make savegames incompatible or is it just more difficult to fix the issue and make it revertable?

@szapp
Copy link
Collaborator

szapp commented Feb 12, 2021

I think I can manage to both apply the fix if Gravo has already been spoken to and revert the fix it properly. You can ignore my previous comment.

@szapp szapp added the compatibility: difficult This issue is difficult to make compatible. label Feb 20, 2021
@AmProsius AmProsius added the validation: required This issue needs validation from one of the validators. label Feb 20, 2021
@AmProsius AmProsius added this to To Do in v1.1.0 via automation Mar 5, 2021
@AmProsius AmProsius modified the milestones: v1.0.0, v1.1.0 Mar 5, 2021
@szapp szapp added this to Dialog: Info function in Fix templates Mar 17, 2021
@szapp szapp added the impl: replace func call This issue requires replacing function calls in the scripts. label Mar 17, 2021
@szapp szapp self-assigned this Mar 17, 2021
@szapp szapp added the impl: modify/analyze script func This issue requires analyzing and/or modifying the bytecode of script functions. label Mar 18, 2021
@szapp
Copy link
Collaborator

szapp commented Mar 18, 2021

The log entries not being created if the log topic does not exist yet seems to be a reoccurring problem. It could be an issue on its own, because I think we might have already fixed it once for another issue. (I can't find it, maybe I am mistaken?)

The fix here could then concentrate on creating the log entry post-hoc if Gravo had been spoken to before but no entry exists yet (and removing it on saving).

Apply

  1. Check if the symbols DIA_Gravo_HelpHow_Info, B_LogEntry, and GE_TraderOC exist.
  2. Find B_LogEntry in DIA_Gravo_HelpHow_Info.
    1. Check if GE_TraderOC is the first argument of B_LogEntry.
    2. Remember the second argument of B_LogEntry, i.e. the log entry.
  3. Check Npc_KnowsInfo(hero, MEM_FindParserSymbol("DIA_Gravo_HelpHow_Info"))
    • If yes, take the previously determined string and check if it exists in the log entry.
      • If yes, no need to apply the fix.
      • If no, add the log entry silently.

Revert

  1. If previously applied, remove the log entry, if it exists.

The log entry should always be re-created as the first entry of the log section (instead of always added to the bottom).

@szapp szapp removed the impl: replace func call This issue requires replacing function calls in the scripts. label Mar 18, 2021
@szapp
Copy link
Collaborator

szapp commented Mar 25, 2021

The log entries not being created if the log topic does not exist yet seems to be a reoccurring problem. It could be an issue on its own

That actually won't work, because a log topic can be either a mission or a note. The issue would have to be fixed on an individual basis.

@szapp szapp moved this from To Do to In Progress in v1.1.0 Mar 25, 2021
@szapp
Copy link
Collaborator

szapp commented Mar 26, 2021

Seems like the same is happening for Graham:

FUNC VOID DIA_Graham_Hello_Info()
{
AI_Output (other, self,"DIA_Graham_Hello_15_00"); //Hi! I'm new here.
AI_Output (self, other,"DIA_Graham_Hello_02_01"); //I'm Graham. I draw maps. I haven't seen you here before... What do you want?
B_LogEntry( GE_TraderOC,"The digger Graham sells maps left of the main gate.");
};

@szapp szapp marked this pull request as draft March 26, 2021 18:33
@szapp
Copy link
Collaborator

szapp commented Mar 26, 2021

The test is still missing.

@AmProsius
Copy link
Owner Author

AmProsius commented Mar 26, 2021

Just to save it somewhere (Regex: \s+\n\s*B_LogEntry\s*\(\s?GE), these are the log entries that might not be created due to lacking Log_CreateTopic:

C:\Users\amprosius\projects\gothic-1-community-patch\scriptbase\_work\Data\Scripts\Content\Story\Missions\DIA_GRD_219_Stone.d:
  104      CreateInvItem       (other,GRD_ARMOR_L);
  105      AI_EquipBestArmor   (hero);
  106:     AI_EquipBestMeleeWeapon (hero);
  107: 
  108:     B_LogEntry      (GE_BecomeGuard,"I've collected my first guard's armor at the smith Stone's. I could even buy better armor there, but he's prices are high.");
  109  
  110      AI_StopProcessInfos ( self );

C:\Users\amprosius\projects\gothic-1-community-patch\scriptbase\_work\Data\Scripts\Content\Story\Missions\DIA_KDF_402_Corristo.d:
  335      hero.guild = GIL_KDF;
  336  
  337:     hero.attribute [ATR_HITPOINTS] = hero.attribute [ATR_HITPOINTS_MAX];
  338: 
  339:     B_LogEntry      (GE_BecomeFiremage,"I've passed the test and sworn the oath of Fire. From now on I'll wear the red robe of the Circle of Fire!");
  340      Log_CreateTopic (GE_TeacherOC,LOG_NOTE);
  341      B_LogEntry      (GE_TeacherOC,"Corristo can teach me the magic CIRCLES and increase my MANA. He's in the house of the Magicians of Fire.");

C:\Users\amprosius\projects\gothic-1-community-patch\scriptbase\_work\Data\Scripts\Content\Story\Missions\DIA_ORG_855_Wolf.d:
   46  {
   47      AI_Output           (other, self,"DIA_Wolf_Hello_15_00"); //Who are you?
   48:     AI_Output           (self, other,"DIA_Wolf_Hello_09_01"); //I'm Wolf. I make armor.
   49: 
   50:     B_LogEntry          (GE_TraderNC,"Wolf supplies the rogues with ARMOR. He's usually in front of his hut in the big living cave.");
   51  };
   52  

C:\Users\amprosius\projects\gothic-1-community-patch\scriptbase\_work\Data\Scripts\Content\Story\Missions\DIA_STT_331_Fingers.d:
  222      AI_Output (other, self,"DIA_Fingers_WhereCavalorn_15_00"); //Where can I find Cavalorn?
  223      AI_Output (self, other,"DIA_Fingers_WhereCavalorn_05_01"); //He's hunting out in the wild. You'll find him at the path to the New Camp. Westwards of the Old Camp there's a wide canyon.
  224:     AI_Output (self, other,"DIA_Fingers_WhereCavalorn_05_02"); //In this canyon there's an old woodcutters' hut. You'll find him there.
  225: 
  226:     B_LogEntry( GE_TeacherOW,"Cavalorn can teach me to sneak. His hut is in a canyon to the west of the Old Camp, in the direction of the New Camp.");
  227  };
  228  

C:\Users\amprosius\projects\gothic-1-community-patch\scriptbase\_work\Data\Scripts\Content\Story\Missions\DIA_TPL_1402_GorNaToth.d:
  135      AI_Output           (other, self,"TPL_1402_GorNaToth_GETSTUFF_Info_15_01"); //I'd like to collect my templar's armor.
  136      AI_Output           (self, other,"TPL_1402_GorNaToth_GETSTUFF_Info_11_02"); //I'm delighted to have the honor of handing our armor to the man who found the minecrawler eggs.
  137:     AI_Output           (self, other,"TPL_1402_GorNaToth_GETSTUFF_Info_11_03"); //May this armor protect you, as the Sleeper protects the Brotherhood!
  138: 
  139:     B_LogEntry          (GE_BecomeTemplar,"Gor Na Toth gave me my first templars' armor. Now I'm a proper member of the warrior clan!");
  140  
  141      Log_CreateTopic     (GE_TraderPSI,      LOG_NOTE);

C:\Users\amprosius\projects\gothic-1-community-patch\scriptbase\_work\Data\Scripts\Content\Story\Missions\DIA_VLK_572_Gravo.d:
   80      AI_Output (self, other,"DIA_Gravo_HelpHow_04_03"); //As a greenhorn, you depend on him. So you come to see me. I know a lot of people here Thorus listens to.
   81      AI_Output (self, other,"DIA_Gravo_HelpHow_04_04"); //They put in a good word for you, and Thorus is your friend again. Of course the boys want to see some ore for these kind of favors. Your ore.
   82:     AI_Output (self, other,"DIA_Gravo_HelpHow_04_05"); //And I take care that your ore gets to the right people...
   83: 
   84:     B_LogEntry(GE_TraderOC,"The digger Gravo is selling a special kind of service. If I get in trouble with important people in the Camp, I can pay him to settle it.");
   85  };
   86  

C:\Users\amprosius\projects\gothic-1-community-patch\scriptbase\_work\Data\Scripts\Content\Story\Missions\DIA_VLK_573_Graham.d:
   45  {
   46      AI_Output (other, self,"DIA_Graham_Hello_15_00"); //Hi! I'm new here.
   47:     AI_Output (self, other,"DIA_Graham_Hello_02_01"); //I'm Graham. I draw maps. I haven't seen you here before... What do you want?
   48: 
   49:     B_LogEntry( GE_TraderOC,"The digger Graham sells maps left of the main gate.");
   50  };

Since I'm not sure with GE_BecomeXYZ atm (I think they might all be created before), I'll narrow it down to these four:

C:\Users\amprosius\projects\gothic-1-community-patch\scriptbase\_work\Data\Scripts\Content\Story\Missions\DIA_ORG_855_Wolf.d:
   46  {
   47      AI_Output           (other, self,"DIA_Wolf_Hello_15_00"); //Who are you?
   48:     AI_Output           (self, other,"DIA_Wolf_Hello_09_01"); //I'm Wolf. I make armor.
   49: 
   50:     B_LogEntry          (GE_TraderNC,"Wolf supplies the rogues with ARMOR. He's usually in front of his hut in the big living cave.");
   51  };
   52  

C:\Users\amprosius\projects\gothic-1-community-patch\scriptbase\_work\Data\Scripts\Content\Story\Missions\DIA_STT_331_Fingers.d:
  222      AI_Output (other, self,"DIA_Fingers_WhereCavalorn_15_00"); //Where can I find Cavalorn?
  223      AI_Output (self, other,"DIA_Fingers_WhereCavalorn_05_01"); //He's hunting out in the wild. You'll find him at the path to the New Camp. Westwards of the Old Camp there's a wide canyon.
  224:     AI_Output (self, other,"DIA_Fingers_WhereCavalorn_05_02"); //In this canyon there's an old woodcutters' hut. You'll find him there.
  225: 
  226:     B_LogEntry( GE_TeacherOW,"Cavalorn can teach me to sneak. His hut is in a canyon to the west of the Old Camp, in the direction of the New Camp.");
  227  };
  228  

C:\Users\amprosius\projects\gothic-1-community-patch\scriptbase\_work\Data\Scripts\Content\Story\Missions\DIA_VLK_572_Gravo.d:
   80      AI_Output (self, other,"DIA_Gravo_HelpHow_04_03"); //As a greenhorn, you depend on him. So you come to see me. I know a lot of people here Thorus listens to.
   81      AI_Output (self, other,"DIA_Gravo_HelpHow_04_04"); //They put in a good word for you, and Thorus is your friend again. Of course the boys want to see some ore for these kind of favors. Your ore.
   82:     AI_Output (self, other,"DIA_Gravo_HelpHow_04_05"); //And I take care that your ore gets to the right people...
   83: 
   84:     B_LogEntry(GE_TraderOC,"The digger Gravo is selling a special kind of service. If I get in trouble with important people in the Camp, I can pay him to settle it.");
   85  };
   86  

C:\Users\amprosius\projects\gothic-1-community-patch\scriptbase\_work\Data\Scripts\Content\Story\Missions\DIA_VLK_573_Graham.d:
   45  {
   46      AI_Output (other, self,"DIA_Graham_Hello_15_00"); //Hi! I'm new here.
   47:     AI_Output (self, other,"DIA_Graham_Hello_02_01"); //I'm Graham. I draw maps. I haven't seen you here before... What do you want?
   48: 
   49:     B_LogEntry( GE_TraderOC,"The digger Graham sells maps left of the main gate.");
   50  };
   51  

I already created the issues accordingly.

@szapp szapp marked this pull request as ready for review March 26, 2021 20:52
@szapp szapp requested a review from AmProsius March 26, 2021 20:52
@szapp
Copy link
Collaborator

szapp commented Mar 26, 2021

I will streamline this fix, once we have verified that it works as expected.

Although the test is fully automatic, some additional manual test will be necessary:

UPDATE: Done

  • A
  1. Start the game without the fix
  2. Talk to Gravo (before the topic was ever created)
  3. Confirm that the log topic and log entry were not created
  4. Save and quit the game and start it with the fix
  5. Confirm that the log topic and the entry exist now
  6. Save and quit the game and start it without the fix again
  7. Confirm that the log entry does not exist anymore
  • B
  1. Load the game from above without the fix
  2. Talk to someone that creates a log entry in that topic
  3. Confirm that both log topic and log entry exist
  4. Save and quit the game and start it with the fix
  5. Confirm that the log entry concerning Gravo is the first entry of that topic[1]
  6. Save and quit the game and start it again without the fix
  7. Confirm that Gravo's log entry is not there anymore

[1] Gravo's log entry should not be added to the bottom of the topic. Otherwise it will always look like it's the newest entry. Therefore it is always added as the very first entry.

@AmProsius
Copy link
Owner Author

AmProsius commented Mar 27, 2021

  • C:
  1. Start the game without the fix.
  2. Talk to someone that creates a log entry in that topic.
  3. Talk to Gravo.
  4. Confirm that both log topic and both log entries exist.
  5. Save and quit the game and start it with the fix.
  6. Confirm that the log entry concerning Gravo is untouched (should be the last entry of that topic).
  7. Save and quit the game and start it again without the fix.
  8. Confirm that Gravo's log entry is still there.

@szapp
Copy link
Collaborator

szapp commented Mar 28, 2021

I tried to make porting this fix to other occurrences as easy as possible, by defining any specifics as constants at the beginning of the functions. These are preceded by the comment // Parameters of this fix. Still, the code will have to be carefully copied as there are multiple things to change:

  • Function names
  • Constants (as mentioned above)
  • Fix ID, i.e. in the context G1CP_IsFixApplied(37)
  • Function calls to the fix functions inside the test function

@AmProsius AmProsius merged commit 1c94b51 into master Mar 28, 2021
v1.1.0 automation moved this from In Progress to Done Mar 28, 2021
@AmProsius AmProsius deleted the bug037 branch March 28, 2021 20:42
Copy link
Owner

@AmProsius AmProsius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks fine.

@szapp szapp removed their assignment Mar 29, 2021
AmProsius added a commit that referenced this pull request Apr 19, 2021
szapp added a commit that referenced this pull request Apr 19, 2021
@szapp szapp removed the validation: required This issue needs validation from one of the validators. label May 14, 2021
@szapp szapp moved this from Modify dialog function to Add missing log creation in Fix templates Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility: difficult This issue is difficult to make compatible. impl: modify/analyze script func This issue requires analyzing and/or modifying the bytecode of script functions. provided fix This issue has a fix provided in the comments. type: revert on save The fix for this issue impacts the game and should be reverted when saving.
Projects
Fix templates
Create log topic in dialog function
v1.1.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants