Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***********************************************************************/
- /** © 2015 CD PROJEKT S.A. All rights reserved.
- /** THE WITCHER® is a trademark of CD PROJEKT S. A.
- /** The Witcher game is based on the prose of Andrzej Sapkowski.
- /***********************************************************************/
- enum EFloatingValueType
- {
- EFVT_None,
- EFVT_Critical,
- EFVT_Block,
- EFVT_InstantDeath,
- EFVT_DoT,
- EFVT_Heal,
- EFVT_Buff
- }
- class CR4HudModuleEnemyFocus extends CR4HudModuleBase
- //modEnemyHud ----------------------------------------------------------------------------
- private var m_staminaBar : CScriptedFlashFunction;
- private var m_TextField : CScriptedFlashFunction;
- private var m_Icon : CScriptedFlashFunction;
- private var m_Mutation : CScriptedFlashFunction;
- private var m_staminaBarY : CScriptedFlashFunction;
- private var m_yPos : CScriptedFlashFunction;
- private var healthColorInt : int;
- private var staminaBool : int;
- private var iconBool : bool;
- private var mutationBool : bool;
- private var levelBool : bool;
- private var dodgeBool : bool;
- private var targetBool : bool;
- private var skullBool : bool;
- private var wasContainer : bool;
- private var htmlSize : int;
- private var ypos : int;
- private var currentAttitude : EAIAttitude;
- private var lastTarget : CNewNPC;
- private var lastNotActor : CGameplayEntity;
- private var ingameConfigWrapper : CInGameConfigWrapper;
- //modEnemyHud ----------------------------------------------------------------------------
- private var healthColorInt : int;
- private var staminaBool : int;
- private var iconBool : bool;
- private var mutationBool : bool;
- private var levelBool : bool;
- private var dodgeBool : bool;
- private var targetBool : bool;
- private var skullBool : bool;
- private var wasContainer : bool;
- private var htmlSize : int;
- private var ypos : int;
- private var currentAttitude : EAIAttitude;
- private var lastTarget : CNewNPC;
- private var lastNotActor : CGameplayEntity;
- private var ingameConfigWrapper : CInGameConfigWrapper;
- //modEnemyHud ----------------------------------------------------------------------------
- private var m_fxSetEnemyName : CScriptedFlashFunction;
- private var m_fxSetEnemyLevel : CScriptedFlashFunction;
- private var m_fxSetAttitude : CScriptedFlashFunction;
- private var m_fxSetEnemyHealth : CScriptedFlashFunction;
- private var m_fxSetEnemyStamina : CScriptedFlashFunction;
- private var m_fxSetEssenceBarVisibility : CScriptedFlashFunction;
- private var m_fxSetStaminaVisibility : CScriptedFlashFunction;
- private var m_fxSetNPCQuestIcon : CScriptedFlashFunction;
- private var m_fxSetDodgeFeedback : CScriptedFlashFunction;
- private var m_fxSetBossOrDead : CScriptedFlashFunction;
- private var m_fxSetShowHardLock : CScriptedFlashFunction;
- private var m_fxSetDamageText : CScriptedFlashFunction;
- private var m_fxHideDamageText : CScriptedFlashFunction;
- private var m_fxSetGeneralVisibility : CScriptedFlashFunction;
- private var m_fxSetMutationEightVisibility : CScriptedFlashFunction;
- private var m_mcNPCFocus : CScriptedFlashSprite;
- private var m_lastTarget : CGameplayEntity;
- private var m_lastTargetAttitude : EAIAttitude;
- private var m_lastHealthPercentage : int;
- private var m_wasAxiied : bool;
- private var m_lastStaminaPercentage : int;
- private var m_nameInterval : float;
- private var m_lastEnemyDifferenceLevel : string;
- private var m_lastEnemyLevelString : string;
- private var m_lastDodgeFeedbackTarget : CActor;
- private var m_lastEnemyName : string;
- private var m_lastUseMutation8Icon : bool;
- event OnConfigUI()
- {
- var flashModule : CScriptedFlashSprite;
- var hud : CR4ScriptedHud;
- m_anchorName = "ScaleOnly";
- flashModule = GetModuleFlash();
- m_fxSetEnemyName = flashModule.GetMemberFlashFunction( "setEnemyName" );
- m_fxSetEnemyLevel = flashModule.GetMemberFlashFunction( "setEnemyLevel" );
- m_fxSetAttitude = flashModule.GetMemberFlashFunction( "setAttitude" );
- m_fxSetEnemyHealth = flashModule.GetMemberFlashFunction( "setEnemyHealth" );
- m_fxSetEnemyStamina = flashModule.GetMemberFlashFunction( "setEnemyStamina" );
- m_fxSetEssenceBarVisibility = flashModule.GetMemberFlashFunction( "setEssenceBarVisibility" );
- m_fxSetStaminaVisibility = flashModule.GetMemberFlashFunction( "setStaminaVisibility" );
- m_fxSetNPCQuestIcon = flashModule.GetMemberFlashFunction( "setNPCQuestIcon" );
- m_fxSetDodgeFeedback = flashModule.GetMemberFlashFunction( "setDodgeFeedback" );
- m_fxSetDamageText = flashModule.GetMemberFlashFunction( "setDamageText" );
- m_fxHideDamageText = flashModule.GetMemberFlashFunction( "hideDamageText" );
- m_fxSetBossOrDead = flashModule.GetMemberFlashFunction( "SetBossOrDead" );
- m_fxSetShowHardLock = flashModule.GetMemberFlashFunction( "setShowHardLock" );
- m_fxSetGeneralVisibility = flashModule.GetMemberFlashFunction( "SetGeneralVisibility" );
- m_fxSetMutationEightVisibility = flashModule.GetMemberFlashFunction( "displayMutationEight" );
- m_mcNPCFocus = flashModule.GetChildFlashSprite( "mcNPCFocus" );
- super.OnConfigUI();
- m_fxSetEnemyName.InvokeSelfOneArg( FlashArgString( "" ) );
- m_fxSetEnemyStamina.InvokeSelfOneArg(FlashArgInt(0));
- hud = (CR4ScriptedHud)theGame.GetHud();
- if (hud)
- {
- hud.UpdateHudConfig('EnemyFocusModule', true);
- }
- //modEnemyHud ----------------------------------------------------------------------------
- m_staminaBarY = m_mcNPCFocus.GetMemberFlashFunction( "setStaminaBarY" );
- m_TextField = m_mcNPCFocus.GetMemberFlashFunction( "setTextField" );
- m_Icon = m_mcNPCFocus.GetMemberFlashFunction( "setIcon" );
- m_Mutation = m_mcNPCFocus.GetMemberFlashFunction( "setMutation" );
- m_yPos = m_mcNPCFocus.GetMemberFlashFunction( "setTextY" );
- ingameConfigWrapper = theGame.GetInGameConfigWrapper();
- healthColorInt = StringToInt(ingameConfigWrapper.GetVarValue('EnemyHUD', 'HealthColor'));
- staminaBool = StringToInt(ingameConfigWrapper.GetVarValue('EnemyHUD', 'Stamina'));
- levelBool = ingameConfigWrapper.GetVarValue('EnemyHUD', 'Level'); //x
- dodgeBool = ingameConfigWrapper.GetVarValue('EnemyHUD', 'Dodge'); //x
- iconBool = ingameConfigWrapper.GetVarValue('EnemyHUD', 'Icon'); //x
- mutationBool = ingameConfigWrapper.GetVarValue('EnemyHUD', 'Mutation'); //x
- targetBool = ingameConfigWrapper.GetVarValue('EnemyHUD', 'Focus'); //x
- skullBool = ingameConfigWrapper.GetVarValue('EnemyHUD', 'Skull'); //x
- htmlSize = StringToInt(ingameConfigWrapper.GetVarValue('EnemyHUD', 'FontSize')); //x
- ypos = StringToInt(ingameConfigWrapper.GetVarValue('EnemyHUD', 'YPos')); //x
- //modEnemyHud ----------------------------------------------------------------------------
- }
- private function GetAttitudeOfTargetActor( target : CGameplayEntity ) : EAIAttitude
- {
- var targetActor : CActor;
- targetActor = ( CActor )target;
- if ( targetActor )
- {
- return targetActor.GetAttitude( thePlayer );
- }
- return AIA_Neutral;
- }
- public function SetDodgeFeedback( target : CActor ) :void
- {
- //modEnemyHud ----------------------------------------------------------------------------
- if(dodgeBool){
- m_fxSetDodgeFeedback.InvokeSelfOneArg( FlashArgBool( !( !target ) ) );
- m_lastDodgeFeedbackTarget = target;
- }
- }
- public function DisplayMutationEight( value : bool ) :void
- {
- m_fxSetMutationEightVisibility.InvokeSelfOneArg( FlashArgBool ( value ) );
- }
- public function SetGeneralVisibility( showEnemyFocus : bool, showName : bool )
- {
- m_fxSetGeneralVisibility.InvokeSelfTwoArgs( FlashArgBool( showEnemyFocus ), FlashArgBool( showName ) );
- }
- public function ShowDamageType(valueType : EFloatingValueType, value : float, optional stringParam : string)
- {
- var label:string;
- var color:float;
- var hud:CR4ScriptedHud;
- if(valueType != EFVT_InstantDeath && valueType != EFVT_Buff && value == 0.f)
- return;
- hud = (CR4ScriptedHud)theGame.GetHud();
- if ( !hud.AreEnabledEnemyHitEffects() )
- {
- return;
- }
- switch (valueType)
- {
- case EFVT_Critical:
- label = GetLocStringByKeyExt("attribute_name_critical_hit_damage");
- color = 0xFDFFC2;
- break;
- case EFVT_InstantDeath:
- label = GetLocStringByKeyExt("effect_instant_death");
- color = 0xFFC2C2;
- break;
- case EFVT_Block:
- label = GetLocStringByKeyExt("");
- color = 0xFC5B5B;
- break;
- case EFVT_DoT:
- label = GetLocStringByKeyExt("");
- color = 0xFF0000;
- break;
- case EFVT_Heal:
- label = GetLocStringByKeyExt("");
- color = 0x00FF00;
- break;
- case EFVT_Buff:
- label = GetLocStringByKeyExt(stringParam);
- color = 0xFFF0F0;
- break;
- default:
- label = GetLocStringByKeyExt("");
- color = 0xFFF0F0;
- break;
- }
- SetDamageText(label, CeilF(value), color);
- }
- private function SetDamageText(label:string, value:int, color:float) : void
- {
- m_fxSetDamageText.InvokeSelfThreeArgs( FlashArgString(label), FlashArgNumber(value), FlashArgNumber(color) );
- }
- public function HideDamageText()
- {
- m_fxHideDamageText.InvokeSelf();
- }
- event OnTick( timeDelta : float )
- {
- var l_target : CNewNPC;
- var l_targetNonActor : CGameplayEntity;
- var l_isHuman : bool;
- var l_isDifferentTarget : bool;
- var l_wasAxiied : bool;
- var l_currentHealthPercentage : int;
- var l_currentStaminaPercentage : int;
- var l_currentTargetAttitude : EAIAttitude;
- var l_currentEnemyDifferenceLevel : string;
- var l_currentEnemyLevelString : string;
- var l_targetScreenPos : Vector;
- var l_dodgeFeedbackTarget : CActor;
- var l_isBoss : bool;
- var screenMargin : float = 0.025;
- var marginLeftTop : Vector;
- var marginRightBottom : Vector;
- var hud : CR4ScriptedHud;
- var extraOffset : int;
- var herbTag : name;
- var herbEntity : W3Herb;
- var definitionManager : CDefinitionsManagerAccessor;
- var useMutation8Icon : bool;
- l_targetNonActor = thePlayer.GetDisplayTarget();
- l_target = (CNewNPC)l_targetNonActor;
- l_dodgeFeedbackTarget = thePlayer.GetDodgeFeedbackTarget();
- hud = (CR4ScriptedHud)theGame.GetHud();
- //modEnemyHud ----------------------------------------------------------------------------
- healthColorInt = StringToInt(ingameConfigWrapper.GetVarValue('EnemyHUD', 'HealthColor'));
- staminaBool = StringToInt(ingameConfigWrapper.GetVarValue('EnemyHUD', 'Stamina'));
- levelBool = ingameConfigWrapper.GetVarValue('EnemyHUD', 'Level'); //x
- dodgeBool = ingameConfigWrapper.GetVarValue('EnemyHUD', 'Dodge'); //x
- iconBool = ingameConfigWrapper.GetVarValue('EnemyHUD', 'Icon'); //x
- mutationBool = ingameConfigWrapper.GetVarValue('EnemyHUD', 'Mutation'); //x
- targetBool = ingameConfigWrapper.GetVarValue('EnemyHUD', 'Focus'); //x
- skullBool = ingameConfigWrapper.GetVarValue('EnemyHUD', 'Skull'); //x
- wasContainer = false;
- if(!l_target){
- if(l_targetNonActor){
- wasContainer = true;
- }
- }
- if( theInput.GetActionValue('EnemyHudLevel') ){
- levelBool = true;
- skullBool = true;
- }
- //modEnemyHud ----------------------------------------------------------------------------
- if ( l_target )
- {
- if ( !l_target.IsUsingTooltip())
- {
- l_target = NULL;
- }
- }
- if ( l_target )
- {
- if ( l_target.HasTag( 'HideHealthBarModule' ) )
- {
- if ( l_target.HasTag( 'NotBoss' ) )
- {
- l_target = NULL;
- }
- else
- l_isBoss = true;
- }
- else
- {
- if ( (CHeartMiniboss)l_target )
- {
- l_target = NULL;
- }
- }
- }
- if ( l_target )
- {
- l_isHuman = l_target.IsHuman();
- l_isDifferentTarget = ( l_target != m_lastTarget );
- l_wasAxiied = ( l_target.GetAttitudeGroup() == 'npc_charmed' );
- if(l_isDifferentTarget && l_target && !l_target.IsInCombat() && IsRequiredAttitudeBetween(thePlayer, l_target, true))
- {
- l_target.RecalcLevel();
- }
- if ( l_isDifferentTarget )
- {
- m_fxSetBossOrDead.InvokeSelfOneArg( FlashArgBool( l_isBoss || !l_target.IsAlive() ) );
- HideDamageText();
- m_fxSetStaminaVisibility.InvokeSelfOneArg( FlashArgBool( l_isHuman ) );
- //modEnemyHud ----------------------------------------------------------------------------
- if(l_target.UsesEssence())
- {
- if(healthColorInt == 0 || healthColorInt == 3 )
- m_fxSetEssenceBarVisibility.InvokeSelfOneArg( FlashArgBool( true ) );
- else
- m_fxSetEssenceBarVisibility.InvokeSelfOneArg( FlashArgBool( false ) );
- }
- else
- {
- if(healthColorInt == 0 || healthColorInt == 2 )
- m_fxSetEssenceBarVisibility.InvokeSelfOneArg( FlashArgBool( false ) );
- else
- m_fxSetEssenceBarVisibility.InvokeSelfOneArg( FlashArgBool( true ) );
- }
- //m_fxSetEssenceBarVisibility.InvokeSelfOneArg( FlashArgBool( l_target.UsesEssence()) );
- //modEnemyHud ----------------------------------------------------------------------------
- UpdateQuestIcon( l_target );
- SetDodgeFeedback( NULL );
- ShowElement( true );
- m_lastTarget = l_target;
- }
- l_currentTargetAttitude = l_target.GetAttitude( thePlayer );
- if ( l_currentTargetAttitude != AIA_Hostile )
- {
- if ( l_target.IsVIP() )
- {
- l_currentTargetAttitude = 4;
- }
- }
- //modEnemyHud ----------------------------------------------------------------------------
- currentAttitude = l_currentTargetAttitude;
- lastTarget = l_target;
- //modEnemyHud ----------------------------------------------------------------------------
- if ( l_isDifferentTarget || m_lastTargetAttitude != l_currentTargetAttitude || m_wasAxiied != l_wasAxiied )
- {
- m_lastTargetAttitude = l_currentTargetAttitude;
- m_wasAxiied = l_wasAxiied;
- if( m_wasAxiied )
- {
- m_fxSetAttitude.InvokeSelfOneArg( FlashArgInt( 3 ) );
- }
- else
- {
- m_fxSetAttitude.InvokeSelfOneArg( FlashArgInt( l_currentTargetAttitude ) );
- }
- }
- if ( m_lastDodgeFeedbackTarget != l_dodgeFeedbackTarget )
- {
- if ( l_currentTargetAttitude == AIA_Hostile )
- {
- SetDodgeFeedback( l_dodgeFeedbackTarget );
- }
- else
- {
- SetDodgeFeedback( NULL );
- }
- m_lastDodgeFeedbackTarget = l_dodgeFeedbackTarget;
- }
- m_nameInterval -= timeDelta;
- if ( l_isDifferentTarget || m_nameInterval < 0 )
- {
- m_nameInterval = 0.25;
- UpdateName( l_target.GetDisplayName() );
- }
- l_currentHealthPercentage = CeilF( 100 * l_target.GetHealthPercents() );
- if ( m_lastHealthPercentage != l_currentHealthPercentage )
- {
- m_lastHealthPercentage = l_currentHealthPercentage;
- m_fxSetEnemyHealth.InvokeSelfOneArg( FlashArgInt( l_currentHealthPercentage ) );
- }
- l_currentStaminaPercentage = CeilF( 100 * l_target.GetStaminaPercents() );
- if ( m_lastStaminaPercentage != l_currentStaminaPercentage )
- {
- m_lastStaminaPercentage = l_currentStaminaPercentage;
- m_fxSetEnemyStamina.InvokeSelfOneArg( FlashArgInt( l_currentStaminaPercentage ) );
- }
- l_currentEnemyDifferenceLevel = l_target.GetExperienceDifferenceLevelName( l_currentEnemyLevelString );
- if ( l_isDifferentTarget ||
- m_lastEnemyDifferenceLevel != l_currentEnemyDifferenceLevel ||
- m_lastEnemyLevelString != l_currentEnemyLevelString )
- {
- m_lastEnemyDifferenceLevel = l_currentEnemyDifferenceLevel;
- m_lastEnemyLevelString = l_currentEnemyLevelString;
- //modEnemyHud -----------------------------------------------------------------------
- if(levelBool){
- if(skullBool){
- m_fxSetEnemyLevel.InvokeSelfTwoArgs( FlashArgString( l_currentEnemyDifferenceLevel ), FlashArgString( l_currentEnemyLevelString ) );
- }else{
- if(l_currentEnemyDifferenceLevel == "deadlyLevel")
- {
- m_fxSetEnemyLevel.InvokeSelfTwoArgs( FlashArgString( "none" ), FlashArgString( "" ) );
- }
- else if(l_currentEnemyDifferenceLevel == "highLevel")
- {
- m_fxSetEnemyLevel.InvokeSelfTwoArgs( FlashArgString( "normalLevel" ), FlashArgString( l_currentEnemyLevelString ) );
- }
- else
- {
- m_fxSetEnemyLevel.InvokeSelfTwoArgs( FlashArgString( l_currentEnemyDifferenceLevel ), FlashArgString( l_currentEnemyLevelString ) );
- }
- }
- }else if(skullBool){
- if(l_currentEnemyDifferenceLevel == "deadlyLevel")
- {
- m_fxSetEnemyLevel.InvokeSelfTwoArgs( FlashArgString( l_currentEnemyDifferenceLevel ), FlashArgString( "" ) );
- }
- else if(l_currentEnemyDifferenceLevel == "highLevel")
- {
- m_fxSetEnemyLevel.InvokeSelfTwoArgs( FlashArgString( l_currentEnemyDifferenceLevel ), FlashArgString( "" ) );
- }
- else
- {
- m_fxSetEnemyLevel.InvokeSelfTwoArgs( FlashArgString( "none" ), FlashArgString( "" ) );
- }
- }else{
- m_fxSetEnemyLevel.InvokeSelfTwoArgs( FlashArgString( "none" ), FlashArgString( "" ) );
- }
- //modEnemyHud -----------------------------------------------------------------------
- }
- useMutation8Icon = GetWitcherPlayer().IsMutationActive( EPMT_Mutation8 ) && !l_target.IsImmuneToMutation8Finisher();
- if ( m_lastUseMutation8Icon != useMutation8Icon )
- {
- m_lastUseMutation8Icon = useMutation8Icon;
- DisplayMutationEight( useMutation8Icon );
- }
- if ( GetBaseScreenPosition( l_targetScreenPos, l_target ) )
- {
- l_targetScreenPos.Y -= 45;
- marginLeftTop = hud.GetScaleformPoint( screenMargin, screenMargin );
- marginRightBottom = hud.GetScaleformPoint( 1 - screenMargin, 1 - screenMargin );
- if ( l_targetScreenPos.X < marginLeftTop.X )
- {
- l_targetScreenPos.X = marginLeftTop.X;
- }
- else if ( l_targetScreenPos.X > marginRightBottom.X )
- {
- l_targetScreenPos.X = marginRightBottom.X;
- }
- if ( l_targetScreenPos.Y < marginLeftTop.Y )
- {
- l_targetScreenPos.Y = marginLeftTop.Y;
- }
- else if ( l_targetScreenPos.Y > marginRightBottom.Y )
- {
- l_targetScreenPos.Y = marginRightBottom.Y;
- }
- //HPAS
- if ( l_target.GetAttitude( thePlayer ) == AIA_Hostile && ! l_isBoss && isEnemyOn() && isModOn() )
- {
- l_targetScreenPos.X = mHPAS_Pos.Enemy('X');
- l_targetScreenPos.Y = mHPAS_Pos.Enemy('Y');
- }
- //HPAS
- m_mcNPCFocus.SetVisible( true );
- //modEnemyHud ----------------------------------------------------------------------------
- if(l_currentTargetAttitude == AIA_Hostile || l_target.GetAttitudeGroup() == 'npc_charmed'){
- m_mcNPCFocus.SetPosition( l_targetScreenPos.X, l_targetScreenPos.Y );
- }else{
- m_mcNPCFocus.SetPosition( l_targetScreenPos.X, l_targetScreenPos.Y + 33 );
- }
- //modEnemyHud -----------------------------------------------------------------------
- }
- else
- {
- m_mcNPCFocus.SetVisible( false );
- }
- }
- else if ( l_targetNonActor )
- {
- l_isDifferentTarget = ( l_targetNonActor != m_lastTarget );
- if ( l_isDifferentTarget )
- {
- m_fxSetStaminaVisibility.InvokeSelfOneArg( FlashArgBool( false ) );
- m_fxSetEssenceBarVisibility.InvokeSelfOneArg( FlashArgBool( false ) );
- UpdateQuestIcon( (CNewNPC)l_targetNonActor );
- SetDodgeFeedback( NULL );
- ShowElement( true );
- m_fxSetAttitude.InvokeSelfOneArg( FlashArgInt( 0 ) );
- m_fxSetEnemyLevel.InvokeSelfTwoArgs( FlashArgString( "none" ), FlashArgString( "" ) );
- m_lastTarget = l_targetNonActor;
- m_lastTargetAttitude = GetAttitudeOfTargetActor( m_lastTarget );
- m_lastHealthPercentage = -1;
- m_lastStaminaPercentage = -1;
- m_lastEnemyDifferenceLevel = "none";
- m_lastEnemyLevelString = "";
- }
- herbEntity = (W3Herb)l_targetNonActor;
- if ( herbEntity )
- {
- extraOffset = 140;
- m_nameInterval -= timeDelta;
- if ( l_isDifferentTarget || m_nameInterval < 0 )
- {
- m_nameInterval = 0.25;
- herbEntity.GetStaticMapPinTag( herbTag );
- if ( herbTag )
- {
- definitionManager = theGame.GetDefinitionsManager();
- if ( definitionManager )
- {
- UpdateName( GetLocStringByKeyExt( definitionManager.GetItemLocalisationKeyName( herbTag ) ) );
- }
- }
- else
- {
- UpdateName( "" );
- }
- }
- }
- else
- {
- if ( l_isDifferentTarget )
- {
- UpdateName( "" );
- }
- }
- useMutation8Icon = false;
- if ( m_lastUseMutation8Icon != useMutation8Icon )
- {
- DisplayMutationEight( useMutation8Icon );
- m_lastUseMutation8Icon = useMutation8Icon;
- }
- if ( GetBaseScreenPosition( l_targetScreenPos, l_targetNonActor ) )
- {
- l_targetScreenPos.Y -= 10;
- l_targetScreenPos.Y -= extraOffset;
- marginLeftTop = hud.GetScaleformPoint( screenMargin, screenMargin );
- marginRightBottom = hud.GetScaleformPoint( 1 - screenMargin, 1 - screenMargin );
- if ( l_targetScreenPos.X < marginLeftTop.X )
- {
- l_targetScreenPos.X = marginLeftTop.X;
- }
- else if ( l_targetScreenPos.X > marginRightBottom.X )
- {
- l_targetScreenPos.X = marginRightBottom.X;
- }
- if ( l_targetScreenPos.Y < marginLeftTop.Y )
- {
- l_targetScreenPos.Y = marginLeftTop.Y;
- }
- else if ( l_targetScreenPos.Y > marginRightBottom.Y )
- {
- l_targetScreenPos.Y = marginRightBottom.Y;
- }
- m_mcNPCFocus.SetVisible( true );
- m_mcNPCFocus.SetPosition( l_targetScreenPos.X - 10, l_targetScreenPos.Y + 53 );
- }
- else
- {
- m_mcNPCFocus.SetVisible( false );
- }
- }
- else if ( m_lastTarget )
- {
- m_lastTarget = NULL;
- m_mcNPCFocus.SetVisible( false );
- SetDodgeFeedback( NULL );
- ShowElement( false );
- }
- else
- {
- if ( m_mcNPCFocus.GetVisible() )
- {
- m_mcNPCFocus.SetVisible( false );
- ShowElement( false );
- }
- }
- //modEnemyHud ----------------------------------------------------------------------------
- if(staminaBool == 1 || (staminaBool == 2 && l_isHuman) )
- {
- m_staminaBarY.InvokeSelfOneArg( FlashArgInt( 43 ) );
- }
- else
- {
- m_staminaBarY.InvokeSelfOneArg( FlashArgInt( -9000 ) );
- }
- //modEnemyHud ----------------------------------------------------------------------------
- }
- public function UpdateName( enemyName : string )
- //modEnemyHud ----------------------------------------------------------------------------
- var htmlColor : string;
- var ingameConfigWrappe : CInGameConfigWrapper;
- var humanFriend, humanHostile, monsterFriend, monsterHostile, axiiHuman, axiiMonster, animal, herb : bool;
- var target : CGameplayEntity;
- var targetActor : CActor;
- //modEnemyHud ----------------------------------------------------------------------------
- if ( m_lastEnemyName != enemyName )
- {
- m_lastEnemyName = enemyName;
- //modEnemyHud ----------------------------------------------------------------------------
- ingameConfigWrappe = theGame.GetInGameConfigWrapper();
- htmlSize = StringToInt(ingameConfigWrappe.GetVarValue('EnemyHUD', 'FontSize')); //x
- ypos = StringToInt(ingameConfigWrappe.GetVarValue('EnemyHUD', 'YPos')); //x
- humanFriend = ingameConfigWrappe.GetVarValue('EnemyHUD', 'NameFriendlyHuman');
- humanHostile = ingameConfigWrappe.GetVarValue('EnemyHUD', 'NameHostileHuman');
- monsterFriend = ingameConfigWrappe.GetVarValue('EnemyHUD', 'NameFriendlyMonster');
- monsterHostile = ingameConfigWrappe.GetVarValue('EnemyHUD', 'NameHostileMonster');
- axiiHuman = ingameConfigWrappe.GetVarValue('EnemyHUD', 'NameAxiiHuman');
- axiiMonster = ingameConfigWrappe.GetVarValue('EnemyHUD', 'NameAxiiMonster');
- animal = ingameConfigWrappe.GetVarValue('EnemyHUD', 'NameAnimal');
- herb = ingameConfigWrappe.GetVarValue('EnemyHUD', 'NameHerbs');
- target = thePlayer.GetDisplayTarget();
- targetActor = ((CActor)target);
- if(targetActor)
- {
- if(targetActor.IsAnimal() && !animal)
- {
- m_lastEnemyName = "";
- }
- else if(targetActor.IsHuman())
- {
- if( targetActor.GetAttitudeGroup() == 'npc_charmed' ) // human axii
- {
- if(!axiiHuman)
- {
- m_lastEnemyName = "";
- }
- else if(targetActor.IsHuman())
- {
- if( targetActor.GetAttitudeGroup() == 'npc_charmed' ) // human axii
- {
- if(!axiiHuman)
- {
- m_lastEnemyName = "";
- }
- }
- else if(currentAttitude == 2) // human enemy
- {
- if(!humanHostile)
- {
- m_lastEnemyName = "";
- }
- }
- else // human friendly
- {
- if(!humanFriend)
- {
- m_lastEnemyName = "";
- }
- }
- }
- else if(targetActor.IsMonster())
- {
- if( targetActor.GetAttitudeGroup() == 'npc_charmed' ) // human axii
- {
- if(!axiiMonster)
- {
- m_lastEnemyName = "";
- }
- }
- else if(currentAttitude == 2) // human enemy
- {
- if(!monsterHostile)
- {
- m_lastEnemyName = "";
- }
- }
- else // human friendly
- {
- if(!monsterFriend)
- {
- m_lastEnemyName = "";
- }
- }
- }
- }
- else if(((W3Herb)target))
- {
- if(!herb)
- {
- m_lastEnemyName = "";
- }
- }
- htmlColor = GetColors();
- m_lastEnemyName = "<FONT SIZE='" + htmlSize + "' COLOR='" + htmlColor +"'>" + m_lastEnemyName + "</FONT>";
- m_yPos.InvokeSelfOneArg( FlashArgInt( ypos ) );
- m_TextField.InvokeSelfOneArg( FlashArgString( m_lastEnemyName ) );
- //modEnemyHud ----------------------------------------------------------------------------
- }
- }
- //modEnemyHud ----------------------------------------------------------------------------
- function GetColors() : string
- {
- var htmlColor, s : string;
- var red, green, blue : int;
- var ingameConfigWrapp : CInGameConfigWrapper;
- ingameConfigWrapp = theGame.GetInGameConfigWrapper();
- if(wasContainer){
- red = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDContainer', 'Red' ));
- green = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDContainer', 'Green' ));
- blue = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDContainer', 'Blue' ));
- }
- else{
- switch(currentAttitude){
- case 0:
- red = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDNeutral', 'Red' ));
- green = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDNeutral', 'Green' ));
- blue = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDNeutral', 'Blue' ));
- break;
- case 1:
- red = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDFriendly', 'Red' ));
- green = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDFriendly', 'Green' ));
- blue = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDFriendly', 'Blue' ));
- break;
- case 2:
- if(lastTarget.IsHuman())
- {
- red = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDHostile', 'Red' ));
- green = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDHostile', 'Green' ));
- blue = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDHostile', 'Blue' ));
- }
- else if(lastTarget.UsesEssence())
- {
- red = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDHostile', 'RedSilv' ));
- green = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDHostile', 'GreenSilv' ));
- blue = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDHostile', 'BlueSilv' ));
- }
- else
- {
- red = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDHostile', 'RedSt' ));
- green = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDHostile', 'GreenSt' ));
- blue = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDHostile', 'BlueSt' ));
- }
- break;
- case 3:
- red = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDAxii', 'Red' ));
- green = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDAxii', 'Green' ));
- blue = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDAxii', 'Blue' ));
- break;
- case 4:
- red = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDVIP', 'Red' ));
- green = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDVIP', 'Green' ));
- blue = StringToInt(ingameConfigWrapp.GetVarValue( 'EnemyHUDVIP', 'Blue' ));
- break;
- }
- }
- htmlColor = "#";
- s = ToHex(red);
- htmlColor = htmlColor + s;
- s = ToHex(green);
- htmlColor = htmlColor + s;
- s = ToHex(blue);
- htmlColor = htmlColor + s;
- return htmlColor;
- }
- private function ToHex( n : int) : string
- {
- var r, x : int;
- var str : string;
- if (n == 0){
- str += "00";
- }else{
- r = FloorF(n / 16);
- switch (r)
- {
- case 10:
- str += "a";
- break;
- case 11:
- str += "b";
- break;
- case 12:
- str += "c";
- break;
- case 13:
- str += "d";
- break;
- case 14:
- str += "e";
- break;
- case 15:
- str += "f";
- break;
- default:
- str += IntToString(r);
- break;
- }
- x = n;
- n = FloorF(n / 16);
- n = x-(n*16);
- switch (n)
- {
- case 10:
- str += "a";
- break;
- case 11:
- str += "b";
- break;
- case 12:
- str += "c";
- break;
- case 13:
- str += "d";
- break;
- case 14:
- str += "e";
- break;
- case 15:
- str += "f";
- break;
- default:
- str += IntToString(n);
- break;
- }
- }
- return str;
- }
- //modEnemyHud ----------------------------------------------------------------------------
- public function SetShowHardLock( set : bool )
- {
- //modEnemyHud ----------------------------------------------------------------------------
- if(targetBool){
- m_fxSetShowHardLock.InvokeSelfOneArg( FlashArgBool( set ) );
- }
- }
- protected function UpdateScale( scale : float, flashModule : CScriptedFlashSprite ) : bool
- {
- return false;
- }
- private function UpdateQuestIcon( target : CNewNPC )
- {
- var mapPinInstances : array< SCommonMapPinInstance >;
- var commonMapManager : CCommonMapManager;
- var currentPin : SCommonMapPinInstance;
- var targetTags : array< name >;
- var i : int;
- var questIcon : string;
- var mapPinType : name;
- questIcon = "none";
- if ( target )
- {
- targetTags = target.GetTags();
- if (targetTags.Size() > 0)
- {
- commonMapManager = theGame.GetCommonMapManager();
- mapPinType = commonMapManager.GetMapPinTypeByTag( targetTags[0] );
- switch ( mapPinType )
- {
- case 'QuestReturn':
- questIcon = "QuestReturn";
- break;
- case 'QuestGiverStory':
- questIcon = "QuestGiverStory";
- break;
- case 'QuestGiverChapter':
- questIcon = "QuestGiverChapter";
- break;
- case 'QuestGiverSide':
- case 'QuestAvailable':
- case 'QuestAvailableHoS':
- case 'QuestAvailableBaW':
- questIcon = "QuestGiverSide";
- break;
- case 'MonsterQuest':
- questIcon = "MonsterQuest";
- break;
- case 'TreasureQuest':
- questIcon = "TreasureQuest";
- break;
- }
- }
- }
- //modEnemyHud ----------------------------------------------------------------------------
- if(iconBool){
- m_Icon.InvokeSelfOneArg( FlashArgBool( true ) );
- }else{
- m_Icon.InvokeSelfOneArg( FlashArgBool( false ) );
- }
- m_fxSetNPCQuestIcon.InvokeSelfOneArg( FlashArgString( questIcon ) );
- }
- }
- exec function dodgeFeedback()
- {
- var npc : CNewNPC;
- npc = (CNewNPC)thePlayer.GetDisplayTarget();
- if ( npc )
- {
- thePlayer.SetDodgeFeedbackTarget( npc );
- }
- }
- exec function hardlock( set : bool )
- {
- var hud : CR4ScriptedHud;
- var module : CR4HudModuleEnemyFocus;
- hud = (CR4ScriptedHud)theGame.GetHud();
- module = (CR4HudModuleEnemyFocus)hud.GetHudModule("EnemyFocusModule");
- module.SetShowHardLock( set );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement