Guest User

Untitled

a guest
Jul 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.72 KB | None | 0 0
  1. #include "sys_chargen_h"
  2. #include "nrt_2da_constants_h"
  3. #include "wrappers_h"
  4. #include "plt_gen00pt_backgrounds"
  5. #include "plt_newraces"
  6.  
  7. void nrt_Chargen_SelectRace(object oChar,int nRace, int bUndo = FALSE)
  8. {
  9.  
  10. Log_Chargen("Chargen_SelectRace","-- " + (bUndo?"Un":"") +"Selecting Race: " + ToString(nRace),oChar);
  11.  
  12. if (!bUndo && nRace != GetCreatureRacialType(oChar))
  13. {
  14. // -------------------------------------------------------------------------
  15. // 1. SetAppearance
  16. // - Retrieve the appearance for the race from races.xls
  17. // - Set Appearance
  18. // - Set Racial Type
  19. // -------------------------------------------------------------------------
  20.  
  21. if (nRace == RACE_HUMAN || nRace == RACE_DWARF || nRace == RACE_ELF || nRace == RACE_HURLOCK)
  22. {
  23. int nApp = GetM2DAInt(TABLE_RULES_RACES, "Appearance", nRace);
  24. if (GetCreatureRacialType(oChar) != nRace)
  25. {
  26. SetAppearanceType(oChar,nApp, TRUE);
  27. SetCreatureRacialType(oChar,nRace);
  28. }
  29.  
  30.  
  31. }
  32. }
  33.  
  34. // Humanoids gain the 'humanoid' trait (prereq for skills)
  35. if (bUndo)
  36. {
  37. RemoveAbility(oChar,ABILITY_TALENT_TRAIT_HUMANOID);
  38. }
  39. else if (IsHumanoid(oChar))
  40. {
  41. AddAbility(oChar,ABILITY_TALENT_TRAIT_HUMANOID,FALSE);
  42. }
  43.  
  44.  
  45. // -------------------------------------------------------------------------
  46. // Dwaves gain dwarven resistance free.
  47. // -------------------------------------------------------------------------
  48. if (nRace == RACE_DWARF)
  49. {
  50. if (!bUndo)
  51. {
  52. AddAbility(oChar, ABILITY_SKILL_DWARVEN_RESISTANCE, FALSE);
  53. }
  54. else
  55. {
  56. RemoveAbility(oChar, ABILITY_SKILL_DWARVEN_RESISTANCE);
  57. }
  58. }
  59.  
  60. Chargen_ApplyRaceModifiers(oChar, bUndo);
  61. }
  62.  
  63. void nrt_Chargen_SelectBackground(object oChar, int nBackground, int bUnApply = FALSE)
  64. {
  65. Log_Chargen("nrt_Chargen_SelectBackground","-- " + (bUnApply?"Un":"") +"Selecting BG: " + ToString(nBackground),oChar);
  66. // -------------------------------------------------------------------------
  67. // 1. Set the background variable
  68. // - Create creature property (or check what we used so far
  69. // - We don't set backgrounds on non player generated chars.
  70. // -------------------------------------------------------------------------
  71. if (bUnApply)
  72. {
  73. SetCreatureProperty(oChar, PROPERTY_SIMPLE_BACKGROUND, 0.0, PROPERTY_VALUE_BASE);
  74. }
  75. else
  76. {
  77. SetCreatureProperty(oChar, PROPERTY_SIMPLE_BACKGROUND, IntToFloat(nBackground), PROPERTY_VALUE_BASE);
  78. }
  79. // -------------------------------------------------------------------------
  80. // 2. Give one skill
  81. // - retrieve the skill that is granted by the background from backgrounds.xls
  82. // - give it to the player.
  83. // -------------------------------------------------------------------------
  84. int nAbility = ChargenGetBackgroundSkill(GetCreatureRacialType(oChar), nBackground);
  85. if (nAbility)
  86. {
  87. _AddAbility (oChar, nAbility, bUnApply);
  88. }
  89. }
  90.  
  91. void nrt_Chargen_SetupPlotFlags(object oChar)
  92. {
  93. int nRace = GetCreatureRacialType(oChar);
  94. int nBackground = GetPlayerBackground(oChar);
  95.  
  96. Log_Trace(LOG_CHANNEL_CHARACTER,"nrt_sys_chargen_h","Setting plot flags, race: "
  97. + IntToString(nRace) + ", background: " + IntToString(nBackground));
  98.  
  99. // First, init all flags (debug setup)
  100. WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_HUMAN_COMMONER,FALSE);
  101. WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_HUMAN_NOBLE,FALSE);
  102. WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_CIRCLE,FALSE);
  103. WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_DWARF_COMMONER,FALSE);
  104. WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_DWARF_NOBLE,FALSE);
  105. WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_ELF_CITY,FALSE);
  106. WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_ELF_DALISH,FALSE);
  107. WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_CIRCLE,FALSE);
  108. WR_SetPlotFlag(PLT_NEWRACES, RPT_GEN_BACK_DARKSPAWN,FALSE);
  109.  
  110. switch (nRace)
  111. {
  112. case RACE_HUMAN:
  113. {
  114. switch(nBackground)
  115. {
  116. case BACKGROUND_COMMONER: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_HUMAN_COMMONER,TRUE); break;
  117. case BACKGROUND_NOBLE: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_HUMAN_NOBLE,TRUE); break;
  118. case BACKGROUND_MAGI: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_CIRCLE,TRUE); break;
  119. }
  120. break;
  121. }
  122. case RACE_DWARF:
  123. {
  124. switch(nBackground)
  125. {
  126. case BACKGROUND_COMMONER: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_DWARF_COMMONER,TRUE); break;
  127. case BACKGROUND_NOBLE: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_DWARF_NOBLE,TRUE); break;
  128. }
  129. break;
  130. }
  131. case RACE_ELF:
  132. {
  133. switch(nBackground)
  134. {
  135. case BACKGROUND_CITY: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_ELF_CITY,TRUE); break;
  136. case BACKGROUND_DALISH: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_ELF_DALISH,TRUE); break;
  137. case BACKGROUND_MAGI: WR_SetPlotFlag(PLT_GEN00PT_BACKGROUNDS, GEN_BACK_CIRCLE,TRUE); break;
  138. }
  139. break;
  140. }
  141. case RACE_HURLOCK:
  142. {
  143. switch(nBackground)
  144. {
  145. case BACKGROUND_DARKSPAWN: WR_SetPlotFlag(PLT_NEWRACES, RPT_GEN_BACK_DARKSPAWN,TRUE); break;
  146.  
  147. }
  148. break;
  149. }
  150. }
  151. }
Add Comment
Please, Sign In to add comment