Advertisement
Antonic

Untitled

Oct 1st, 2022
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.42 KB | None | 0 0
  1. /***********************************************************************/
  2. /** © 2015 CD PROJEKT S.A. All rights reserved.
  3. /** THE WITCHER® is a trademark of CD PROJEKT S. A.
  4. /** The Witcher game is based on the prose of Andrzej Sapkowski.
  5. /***********************************************************************/
  6. enum EFloatingValueType
  7. {
  8. EFVT_None,
  9. EFVT_Critical,
  10. EFVT_Block,
  11. EFVT_InstantDeath,
  12. EFVT_DoT,
  13. EFVT_Heal,
  14. EFVT_Buff
  15. }
  16.  
  17. class CR4HudModuleEnemyFocus extends CR4HudModuleBase
  18. {
  19.  
  20.  
  21.  
  22.  
  23. private var m_fxSetEnemyName : CScriptedFlashFunction;
  24. private var m_fxSetEnemyLevel : CScriptedFlashFunction;
  25. private var m_fxSetAttitude : CScriptedFlashFunction;
  26. private var m_fxSetEnemyHealth : CScriptedFlashFunction;
  27. private var m_fxSetEnemyStamina : CScriptedFlashFunction;
  28. private var m_fxSetEssenceBarVisibility : CScriptedFlashFunction;
  29. private var m_fxSetStaminaVisibility : CScriptedFlashFunction;
  30. private var m_fxSetNPCQuestIcon : CScriptedFlashFunction;
  31. private var m_fxSetDodgeFeedback : CScriptedFlashFunction;
  32. private var m_fxSetBossOrDead : CScriptedFlashFunction;
  33. private var m_fxSetShowHardLock : CScriptedFlashFunction;
  34. private var m_fxSetDamageText : CScriptedFlashFunction;
  35. private var m_fxHideDamageText : CScriptedFlashFunction;
  36. private var m_fxSetGeneralVisibility : CScriptedFlashFunction;
  37. private var m_fxSetMutationEightVisibility : CScriptedFlashFunction;
  38.  
  39. private var m_mcNPCFocus : CScriptedFlashSprite;
  40.  
  41. private var m_lastTarget : CGameplayEntity;
  42. private var m_lastTargetAttitude : EAIAttitude;
  43. private var m_lastHealthPercentage : int;
  44. private var m_wasAxiied : bool;
  45. private var m_lastStaminaPercentage : int;
  46. private var m_nameInterval : float;
  47. private var m_lastEnemyDifferenceLevel : string;
  48. private var m_lastEnemyLevelString : string;
  49. private var m_lastDodgeFeedbackTarget : CActor;
  50. private var m_lastEnemyName : string;
  51. private var m_lastUseMutation8Icon : bool;
  52. private var m_showName : bool;
  53.  
  54.  
  55.  
  56. event OnConfigUI()
  57. {
  58. var flashModule : CScriptedFlashSprite;
  59. var hud : CR4ScriptedHud;
  60.  
  61. m_anchorName = "ScaleOnly";
  62.  
  63. flashModule = GetModuleFlash();
  64.  
  65. m_fxSetEnemyName = flashModule.GetMemberFlashFunction( "setEnemyName" );
  66. m_fxSetEnemyLevel = flashModule.GetMemberFlashFunction( "setEnemyLevel" );
  67. m_fxSetAttitude = flashModule.GetMemberFlashFunction( "setAttitude" );
  68. m_fxSetEnemyHealth = flashModule.GetMemberFlashFunction( "setEnemyHealth" );
  69. m_fxSetEnemyStamina = flashModule.GetMemberFlashFunction( "setEnemyStamina" );
  70. m_fxSetEssenceBarVisibility = flashModule.GetMemberFlashFunction( "setEssenceBarVisibility" );
  71. m_fxSetStaminaVisibility = flashModule.GetMemberFlashFunction( "setStaminaVisibility" );
  72. m_fxSetNPCQuestIcon = flashModule.GetMemberFlashFunction( "setNPCQuestIcon" );
  73. m_fxSetDodgeFeedback = flashModule.GetMemberFlashFunction( "setDodgeFeedback" );
  74. m_fxSetDamageText = flashModule.GetMemberFlashFunction( "setDamageText" );
  75. m_fxHideDamageText = flashModule.GetMemberFlashFunction( "hideDamageText" );
  76. m_fxSetBossOrDead = flashModule.GetMemberFlashFunction( "SetBossOrDead" );
  77. m_fxSetShowHardLock = flashModule.GetMemberFlashFunction( "setShowHardLock" );
  78. m_fxSetGeneralVisibility = flashModule.GetMemberFlashFunction( "SetGeneralVisibility" );
  79. m_fxSetMutationEightVisibility = flashModule.GetMemberFlashFunction( "displayMutationEight" );
  80. m_mcNPCFocus = flashModule.GetChildFlashSprite( "mcNPCFocus" );
  81.  
  82. super.OnConfigUI();
  83.  
  84. m_fxSetEnemyName.InvokeSelfOneArg( FlashArgString( "" ) );
  85. m_fxSetEnemyStamina.InvokeSelfOneArg(FlashArgInt(0));
  86.  
  87.  
  88. hud = (CR4ScriptedHud)theGame.GetHud();
  89.  
  90. if (hud)
  91. {
  92. hud.UpdateHudConfig('EnemyFocusModule', true);
  93. }
  94. }
  95.  
  96.  
  97.  
  98. private function GetAttitudeOfTargetActor( target : CGameplayEntity ) : EAIAttitude
  99. {
  100. var targetActor : CActor;
  101.  
  102. targetActor = ( CActor )target;
  103. if ( targetActor )
  104. {
  105. return targetActor.GetAttitude( thePlayer );
  106. }
  107. return AIA_Neutral;
  108. }
  109.  
  110.  
  111. public function SetDodgeFeedback( target : CActor ) :void
  112. {
  113. m_fxSetDodgeFeedback.InvokeSelfOneArg( FlashArgBool( !( !target ) ) );
  114. m_lastDodgeFeedbackTarget = target;
  115. }
  116.  
  117.  
  118. public function DisplayMutationEight( value : bool ) :void
  119. {
  120. m_fxSetMutationEightVisibility.InvokeSelfOneArg( FlashArgBool ( value ) );
  121. }
  122.  
  123.  
  124. public function SetGeneralVisibility( showEnemyFocus : bool, showName : bool, showDescriptiveLevel : bool )
  125. {
  126. m_fxSetGeneralVisibility.InvokeSelfTwoArgs( FlashArgBool( showEnemyFocus ), FlashArgBool( showDescriptiveLevel ) );
  127. m_showName = showName;
  128. }
  129.  
  130.  
  131.  
  132. public function ShowDamageType(valueType : EFloatingValueType, value : float, optional stringParam : string)
  133. {
  134. var label:string;
  135. var color:float;
  136. var hud:CR4ScriptedHud;
  137.  
  138. //---=== modFriendlyHUD ===---
  139. if ( GetFHUDConfig().doNotShowDamage )
  140. return;
  141. //---=== modFriendlyHUD ===---
  142.  
  143. if(valueType != EFVT_InstantDeath && valueType != EFVT_Buff && value == 0.f)
  144. return;
  145.  
  146. hud = (CR4ScriptedHud)theGame.GetHud();
  147. if ( !hud.AreEnabledEnemyHitEffects() )
  148. {
  149. return;
  150. }
  151.  
  152. switch (valueType)
  153. {
  154. case EFVT_Critical:
  155. label = GetLocStringByKeyExt("attribute_name_critical_hit_damage");
  156. color = 0xFDFFC2;
  157. break;
  158. case EFVT_InstantDeath:
  159. label = GetLocStringByKeyExt("effect_instant_death");
  160. color = 0xFFC2C2;
  161. break;
  162. case EFVT_Block:
  163. label = GetLocStringByKeyExt("");
  164. color = 0xFC5B5B;
  165. break;
  166. case EFVT_DoT:
  167. label = GetLocStringByKeyExt("");
  168. color = 0xFF0000;
  169. break;
  170. case EFVT_Heal:
  171. label = GetLocStringByKeyExt("");
  172. color = 0x00FF00;
  173. break;
  174. case EFVT_Buff:
  175. label = GetLocStringByKeyExt(stringParam);
  176. color = 0xFFF0F0;
  177. break;
  178. default:
  179. label = GetLocStringByKeyExt("");
  180. color = 0xFFF0F0;
  181. break;
  182. }
  183. SetDamageText(label, CeilF(value), color);
  184. }
  185.  
  186.  
  187.  
  188. private function SetDamageText(label:string, value:int, color:float) : void
  189. {
  190. m_fxSetDamageText.InvokeSelfThreeArgs( FlashArgString(label), FlashArgNumber(value), FlashArgNumber(color) );
  191. }
  192. public function HideDamageText()
  193. {
  194. m_fxHideDamageText.InvokeSelf();
  195. }
  196.  
  197.  
  198.  
  199.  
  200. event OnTick( timeDelta : float )
  201. {
  202. var l_target : CNewNPC;
  203. var l_targetNonActor : CGameplayEntity;
  204. var l_isHuman : bool;
  205. var l_isDifferentTarget : bool;
  206. var l_wasAxiied : bool;
  207. var l_currentHealthPercentage : int;
  208. var l_currentStaminaPercentage : int;
  209. var l_currentTargetAttitude : EAIAttitude;
  210. var l_currentEnemyDifferenceLevel : string;
  211. var l_currentEnemyLevelString : string;
  212. var l_targetScreenPos : Vector;
  213. var l_dodgeFeedbackTarget : CActor;
  214. var l_isBoss : bool;
  215. var screenMargin : float = 0.025;
  216. var marginLeftTop : Vector;
  217. var marginRightBottom : Vector;
  218. var hud : CR4ScriptedHud;
  219. var extraOffset : int;
  220. var herbTag : name;
  221. var herbEntity : W3Herb;
  222. var definitionManager : CDefinitionsManagerAccessor;
  223. var useMutation8Icon : bool;
  224. var displayName, entityName, levelName : string;
  225. var language, audioLanguage : string;
  226. l_targetNonActor = thePlayer.GetDisplayTarget();
  227. l_target = (CNewNPC)l_targetNonActor;
  228. l_dodgeFeedbackTarget = thePlayer.GetDodgeFeedbackTarget();
  229.  
  230. hud = (CR4ScriptedHud)theGame.GetHud();
  231.  
  232. definitionManager = theGame.GetDefinitionsManager();
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244. if ( l_target )
  245. {
  246. if ( !l_target.IsUsingTooltip())
  247. {
  248. l_target = NULL;
  249. }
  250. }
  251. if ( l_target )
  252. {
  253.  
  254.  
  255. if ( l_target.HasTag( 'HideHealthBarModule' ) )
  256. {
  257. if ( l_target.HasTag( 'NotBoss' ) )
  258. {
  259. l_target = NULL;
  260. }
  261. else
  262. l_isBoss = (!GetFHUDConfig().showBossHP); //modFriendlyHUD
  263. }
  264. else
  265. {
  266.  
  267. if ( (CHeartMiniboss)l_target )
  268. {
  269. l_target = NULL;
  270. }
  271. }
  272. }
  273.  
  274. if ( l_target )
  275. {
  276.  
  277. l_isHuman = l_target.IsHuman();
  278. l_isDifferentTarget = ( l_target != m_lastTarget );
  279. l_wasAxiied = ( l_target.GetAttitudeGroup() == 'npc_charmed' );
  280.  
  281.  
  282.  
  283.  
  284. if(l_isDifferentTarget && l_target && !l_target.IsInCombat() && IsRequiredAttitudeBetween(thePlayer, l_target, true))
  285. {
  286. l_target.RecalcLevel();
  287. }
  288.  
  289.  
  290. if ( l_isDifferentTarget )
  291. {
  292. m_fxSetBossOrDead.InvokeSelfOneArg( FlashArgBool( l_isBoss || !l_target.IsAlive() ) );
  293.  
  294.  
  295. HideDamageText();
  296.  
  297.  
  298. m_fxSetStaminaVisibility.InvokeSelfOneArg( FlashArgBool( l_isHuman ) );
  299. m_fxSetEssenceBarVisibility.InvokeSelfOneArg( FlashArgBool( l_target.UsesEssence()) );
  300. UpdateQuestIcon( l_target );
  301. SetDodgeFeedback( NULL );
  302.  
  303. ShowElement( true );
  304.  
  305. m_lastTarget = l_target;
  306. }
  307.  
  308.  
  309.  
  310. l_currentTargetAttitude = l_target.GetAttitude( thePlayer );
  311. if ( l_currentTargetAttitude != AIA_Hostile )
  312. {
  313.  
  314. if ( l_target.IsVIP() )
  315. {
  316. l_currentTargetAttitude = 4;
  317. }
  318. }
  319.  
  320. if ( l_isDifferentTarget || m_lastTargetAttitude != l_currentTargetAttitude || m_wasAxiied != l_wasAxiied )
  321. {
  322. m_lastTargetAttitude = l_currentTargetAttitude;
  323. m_wasAxiied = l_wasAxiied;
  324. if( m_wasAxiied )
  325. {
  326. m_fxSetAttitude.InvokeSelfOneArg( FlashArgInt( 3 ) );
  327. }
  328. else
  329. {
  330. m_fxSetAttitude.InvokeSelfOneArg( FlashArgInt( l_currentTargetAttitude ) );
  331. }
  332. }
  333.  
  334.  
  335. if ( m_lastDodgeFeedbackTarget != l_dodgeFeedbackTarget )
  336. {
  337. if ( l_currentTargetAttitude == AIA_Hostile )
  338. {
  339. SetDodgeFeedback( l_dodgeFeedbackTarget );
  340. }
  341. else
  342. {
  343. SetDodgeFeedback( NULL );
  344. }
  345. m_lastDodgeFeedbackTarget = l_dodgeFeedbackTarget;
  346. }
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353. m_nameInterval -= timeDelta;
  354. if ( l_isDifferentTarget || m_nameInterval < 0 )
  355. {
  356. m_nameInterval = 0.25;
  357.  
  358. //---=== modFriendlyHUD ===---
  359. if( GetFHUDConfig().ShowNPCName(l_target) )
  360. {
  361. UpdateName( l_target.GetDisplayName() );
  362. }
  363.  
  364. if (l_currentTargetAttitude == AIA_Hostile && !l_isBoss && !DisallowDescriptive(l_target) && GetReduxConfig().reduxDL)
  365. {
  366. levelName = definitionManager.GetDescriptiveLevel(l_target);
  367. }
  368.  
  369. entityName = l_target.GetDisplayName();
  370. theGame.GetGameLanguageName(audioLanguage, language);
  371.  
  372. if (levelName != "" && KeyCharacterName(entityName, language))
  373. {
  374. levelName = "";
  375. }
  376.  
  377. if(m_showName)
  378. {
  379. if (levelName != "")
  380. {
  381. if (language == "RU")
  382. {
  383. entityName = StrLowerUTF(entityName);
  384. }
  385.  
  386. if (language == "FR")
  387. {
  388. displayName = entityName + " " + levelName;
  389. }
  390. else
  391. {
  392. displayName = levelName + " " + entityName;
  393. }
  394. }
  395. else
  396. {
  397. displayName = entityName;
  398. }
  399. }
  400. else
  401. {
  402. displayName = levelName;
  403. }
  404.  
  405. UpdateName( displayName );
  406. }
  407. else
  408. {
  409. UpdateName( "" );
  410. }
  411. //---=== modFriendlyHUD ===---
  412. }
  413.  
  414.  
  415. l_currentHealthPercentage = CeilF( 100 * l_target.GetHealthPercents() );
  416. if ( m_lastHealthPercentage != l_currentHealthPercentage )
  417. {
  418. m_lastHealthPercentage = l_currentHealthPercentage;
  419. m_fxSetEnemyHealth.InvokeSelfOneArg( FlashArgInt( l_currentHealthPercentage ) );
  420.  
  421. }
  422.  
  423.  
  424. l_currentStaminaPercentage = CeilF( 100 * l_target.GetStaminaPercents() );
  425. if ( m_lastStaminaPercentage != l_currentStaminaPercentage )
  426. {
  427. m_lastStaminaPercentage = l_currentStaminaPercentage;
  428. m_fxSetEnemyStamina.InvokeSelfOneArg( FlashArgInt( l_currentStaminaPercentage ) );
  429. }
  430.  
  431.  
  432. l_currentEnemyDifferenceLevel = l_target.GetExperienceDifferenceLevelName( l_currentEnemyLevelString );
  433. if (!GetReduxConfig().reduxDL)
  434. {
  435. if ( l_isDifferentTarget ||
  436. m_lastEnemyDifferenceLevel != l_currentEnemyDifferenceLevel ||
  437. m_lastEnemyLevelString != l_currentEnemyLevelString )
  438. {
  439. m_lastEnemyDifferenceLevel = l_currentEnemyDifferenceLevel;
  440. m_lastEnemyLevelString = l_currentEnemyLevelString;
  441. //---=== modFriendlyHUD ===---
  442. switch ( GetFHUDConfig().doNotShowLevels )
  443. {
  444. case 1:
  445. m_fxSetEnemyLevel.InvokeSelfTwoArgs( FlashArgString( "none" ), FlashArgString( "" ) );
  446. break;
  447. case 2:
  448. m_fxSetEnemyLevel.InvokeSelfTwoArgs( FlashArgString( l_currentEnemyDifferenceLevel ), FlashArgString( "*" ) );
  449. break;
  450. default:
  451. m_fxSetEnemyLevel.InvokeSelfTwoArgs( FlashArgString( l_currentEnemyDifferenceLevel ), FlashArgString( l_currentEnemyLevelString ) );
  452. break;
  453. }
  454. //---=== modFriendlyHUD ===---
  455. }
  456. }
  457.  
  458.  
  459. useMutation8Icon = GetWitcherPlayer().IsMutationActive( EPMT_Mutation8 ) && !l_target.IsImmuneToMutation8Finisher();
  460. if ( m_lastUseMutation8Icon != useMutation8Icon )
  461. {
  462. m_lastUseMutation8Icon = useMutation8Icon;
  463. DisplayMutationEight( useMutation8Icon );
  464. }
  465.  
  466.  
  467. if ( GetBaseScreenPosition( l_targetScreenPos, l_target ) )
  468. {
  469. l_targetScreenPos.Y -= 45;
  470.  
  471. marginLeftTop = hud.GetScaleformPoint( screenMargin, screenMargin );
  472. marginRightBottom = hud.GetScaleformPoint( 1 - screenMargin, 1 - screenMargin );
  473.  
  474. if ( l_targetScreenPos.X < marginLeftTop.X )
  475. {
  476. l_targetScreenPos.X = marginLeftTop.X;
  477. }
  478. else if ( l_targetScreenPos.X > marginRightBottom.X )
  479. {
  480. l_targetScreenPos.X = marginRightBottom.X;
  481. }
  482.  
  483. if ( l_targetScreenPos.Y < marginLeftTop.Y )
  484. {
  485. l_targetScreenPos.Y = marginLeftTop.Y;
  486. }
  487. else if ( l_targetScreenPos.Y > marginRightBottom.Y )
  488. {
  489. l_targetScreenPos.Y = marginRightBottom.Y;
  490. }
  491. // Enemy Healthbar On Top - BEGIN
  492. if ( l_target.GetAttitude( thePlayer ) == AIA_Hostile && ! l_isBoss)
  493. {
  494. l_targetScreenPos.X = curResolutionWidth / 2;
  495. l_targetScreenPos.Y = curResolutionHeight / 20;
  496. }
  497. // Enemy Healthbar On Top - END
  498. m_mcNPCFocus.SetVisible( true );
  499. m_mcNPCFocus.SetPosition( l_targetScreenPos.X, l_targetScreenPos.Y );
  500. }
  501. else
  502. {
  503. m_mcNPCFocus.SetVisible( false );
  504. }
  505. }
  506. else if ( l_targetNonActor )
  507. {
  508.  
  509. l_isDifferentTarget = ( l_targetNonActor != m_lastTarget );
  510.  
  511.  
  512. if ( l_isDifferentTarget )
  513. {
  514.  
  515. m_fxSetStaminaVisibility.InvokeSelfOneArg( FlashArgBool( false ) );
  516. m_fxSetEssenceBarVisibility.InvokeSelfOneArg( FlashArgBool( false ) );
  517. UpdateQuestIcon( (CNewNPC)l_targetNonActor );
  518. SetDodgeFeedback( NULL );
  519.  
  520. ShowElement( true );
  521.  
  522. m_fxSetAttitude.InvokeSelfOneArg( FlashArgInt( 0 ) );
  523. m_fxSetEnemyLevel.InvokeSelfTwoArgs( FlashArgString( "none" ), FlashArgString( "" ) );
  524.  
  525.  
  526. m_lastTarget = l_targetNonActor;
  527. m_lastTargetAttitude = GetAttitudeOfTargetActor( m_lastTarget );
  528. m_lastHealthPercentage = -1;
  529. m_lastStaminaPercentage = -1;
  530. m_lastEnemyDifferenceLevel = "none";
  531. m_lastEnemyLevelString = "";
  532. }
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540. herbEntity = (W3Herb)l_targetNonActor;
  541. if ( herbEntity && m_showName )
  542. {
  543. extraOffset = 140;
  544. m_nameInterval -= timeDelta;
  545. if ( l_isDifferentTarget || m_nameInterval < 0 )
  546. {
  547. m_nameInterval = 0.25;
  548.  
  549. herbEntity.GetStaticMapPinTag( herbTag );
  550. //---=== modFriendlyHUD ===---
  551. if ( (bool)herbTag && !GetFHUDConfig().hideHerbNames )
  552. //---=== modFriendlyHUD ===---
  553. {
  554. //definitionManager = theGame.GetDefinitionsManager();
  555. if ( definitionManager )
  556. {
  557. UpdateName( GetLocStringByKeyExt( definitionManager.GetItemLocalisationKeyName( herbTag ) ) );
  558. }
  559. }
  560. else
  561. {
  562. UpdateName( "" );
  563. }
  564. }
  565. }
  566. else
  567. {
  568. if ( l_isDifferentTarget )
  569. {
  570. UpdateName( "" );
  571. }
  572. }
  573.  
  574.  
  575. useMutation8Icon = false;
  576. if ( m_lastUseMutation8Icon != useMutation8Icon )
  577. {
  578. DisplayMutationEight( useMutation8Icon );
  579. m_lastUseMutation8Icon = useMutation8Icon;
  580. }
  581.  
  582.  
  583. if ( GetBaseScreenPosition( l_targetScreenPos, l_targetNonActor ) )
  584. {
  585. l_targetScreenPos.Y -= 10;
  586. l_targetScreenPos.Y -= extraOffset;
  587.  
  588. marginLeftTop = hud.GetScaleformPoint( screenMargin, screenMargin );
  589. marginRightBottom = hud.GetScaleformPoint( 1 - screenMargin, 1 - screenMargin );
  590.  
  591. if ( l_targetScreenPos.X < marginLeftTop.X )
  592. {
  593. l_targetScreenPos.X = marginLeftTop.X;
  594. }
  595. else if ( l_targetScreenPos.X > marginRightBottom.X )
  596. {
  597. l_targetScreenPos.X = marginRightBottom.X;
  598. }
  599.  
  600. if ( l_targetScreenPos.Y < marginLeftTop.Y )
  601. {
  602. l_targetScreenPos.Y = marginLeftTop.Y;
  603. }
  604. else if ( l_targetScreenPos.Y > marginRightBottom.Y )
  605. {
  606. l_targetScreenPos.Y = marginRightBottom.Y;
  607. }
  608.  
  609. m_mcNPCFocus.SetVisible( true );
  610. m_mcNPCFocus.SetPosition( l_targetScreenPos.X, l_targetScreenPos.Y );
  611. }
  612. else
  613. {
  614. m_mcNPCFocus.SetVisible( false );
  615. }
  616. }
  617. else if ( m_lastTarget )
  618. {
  619. m_lastTarget = NULL;
  620. m_mcNPCFocus.SetVisible( false );
  621. SetDodgeFeedback( NULL );
  622. ShowElement( false );
  623. }
  624. else
  625. {
  626.  
  627. if ( m_mcNPCFocus.GetVisible() )
  628. {
  629. m_mcNPCFocus.SetVisible( false );
  630. ShowElement( false );
  631. }
  632. }
  633. }
  634.  
  635. private function DisallowDescriptive(l_target : CNewNPC) : bool
  636. {
  637. return (
  638. l_target.HasAbility('mon_troll_fistfight') ||
  639. l_target.HasAbility('mon_wild_hunt_default') ||
  640. l_target.HasAbility('mon_heart_miniboss') ||
  641. l_target.HasAbility('mon_wild_hunt_minion_weak') ||
  642. l_target.HasAbility('mon_wild_hunt_minion_lesser') ||
  643. l_target.HasAbility('mon_wild_hunt_minion') ||
  644. l_target.HasAbility('mon_witch1') ||
  645. l_target.HasAbility('mon_witch2') ||
  646. l_target.HasAbility('mon_witch3') ||
  647. l_target.HasAbility('mon_q704_ft_pixies') ||
  648. l_target.HasAbility('SkillFistsHard') ||
  649. l_target.HasAbility('SkillFistsMedium') ||
  650. l_target.HasAbility('SkillFistsEasy') ||
  651. l_target.HasAbility('mon_dettlaff_construct_base') ||
  652. l_target.HasAbility('mon_dettlaff_column_weak') ||
  653. l_target.HasAbility('mon_dettlaff_column_strong') ||
  654. l_target.HasAbility('mq1019_priestFakeLevel') ||
  655. l_target.HasAbility('olgierd_default_stats') ||
  656. l_target.HasAbility('mon_broom_base') ||
  657. l_target.HasAbility('banshee_summons') ||
  658. l_target.HasAbility('mon_baronswife') ||
  659. l_target.HasAbility('VesemirDamage') ||
  660. l_target.HasAbility('HealthFistFightTutorial') ||
  661. l_target.HasAbility('HealthFistFightEasy') ||
  662. l_target.HasAbility('HealthFistFightMedium') ||
  663. l_target.HasAbility('HealthFistFightHard') ||
  664. l_target.HasAbility('qth1003_kiyan') ||
  665. l_target.HasAbility('qRosaVarAttre') ||
  666. l_target.HasAbility('qSergeantFistFIght') ||
  667. l_target.HasAbility('MiniBoss') ||
  668. l_target.HasAbility('Boss') ||
  669. l_target.HasAbility('q302_whorenson') ||
  670. l_target.HasAbility('q302_bear') ||
  671. l_target.HasAbility('q302_mh104') ||
  672. l_target.HasAbility('q302_ReplacerThugs') ||
  673. l_target.HasAbility('mq0003_noonwraith')
  674. );
  675. }
  676.  
  677. private function KeyCharacterName(entityName : string, language : string) : bool
  678. {
  679. return (
  680. entityName == GetLocStringById(509796) || //Nathaniel Pastodi
  681. entityName == GetLocStringById(492157) || //Ernst van Hoorn
  682. entityName == GetLocStringById(1049412) || //Gustav Roene
  683. entityName == GetLocStringById(174091) || //Dandelion
  684. (entityName == GetLocStringById(1051217) && language == "RU") || //Whoreson's Henchman
  685. entityName == GetLocStringById(467824) || //Vernossiel
  686. entityName == GetLocStringById(1159914) || //Pale Widow
  687. entityName == GetLocStringById(341434) || //Steingrim
  688. entityName == GetLocStringById(1086642) || //Clan An Craite Guard
  689. entityName == GetLocStringById(1086643) || //Clan Brokvar Guard
  690. entityName == GetLocStringById(1086644) || //Clan Dimun Guard
  691. entityName == GetLocStringById(1086645) || //Clan Drummond Guard
  692. entityName == GetLocStringById(1086646) || //Clan Heymaey Guard
  693. entityName == GetLocStringById(180880) || //Clan Tuirseach Guard
  694. entityName == GetLocStringById(1086456) || //Brokvar Shieldmaiden
  695. entityName == GetLocStringById(1086457) || //An Craite Shieldmaiden
  696. entityName == GetLocStringById(1086458) || //Dimun Shieldmaiden
  697. entityName == GetLocStringById(1086459) || //Drummond Shieldmaiden
  698. entityName == GetLocStringById(1086460) || //Heymaey Shieldmaiden
  699. entityName == GetLocStringById(1086461) || //Tuirseach Shieldmaiden
  700. entityName == GetLocStringById(1047248) || //Troll Joe
  701. entityName == GetLocStringById(1047249) || //Troll Jesse
  702. entityName == GetLocStringById(1047252) || //Troll Dodger
  703. entityName == GetLocStringById(503840) || //Ronvid of the Small Marsh
  704. entityName == GetLocStringById(1055566) || //Ronvid's Friend
  705. entityName == GetLocStringById(1199817) || //Madman Lugos 1/2
  706. entityName == GetLocStringById(166474) || //Madman Lugos 2/2
  707. entityName == GetLocStringById(1018188) || //Jutta
  708. entityName == GetLocStringById(581137) || //Hammond
  709. entityName == GetLocStringById(501932) || //Morkvarg
  710. entityName == GetLocStringById(1055580) || //Manfred Grossbart
  711. entityName == GetLocStringById(1055581) || //Hegel Grossbart
  712. entityName == GetLocStringById(1055582) || //Jesse Grossbart
  713. entityName == GetLocStringById(1056273) || //Ulle the Unlucky
  714. entityName == GetLocStringById(474721) || //Kori
  715. entityName == GetLocStringById(474724) || //Kraki
  716. entityName == GetLocStringById(1051564) || //Simun Brambling
  717. entityName == GetLocStringById(1059579) || //Guard Dog
  718. entityName == GetLocStringById(166457) || //Arnvald
  719. entityName == GetLocStringById(171505) || //Fugas
  720. entityName == GetLocStringById(180322) || //Halgrim
  721. entityName == GetLocStringById(1048435) || //Earl
  722. (entityName == GetLocStringById(480174) && language == "RU") || //Dijkstra's Henchman 1/3
  723. (entityName == GetLocStringById(488917) && language == "RU") || //Dijkstra's Henchman 2/3
  724. (entityName == GetLocStringById(1052062) && language == "RU") || //Dijkstra's Henchman 3/3
  725. entityName == GetLocStringById(1059068) || //Bart
  726. entityName == GetLocStringById(595891) || //Peasant 1/8
  727. entityName == GetLocStringById(1055097) || //Peasant 2/8
  728. entityName == GetLocStringById(166469) || //Peasant 3/8
  729. entityName == GetLocStringById(172329) || //Peasant 4/8
  730. entityName == GetLocStringById(444265) || //Peasant 5/8
  731. entityName == GetLocStringById(532375) || //Peasant 6/8
  732. entityName == GetLocStringById(595913) || //Peasant 7/8
  733. entityName == GetLocStringById(1055084) || //Peasant 8/8
  734. entityName == GetLocStringById(1137608) || //Eulalia von Everec
  735. entityName == GetLocStringById(1137609) || //Honoratina von Everec
  736. entityName == GetLocStringById(1137610) || //Kestatis von Everec
  737. entityName == GetLocStringById(1137611) || //Alexy von Everec
  738. entityName == GetLocStringById(1137612) || //Ernest von Everec
  739. entityName == GetLocStringById(1104540) || //Quinto
  740. entityName == GetLocStringById(1104837) || //Casimir
  741. entityName == GetLocStringById(1079736) || //Young One
  742. entityName == GetLocStringById(525756) || //Young Arachas
  743. entityName == GetLocStringById(1197251) || //Living Statue
  744. entityName == GetLocStringById(1125951) || //Delwyn of Creigiau
  745. entityName == GetLocStringById(1125948) || //Rainfarn of Attre
  746. entityName == GetLocStringById(1125920) || //Donimir of Troy
  747. entityName == GetLocStringById(1125950) || //Guy de Bois-Fresnes
  748. entityName == GetLocStringById(1125949) || //Prince Horm Akerspaark of Maecht
  749. entityName == GetLocStringById(1125952) || //Llinos of Metinna
  750. entityName == GetLocStringById(1124660) || //Baron Palmerin de Launfal
  751. entityName == GetLocStringById(172316) || //Witch Hunter
  752. (entityName == GetLocStringById(458127) && language == "RU") || //Guard 1/2
  753. (entityName == GetLocStringById(458130) && language == "RU") || //Guard 2/2
  754. entityName == GetLocStringById(300169) || //Philippa Eilhart 1/2
  755. entityName == GetLocStringById(1065213) || //Philippa Eilhart 2/2
  756. (entityName == GetLocStringById(1194573) && language == "RU") || //Hansa Dog
  757. (entityName == GetLocStringById(1119408) && language == "RU") || //Dracolizard
  758. entityName == GetLocStringById(1209398) || //Dracolizard Matriarch
  759. entityName == GetLocStringById(1168278) || //Great Beggar's Ghost
  760. entityName == GetLocStringById(1145517) || //Beau Duvall
  761. entityName == GetLocStringById(1188336) || //Gromm
  762. entityName == GetLocStringById(1188337) || //Argoin
  763. entityName == GetLocStringById(1188338) || //Yaki Rafiberg
  764. entityName == GetLocStringById(1209925) || //Hornitz
  765. entityName == GetLocStringById(1199456) || //Tad
  766. entityName == GetLocStringById(1199454) || //Madden
  767. entityName == GetLocStringById(1199455) || //Nevin
  768. entityName == GetLocStringById(1199453) || //Keir
  769. entityName == GetLocStringById(1184463) || //Roderick of Dun Tynne
  770. entityName == GetLocStringById(1207111) || //Iron Borg
  771. entityName == GetLocStringById(1205323) || //Peeps
  772. entityName == GetLocStringById(1205362) || //Ox
  773. entityName == GetLocStringById(1205382) || //Gueule
  774. entityName == GetLocStringById(1205389) || //Catfish
  775. entityName == GetLocStringById(1187538) || //Dun Tynne Guard
  776. (entityName == GetLocStringById(1199796) && language == "RU") || //Nazairi Bandit 1/2
  777. (entityName == GetLocStringById(1200141) && language == "RU") || //Nazairi Bandit 2/2
  778. entityName == GetLocStringById(1199660) || //Cael
  779. entityName == GetLocStringById(1165552) || //Redbeard 1/3
  780. entityName == GetLocStringById(1186383) || //Redbeard 2/3
  781. entityName == GetLocStringById(1190140) //Redbeard 3/3
  782. );
  783. }
  784.  
  785. public function UpdateName( enemyName : string )
  786. {
  787. if ( m_lastEnemyName != enemyName )
  788. {
  789. m_lastEnemyName = enemyName;
  790. m_fxSetEnemyName.InvokeSelfOneArg( FlashArgString( m_lastEnemyName ) );
  791. }
  792. }
  793.  
  794. public function SetShowHardLock( set : bool )
  795. {
  796. m_fxSetShowHardLock.InvokeSelfOneArg( FlashArgBool( set ) );
  797. }
  798.  
  799. protected function UpdateScale( scale : float, flashModule : CScriptedFlashSprite ) : bool
  800. {
  801. return false;
  802. }
  803.  
  804. //---=== modFriendlyHUD ===---
  805. private function UpdateQuestIcon( target : CNewNPC )
  806. {
  807. var questIcon : string;
  808.  
  809. if( GetFHUDConfig().hideNPCQuestMarkers )
  810. {
  811. questIcon = "none";
  812. }
  813. else
  814. {
  815. questIcon = GetQuestIconFromMarker( target );
  816. if( questIcon == "none" )
  817. {
  818. questIcon = GetQuestIconFromJournal( target );
  819. }
  820. }
  821. m_fxSetNPCQuestIcon.InvokeSelfOneArg( FlashArgString( questIcon ) );
  822. }
  823.  
  824. private function GetQuestIconFromMarker( target : CNewNPC ) : string
  825. {
  826. var mapPinInstances : array< SCommonMapPinInstance >;
  827. var commonMapManager : CCommonMapManager;
  828. var currentPin : SCommonMapPinInstance;
  829. var targetTags : array< name >;
  830. var i : int;
  831. var questIcon : string;
  832. var mapPinType : name;
  833.  
  834. questIcon = "none";
  835.  
  836. if ( target )
  837. {
  838. targetTags = target.GetTags();
  839.  
  840. if (targetTags.Size() > 0)
  841. {
  842. commonMapManager = theGame.GetCommonMapManager();
  843.  
  844. mapPinType = commonMapManager.GetMapPinTypeByTag( targetTags[0] );
  845. switch ( mapPinType )
  846. {
  847. case 'QuestReturn':
  848. questIcon = "QuestReturn";
  849. break;
  850. case 'QuestGiverStory':
  851. questIcon = "QuestGiverStory";
  852. break;
  853. case 'QuestGiverChapter':
  854. questIcon = "QuestGiverChapter";
  855. break;
  856. case 'QuestGiverSide':
  857. case 'QuestAvailable':
  858. case 'QuestAvailableHoS':
  859. case 'QuestAvailableBaW':
  860. questIcon = "QuestGiverSide";
  861. break;
  862. case 'MonsterQuest':
  863. questIcon = "MonsterQuest";
  864. break;
  865. case 'TreasureQuest':
  866. questIcon = "TreasureQuest";
  867. break;
  868. }
  869. }
  870. }
  871. return questIcon;
  872. }
  873.  
  874. private function GetQuestIconFromJournal( target : CNewNPC ) : string
  875. {
  876. var journalManager : CWitcherJournalManager;
  877. var currentQuest : CJournalQuest;
  878. var currentPhase : CJournalQuestPhase;
  879. var currentObjective : CJournalQuestObjective;
  880. var questsList : array< CJournalBase >;
  881. var questsCount, qIdx : int;
  882. var phaseCount, pIdx : int;
  883. var objCount, oIdx : int;
  884. var pinsCount, pinIdx : int;
  885. var currentMappin : CJournalQuestMapPin;
  886. var questIcon : string;
  887. var targetTags : array< name >;
  888. var tagsCount, tIdx : int;
  889.  
  890. questIcon = "none";
  891. if ( target )
  892. {
  893. targetTags = target.GetTags();
  894. tagsCount = targetTags.Size();
  895. if ( tagsCount > 0 )
  896. {
  897. journalManager = theGame.GetJournalManager();
  898. journalManager.GetActivatedOfType( 'CJournalQuest', questsList );
  899. questsCount = questsList.Size();
  900. for( qIdx = 0; qIdx < questsCount; qIdx += 1 )
  901. {
  902. currentQuest = (CJournalQuest)questsList[qIdx];
  903. if( currentQuest && journalManager.GetEntryStatus( currentQuest ) == JS_Active )
  904. {
  905. phaseCount = currentQuest.GetNumChildren();
  906. for( pIdx = 0; pIdx < phaseCount; pIdx += 1 )
  907. {
  908. currentPhase = (CJournalQuestPhase)currentQuest.GetChild(pIdx);
  909. if( currentPhase )
  910. {
  911. objCount = currentPhase.GetNumChildren();
  912. for( oIdx = 0; oIdx < objCount; oIdx += 1 )
  913. {
  914. currentObjective = (CJournalQuestObjective)currentPhase.GetChild(oIdx);
  915. if ( currentObjective && journalManager.GetEntryStatus( currentObjective ) == JS_Active )
  916. {
  917. pinsCount = currentObjective.GetNumChildren();
  918. for( pinIdx = 0; pinIdx < pinsCount; pinIdx += 1 )
  919. {
  920. currentMappin = (CJournalQuestMapPin)currentObjective.GetChild(pinIdx);
  921. if( currentMappin )
  922. {
  923. for( tIdx = 0; tIdx < tagsCount; tIdx += 1 )
  924. {
  925. if( currentMappin.GetMapPinID() == targetTags[tIdx] )
  926. {
  927. switch (currentQuest.GetType())
  928. {
  929. case Story:
  930. questIcon = "QuestGiverStory"; // yellow !
  931. return questIcon;
  932. case Chapter:
  933. questIcon = "QuestGiverChapter"; // white !
  934. return questIcon;
  935. case Side:
  936. questIcon = "QuestGiverSide"; // white !
  937. return questIcon;
  938. case MonsterHunt:
  939. questIcon = "MonsterQuest";
  940. return questIcon;
  941. case TreasureHunt:
  942. questIcon = "TreasureQuest";
  943. return questIcon;
  944. default:
  945. //return "QuestReturn"; //?
  946. break;
  947. }
  948. }
  949. }
  950. }
  951. }
  952. }
  953. }
  954. }
  955. }
  956. }
  957. }
  958. }
  959. }
  960. return questIcon;
  961. }
  962. //---=== modFriendlyHUD ===---
  963.  
  964. exec function dodgeFeedback()
  965. {
  966. var npc : CNewNPC;
  967.  
  968. npc = (CNewNPC)thePlayer.GetDisplayTarget();
  969. if ( npc )
  970. {
  971. thePlayer.SetDodgeFeedbackTarget( npc );
  972. }
  973. }
  974.  
  975. exec function hardlock( set : bool )
  976. {
  977. var hud : CR4ScriptedHud;
  978. var module : CR4HudModuleEnemyFocus;
  979.  
  980. hud = (CR4ScriptedHud)theGame.GetHud();
  981. module = (CR4HudModuleEnemyFocus)hud.GetHudModule("EnemyFocusModule");
  982. module.SetShowHardLock( set );
  983. }
  984.  
  985.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement