// Part of Blue Sage quests
// author: Jenalya
// see bluesageConfig for detailed quest description
// Ensio is one of the helpers working on sorting the bookpages, can take bookpages
// can give second hint about the visitor in investigation subquest
048-2.gat,104,86,0|script|Ensio|365
{
set @investigate, ((QUEST_BlueSage & $@Q_BlueSageInvestigate_MASK) >> $@Q_BlueSageInvestigate_SHIFT);
set @bookpages, ((QUEST_BlueSage & $@Q_BlueSageBookPages_MASK) >> $@Q_BlueSageBookPages_SHIFT);
set @old_bookpage_exp, 1000;
set @new_bookpage_exp, 10000;
if (@bookpages == 31) goto L_Thank;
if (@bookpages > 26) goto L_Almost;
if (@bookpages > 18) goto L_Many;
if (@bookpages > 8) goto L_Some;
if (@bookpages > 0) goto L_Few;
mes "[Ensio]";
mes "\"Hello. Did you come here to see the library? There isn't much left... But we're working on recovering the books by collecting the ripped out book pages, sorting them and recreating the books.\"";
if (BaseLevel < $@Q_BlueSageMinimumLevel)
goto L_Close;
menu
"Good luck with that. See you in ten years or something.",L_Investigate,
"Can I help somehow?",L_Next;
L_Next:
mes "[Ensio]";
mes "\"Oh, would you? That'd be great! You see, the slimes ate most of the books and it is difficult to retrieve the bookpages.";
mes "If you feel capable of this task, you could go out to hunt the Blue and White Slimes, to get the bookpages back from them.\"";
goto L_Progress;
L_Few:
mes "[Ensio]";
mes "\"So many bookpages are still missing...\"";
next;
goto L_Progress;
L_Some:
mes "[Ensio]";
mes "\"Thanks for the pages you brought. There are still some missing.\"";
next;
goto L_Progress;
L_Many:
mes "[Ensio]";
mes "\"Wow, you already found quite a lot of bookpages. Please keep it up!\"";
next;
goto L_Progress;
L_Almost:
mes "[Ensio]";
mes "\"There are only a few pages missing.\"";
next;
goto L_Progress;
L_Progress:
mes "\"Did you get some bookpages from the slimes?\"";
menu
"Yes, have a look.",L_Continue,
"No.",L_Investigate;
L_Continue:
if (countitem("BookPage") < 1)
goto L_NoItem;
delitem "BookPage", 1;
if (rand(90 - @bookpages) < 36)
goto L_OldPage;
set @bookpages, @bookpages + 1;
callfunc "updateBlueSageBookPages";
getexp @new_bookpage_exp, 0;
mes "[Ensio]";
mes "\"Ah, wonderful! This is a page we haven't found yet!\"";
if (@bookpages < 31)
goto L_Progress;
next;
mes "\"Amazing. I think you found all the missing pages of which we didn't have a copy. This is a great help! I'll mention this to Nikolai.\"";
goto L_Investigate;
L_OldPage:
getexp @old_bookpage_exp, 0;
mes "[Ensio]";
mes "\"Mh, let me see. We already have a copy of this page, but it's helpful nevertheless. Thank you.\"";
goto L_Progress;
L_Thank:
mes "[Ensio]";
mes "\"We'd never be able to recover our books so quickly without your help. Thanks!\"";
goto L_Investigate;
L_NoItem:
mes "[Ensio]";
mes "\"This isn't funny! Come back when you're serious.\"";
goto L_Investigate;
L_Investigate:
if ((@investigate == 3) || (@investigate == 4)) goto L_Ask_Visitor;
if ((@investigate == 5) || (@investigate == 8)) goto L_Ask_Helper;
if ((@investigate == 6) || (@investigate == 7) || (@investigate == 9) || (@investigate == 10)) goto L_Ask_Both;
goto L_Close;
L_Ask_Visitor:
menu
"Can you tell me anything about the visitor with the mask?",L_Visitor,
"I need to leave.",L_Close;
L_Ask_Helper:
menu
"What's your opinion of Peetu and how he does his work?",L_Helper,
"See you later.",L_Close;
L_Ask_Both:
menu
"Can you tell me anything about the visitor with the mask?",L_Visitor,
"What's your opinion of Peetu and how he does his work?",L_Helper,
"Bye.",L_Close;
L_Visitor:
mes "[Ensio]";
mes "\"Visitor with a mask? Ah, I think I know who are you talking about. Black clothes and a golden mask. Rather strange guy.\"";
next;
mes "\"He was looking around in the library a while, and then came to ask about our research. He seemed to be particularly interested in our experiments with the slimes.";
mes "Heh, I wonder what he would've said if he'd have visited us a little bit later. Mh, now that I think about it, the accident with the slimes happened just the night after he was here.\"";
if ((@investigate != 3) && (@investigate != 6) && (@investigate != 9))
goto L_Close;
set @investigate, @investigate + 1;
callfunc "updateBlueSageInvestigate";
goto L_Close;
L_Helper:
mes "[Ensio]";
mes "\"Oh, I can't really tell. I'm mostly working in the library, while he's very involved in the research.\"";
goto L_Close;
L_Close:
set @investigate, 0;
set @bookpages, 0;
set @old_bookpage_exp, 0;
set @new_bookpage_exp, 0;
close;
}