Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // DRAK SERAT
- // Teaches various ninjutsu skills to us for pay
- // Sells rare ninjutsu items
- const int Flag_First_Encounter = 0;
- const int Flag_First_Exit_Talk = 1;
- const int Flag_First_Exit = 2;
- const int Flag_First_Taught = 3;
- const int Flag_Second_Taught = 4;
- const int Flag_Failed_Lesson = 5;
- const int Flag_Failed_Lesson_Again = 6;
- const int Flag_Failed_Lesson_Yet_Again = 7;
- const int Flag_Recent_Training_Failed = 8;
- const int Flag_Explained_Services = 9;
- const int CHOICETEXT_Training = 14;
- const int SKILL_NINJITSU = 3;
- const int SKILL_STEALTH = 12;
- const int SKILL_DEFLECTION = 14;
- const int SKILL_SCOUT = 15;
- const int SKILL_IAJITSU = 16;
- const int SKILL_EVASION = 21;
- const int SKILL_SWORDSMANSHIP = 29;
- const int SKILL_POWERSTRIKE = 40;
- const int SKILL_HAND_2_HAND = 42;
- const int TRAIN_STEALTH = 0;
- const int TRAIN_EVASION = 1;
- const int TRAIN_SCOUT = 2;
- const int TRAIN_HAND_2_HAND = 3;
- const int TRAIN_SWORDSMANSHIP = 4;
- const int TRAIN_DEFLECTION = 5;
- const int TRAIN_NINJITSU = 6;
- const int TRAIN_POWERSTRIKE = 7;
- const int TRAIN_IAJITSU = 8;
- const int TRAIN_TOTAL = 9;
- const int SKILL_MAXIMUM = 100;
- const int TEACHER_SKILL = 25;
- const int LEVEL_IAJITSU = 12;
- const int LEVEL_MINIMUM_GROUP1 = 3;
- const int LEVEL_MINIMUM_GROUP2 = 6;
- const int LEVEL_MINIMUM_GROUP3 = 9;
- const int GOLD_STEALTH = 3600;
- const int GOLD_EVASION = 2400;
- const int GOLD_SCOUT = 1800;
- const int GOLD_HAND_2_HAND = 7600;
- const int GOLD_SWORDSMANSHIP = 7200;
- const int GOLD_DEFLECTION = 11600;
- const int GOLD_NINJITSU = 24700;
- const int GOLD_POWERSTRIKE = 42200;
- const int GOLD_IAJITSU = 38800;
- const int GOLD_TRAINING_MARGIN = 600;
- const int LUT_WIDTH = 7;
- const int LUT_SKILL = 0;
- const int LUT_LEVEL = 1;
- const int LUT_GOLD = 2;
- const int LUT_PROF = 3;
- const int LUT_MAX = 4;
- const int LUT_ACQUIRE = 5;
- const int LUT_TEXT = 6;
- const int TRAINRESULT_ABORT = -1;
- const int TRAINRESULT_FAILURE = 0;
- const int TRAINRESULT_SUCCESS = 1;
- const int TEST_CHARMED_MERCENARY = 40;
- const int TEST_CHARMED_SERVICES = 50;
- const int TEST_AMITY_OWL = 3;
- int [] tblTraining =
- {// skill index, minimum level to learn, cost, minimum profession, maximum train, level acquire,text
- SKILL_STEALTH,LEVEL_MINIMUM_GROUP1, GOLD_STEALTH,cROGUE,70,0,41,
- SKILL_EVASION,LEVEL_MINIMUM_GROUP1, GOLD_EVASION,cROGUE,80,0,42,
- SKILL_SCOUT,LEVEL_MINIMUM_GROUP1, GOLD_SCOUT,cWARRIOR,80,0,43,
- SKILL_HAND_2_HAND,LEVEL_MINIMUM_GROUP2, GOLD_HAND_2_HAND,cRANGER,70,0,9,
- SKILL_SWORDSMANSHIP, LEVEL_MINIMUM_GROUP2, GOLD_SWORDSMANSHIP,cWARRIOR,70,0,45,
- SKILL_DEFLECTION,LEVEL_MINIMUM_GROUP2, GOLD_DEFLECTION,cTEMPLAR,50,12,46,
- SKILL_NINJITSU,LEVEL_MINIMUM_GROUP3, GOLD_NINJITSU,cASSASSIN,60,0,47,
- SKILL_POWERSTRIKE,LEVEL_MINIMUM_GROUP3, GOLD_POWERSTRIKE,cTEMPLAR,50,18,48,
- SKILL_IAJITSU,LEVEL_MINIMUM_GROUP3, GOLD_IAJITSU,cASSASSIN,40,22,49
- };
- int Trainer()
- {
- int enbits = 0;
- int prof = GetTalkerProfession();
- int lvl = GetTalkerLevel();
- int sk = 0;
- int currentsk = 0;
- int getsk = 0;
- int choice = -1;
- int c = 0;
- int row = 0;
- int cost = 0;
- bool trained = false;
- // scan through training table array and see what kinds of training can
- // be offered to current speaker in party
- for(c = 0;c< TRAIN_TOTAL;c++)
- {
- row = c * LUT_WIDTH;
- if(HasSkill(tblTraining[row + LUT_SKILL]) &&
- lvl >= tblTraining[row + LUT_LEVEL] &&
- prof >= tblTraining[row + LUT_PROF]
- )
- {
- enbits |= Bit(c);
- }
- }
- if(enbits > 0)
- {
- choice = MultiChoice(CHOICETEXT_Training, enbits);
- }
- else
- {
- Say(37);
- return(TRAINRESULT_ABORT);
- }
- if(choice < 1)
- {
- RandomSay(37,38,39);
- return(TRAINRESULT_ABORT);
- }
- row = (choice - 1) * LUT_WIDTH;
- sk = tblTraining[row + LUT_SKILL];
- SubstituteTag(cTX_SKILLS,sk);
- Say(40);
- getsk = tblTraining[row + LUT_ACQUIRE];
- if(HasSkill(sk) == false && getsk > 0 && lvl < getsk)
- {
- Say(44);
- return(TRAINRESULT_ABORT);
- }
- currentsk = GetTalkerSkill(sk);
- if(currentsk >= SKILL_MAXIMUM)
- {
- RandomSay(53,54,55);
- return(TRAINRESULT_ABORT);
- }
- if(currentsk >= tblTraining[row + LUT_MAX])
- {
- RandomSay(50,52,56);
- return(TRAINRESULT_ABORT);
- }
- cost = tblTraining[row + LUT_GOLD];
- cost = BarterPrice(cost,GOLD_TRAINING_MARGIN);
- SetNumberText(cost);
- Say(8);
- if(GetGold(cost) == false)
- {
- Say(38);
- return(TRAINRESULT_ABORT);
- }
- GetTalkerName();
- Narrative(tblTraining[row + LUT_TEXT]);
- trained = LearnSkill(sk,TEACHER_SKILL);
- return((trained == true) ? TRAINRESULT_SUCCESS : TRAINRESULT_FAILURE);
- }
- bool OnSubject_YOU(int querytype)
- {
- if(Get(Flag_First_Exit) == false)
- {
- Say(3);
- }
- else
- {
- Say(61);
- }
- return(true);
- }
- bool OnSubject_JOB(int querytype)
- {
- if(Get(Flag_First_Exit) == false)
- {
- CharmSay(TEST_CHARMED_MERCENARY,63,4);
- }
- else
- {
- CharmSay(TEST_CHARMED_MERCENARY,63,62);
- }
- return(true);
- }
- bool OnSubject_TRAINING(int querytype)
- {
- if(Amicable() == false)
- {
- Say(51);
- return(true);
- }
- if(Get(Flag_Recent_Training_Failed) == true)
- {
- if(Get(Flag_Failed_Lesson_Yet_Again) == true)
- {
- RandomSay(32,35,36);
- }
- else if(Get(Flag_Failed_Lesson_Again) == true)
- {
- RandomSay(31,32,33);
- }
- else if(Get(Flag_Failed_Lesson) == true)
- {
- Say(33);
- }
- else if(Get(Flag_First_Taught) == false)
- {
- Say(28);
- }
- }
- if(Get(Flag_First_Taught)==false)
- {
- Say(7);
- Say(28);
- }
- else if(Get(Flag_Second_Taught)==false)
- {
- Say(57);
- }
- else
- {
- RandomSay(58,59,60);
- }
- int result = Trainer();
- if(result == TRAINRESULT_ABORT)return(true);
- if(Get(Flag_First_Taught)==false)
- {
- Set(Flag_First_Taught);
- }
- else if(Get(Flag_Second_Taught)==false)
- {
- Set(Flag_Second_Taught);
- if(result == TRAINRESULT_SUCCESS)
- {
- Say(70);
- }
- }
- if(result == TRAINRESULT_SUCCESS)
- {
- RandomSay(12,13,14);
- // keep increasing trust and friendship with good students
- ModifyAmity(cPARTY_AGENTSOFWHITEOWL,+1);
- ClearFlag(SELF,Flag_Recent_Training_Failed);
- }
- else
- {
- RandomSay(15,16,17);
- Set(Flag_Recent_Training_Failed);
- if(Get(Flag_Failed_Lesson) == false)
- {
- RandomSay(21,22,23);
- Set(Flag_Failed_Lesson);
- }
- else if(Get(Flag_Failed_Lesson_Again) == false)
- {
- RandomSay(24,25,26);
- Set(Flag_Failed_Lesson_Again);
- }
- else if(Get(Flag_Failed_Lesson_Yet_Again) == false)
- {
- RandomSay(27,21,24);
- Set(Flag_Failed_Lesson_Yet_Again);
- }
- else
- {
- if(FlipCoin())
- {
- RandomSay(22,25,23);
- }
- else
- {
- RandomSay(21,24,26);
- }
- }
- }
- return(true);
- }
- bool OnSubject_SERVICES(int querytype)
- {
- switch(querytype)
- {
- case cDISPATCH_WHAT:
- default:
- if(Charmed(TEST_CHARMED_SERVICES) == true || GetAmity() > TEST_AMITY_OWL)
- {
- if(Get(Flag_Explained_Services)==false)
- {
- Say(64);
- Set(Flag_Explained_Services);
- }
- else
- {
- Say(68);
- }
- }
- else
- {
- RandomSay(65,66,67);
- }
- break;
- }
- return(true);
- }
- bool OnEncounter(int value)
- {
- if(Get(Flag_First_Encounter)==false)
- {
- Narrative(1);
- Say(2);
- Set(Flag_First_Encounter);
- }
- return(true);
- }
- bool OnExitEncounter(int value)
- {
- if(Get(Flag_First_Exit)==false)
- {
- Say(6);
- Set(Flag_First_Exit);
- return(true);
- }
- return(true);
- }
- bool OnExitTalk(int value)
- {
- if(Get(Flag_First_Exit_Talk)==false)
- {
- Say(69);
- Set(Flag_First_Exit_Talk);
- return(true);
- }
- return(true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement